3 # This is the specification for the ia32 assembler Firm-operations
5 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
9 # The node description is done as a perl hash initializer with the
10 # following structure:
15 # "op_flags" => "N|L|C|X|I|F|Y|H|c",
16 # "arity" => "0|1|2|3|variable|dynamic|all",
17 # "state" => "floats|pinned",
19 # { "type" => "type 1", "name" => "name 1" },
20 # { "type" => "type 2", "name" => "name 2" },
23 # "comment" => "any comment for constructor",
24 # "rd_constructor" => "c source code which constructs an ir_node"
27 # ... # (all nodes you need to describe)
29 # ); # close the %nodes initializer
31 # the op_flags correspond to the firm irop_flags:
34 # C irop_flag_commutative
35 # X irop_flag_cfopcode
36 # I irop_flag_ip_cfopcode
39 # H irop_flag_highlevel
40 # c irop_flag_constlike
42 # op_flags: flags for the operation, OPTIONAL (default is "N")
44 # state: state of the operation, OPTIONAL (default is "pinned")
46 # arity: arity of the operation, MUST NOT BE OMITTED
48 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
49 # are always the first 3 arguments and are always autmatically
51 # If this key is missing the following arguments will be created:
52 # for i = 1 .. arity: ir_node *op_i
55 # comment: OPTIONAL comment for the node constructor
57 # rd_constructor: for every operation there will be a
58 # new_rd_<arch>_<op-name> function with the arguments from above
59 # which creates the ir_node corresponding to the defined operation
60 # you can either put the complete source code of this function here
62 # This key is OPTIONAL. If omitted, the following constructor will
64 # if (!op_<arch>_<op-name>) assert(0);
68 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
69 # res = optimize_node(res)
70 # IRN_VRFY_IRG(res, irg)
73 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
75 #--------------------------------------------------#
78 # _ __ _____ __ _ _ __ ___ _ __ ___ #
79 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
80 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
81 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
84 #--------------------------------------------------#
88 # arithmetic operations
90 # commutative operations
95 "comment" => "construct Add: Add(a, b) = Add(b, a) = a + b"
100 "comment" => "construct Add: Add(a, const) = Add(const, a) = a + const",
106 "comment" => "construct Mul: Mul(a, b) = Mul(b, a) = a * b"
112 "comment" => "construct Mul: Mul(a, const) = Mul(const, a) = a * const"
118 "comment" => "construct Mulh: Mulh(a, b) = Mulh(b, a) = get_32_highest_bits(a * b)"
124 "comment" => "construct Mulh: Mulh(a, const) = Mulh(const, a) = get_32_highest_bits(a * const)"
130 "comment" => "construct And: And(a, b) = And(b, a) = a AND b"
135 "comment" => "construct And: And(a, const) = And(const, a) = a AND const"
141 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b"
146 "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const"
152 "comment" => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b"
157 "comment" => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const"
163 "comment" => "construct Max: Max(a, b) = Max(b, a) = a > b ? a : b"
168 "comment" => "construct Max: Max(a, const) = Max(const, a) = a > const ? a : const"
174 "comment" => "construct Min: Min(a, b) = Min(b, a) = a < b ? a : b"
179 "comment" => "construct Min: Min(a, const) = Min(const, a) = a < const ? a : const"
182 # not commutative operations
186 "comment" => "construct Sub: Sub(a, b) = a - b"
191 "comment" => "construct Sub: Sub(a, const) = a - const"
196 "comment" => "construct Mod: Mod(a, b) = a % b"
201 "comment" => "construct Mod: Mod(a, const) = a % const"
206 "comment" => "construct DivMod: DivMod(a,b) = (a / b, a % b)"
211 "comment" => "construct DivMod: DivMod(a, const) = (a / const, a % const)"
216 "comment" => "construct Div: Div(a, b) = a / b"
221 "comment" => "construct Div: Div(a, const) = a / const"
226 "comment" => "construct Shl: Shl(a, b) = a << b"
231 "comment" => "construct Shl: Shl(a, const) = a << const"
236 "comment" => "construct Shr: Shr(a, b) = a >> b"
241 "comment" => "construct Shr: Shr(a, const) = a >> const"
246 "comment" => "construct Shrs: Shrs(a, b) = a >> b"
251 "comment" => "construct Shrs: Shrs(a, const) = a >> const"
256 "comment" => "construct Rot: Rot(a, b) = a ROT b"
261 "comment" => "construct Rot: Rot(a, const) = a ROT const"
266 "comment" => "construct Minus: Minus(a) = -a"
271 "comment" => "construct Increment: Inc(a) = a++"
276 "comment" => "construct Decrement: Dec(a) = a--"
281 "comment" => "construct Abs: Abs(a) = |a|"
286 "comment" => "construct Not: Not(a) = !a"
293 "comment" => "construct Conv: Conv(a) = (conv)a"
299 "comment" => "construct Cmp: Cmp(a, b) = a CMP b"
304 "comment" => "construct Cmp: Cmp(a, const) = Cmp(const, a) = a CMP const"
311 "comment" => "construct Load: Load(mem-edge, ptr) = LD ptr"
316 "comment" => "construct Store: Store(mem-edge, ptr, val) = ST ptr,val"
321 "comment" => "construct Lea: Lea(a,b) = lea offs(a,b,const) | res = a + b * const + offs with const = 0,1,2,4,8"
326 "comment" => "construct Lea: Lea(a) = lea offs(a) | res = a + offs"
333 "comment" => "construct Call: Call(...)",
334 "args" => [ { "type" => "ir_node *", "name" => "old_call" } ],
340 if (!op_ia32_Call) assert(0);
342 in[0] = get_Call_mem(old_call);
344 res = new_ir_node(db, irg, block, op_ia32_Call, mode_T, 1, in);
345 res = optimize_node(res);
346 irn_vrfy_irg(res, irg);
348 attr = (asmop_attr *)get_irn_generic_attr(res);
349 attr->data.old_ir = old_call;