Commit 128e604d authored by Matthias Braun's avatar Matthias Braun
Browse files

- Fix some more stuff in ir_spec.py

- No exceptions for argument order in the Builtin constructor
- add missing functions for Borrow node

[r25888]
parent d556fd12
......@@ -222,7 +222,7 @@ typedef enum {
ir_bk_trap, /**< GCC __builtin_trap(): insert trap */
ir_bk_debugbreak, /**< MS __debugbreak(): insert debug break */
ir_bk_return_address, /**< GCC __builtin_return_address() */
ir_bk_frame_addess, /**< GCC __builtin_frame_address() */
ir_bk_frame_address, /**< GCC __builtin_frame_address() */
ir_bk_prefetch, /**< GCC __builtin_prefetch() */
ir_bk_ffs, /**< GCC __builtin_ffs(): find first (least) significant 1 bit */
ir_bk_clz, /**< GCC __builtin_clz(): count leading zero */
......
......@@ -1468,13 +1468,13 @@ ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *st
* @param *irg The IR graph the node belongs to.
* @param *block The IR block the node belongs to.
* @param *store The current memory state.
* @param kind The kind of the called builtin.
* @param arity The number of procedure parameters.
* @param *in[] An array with the procedure parameters. The constructor copies this array.
* @param kind The kind of the called builtin.
* @param *tp Type information of the procedure called.
*/
ir_node *new_rd_Builtin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
ir_builtin_kind kind, int arity, ir_node *in[], ir_type *tp);
int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
/** Constructor for a Add node.
*
......@@ -2321,13 +2321,13 @@ ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
* @param *irg The IR graph the node belongs to.
* @param *block The IR block the node belongs to.
* @param *store The actual store.
* @param kind The kind of the called builtin.
* @param arity The number of procedure parameters.
* @param *in[] An array with the pointers to the parameters. The constructor copies this array.
* @param kind The kind of the called builtin.
* @param *tp Type information of the procedure called.
*/
ir_node *new_r_Builtin(ir_graph *irg, ir_node *block, ir_node *store,
ir_builtin_kind kind, int arity, ir_node *in[], ir_type *tp);
int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
/** Constructor for a Add node.
*
......@@ -3168,13 +3168,12 @@ ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity,
*
* @param *db A pointer for debug information.
* @param *store The actual store.
* @param kind The kind of the called builtin.
* @param arity The number of procedure parameters.
* @param *in[] An array with the pointers to the parameters. The constructor copies this array.
* @param kind The kind of the called builtin.
* @param *tp Type information of the procedure called.
*/
ir_node *new_d_Builtin(dbg_info *db, ir_node *store, ir_builtin_kind kind, int arity, ir_node *in[],
ir_type *tp);
ir_node *new_d_Builtin(dbg_info *db, ir_node *store, int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
/** Constructor for a Add node.
*
......@@ -3997,8 +3996,8 @@ ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
* @param *in[] An array with the pointers to the parameters. The constructor copies this array.
* @param *tp Type information of the procedure called.
*/
ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity, ir_node *in[],
ir_type *tp);
ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
ir_builtin_kind kind, ir_type *tp);
/** Constructor for a CallBegin node.
*
......
......@@ -727,6 +727,11 @@ void set_Carry_left(ir_node *node, ir_node *left);
ir_node *get_Carry_right(const ir_node *node);
void set_Carry_right(ir_node *node, ir_node *right);
ir_node *get_Borrow_left(const ir_node *node);
void set_Borrow_left(ir_node *node, ir_node *left);
ir_node *get_Borrow_right(const ir_node *node);
void set_Borrow_right(ir_node *node, ir_node *right);
ir_node *get_Sub_left(const ir_node *node);
void set_Sub_left(ir_node *node, ir_node *left);
ir_node *get_Sub_right(const ir_node *node);
......@@ -795,6 +800,7 @@ void set_Div_mem(ir_node *node, ir_node *mem);
ir_mode *get_Div_resmode(const ir_node *node);
void set_Div_resmode(ir_node *node, ir_mode *mode);
int get_Div_no_remainder(const ir_node *node);
void set_Div_no_remainder(ir_node *node, int no_remainder);
/**
* Projection numbers for Div: use for Proj nodes!
......
......@@ -5136,7 +5136,7 @@ static ir_node *gen_Builtin(ir_node *node) {
return gen_debugbreak(node);
case ir_bk_return_address:
return gen_return_address(node);
case ir_bk_frame_addess:
case ir_bk_frame_address:
return gen_frame_address(node);
case ir_bk_prefetch:
return gen_prefetch(node);
......@@ -5172,7 +5172,7 @@ static ir_node *gen_Proj_Builtin(ir_node *proj) {
switch (kind) {
case ir_bk_return_address:
case ir_bk_frame_addess:
case ir_bk_frame_address:
case ir_bk_ffs:
case ir_bk_clz:
case ir_bk_ctz:
......
......@@ -491,7 +491,7 @@ new_bd_Call(dbg_info *db, ir_node *block, ir_node *store,
static ir_node *
new_bd_Builtin(dbg_info *db, ir_node *block, ir_node *store,
ir_builtin_kind kind, int arity, ir_node **in, ir_type *tp) {
int arity, ir_node **in, ir_builtin_kind kind, ir_type *tp) {
ir_node **r_in;
ir_node *res;
int r_arity;
......@@ -1154,12 +1154,12 @@ new_rd_Call(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
ir_node *
new_rd_Builtin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
ir_builtin_kind kind, int arity, ir_node **in, ir_type *tp) {
int arity, ir_node **in, ir_builtin_kind kind, ir_type *tp) {
ir_node *res;
ir_graph *rem = current_ir_graph;
current_ir_graph = irg;
res = new_bd_Builtin(db, block, store, kind, arity, in, tp);
res = new_bd_Builtin(db, block, store, arity, in, kind, tp);
current_ir_graph = rem;
return res;
......@@ -1556,9 +1556,9 @@ ir_node *new_r_Call(ir_graph *irg, ir_node *block, ir_node *store,
return new_rd_Call(NULL, irg, block, store, callee, arity, in, tp);
}
ir_node *new_r_Builtin(ir_graph *irg, ir_node *block, ir_node *store,
ir_builtin_kind kind, int arity, ir_node **in,
int arity, ir_node **in, ir_builtin_kind kind,
ir_type *tp) {
return new_rd_Builtin(NULL, irg, block, store, kind, arity, in, tp);
return new_rd_Builtin(NULL, irg, block, store, arity, in, kind, tp);
}
ir_node *new_r_Add(ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode) {
......@@ -2556,9 +2556,9 @@ new_d_Call(dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node **i
} /* new_d_Call */
ir_node *
new_d_Builtin(dbg_info *db, ir_node *store, ir_builtin_kind kind, int arity, ir_node **in,
ir_type *tp) {
return new_bd_Builtin(db, current_ir_graph->current_block, store, kind, arity, in, tp);
new_d_Builtin(dbg_info *db, ir_node *store, int arity, ir_node **in,
ir_builtin_kind kind, ir_type *tp) {
return new_bd_Builtin(db, current_ir_graph->current_block, store, arity, in, tp, kind);
} /* new_d_Builtin */
ir_node *
......
......@@ -190,7 +190,7 @@ static void symtbl_init(void)
INSERTENUM(tt_builtin, ir_bk_trap);
INSERTENUM(tt_builtin, ir_bk_debugbreak);
INSERTENUM(tt_builtin, ir_bk_return_address);
INSERTENUM(tt_builtin, ir_bk_frame_addess);
INSERTENUM(tt_builtin, ir_bk_frame_address);
INSERTENUM(tt_builtin, ir_bk_prefetch);
INSERTENUM(tt_builtin, ir_bk_ffs);
INSERTENUM(tt_builtin, ir_bk_clz);
......
......@@ -1447,7 +1447,7 @@ const char *get_builtin_kind_name(ir_builtin_kind kind) {
X(ir_bk_trap);
X(ir_bk_debugbreak);
X(ir_bk_return_address);
X(ir_bk_frame_addess);
X(ir_bk_frame_address);
X(ir_bk_prefetch);
X(ir_bk_ffs);
X(ir_bk_clz);
......@@ -1587,6 +1587,7 @@ void set_##OP##_resmode(ir_node *node, ir_mode *mode) { \
BINOP(Add)
BINOP(Borrow)
BINOP(Carry)
BINOP(Sub)
UNOP(Minus)
......@@ -1614,6 +1615,11 @@ int get_Div_no_remainder(const ir_node *node) {
return node->attr.divmod.no_remainder;
}
void set_Div_no_remainder(ir_node *node, int no_remainder) {
assert(is_Div(node));
node->attr.divmod.no_remainder = no_remainder;
}
int get_Conv_strict(const ir_node *node) {
assert(is_Conv(node));
return node->attr.conv.strict;
......
......@@ -505,6 +505,12 @@ _is_Carry(const ir_node *node) {
return (_get_irn_op(node) == op_Carry);
}
static inline int
_is_Borrow(const ir_node *node) {
assert(node);
return (_get_irn_op(node) == op_Borrow);
}
static inline int
_is_And(const ir_node *node) {
assert(node);
......@@ -1093,6 +1099,7 @@ _is_arg_Proj(const ir_node *node) {
#define is_Quot(node) _is_Quot(node)
#define is_Add(node) _is_Add(node)
#define is_Carry(node) _is_Carry(node)
#define is_Borrow(node) _is_Borrow(node)
#define is_And(node) _is_And(node)
#define is_Or(node) _is_Or(node)
#define is_Eor(node) _is_Eor(node)
......
......@@ -151,13 +151,6 @@ def preprocess_node(nodename, node):
for input in node["ins"]:
arguments.append(dict(type = "ir_node *", name = "irn_" + input))
# Special case for Builtin...
if nodename == "Builtin":
for attr in node["attrs"]:
if attr["name"] == "kind":
attr.setdefault("initname", "." + attr["name"])
arguments.append(prepare_attr(attr))
if node["arity"] == "variable":
arguments.append(dict(type = "int", name = "arity"))
arguments.append(dict(type = "ir_node **", name = "in"))
......@@ -168,9 +161,6 @@ def preprocess_node(nodename, node):
attrs_with_special = 0
for attr in node["attrs"]:
if nodename == "Builtin" and attr["name"] == "kind":
continue
attr.setdefault("initname", "." + attr["name"])
if "special" in attr:
......
......@@ -127,13 +127,6 @@ def preprocess_node(nodename, node):
arguments.append("prednodes[%i]" % i)
i += 1
# Special case for Builtin...
if nodename == "Builtin":
for attr in node["attrs"]:
if attr["name"] == "kind":
prepare_attr(nodename, attr)
arguments.append(attr["name"])
if node["arity"] == "variable" or node["arity"] == "dynamic":
arguments.append("numpreds - %i" % (i + 1))
arguments.append("prednodes + %i" % i)
......@@ -143,8 +136,6 @@ def preprocess_node(nodename, node):
attrs_with_special = 0
for attr in node["attrs"]:
if nodename == "Builtin" and attr["name"] == "kind":
continue
prepare_attr(nodename, attr)
if "special" in attr:
if not "init" in attr:
......
......@@ -135,7 +135,12 @@ Block = dict(
public void markBlockVisited() {
binding.mark_Block_block_visited(ptr);
}''',
}
public boolean isBad() {
return binding.is_Bad(ptr) != 0;
}
''',
),
Borrow = dict(
......@@ -304,7 +309,7 @@ CopyB = dict(
),
Div = dict(
ins = [ "mem", "dividend", "divisor" ],
ins = [ "mem", "left", "right" ],
outs = [ "M", "X_regular", "X_except", "res" ],
attrs_name = "divmod",
attrs = [
......@@ -331,7 +336,7 @@ Div = dict(
),
DivMod = dict(
ins = [ "mem", "dividend", "divisor" ],
ins = [ "mem", "left", "right" ],
outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ],
attrs_name = "divmod",
attrs = [
......@@ -402,7 +407,7 @@ IJmp = dict(
),
InstOf = dict(
ins = [ "store", "objptr" ],
ins = [ "store", "obj" ],
outs = [ "M", "X_regular", "X_except", "res", "M_except" ],
attrs = [
dict(
......@@ -449,7 +454,7 @@ Minus = dict(
),
Mod = dict(
ins = [ "mem", "dividend", "divisor" ],
ins = [ "mem", "left", "right" ],
outs = [ "M", "X_regular", "X_except", "res" ],
attrs_name = "divmod",
attrs = [
......@@ -514,7 +519,7 @@ Proj = dict(
),
Quot = dict(
ins = [ "mem", "dividend", "divisor" ],
ins = [ "mem", "left", "right" ],
outs = [ "M", "X_regular", "X_except", "res" ],
attrs_name = "divmod",
attrs = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment