1 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
7 $mode_gp = "mode_Iu"; # mode used by general purpose registers
8 $mode_fp = "mode_F"; # mode used by floatingpoint registers
10 # The node description is done as a perl hash initializer with the
11 # following structure:
16 # arity => "0|1|2|3 ... |variable|dynamic|any", # optional
17 # state => "floats|pinned|mem_pinned|exc_pinned", # optional
19 # { type => "type 1", name => "name 1" },
20 # { type => "type 2", name => "name 2" },
23 # comment => "any comment for constructor", # optional
24 # reg_req => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
25 # cmp_attr => "c source code for comparing node attributes", # optional
26 # outs => { "out1", "out2" },# optional, creates pn_op_out1, ... consts
27 # ins => { "in1", "in2" }, # optional, creates n_op_in1, ... consts
28 # mode => "mode_Iu", # optional, predefines the mode
29 # emit => "emit code with templates", # optional for virtual nodes
30 # attr => "additional attribute arguments for constructor", # optional
31 # init_attr => "emit attribute initialization template", # optional
32 # rd_constructor => "c source code which constructs an ir_node", # optional
33 # hash_func => "name of the hash function for this operation", # optional, get the default hash function else
34 # latency => "latency of this operation (can be float)" # optional
35 # attr_type => "name of the attribute struct", # optional
38 # ... # (all nodes you need to describe)
40 # ); # close the %nodes initializer
42 # state: state of the operation, OPTIONAL (default is "floats")
44 # arity: arity of the operation, MUST NOT BE OMITTED
46 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
47 # are always the first 3 arguments and are always autmatically
49 # If this key is missing the following arguments will be created:
50 # for i = 1 .. arity: ir_node *op_i
53 # outs: if a node defines more than one output, the names of the projections
54 # nodes having outs having automatically the mode mode_T
56 # comment: OPTIONAL comment for the node constructor
60 # 1 - ignore (do not assign this register)
61 # 2 - the register is a virtual one
62 # 4 - register represents a state
63 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
80 { name => "sp", realname => "r14", type => 1 }, # stackpointer
81 { name => "bp", realname => "r15", type => 1 }, # basepointer
105 $default_attr_type = "TEMPLATE_attr_t";
106 $default_copy_attr = "TEMPLATE_copy_attr";
113 op_flags => [ "commutative" ],
114 irn_flags => [ "rematerializable" ],
115 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
116 emit => 'add %S1, %S2, %D1',
121 op_flags => [ "commutative" ],
122 irn_flags => [ "rematerializable" ],
123 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
124 emit =>'mul %S1, %S2, %D1',
129 op_flags => [ "commutative" ],
130 irn_flags => [ "rematerializable" ],
131 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
132 emit => 'and %S1, %S2, %D1',
137 op_flags => [ "commutative" ],
138 irn_flags => [ "rematerializable" ],
139 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
140 emit => 'or %S1, %S2, %D1',
145 op_flags => [ "commutative" ],
146 irn_flags => [ "rematerializable" ],
147 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
148 emit => 'xor %S1, %S2, %D1',
153 irn_flags => [ "rematerializable" ],
154 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
155 emit => 'sub %S1, %S2, %D1',
160 irn_flags => [ "rematerializable" ],
161 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
162 emit => 'shl %S1, %S2, %D1',
167 irn_flags => [ "rematerializable" ],
168 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1" ] },
169 emit => 'shr %S2, %D1',
174 irn_flags => [ "rematerializable" ],
175 reg_req => { in => [ "gp" ], out => [ "gp" ] },
176 emit => 'neg %S1, %D1',
183 reg_req => { in => [ "gp" ], out => [ "gp" ] },
184 emit => 'not %S1, %D1',
189 op_flags => [ "constlike" ],
190 irn_flags => [ "rematerializable" ],
191 attr => "ir_tarval *value",
192 custominit => "set_TEMPLATE_value(res, value);",
193 reg_req => { out => [ "gp" ] },
194 emit => 'mov %I, %D1',
197 /* TODO: compare Const attributes */
207 op_flags => [ "cfopcode" ],
208 irn_flags => [ "simple_jump" ],
209 reg_req => { out => [ "none" ] },
215 reg_req => { in => [], out => [ "sp:I|S", "none" ] },
216 outs => [ "stack", "M" ],
222 op_flags => [ "cfopcode" ],
223 ins => [ "stack", "mem" ],
224 reg_req => { in => [ "sp", "none", ], out => [] },
231 op_flags => [ "uses_memory" ],
232 irn_flags => [ "rematerializable" ],
233 state => "exc_pinned",
234 reg_req => { in => [ "gp", "none" ], out => [ "gp" ] },
235 emit => 'mov (%S1), %D1',
239 op_flags => [ "uses_memory" ],
240 irn_flags => [ "rematerializable" ],
241 state => "exc_pinned",
242 reg_req => { in => [ "gp", "gp", "none" ] },
243 emit => 'movl %S2, (%S1)',
246 # Floating Point operations
249 op_flags => [ "commutative" ],
250 irn_flags => [ "rematerializable" ],
251 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
252 emit => 'fadd %S1, %S2, %D1',
257 op_flags => [ "commutative" ],
258 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
259 emit =>'fmul %S1, %S2, %D1',
264 irn_flags => [ "rematerializable" ],
265 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
266 emit => 'fsub %S1, %S2, %D1',
271 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
272 emit => 'fdiv %S1, %S2, %D1',
277 irn_flags => [ "rematerializable" ],
278 reg_req => { in => [ "fp" ], out => [ "fp" ] },
279 emit => 'fneg %S1, %D1',
284 op_flags => [ "constlike" ],
285 irn_flags => [ "rematerializable" ],
286 reg_req => { out => [ "fp" ] },
287 emit => 'fmov %I, %D1',
290 /* TODO: compare fConst attributes */
299 op_flags => [ "uses_memory" ],
300 irn_flags => [ "rematerializable" ],
301 state => "exc_pinned",
302 reg_req => { in => [ "gp", "none" ], out => [ "fp" ] },
303 emit => 'fmov (%S1), %D1',
307 op_flags => [ "uses_memory" ],
308 irn_flags => [ "rematerializable" ],
309 state => "exc_pinned",
310 reg_req => { in => [ "gp", "fp", "none" ] },
311 emit => 'fmov %S2, (%S1)',