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
Show whitespace changes
Inline
Side-by-side
include/libfirm/ircons.h
View file @
4b734653
...
@@ -265,7 +265,7 @@
...
@@ -265,7 +265,7 @@
* ir_node *new_IJmp (ir_node *tgt);
* ir_node *new_IJmp (ir_node *tgt);
* ir_node *new_Cond (ir_node *c);
* ir_node *new_Cond (ir_node *c);
* ir_node *new_Return (ir_node *store, int arity, ir_node **in);
* 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_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_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
* ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
* ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
...
@@ -512,14 +512,14 @@
...
@@ -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
* 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:
* Parameters:
* *mode The mode of the constant.
* *con Points to an entry in the constant table.
* *con Points to an entry in the constant table.
* This pointer is added to the attributes of
* This pointer is added to the attributes of
* the node (self->attr.con)
* the node (self->attr.con)
...
@@ -1228,15 +1228,15 @@ ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
...
@@ -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
* The constant represents a target value. This constructor sets high
* level type information for the constant value.
* level type information for the constant value.
* Derives mode from passed tarval.
*
*
* @param *db A pointer for debug information.
* @param *db A pointer for debug information.
* @param *irg The IR graph the node belongs to.
* @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 *con Points to an entry in the constant table.
* @param *tp The type of the constant.
* @param *tp The type of the constant.
*/
*/
ir_node
*
new_rd_Const_type
(
dbg_info
*
db
,
ir_graph
*
irg
,
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.
/** Constructor for a Const node.
*
*
...
@@ -1245,14 +1245,13 @@ ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg,
...
@@ -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
* Constructor for a Const node. The constant represents a target
* value. Sets the type information to type_unknown. (No more
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* supported: If tv is entity derives a somehow useful type.)
* Derives mode from passed tarval.
*
*
* @param *db A pointer for debug information.
* @param *db A pointer for debug information.
* @param *irg The IR graph the node belongs to.
* @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 *con Points to an entry in the constant table.
*/
*/
ir_node
*
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_node
*
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
tarval
*
con
);
ir_mode
*
mode
,
tarval
*
con
);
/** Constructor for a Const node.
/** Constructor for a Const node.
*
*
...
@@ -2128,14 +2127,13 @@ ir_node *new_r_Return (ir_graph *irg, ir_node *block,
...
@@ -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
* Constructor for a Const node. The constant represents a target
* value. Sets the type information to type_unknown. (No more
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* 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 *irg The IR graph the node belongs to.
* @param *block The IR block 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.
* @param *con Points to an entry in the constant table.
*/
*/
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
tarval
*
con
);
ir_mode
*
mode
,
tarval
*
con
);
/** Constructor for a Const node.
/** Constructor for a Const node.
*
*
...
@@ -2158,14 +2156,13 @@ ir_node *new_r_Const_long(ir_graph *irg,
...
@@ -2158,14 +2156,13 @@ ir_node *new_r_Const_long(ir_graph *irg,
*
*
* The constant represents a target value. This constructor sets high
* The constant represents a target value. This constructor sets high
* level type information for the constant value.
* level type information for the constant value.
* Derives mode from passed tarval.
*
*
* @param *irg The IR graph the node belongs to.
* @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 *con Points to an entry in the constant table.
* @param *tp The type of the constant.
* @param *tp The type of the constant.
*/
*/
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
tarval
*
con
,
ir_type
*
tp
);
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a SymConst node.
/** 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[]);
...
@@ -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
* The constant represents a target value. This constructor sets high
* level type information for the constant value.
* level type information for the constant value.
* Derives mode from passed tarval.
*
*
* @param *db A pointer for debug information.
* @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
* @param *con Points to an entry in the constant table. This pointer is
added to the attributes of the node.
added to the attributes of the node.
* @param *tp The type of the constant.
* @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.
/** 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
...
@@ -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
* Constructor for a Const node. The constant represents a target
* value. Sets the type information to type_unknown. (No more
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* supported: If tv is entity derives a somehow useful type.)
* Derives mode from passed tarval.
*
*
* @param *db A pointer for debug information.
* @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
* @param *con Points to an entry in the constant table. This pointer is added
* to the attributes of the node.
* 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.
/** Constructor for a SymConst_type node.
*
*
...
@@ -3744,12 +3741,12 @@ ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
...
@@ -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
* value. Sets the type information to type_unknown. (No more
* supported: If tv is entity derives a somehow useful type.)
* supported: If tv is entity derives a somehow useful type.)
* Adds the node to the block in current_ir_block.
* 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
* @param *con Points to an entry in the constant table. This pointer is
* added to the attributes of the node.
* 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.
* Make a const from a long.
...
@@ -3766,7 +3763,7 @@ ir_node *new_Const_long(ir_mode *mode, long value);
...
@@ -3766,7 +3763,7 @@ ir_node *new_Const_long(ir_mode *mode, long value);
/** Constructor for a Const node.
/** 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
);
ir_node
*
new_Const_type
(
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a SymConst node.
/** 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) {
...
@@ -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_mode
*
mode
=
get_irn_mode
(
irn
);
ir_type
*
tp
=
get_irn_type
(
irn
);
ir_type
*
tp
=
get_irn_type
(
irn
);
tarval
*
tv
=
new_tarval_from_long
(
nr
,
mode
);
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
);
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 *
...
@@ -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.
* We can replace the input with true/false.
*/
*/
if
(
con
==
NULL
)
{
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
);
old
=
get_irn_n
(
user
,
pos
);
set_irn_n
(
user
,
pos
,
con
);
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 *
...
@@ -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
);
NEW_ARR_A
(
ir_node
*
,
in
,
n
);
/* ok, ALL predecessors are either dominated by block OR other block */
/* ok, ALL predecessors are either dominated by block OR other block */
if
(
c_b
==
NULL
)
{
if
(
c_b
==
NULL
)
{
ir_node
*
c_true
=
new_Const
(
mode_b
,
tarval_b_true
);
ir_node
*
c_true
=
new_Const
(
tarval_b_true
);
ir_node
*
c_false
=
new_Const
(
mode_b
,
tarval_b_false
);
ir_node
*
c_false
=
new_Const
(
tarval_b_false
);
c_b
=
new_r_Confirm
(
current_ir_graph
,
cond_block
,
selector
,
c_b
=
new_r_Confirm
(
current_ir_graph
,
cond_block
,
selector
,
pnc
==
pn_Cond_true
?
c_true
:
c_false
,
pn_Cmp_Eq
);
pnc
==
pn_Cond_true
?
c_true
:
c_false
,
pn_Cmp_Eq
);
c_o
=
new_r_Confirm
(
current_ir_graph
,
cond_block
,
selector
,
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) {
...
@@ -504,7 +504,7 @@ static void insert_non_null(ir_node *ptr, ir_node *block, env_t *env) {
*/
*/
if
(
c
==
NULL
)
{
if
(
c
==
NULL
)
{
ir_mode
*
mode
=
get_irn_mode
(
ptr
);
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
);
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,
...
@@ -851,11 +851,11 @@ static ir_node *adjust_alloc_size(unsigned stack_alignment, ir_node *size,
mode
=
get_irn_mode
(
size
);
mode
=
get_irn_mode
(
size
);
tv
=
new_tarval_from_long
(
stack_alignment
-
1
,
mode
);
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
);
size
=
new_rd_Add
(
dbg
,
irg
,
block
,
size
,
mask
,
mode
);
tv
=
new_tarval_from_long
(
-
(
long
)
stack_alignment
,
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
);
size
=
new_rd_And
(
dbg
,
irg
,
block
,
size
,
mask
,
mode
);
}
}
return
size
;
return
size
;
...
@@ -917,7 +917,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
...
@@ -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
);
ir_mode
*
mode
=
get_irn_mode
(
size
);
tarval
*
tv
=
new_tarval_from_long
(
get_type_size_bytes
(
type
),
tarval
*
tv
=
new_tarval_from_long
(
get_type_size_bytes
(
type
),
mode
);
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
);
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)
...
@@ -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 */
/* we might need to multiply the size with the element size */
if
(
type
!=
firm_unknown_type
&&
get_type_size_bytes
(
type
)
!=
1
)
{
if
(
type
!=
firm_unknown_type
&&
get_type_size_bytes
(
type
)
!=
1
)
{
tarval
*
tv
=
new_tarval_from_long
(
get_type_size_bytes
(
type
),
mode_Iu
);
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
),
ir_node
*
mul
=
new_rd_Mul
(
dbg
,
irg
,
block
,
get_Free_size
(
free
),
cnst
,
mode_Iu
);
cnst
,
mode_Iu
);
size
=
mul
;
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)
...
@@ -73,7 +73,7 @@ static ir_entity *create_ent(int value, const char *name)
set_entity_allocation
(
ent
,
allocation_static
);
set_entity_allocation
(
ent
,
allocation_static
);
cnst_irg
=
get_const_code_irg
();
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
);
set_atomic_ent_value
(
ent
,
cnst
);
return
ent
;
return
ent
;
...
...
ir/be/ia32/ia32_intrinsics.c
View file @
4b734653
...
@@ -271,7 +271,7 @@ static int map_Shl(ir_node *call, void *ctx) {
...
@@ -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. */
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
);
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
);
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
{
}
else
{
/* h_res = SHLD a_h, a_l, cnt */
/* h_res = SHLD a_h, a_l, cnt */
...
@@ -297,7 +297,7 @@ static int map_Shl(ir_node *call, void *ctx) {
...
@@ -297,7 +297,7 @@ static int map_Shl(ir_node *call, void *ctx) {
c_mode
=
get_irn_mode
(
cnt
);
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_rd_And
(
dbg
,
irg
,
upper
,
cnt
,
irn
,
c_mode
);
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
);
irn
=
new_r_Proj
(
irg
,
upper
,
irn
,
mode_b
,
pn_Cmp_Eq
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
...
@@ -307,7 +307,7 @@ static int map_Shl(ir_node *call, void *ctx) {
...
@@ -307,7 +307,7 @@ static int map_Shl(ir_node *call, void *ctx) {
/* the block for cnt >= 32 */
/* the block for cnt >= 32 */
n_block
=
new_rd_Block
(
dbg
,
irg
,
1
,
&
in
[
1
]);
n_block
=
new_rd_Block
(
dbg
,
irg
,
1
,
&
in
[
1
]);
h2
=
new_rd_Conv
(
dbg
,
irg
,
n_block
,
l1
,
h_mode
);
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
);
in
[
1
]
=
new_r_Jmp
(
irg
,
n_block
);
set_irn_in
(
block
,
2
,
in
);
set_irn_in
(
block
,
2
,
in
);
...
@@ -358,7 +358,7 @@ static int map_Shr(ir_node *call, void *ctx) {
...
@@ -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
/* simplest case: shift only the higher bits. Note that there is no
need to reduce the constant here, this is done by the hardware. */
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
);
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
);
l_res
=
new_rd_Shr
(
dbg
,
irg
,
block
,
conv
,
cnt
,
l_mode
);
}
else
{
}
else
{
/* l_res = SHRD a_h:a_l, cnt */
/* l_res = SHRD a_h:a_l, cnt */
...
@@ -383,7 +383,7 @@ static int map_Shr(ir_node *call, void *ctx) {
...
@@ -383,7 +383,7 @@ static int map_Shr(ir_node *call, void *ctx) {
c_mode
=
get_irn_mode
(
cnt
);
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_rd_And
(
dbg
,
irg
,
upper
,
cnt
,
irn
,
c_mode
);
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
);
irn
=
new_r_Proj
(
irg
,
upper
,
irn
,
mode_b
,
pn_Cmp_Eq
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
...
@@ -393,7 +393,7 @@ static int map_Shr(ir_node *call, void *ctx) {
...
@@ -393,7 +393,7 @@ static int map_Shr(ir_node *call, void *ctx) {
/* the block for cnt >= 32 */
/* the block for cnt >= 32 */
n_block
=
new_rd_Block
(
dbg
,
irg
,
1
,
&
in
[
1
]);
n_block
=
new_rd_Block
(
dbg
,
irg
,
1
,
&
in
[
1
]);
l2
=
new_rd_Conv
(
dbg
,
irg
,
n_block
,
h1
,
l_mode
);
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
);
in
[
1
]
=
new_r_Jmp
(
irg
,
n_block
);
set_irn_in
(
block
,
2
,
in
);
set_irn_in
(
block
,
2
,
in
);
...
@@ -471,7 +471,7 @@ static int map_Shrs(ir_node *call, void *ctx) {
...
@@ -471,7 +471,7 @@ static int map_Shrs(ir_node *call, void *ctx) {
c_mode
=
get_irn_mode
(
cnt
);
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_r_Const_long
(
irg
,
c_mode
,
32
);
irn
=
new_rd_And
(
dbg
,
irg
,
upper
,
cnt
,
irn
,
c_mode
);
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
);
irn
=
new_r_Proj
(
irg
,
upper
,
irn
,
mode_b
,
pn_Cmp_Eq
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
cond
=
new_rd_Cond
(
dbg
,
irg
,
upper
,
irn
);
...
@@ -777,7 +777,7 @@ static int map_Conv(ir_node *call, void *ctx) {
...
@@ -777,7 +777,7 @@ static int map_Conv(ir_node *call, void *ctx) {
/* convert from float to signed 64bit */
/* convert from float to signed 64bit */
ir_mode
*
flt_mode
=
get_irn_mode
(
a_f
);
ir_mode
*
flt_mode
=
get_irn_mode
(
a_f
);
tarval
*
flt_tv
=
new_tarval_from_str
(
"9223372036854775808"
,
19
,
flt_mode
);
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
*
lower_blk
=
block
;
ir_node
*
upper_blk
;
ir_node
*
upper_blk
;
ir_node
*
cmp
,
*
proj
,
*
cond
,
*
blk
,
*
int_phi
,
*
flt_phi
;
ir_node
*
cmp
,
*
proj
,
*
cond
,
*
blk
,
*
int_phi
,
*
flt_phi
;
...
@@ -797,7 +797,7 @@ static int map_Conv(ir_node *call, void *ctx) {
...
@@ -797,7 +797,7 @@ static int map_Conv(ir_node *call, void *ctx) {
set_irn_in
(
lower_blk
,
2
,
in
);
set_irn_in
(
lower_blk
,
2
,
in
);
/* create to Phis */
/* 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
);
in
[
1
]
=
new_Const_long
(
h_res_mode
,
0x80000000
);
int_phi
=
new_r_Phi
(
irg
,
lower_blk
,
2
,
in
,
h_res_mode
);
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_
...
@@ -1423,7 +1423,7 @@ static ir_node *gen_fp_known_symconst(ppc32_transform_env_t *env, tarval *known_
const code irg */
const code irg */
rem
=
current_ir_graph
;
rem
=
current_ir_graph
;
current_ir_graph
=
get_const_code_irg
();
current_ir_graph
=
get_const_code_irg
();
cnst
=
new_Const
(
env
->
mode
,
key
.
tv
);
cnst
=
new_Const
(
key
.
tv
);
current_ir_graph
=
rem
;
current_ir_graph
=
rem
;
set_atomic_ent_value
(
ent
,
cnst
);
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) {
...
@@ -448,12 +448,12 @@ static ir_node *build_graph(mul_env *env, instruction *inst) {
case
LEA
:
case
LEA
:
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
r
=
build_graph
(
env
,
inst
->
in
[
1
]);
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
);
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
);
return
inst
->
irn
=
new_rd_Add
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
r
,
env
->
mode
);
case
SHIFT
:
case
SHIFT
:
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
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
);
return
inst
->
irn
=
new_rd_Shl
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
c
,
env
->
mode
);
case
SUB
:
case
SUB
:
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
l
=
build_graph
(
env
,
inst
->
in
[
0
]);
...
@@ -464,7 +464,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) {
...
@@ -464,7 +464,7 @@ static ir_node *build_graph(mul_env *env, instruction *inst) {
r
=
build_graph
(
env
,
inst
->
in
[
1
]);
r
=
build_graph
(
env
,
inst
->
in
[
1
]);
return
inst
->
irn
=
new_rd_Add
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
r
,
env
->
mode
);
return
inst
->
irn
=
new_rd_Add
(
env
->
dbg
,
current_ir_graph
,
env
->
blk
,
l
,
r
,
env
->
mode
);
case
ZERO
:
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:
default:
panic
(
"Unsupported instruction kind"
);
panic
(
"Unsupported instruction kind"
);
return
NULL
;
return
NULL
;
...
@@ -822,7 +822,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
...
@@ -822,7 +822,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
struct
ms
mag
=
magic
(
tv
);
struct
ms
mag
=
magic
(
tv
);
/* generate the Mulh instruction */
/* 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
);
q
=
new_rd_Mulh
(
dbg
,
current_ir_graph
,
block
,
n
,
c
,
mode
);
/* do we need an Add or Sub */
/* do we need an Add or Sub */
...
@@ -847,7 +847,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
...
@@ -847,7 +847,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
ir_node
*
c
;
ir_node
*
c
;
/* generate the Mulh instruction */
/* 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
);
q
=
new_rd_Mulh
(
dbg
,
current_ir_graph
,
block
,
n
,
c
,
mode
);
if
(
mag
.
need_add
)
{
if
(
mag
.
need_add
)
{
...
@@ -855,7 +855,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
...
@@ -855,7 +855,7 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
/* use the GM scheme */
/* use the GM scheme */
t
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
n
,
q
,
mode
);
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_Shr
(
dbg
,
current_ir_graph
,
block
,
t
,
c
,
mode
);
t
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
t
,
q
,
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) {
...
@@ -948,7 +948,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
if
(
n_flag
)
{
/* negate the result */
if
(
n_flag
)
{
/* negate the result */
ir_node
*
k_node
;
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
);
res
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
k_node
,
res
,
mode
);
}
}
}
else
{
/* unsigned case */
}
else
{
/* unsigned case */
...
@@ -1134,7 +1134,7 @@ void arch_dep_replace_divmod_by_const(ir_node **div, ir_node **mod, ir_node *irn
...
@@ -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 */
if
(
n_flag
)
{
/* negate the div result */
ir_node
*
k_node
;
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
);
*
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)
...
@@ -257,11 +257,11 @@ new_bd_Phi(dbg_info *db, ir_node *block, int arity, ir_node **in, ir_mode *mode)
}
/* new_bd_Phi */
}
/* new_bd_Phi */
static
ir_node
*
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_node
*
res
;
ir_graph
*
irg
=
current_ir_graph
;
ir_graph
*
irg
=
current_ir_graph
;
res
=
new_ir_node
(
db
,
irg
,
get_irg_start_block
(
irg
),
op_Const
,
mode
,
0
,
NULL
);