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",
101 "rd_constructor" => "DEFAULT"
107 "comment" => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
113 "comment" => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
119 "comment" => "construct And: And(a, b) = And(b, a) = a AND b",
124 "comment" => "construct And: And(a, const) = And(const, a) = a AND const",
130 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
135 "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
141 "comment" => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
146 "comment" => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const",
149 # not commutative operations
153 "comment" => "construct Sub: Sub(a, b) = a - b",
158 "comment" => "construct Sub: Sub(a, const) = a - const",
163 "comment" => "construct Mod: Mod(a, b) = a % b",
168 "comment" => "construct Mod: Mod(a, const) = a % const",
173 "comment" => "construct Shl: Shl(a, b) = a << b",
178 "comment" => "construct Shl: Shl(a, const) = a << const",
183 "comment" => "construct Shr: Shr(a, b) = a >> b",
188 "comment" => "construct Shr: Shr(a, const) = a >> const",
193 "comment" => "construct Shrs: Shrs(a, b) = a >> b",
198 "comment" => "construct Shrs: Shrs(a, const) = a >> const",
203 "comment" => "construct Rot: Rot(a, b) = a ROT b",
208 "comment" => "construct Rot: Rot(a, const) = a ROT const",
213 "comment" => "construct Minus: Minus(a) = -a",
218 "comment" => "construct Increment: Inc(a) = a++",
223 "comment" => "construct Decrement: Dec(a) = a--",
230 "comment" => "construct Conv: Conv(a) = (conv)a",
236 "comment" => "construct Cmp: Cmp(a, b) = a CMP b",
241 "comment" => "construct Cmp: Cmp(a, const) = Cmp(const, a) = a CMP const",
248 "comment" => "construct Load: Load(mem-edge, ptr) = LD ptr",
253 "comment" => "construct Store: Store(mem-edge, ptr, val) = ST ptr,val",
258 "comment" => "construct Lea: Lea(a,b) = lea offs(a,b,const) | res = a + b * const + offs with const = 0,1,2,4,8",
263 "comment" => "construct Lea: Lea(a) = lea offs(a) | res = a + offs",
270 "comment" => "construct Call: Call(...)",
271 "args" => [ { "type" => "ir_node *", "name" => "old_call" } ],
277 if (!op_ia32_Call) assert(0);
279 in[0] = get_Call_mem(old_call);
281 res = new_ir_node(db, irg, block, op_ia32_Call, mode_T, 1, in);
282 res = optimize_node(res);
283 irn_vrfy_irg(res, irg);
285 attr = (asmop_attr *)get_irn_generic_attr(res);
286 attr->data.old_ir = old_call;