blob: 64430c6352efe29e4fbfed71fa6bffeb858c899f [file] [log] [blame]
PulkoMandy17fc7592022-07-28 18:27:54 +02001This chapter documents the Backend for the VideoCore IV processor family.
2
3The backend is in a very early stage, it is not complete, and it can not
4yet be considered useful!
5
6Also note that it is based on freely available, unofficial, and possibly
7incorrect information on the target processor.
8
9@section Additional options for this version
10
11This backend provides the following additional options:
12
13@table @option
14
15 @item -short-double
16
17 Use native 32bit floating point for double and long double.
18 This is much more efficient, but not ISO C conforming.
19
20 @item -one-section
21
22 Put all code and data in the same section (.text).
23
24
25 @item -no-delayed-popping
26
27 By default arguments of function calls are not always popped
28 from the stack immediately after the call, so that the
29 arguments of several calls may be popped at once.
30 With this option @command{vbcc} can be forced to pop them after every
31 function call.
32 This may simplify debugging and reduce the
33 stack size needed by the compiled program.
34
35 @item -no-peephole
36
37 Disable most backend peephole optimizations.
38 Just for testing.
39
40 @item -noext-regs
41
42 Do not use registers r16-r23. Just for testing.
43
44 @item -cond-limit=<n>
45
46 Set the limit (in number of intermediate code instructions)
47 for the length of code-sequences considered for conditional
48 execution (default: 2).
49
50
51@end table
52
53@section ABI
54
55 This backend supports the following registers:
56
57 @itemize @minus
58 @item @code{r0} through @code{r31} for the general purpose registers
59 @end itemize
60
61 Additionally, the register pairs @code{r0/r1} @code{r2/r3, r4/r5, r6/r7, r8/r9,
62 r10/r11, r12/r13, r14/r15,
63 r16/r17, r18/r19, r20/r21, r22/r23} are
64 available.
65
66 @code{r14, r15, r24-r31} are currently reserved by the
67 backend.
68
69
70
71 The current version generates assembly output for use with @file{vasm}.
72
73
74 The registers r0-r5 and r14-r15 are used as scratch registers
75 (i.e. they can be destroyed in function calls), all other registers are
76 preserved. r25 is the stack-pointer.
77
78 The first 6 function arguments which have integer, float32 or pointer types
79 are passed in registers r0 through r5. All other arguments
80 are passed on the stack.
81
82 Integers, float32 and pointers are returned in r0.
83 All other types are returned by passing the function the address
84 of the result as a hidden argument - so when you call such a function
85 without a proper declaration in scope you can expect a crash.
86
87 The elementary data types are represented like:
88
89 @example
90 type size in bits alignment in bytes
91
92 char 8 1
93 short 16 2
94 int 32 4
95 long 32 4
96 long long 64 8 not yet supported
97 all pointers 32 4
98 float 32 4
99 double 64 (32) 4
100 long double 64 (32) 4
101 @end example
102
103@section Target-specific variable-attributes
104
105 The vidcore-backend offers the following variable-attributes:
106
107@table @code
108
109 @item __section("name","attr")
110 Place this function/object in section "name" with
111 attributes "attr".
112@end table
113
114
115@section Target-specific pragmas
116
117 The vidcore-backend offers the following #pragmas:
118
119@table @code
120
121 @item none at the moment...
122
123@end table
124
125@section Predefined Macros
126
127 This backend defines the following macros:
128
129@table @code
130 @item __VIDEOCORE__
131
132 @item __SHORT_DOUBLE__ (if -short-double is used)
133@end table
134
135@section Stdarg
136
137stdarg-implementation is not yet fully working. One restriction is that
138when calling a varargs function, the prototype must be in scope (this is
139ISO C conforming). Another one is that the stdarg-macros only work as
140long as all fixed arguments are passed in registers.
141
142This will be fixed in the future.
143
144
145@section Known problems
146
147@itemize @minus
148 @item no support for long long
149 @item no support for 64bit floating point
150 @item stdarg problems mentioned above
151 @item suboptimal code quality
152 @item ...
153@end itemize
154
155
156
157