Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
4b734653
Commit
4b734653
authored
Nov 27, 2008
by
Moritz Kroll
Browse files
Removed mode parameter from Const and Const_type constructors (now derived from tarval)
[r24088]
parent
3fc36574
Changes
23
Hide whitespace changes
Inline
Side-by-side
include/libfirm/ircons.h
View file @
4b734653
...
...
@@ -265,7 +265,7 @@
* ir_node *new_IJmp (ir_node *tgt);
* ir_node *new_Cond (ir_node *c);
* ir_node *new_Return (ir_node *store, int arity, ir_node **in);
* ir_node *new_Const (
ir_mode *mode,
tarval *con);
* ir_node *new_Const (tarval *con);
* ir_node *new_SymConst (ir_mode *mode, symconst_symbol value, symconst_kind kind);
* ir_node *new_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
* ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
...
...
@@ -512,14 +512,14 @@
*
* ---------
*
* ir_node *new_Const (
ir_mode *mode,
tarval *con)
* ir_node *new_Const (tarval *con)
* -----------------------------------------------
*
* Creates a constant in the constant table and adds a Const node
* returning this value to the start block.
* returning this value to the start block. The mode is derived
* from the tarval.
*
* Parameters:
* *mode The mode of the constant.
* *con Points to an entry in the constant table.
* This pointer is added to the attributes of
* the node (self->attr.con)
...
...
@@ -1228,15 +1228,15 @@ ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
*
* The constant represents a target value. This constructor sets high
* level type information for the constant value.
* Derives mode from passed tarval.
*
* @param *db A pointer for debug information.
* @param *irg The IR graph the node belongs to.
* @param *mode The mode of the operands and results.
* @param *con Points to an entry in the constant table.
* @param *tp The type of the constant.
*/
ir_node
*
new_rd_Const_type
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a Const node.
*
...
...
@@ -1245,14 +1245,13 @@ ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg,
* Constructor for a Const node. The constant represents a target
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* Derives mode from passed tarval.
*
* @param *db A pointer for debug information.
* @param *irg The IR graph the node belongs to.
* @param *mode The mode of the operands and results.
* @param *con Points to an entry in the constant table.
*/
ir_node
*
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
);
ir_node
*
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
tarval
*
con
);
/** Constructor for a Const node.
*
...
...
@@ -2128,14 +2127,13 @@ ir_node *new_r_Return (ir_graph *irg, ir_node *block,
* Constructor for a Const node. The constant represents a target
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* Derives mode from passed tarval.
*
* @param *irg The IR graph the node belongs to.
* @param *block The IR block the node belongs to.
* @param *mode The mode of the operands and the results.
* @param *con Points to an entry in the constant table.
*/
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
);
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
tarval
*
con
);
/** Constructor for a Const node.
*
...
...
@@ -2158,14 +2156,13 @@ ir_node *new_r_Const_long(ir_graph *irg,
*
* The constant represents a target value. This constructor sets high
* level type information for the constant value.
* Derives mode from passed tarval.
*
* @param *irg The IR graph the node belongs to.
* @param *mode The mode of the operands and results.
* @param *con Points to an entry in the constant table.
* @param *tp The type of the constant.
*/
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a SymConst node.
*
...
...
@@ -2958,14 +2955,14 @@ ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
*
* The constant represents a target value. This constructor sets high
* level type information for the constant value.
* Derives mode from passed tarval.
*
* @param *db A pointer for debug information.
* @param *mode The mode of the operands and results.
* @param *con Points to an entry in the constant table. This pointer is
added to the attributes of the node.
* @param *tp The type of the constant.
*/
ir_node
*
new_d_Const_type
(
dbg_info
*
db
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
ir_node
*
new_d_Const_type
(
dbg_info
*
db
,
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a Const node.
*
...
...
@@ -2974,13 +2971,13 @@ ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp
* Constructor for a Const node. The constant represents a target
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* Derives mode from passed tarval.
*
* @param *db A pointer for debug information.
* @param *mode The mode of the operands and results.
* @param *con Points to an entry in the constant table. This pointer is added
* to the attributes of the node.
*/
ir_node
*
new_d_Const
(
dbg_info
*
db
,
ir_mode
*
mode
,
tarval
*
con
);
ir_node
*
new_d_Const
(
dbg_info
*
db
,
tarval
*
con
);
/** Constructor for a SymConst_type node.
*
...
...
@@ -3744,12 +3741,12 @@ ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* Adds the node to the block in current_ir_block.
* Derives mode from passed tarval.
*
* @param *mode The mode of the operands and results.
* @param *con Points to an entry in the constant table. This pointer is
* added to the attributes of the node.
*/
ir_node
*
new_Const
(
ir_mode
*
mode
,
tarval
*
con
);
ir_node
*
new_Const
(
tarval
*
con
);
/**
* Make a const from a long.
...
...
@@ -3766,7 +3763,7 @@ ir_node *new_Const_long(ir_mode *mode, long value);
/** Constructor for a Const node.
*
* Derives mode from passed t
ype
. */
* Derives mode from passed t
arval
. */
ir_node
*
new_Const_type
(
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a SymConst node.
...
...
ir/ana/irconsconfirm.c
View file @
4b734653
...
...
@@ -108,7 +108,7 @@ static void handle_case(ir_node *block, ir_node *irn, long nr, env_t *env) {
ir_mode
*
mode
=
get_irn_mode
(
irn
);
ir_type
*
tp
=
get_irn_type
(
irn
);
tarval
*
tv
=
new_tarval_from_long
(
nr
,
mode
);
c
=
new_r_Const_type
(
current_ir_graph
,
mode
,
tv
,
tp
);
c
=
new_r_Const_type
(
current_ir_graph
,
tv
,
tp
);
}
set_irn_n
(
succ
,
pos
,
c
);
...
...
@@ -146,7 +146,7 @@ static void handle_modeb(ir_node *block, ir_node *selector, pn_Cond pnc, env_t *
* We can replace the input with true/false.
*/
if
(
con
==
NULL
)
{
con
=
new_Const
(
mode_b
,
pnc
==
pn_Cond_true
?
tarval_b_true
:
tarval_b_false
);
con
=
new_Const
(
pnc
==
pn_Cond_true
?
tarval_b_true
:
tarval_b_false
);
}
old
=
get_irn_n
(
user
,
pos
);
set_irn_n
(
user
,
pos
,
con
);
...
...
@@ -207,8 +207,8 @@ static void handle_modeb(ir_node *block, ir_node *selector, pn_Cond pnc, env_t *
NEW_ARR_A
(
ir_node
*
,
in
,
n
);
/* ok, ALL predecessors are either dominated by block OR other block */
if
(
c_b
==
NULL
)
{
ir_node
*
c_true
=
new_Const
(
mode_b
,
tarval_b_true
);
ir_node
*
c_false
=
new_Const
(
mode_b
,
tarval_b_false
);
ir_node
*
c_true
=
new_Const
(
tarval_b_true
);
ir_node
*
c_false
=
new_Const
(
tarval_b_false
);
c_b
=
new_r_Confirm
(
current_ir_graph
,
cond_block
,
selector
,
pnc
==
pn_Cond_true
?
c_true
:
c_false
,
pn_Cmp_Eq
);
c_o
=
new_r_Confirm
(
current_ir_graph
,
cond_block
,
selector
,
...
...
@@ -504,7 +504,7 @@ static void insert_non_null(ir_node *ptr, ir_node *block, env_t *env) {
*/
if
(
c
==
NULL
)
{
ir_mode
*
mode
=
get_irn_mode
(
ptr
);
c
=
new_Const
(
mode
,
get_mode_null
(
mode
));
c
=
new_Const
(
get_mode_null
(
mode
));
c
=
new_r_Confirm
(
current_ir_graph
,
block
,
ptr
,
c
,
pn_Cmp_Lg
);
}
...
...
ir/be/beabi.c
View file @
4b734653
...
...
@@ -851,11 +851,11 @@ static ir_node *adjust_alloc_size(unsigned stack_alignment, ir_node *size,
mode
=
get_irn_mode
(
size
);
tv
=
new_tarval_from_long
(
stack_alignment
-
1
,
mode
);
mask
=
new_r_Const
(
irg
,
mode
,
tv
);
mask
=
new_r_Const
(
irg
,
tv
);
size
=
new_rd_Add
(
dbg
,
irg
,
block
,
size
,
mask
,
mode
);
tv
=
new_tarval_from_long
(
-
(
long
)
stack_alignment
,
mode
);
mask
=
new_r_Const
(
irg
,
mode
,
tv
);
mask
=
new_r_Const
(
irg
,
tv
);
size
=
new_rd_And
(
dbg
,
irg
,
block
,
size
,
mask
,
mode
);
}
return
size
;
...
...
@@ -917,7 +917,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
ir_mode
*
mode
=
get_irn_mode
(
size
);
tarval
*
tv
=
new_tarval_from_long
(
get_type_size_bytes
(
type
),
mode
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
mode
,
tv
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
tv
);
size
=
new_rd_Mul
(
dbg
,
irg
,
block
,
size
,
cnst
,
mode
);
}
...
...
@@ -983,7 +983,7 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp)
/* we might need to multiply the size with the element size */
if
(
type
!=
firm_unknown_type
&&
get_type_size_bytes
(
type
)
!=
1
)
{
tarval
*
tv
=
new_tarval_from_long
(
get_type_size_bytes
(
type
),
mode_Iu
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
mode_Iu
,
tv
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
tv
);
ir_node
*
mul
=
new_rd_Mul
(
dbg
,
irg
,
block
,
get_Free_size
(
free
),
cnst
,
mode_Iu
);
size
=
mul
;
...
...
ir/be/ia32/ia32_fpu.c
View file @
4b734653
...
...
@@ -73,7 +73,7 @@ static ir_entity *create_ent(int value, const char *name)
set_entity_allocation
(
ent
,
allocation_static
);
cnst_irg
=
get_const_code_irg
();
cnst
=
new_r_Const
(
cnst_irg
,
mode
,
tv
);
cnst
=
new_r_Const
(
cnst_irg
,
tv
);
set_atomic_ent_value
(
ent
,
cnst
);
return
ent
;
...
...
ir/be/ia32/ia32_intrinsics.c
View file @
4b734653
...
...
@@ -271,7 +271,7 @@ static int map_Shl(ir_node *call, void *ctx) {
need to reduce the constant here, this is done by the hardware. */
ir_node
*
conv
=
new_rd_Conv
(
dbg
,
irg
,
block
,
a_l
,
h_mode
);
h_res
=
new_rd_Shl
(
dbg
,
irg
,
block
,
conv
,
cnt
,
h_mode
);
l_res
=
new_rd_Const
(
dbg
,
irg
,
l_mode
,
get_mode_null
(
l_mode
));
l_res
=
new_rd_Const
(
dbg
,
irg
,
get_mode_null
(
l_mode
));
}
else
{
/* h_res = SHLD a_h, a_l, cnt */
...
...
@@ -297,7 +297,7 @@ static int map_Shl(ir_node *call, void *ctx) {
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_rd_And
(
dbg
,
irg
,
upper
,
cnt
,
irn
,
c_mode
);
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
c_mode
,
get_mode_null
(
c_mode
)));
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
get_mode_null
(
c_mode
)));
irn
=
new_r_Proj
(
irg
,
upper
,
irn
,
mode_b
,
pn_Cmp_Eq
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
...
...
@@ -307,7 +307,7 @@ static int map_Shl(ir_node *call, void *ctx) {
/* the block for cnt >= 32 */
n_block
=
new_rd_Block
(
dbg
,
irg
,
1
,
&
in
[
1
]);
h2
=
new_rd_Conv
(
dbg
,
irg
,
n_block
,
l1
,
h_mode
);
l2
=
new_r_Const
(
irg
,
l_mode
,
get_mode_null
(
l_mode
));
l2
=
new_r_Const
(
irg
,
get_mode_null
(
l_mode
));
in
[
1
]
=
new_r_Jmp
(
irg
,
n_block
);
set_irn_in
(
block
,
2
,
in
);
...
...
@@ -358,7 +358,7 @@ static int map_Shr(ir_node *call, void *ctx) {
/* simplest case: shift only the higher bits. Note that there is no
need to reduce the constant here, this is done by the hardware. */
ir_node
*
conv
=
new_rd_Conv
(
dbg
,
irg
,
block
,
a_h
,
l_mode
);
h_res
=
new_rd_Const
(
dbg
,
irg
,
h_mode
,
get_mode_null
(
h_mode
));
h_res
=
new_rd_Const
(
dbg
,
irg
,
get_mode_null
(
h_mode
));
l_res
=
new_rd_Shr
(
dbg
,
irg
,
block
,
conv
,
cnt
,
l_mode
);
}
else
{
/* l_res = SHRD a_h:a_l, cnt */
...
...
@@ -383,7 +383,7 @@ static int map_Shr(ir_node *call, void *ctx) {
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_rd_And
(
dbg
,
irg
,
upper
,
cnt
,
irn
,
c_mode
);
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
c_mode
,
get_mode_null
(
c_mode
)));
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
get_mode_null
(
c_mode
)));
irn
=
new_r_Proj
(
irg
,
upper
,
irn
,
mode_b
,
pn_Cmp_Eq
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
...
...
@@ -393,7 +393,7 @@ static int map_Shr(ir_node *call, void *ctx) {
/* the block for cnt >= 32 */
n_block
=
new_rd_Block
(
dbg
,
irg
,
1
,
&
in
[
1
]);
l2
=
new_rd_Conv
(
dbg
,
irg
,
n_block
,
h1
,
l_mode
);
h2
=
new_r_Const
(
irg
,
h_mode
,
get_mode_null
(
h_mode
));
h2
=
new_r_Const
(
irg
,
get_mode_null
(
h_mode
));
in
[
1
]
=
new_r_Jmp
(
irg
,
n_block
);
set_irn_in
(
block
,
2
,
in
);
...
...
@@ -471,7 +471,7 @@ static int map_Shrs(ir_node *call, void *ctx) {
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_rd_And
(
dbg
,
irg
,
upper
,
cnt
,
irn
,
c_mode
);
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
c_mode
,
get_mode_null
(
c_mode
)));
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
get_mode_null
(
c_mode
)));
irn
=
new_r_Proj
(
irg
,
upper
,
irn
,
mode_b
,
pn_Cmp_Eq
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
...
...
@@ -777,7 +777,7 @@ static int map_Conv(ir_node *call, void *ctx) {
/* convert from float to signed 64bit */
ir_mode
*
flt_mode
=
get_irn_mode
(
a_f
);
tarval
*
flt_tv
=
new_tarval_from_str
(
"9223372036854775808"
,
19
,
flt_mode
);
ir_node
*
flt_corr
=
new_Const
(
flt_mode
,
flt_tv
);
ir_node
*
flt_corr
=
new_Const
(
flt_tv
);
ir_node
*
lower_blk
=
block
;
ir_node
*
upper_blk
;
ir_node
*
cmp
,
*
proj
,
*
cond
,
*
blk
,
*
int_phi
,
*
flt_phi
;
...
...
@@ -797,7 +797,7 @@ static int map_Conv(ir_node *call, void *ctx) {
set_irn_in
(
lower_blk
,
2
,
in
);
/* create to Phis */
in
[
0
]
=
new_Const
(
h_res_mode
,
get_mode_null
(
h_res_mode
));
in
[
0
]
=
new_Const
(
get_mode_null
(
h_res_mode
));
in
[
1
]
=
new_Const_long
(
h_res_mode
,
0x80000000
);
int_phi
=
new_r_Phi
(
irg
,
lower_blk
,
2
,
in
,
h_res_mode
);
...
...
ir/be/ppc32/ppc32_transform.c
View file @
4b734653
...
...
@@ -1423,7 +1423,7 @@ static ir_node *gen_fp_known_symconst(ppc32_transform_env_t *env, tarval *known_
const code irg */
rem
=
current_ir_graph
;
current_ir_graph
=
get_const_code_irg
();
cnst
=
new_Const
(
env
->
mode
,
key
.
tv
);
cnst
=
new_Const
(
key
.
tv
);
current_ir_graph
=
rem
;
set_atomic_ent_value
(
ent
,
cnst
);
...
...
ir/ir/irarch.c
View file @
4b734653
...
...
@@ -448,12 +448,12 @@ static ir_node *build_graph(mul_env *env, instruction *inst) {
case
LEA
:
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
r
=
build_graph
(
env
,
inst
->
in
[
1
]);
c
=
new_Const
(
env
->
shf_mode
,
new_tarval_from_long
(
inst
->
shift_count
,
env
->
shf_mode
)
);
c
=
new_Const
_long
(
env
->
shf_mode
,
inst
->
shift_count
);
r
=
new_rd_Shl
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
r
,
c
,
env
->
mode
);
return
inst
->
irn
=
new_rd_Add
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
r
,
env
->
mode
);
case
SHIFT
:
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
c
=
new_Const
(
env
->
shf_mode
,
new_tarval_from_long
(
inst
->
shift_count
,
env
->
shf_mode
)
);
c
=
new_Const
_long
(
env
->
shf_mode
,
inst
->
shift_count
);
return
inst
->
irn
=
new_rd_Shl
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
c
,
env
->
mode
);
case
SUB
:
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
...
...
@@ -464,7 +464,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) {
r
=
build_graph
(
env
,
inst
->
in
[
1
]);
return
inst
->
irn
=
new_rd_Add
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
r
,
env
->
mode
);
case
ZERO
:
return
inst
->
irn
=
new_Const
(
env
->
mode
,
get_mode_null
(
env
->
mode
));
return
inst
->
irn
=
new_Const
(
get_mode_null
(
env
->
mode
));
default:
panic
(
"Unsupported instruction kind"
);
return
NULL
;
...
...
@@ -822,7 +822,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
struct
ms
mag
=
magic
(
tv
);
/* generate the Mulh instruction */
c
=
new_Const
(
mode
,
mag
.
M
);
c
=
new_Const
(
mag
.
M
);
q
=
new_rd_Mulh
(
dbg
,
current_ir_graph
,
block
,
n
,
c
,
mode
);
/* do we need an Add or Sub */
...
...
@@ -847,7 +847,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
ir_node
*
c
;
/* generate the Mulh instruction */
c
=
new_Const
(
mode
,
mag
.
M
);
c
=
new_Const
(
mag
.
M
);
q
=
new_rd_Mulh
(
dbg
,
current_ir_graph
,
block
,
n
,
c
,
mode
);
if
(
mag
.
need_add
)
{
...
...
@@ -855,7 +855,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
/* use the GM scheme */
t
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
n
,
q
,
mode
);
c
=
new_Const
(
mode_Iu
,
get_mode_one
(
mode_Iu
));
c
=
new_Const
(
get_mode_one
(
mode_Iu
));
t
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
t
,
c
,
mode
);
t
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
t
,
q
,
mode
);
...
...
@@ -948,7 +948,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
if
(
n_flag
)
{
/* negate the result */
ir_node
*
k_node
;
k_node
=
new_Const
(
mode
,
get_mode_null
(
mode
));
k_node
=
new_Const
(
get_mode_null
(
mode
));
res
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
k_node
,
res
,
mode
);
}
}
else
{
/* unsigned case */
...
...
@@ -1134,7 +1134,7 @@ void arch_dep_replace_divmod_by_const(ir_node **div, ir_node **mod, ir_node *irn
if
(
n_flag
)
{
/* negate the div result */
ir_node
*
k_node
;
k_node
=
new_Const
(
mode
,
get_mode_null
(
mode
));
k_node
=
new_Const
(
get_mode_null
(
mode
));
*
div
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
k_node
,
*
div
,
mode
);
}
...
...
ir/ir/ircons.c
View file @
4b734653
...
...
@@ -257,11 +257,11 @@ new_bd_Phi(dbg_info *db, ir_node *block, int arity, ir_node **in, ir_mode *mode)
}
/* new_bd_Phi */
static
ir_node
*
new_bd_Const_type
(
dbg_info
*
db
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
)
{
new_bd_Const_type
(
dbg_info
*
db
,
tarval
*
con
,
ir_type
*
tp
)
{
ir_node
*
res
;
ir_graph
*
irg
=
current_ir_graph
;
res
=
new_ir_node
(
db
,
irg
,
get_irg_start_block
(
irg
),
op_Const
,
mode
,
0
,
NULL
);
res
=
new_ir_node
(
db
,
irg
,
get_irg_start_block
(
irg
),
op_Const
,
get_tarval_mode
(
con
)
,
0
,
NULL
);
res
->
attr
.
con
.
tv
=
con
;
set_Const_type
(
res
,
tp
);
/* Call method because of complex assertion. */
res
=
optimize_node
(
res
);
...
...
@@ -272,17 +272,17 @@ new_bd_Const_type(dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp) {
}
/* new_bd_Const_type */
static
ir_node
*
new_bd_Const
(
dbg_info
*
db
,
ir_mode
*
mode
,
tarval
*
con
)
{
new_bd_Const
(
dbg_info
*
db
,
tarval
*
con
)
{
ir_graph
*
irg
=
current_ir_graph
;
return
new_rd_Const_type
(
db
,
irg
,
mode
,
con
,
firm_unknown_type
);
return
new_rd_Const_type
(
db
,
irg
,
con
,
firm_unknown_type
);
}
/* new_bd_Const */
static
ir_node
*
new_bd_Const_long
(
dbg_info
*
db
,
ir_mode
*
mode
,
long
value
)
{
ir_graph
*
irg
=
current_ir_graph
;
return
new_rd_Const
(
db
,
irg
,
mode
,
new_tarval_from_long
(
value
,
mode
));
return
new_rd_Const
(
db
,
irg
,
new_tarval_from_long
(
value
,
mode
));
}
/* new_bd_Const_long */
static
ir_node
*
...
...
@@ -894,24 +894,24 @@ new_rd_Phi(dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node **in,
}
/* new_rd_Phi */
ir_node
*
new_rd_Const_type
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
)
{
new_rd_Const_type
(
dbg_info
*
db
,
ir_graph
*
irg
,
tarval
*
con
,
ir_type
*
tp
)
{
ir_node
*
res
;
ir_graph
*
rem
=
current_ir_graph
;
current_ir_graph
=
irg
;
res
=
new_bd_Const_type
(
db
,
mode
,
con
,
tp
);
res
=
new_bd_Const_type
(
db
,
con
,
tp
);
current_ir_graph
=
rem
;
return
res
;
}
/* new_rd_Const_type */
ir_node
*
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
)
{
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
tarval
*
con
)
{
ir_node
*
res
;
ir_graph
*
rem
=
current_ir_graph
;
current_ir_graph
=
irg
;
res
=
new_bd_Const_type
(
db
,
mode
,
con
,
firm_unknown_type
);
res
=
new_bd_Const_type
(
db
,
con
,
firm_unknown_type
);
current_ir_graph
=
rem
;
return
res
;
...
...
@@ -919,7 +919,7 @@ new_rd_Const(dbg_info *db, ir_graph *irg, ir_mode *mode, tarval *con) {
ir_node
*
new_rd_Const_long
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
long
value
)
{
return
new_rd_Const
(
db
,
irg
,
mode
,
new_tarval_from_long
(
value
,
mode
));
return
new_rd_Const
(
db
,
irg
,
new_tarval_from_long
(
value
,
mode
));
}
/* new_rd_Const_long */
ir_node
*
...
...
@@ -1444,15 +1444,14 @@ ir_node *new_r_Return(ir_graph *irg, ir_node *block,
ir_node
*
store
,
int
arity
,
ir_node
**
in
)
{
return
new_rd_Return
(
NULL
,
irg
,
block
,
store
,
arity
,
in
);
}
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
)
{
return
new_rd_Const
(
NULL
,
irg
,
mode
,
con
);
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
tarval
*
con
)
{
return
new_rd_Const
(
NULL
,
irg
,
con
);
}
ir_node
*
new_r_Const_long
(
ir_graph
*
irg
,
ir_mode
*
mode
,
long
value
)
{
return
new_rd_Const_long
(
NULL
,
irg
,
mode
,
value
);
}
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
)
{
return
new_rd_Const_type
(
NULL
,
irg
,
mode
,
con
,
tp
);
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
tarval
*
con
,
ir_type
*
tp
)
{
return
new_rd_Const_type
(
NULL
,
irg
,
con
,
tp
);
}
ir_node
*
new_r_SymConst
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_mode
*
mode
,
symconst_symbol
value
,
symconst_kind
symkind
)
{
...
...
@@ -2256,8 +2255,8 @@ new_d_Phi(dbg_info *db, int arity, ir_node **in, ir_mode *mode) {
}
/* new_d_Phi */
ir_node
*
new_d_Const
(
dbg_info
*
db
,
ir_mode
*
mode
,
tarval
*
con
)
{
return
new_bd_Const
(
db
,
mode
,
con
);
new_d_Const
(
dbg_info
*
db
,
tarval
*
con
)
{
return
new_bd_Const
(
db
,
con
);
}
/* new_d_Const */
ir_node
*
...
...
@@ -2266,8 +2265,8 @@ new_d_Const_long(dbg_info *db, ir_mode *mode, long value) {
}
/* new_d_Const_long */
ir_node
*
new_d_Const_type
(
dbg_info
*
db
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
)
{
return
new_bd_Const_type
(
db
,
mode
,
con
,
tp
);
new_d_Const_type
(
dbg_info
*
db
,
tarval
*
con
,
ir_type
*
tp
)
{
return
new_bd_Const_type
(
db
,
con
,
tp
);
}
/* new_d_Const_type */
...
...
@@ -2849,8 +2848,8 @@ ir_node *new_Cond(ir_node *c) {
ir_node
*
new_Return
(
ir_node
*
store
,
int
arity
,
ir_node
*
in
[])
{
return
new_d_Return
(
NULL
,
store
,
arity
,
in
);
}
ir_node
*
new_Const
(
ir_mode
*
mode
,
tarval
*
con
)
{
return
new_d_Const
(
NULL
,
mode
,
con
);
ir_node
*
new_Const
(
tarval
*
con
)
{
return
new_d_Const
(
NULL
,
con
);
}
ir_node
*
new_Const_long
(
ir_mode
*
mode
,
long
value
)
{
...
...
@@ -2858,7 +2857,7 @@ ir_node *new_Const_long(ir_mode *mode, long value) {
}
ir_node
*
new_Const_type
(
tarval
*
con
,
ir_type
*
tp
)
{
return
new_d_Const_type
(
NULL
,
get_type_mode
(
tp
),
con
,
tp
);
return
new_d_Const_type
(
NULL
,
con
,
tp
);
}
ir_node
*
new_SymConst_type
(
ir_mode
*
mode
,
symconst_symbol
value
,
symconst_kind
kind
,
ir_type
*
type
)
{
...
...
ir/ir/iropt.c
View file @
4b734653
...
...
@@ -1984,7 +1984,7 @@ static ir_node *apply_binop_on_phi(ir_node *phi, tarval *other, tarval *(*eval)(
irg
=
current_ir_graph
;
for
(
i
=
0
;
i
<
n
;
++
i
)
{
pred
=
get_irn_n
(
phi
,
i
);
res
[
i
]
=
new_r_Const_type
(
irg
,
mode
,
res
[
i
],
get_Const_type
(
pred
));
res
[
i
]
=
new_r_Const_type
(
irg
,
res
[
i
],
get_Const_type
(
pred
));
}
return
new_r_Phi
(
irg
,
get_nodes_block
(
phi
),
n
,
(
ir_node
**
)
res
,
mode
);
}
/* apply_binop_on_phi */
...
...
@@ -2028,7 +2028,7 @@ static ir_node *apply_binop_on_2_phis(ir_node *a, ir_node *b, tarval *(*eval)(),
irg
=
current_ir_graph
;
for
(
i
=
0
;
i
<
n
;
++
i
)
{
pred
=
get_irn_n
(
a
,
i
);
res
[
i
]
=
new_r_Const_type
(
irg
,
mode
,
res
[
i
],
get_Const_type
(
pred
));
res
[
i
]
=
new_r_Const_type
(
irg
,
res
[
i
],
get_Const_type
(
pred
));
}
return
new_r_Phi
(
irg
,
get_nodes_block
(
a
),
n
,
(
ir_node
**
)
res
,
mode
);
}
/* apply_binop_on_2_phis */
...
...
@@ -2065,7 +2065,7 @@ static ir_node *apply_unop_on_phi(ir_node *phi, tarval *(*eval)(tarval *)) {
irg
=
current_ir_graph
;
for
(
i
=
0
;
i
<
n
;
++
i
)
{
pred
=
get_irn_n
(
phi
,
i
);
res
[
i
]
=
new_r_Const_type
(
irg
,
mode
,
res
[
i
],
get_Const_type
(
pred
));
res
[
i
]
=
new_r_Const_type
(
irg
,
res
[
i
],
get_Const_type
(
pred
));
}
return
new_r_Phi
(
irg
,
get_nodes_block
(
phi
),
n
,
(
ir_node
**
)
res
,
mode
);
}
/* apply_unop_on_phi */
...
...
@@ -2099,7 +2099,7 @@ static ir_node *apply_conv_on_phi(ir_node *phi, ir_mode *mode) {
irg
=
current_ir_graph
;
for
(
i
=
0
;
i
<
n
;
++
i
)
{
pred
=
get_irn_n
(
phi
,
i
);
res
[
i
]
=
new_r_Const_type
(
irg
,
mode
,
res
[
i
],
get_Const_type
(
pred
));
res
[
i
]
=
new_r_Const_type
(
irg
,
res
[
i
],
get_Const_type
(
pred
));
}
return
new_r_Phi
(
irg
,
get_nodes_block
(
phi
),
n
,
(
ir_node
**
)
res
,
mode
);
}
/* apply_conv_on_phi */
...
...
@@ -2297,7 +2297,7 @@ static ir_node *transform_node_Add(ir_node *n) {
}
if
(
op
==
b
)
{
/* ~x + x = -1 */
n
=
new_Const
(
mode
,
get_mode_minus_one
(
mode
));
n
=
new_Const
(
get_mode_minus_one
(
mode
));
DBG_OPT_ALGSIM0
(
oldn
,
n
,
FS_OPT_ADD_X_NOT_X
);
return
n
;
}
...
...
@@ -2307,7 +2307,7 @@ static ir_node *transform_node_Add(ir_node *n) {
if
(
op
==
a
)
{
/* x + ~x = -1 */
n
=
new_Const
(
mode
,
get_mode_minus_one
(
mode
));
n
=
new_Const
(
get_mode_minus_one
(
mode
));
DBG_OPT_ALGSIM0
(
oldn
,
n
,
FS_OPT_ADD_X_NOT_X
);
return
n
;
}
...
...
@@ -2324,9 +2324,8 @@ static ir_node *const_negate(ir_node *cnst) {
tarval
*
tv
=
tarval_neg
(
get_Const_tarval
(
cnst
));
dbg_info
*
dbgi
=
get_irn_dbg_info
(
cnst
);
ir_graph
*
irg
=
get_irn_irg
(
cnst
);
ir_mode
*
mode
=
get_irn_mode
(
cnst
);
if
(
tv
==
tarval_bad
)
return
NULL
;
return
new_rd_Const
(
dbgi
,
irg
,
mode
,
tv
);
return
new_rd_Const
(
dbgi
,
irg
,
tv
);
}
/**
...
...
@@ -2626,7 +2625,7 @@ restart:
tv
=
tarval_add
(
tv
,
get_mode_one
(
mode
));
if
(
tv
!=
tarval_bad
)
{
ir_node
*
blk
=
get_nodes_block
(
n
);
ir_node
*
c
=
new_Const
(
mode
,
tv
);
ir_node
*
c
=
new_Const
(
tv
);
n
=
new_rd_Add
(
get_irn_dbg_info
(
n
),
current_ir_graph
,
blk
,
get_Not_op
(
b
),
c
,
mode
);
DBG_OPT_ALGSIM0
(
oldn
,
n
,
FS_OPT_SUB_C_NOT_X
);
return
n
;
...
...
@@ -2816,7 +2815,7 @@ static ir_node *transform_node_Div(ir_node *n) {
value
=
n
;
tv
=
value_of
(
n
);
if
(
tv
!=
tarval_bad
)
{
value
=
new_Const
(
get_tarval_mode
(
tv
),
tv
);
value
=
new_Const
(
tv
);
DBG_OPT_CSTEVAL
(
n
,
value
);
goto
make_tuple
;
...
...
@@ -2827,7 +2826,7 @@ static ir_node *transform_node_Div(ir_node *n) {
if
(
a
==
b
&&
value_not_zero
(
a
,
&
dummy
))
{
/* BEWARE: we can optimize a/a to 1 only if this cannot cause a exception */
value
=
new_Const
(
mode
,
get_mode_one
(
mode
));
value
=
new_Const
(
get_mode_one
(
mode
));
DBG_OPT_CSTEVAL
(
n
,
value
);
goto
make_tuple
;
}
else
{
...
...
@@ -2903,7 +2902,7 @@ static ir_node *transform_node_Mod(ir_node *n) {
value
=
n
;
tv
=
value_of
(
n
);
if
(
tv
!=
tarval_bad
)
{