Commit 955ab695 authored by Moritz Kroll's avatar Moritz Kroll
Browse files

Added gen_ir.py support for Div, DivMod, Mod, and Quot

[r25768]
parent c6818545
......@@ -380,12 +380,10 @@ NEW_BD_BINOP(Sub)
NEW_BD_UNOP(Minus)
NEW_BD_BINOP(Mul)
NEW_BD_BINOP(Mulh)
#endif
NEW_BD_DIVOP(Quot)
NEW_BD_DIVOP(DivMod)
NEW_BD_DIVOP(Div)
NEW_BD_DIVOP(Mod)
#ifdef USE_ORIGINAL
NEW_BD_BINOP(And)
NEW_BD_BINOP(Or)
NEW_BD_BINOP(Eor)
......@@ -1074,12 +1072,10 @@ NEW_RD_BINOP(Sub)
NEW_RD_UNOP(Minus)
NEW_RD_BINOP(Mul)
NEW_RD_BINOP(Mulh)
#endif
NEW_RD_DIVOP(Quot)
NEW_RD_DIVOP(DivMod)
NEW_RD_DIVOP(Div)
NEW_RD_DIVOP(Mod)
#ifdef USE_ORIGINAL
NEW_RD_BINOP(And)
NEW_RD_BINOP(Or)
NEW_RD_BINOP(Eor)
......@@ -1604,7 +1600,6 @@ ir_node *new_r_Mulh(ir_graph *irg, ir_node *block,
ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_rd_Mulh(NULL, irg, block, op1, op2, mode);
}
#endif
ir_node *new_r_Quot(ir_graph *irg, ir_node *block,
ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_rd_Quot(NULL, irg, block, memop, op1, op2, mode, state);
......@@ -1617,15 +1612,16 @@ ir_node *new_r_Div(ir_graph *irg, ir_node *block,
ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_rd_Div(NULL, irg, block, memop, op1, op2, mode, state);
}
#endif
ir_node *new_r_DivRL(ir_graph *irg, ir_node *block,
ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_rd_DivRL(NULL, irg, block, memop, op1, op2, mode, state);
}
#ifdef USE_ORIGINAL
ir_node *new_r_Mod(ir_graph *irg, ir_node *block,
ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_rd_Mod(NULL, irg, block, memop, op1, op2, mode, state);
}
#ifdef USE_ORIGINAL
ir_node *new_r_Abs(ir_graph *irg, ir_node *block,
ir_node *op, ir_mode *mode) {
return new_rd_Abs(NULL, irg, block, op, mode);
......@@ -2484,6 +2480,7 @@ void firm_alloc_frag_arr(ir_node *irn, ir_op *op, ir_node ***frag_store) {
}
} /* firm_alloc_frag_arr */
#ifdef USE_ORIGINAL
ir_node *
new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
ir_node *res;
......@@ -2516,6 +2513,7 @@ new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mod
return res;
} /* new_d_Div */
#endif
ir_node *
new_d_DivRL(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
......@@ -2528,6 +2526,7 @@ new_d_DivRL(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *m
return res;
} /* new_d_DivRL */
#ifdef USE_ORIGINAL
ir_node *
new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
ir_node *res;
......@@ -2539,7 +2538,6 @@ new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mod
return res;
} /* new_d_Mod */
#ifdef USE_ORIGINAL
NEW_D_BINOP(And)
NEW_D_BINOP(Or)
NEW_D_BINOP(Eor)
......@@ -3070,7 +3068,6 @@ ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode) {
ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode) {
return new_d_Mulh(NULL, op1, op2, mode);
}
#endif
ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_d_Quot(NULL, memop, op1, op2, mode, state);
}
......@@ -3080,13 +3077,14 @@ ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, o
ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_d_Div(NULL, memop, op1, op2, mode, state);
}
#endif
ir_node *new_DivRL(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_d_DivRL(NULL, memop, op1, op2, mode, state);
}
#ifdef USE_ORIGINAL
ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) {
return new_d_Mod(NULL, memop, op1, op2, mode, state);
}
#ifdef USE_ORIGINAL
ir_node *new_Abs(ir_node *op, ir_mode *mode) {
return new_d_Abs(NULL, op, mode);
}
......
......@@ -290,8 +290,8 @@ def main(argv):
# List of TODOs
niymap = ["Alloc", "Anchor", "ASM", "Bad", "Bound", "Break", "Builtin",
"Call", "CallBegin", "Const", "Const_type", "Const_long", "CopyB",
"defaultProj", "Div", "DivRL", "DivMod", "Dummy", "EndReg", "EndExcept",
"Filter", "InstOf", "Mod", "NoMem", "Phi", "Quot", "Raise",
"defaultProj", "DivRL", "Dummy", "EndReg", "EndExcept",
"Filter", "InstOf", "NoMem", "Phi", "Raise",
"simpleSel", "strictConv", "SymConst", "SymConst_type", "Sync"]
file = open(gendir + "/gen_ir_cons.c.inl", "w")
......
......@@ -261,6 +261,7 @@ CopyB = dict(
Div = dict(
ins = [ "mem", "dividend", "divisor" ],
outs = [ "M", "X_regular", "X_except", "res" ],
attrs_name = "divmod",
attrs = [
dict(
type = "ir_mode*",
......@@ -268,7 +269,8 @@ Div = dict(
),
dict(
name = "state",
type = "op_pin_state"
type = "op_pin_state",
initname = ".exc.pin_state"
),
dict(
name = "no_remainder",
......@@ -279,12 +281,18 @@ Div = dict(
init = "1"
)
)
]
],
d_post = '''
#if PRECISE_EXC_CONTEXT
firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);
#endif
'''
),
DivMod = dict(
ins = [ "mem", "dividend", "divisor" ],
outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ],
attrs_name = "divmod",
attrs = [
dict(
type = "ir_mode*",
......@@ -292,9 +300,15 @@ DivMod = dict(
),
dict(
name = "state",
type = "op_pin_state"
type = "op_pin_state",
initname = ".exc.pin_state"
)
]
],
d_post = '''
#if PRECISE_EXC_CONTEXT
firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);
#endif
'''
),
End = dict(
......@@ -373,6 +387,7 @@ Minus = dict(
Mod = dict(
ins = [ "mem", "dividend", "divisor" ],
outs = [ "M", "X_regular", "X_except", "res" ],
attrs_name = "divmod",
attrs = [
dict(
type = "ir_mode*",
......@@ -380,9 +395,15 @@ Mod = dict(
),
dict(
name = "state",
type = "op_pin_state"
type = "op_pin_state",
initname = ".exc.pin_state"
)
]
],
d_post = '''
#if PRECISE_EXC_CONTEXT
firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr);
#endif
'''
),
Mul = dict(
......@@ -435,6 +456,7 @@ Proj = dict(
Quot = dict(
ins = [ "mem", "dividend", "divisor" ],
outs = [ "M", "X_regular", "X_except", "res" ],
attrs_name = "divmod",
attrs = [
dict(
type = "ir_mode*",
......@@ -442,9 +464,15 @@ Quot = dict(
),
dict(
name = "state",
type = "op_pin_state"
type = "op_pin_state",
initname = ".exc.pin_state"
)
]
],
d_post = '''
#if PRECISE_EXC_CONTEXT
firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr);
#endif
'''
),
Return = dict(
......
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