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
8ce557f8
Commit
8ce557f8
authored
Nov 18, 2008
by
Moritz Kroll
Browse files
Removed unused block parameter from Const constructors
[r23750]
parent
af7c3d76
Changes
17
Hide whitespace changes
Inline
Side-by-side
include/libfirm/ircons.h
View file @
8ce557f8
...
@@ -1223,21 +1223,24 @@ ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
...
@@ -1223,21 +1223,24 @@ ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
ir_node
*
store
,
int
arity
,
ir_node
*
in
[]);
ir_node
*
store
,
int
arity
,
ir_node
*
in
[]);
/** Constructor for a Const_type node.
/** Constructor for a Const_type node.
*
* Adds the node to the start 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.
*
*
* @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 *block The IR block the node belongs to.
* @param *mode The mode of the operands and results.
* @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
*
block
,
ir_node
*
new_rd_Const_type
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a Const node.
/** Constructor for a Const node.
*
* Adds the node to the start 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
...
@@ -1245,11 +1248,10 @@ ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
...
@@ -1245,11 +1248,10 @@ ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
*
*
* @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 *block The IR block the node belongs to.
* @param *mode The mode of the operands and results.
* @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
*
block
,
ir_node
*
new_rd_Const
(
dbg_info
*
db
,
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
);
ir_mode
*
mode
,
tarval
*
con
);
/** Constructor for a SymConst_type node.
/** Constructor for a SymConst_type node.
...
@@ -2104,6 +2106,8 @@ ir_node *new_r_Return (ir_graph *irg, ir_node *block,
...
@@ -2104,6 +2106,8 @@ ir_node *new_r_Return (ir_graph *irg, ir_node *block,
ir_node
*
store
,
int
arity
,
ir_node
*
in
[]);
ir_node
*
store
,
int
arity
,
ir_node
*
in
[]);
/** Constructor for a Const node.
/** Constructor for a Const node.
*
* Adds the node to the start 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
...
@@ -2114,35 +2118,37 @@ ir_node *new_r_Return (ir_graph *irg, ir_node *block,
...
@@ -2114,35 +2118,37 @@ ir_node *new_r_Return (ir_graph *irg, ir_node *block,
* @param *mode The mode of the operands and the results.
* @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
*
block
,
ir_node
*
new_r_Const
(
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
);
ir_mode
*
mode
,
tarval
*
con
);
/** Constructor for a Const node.
/** Constructor for a Const node.
*
* Adds the node to the start 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.)
*
*
* @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 *mode The mode of the operands and the results.
* @param *mode The mode of the operands and the results.
* @param value A value from which the tarval is made.
* @param value A value from which the tarval is made.
*/
*/
ir_node
*
new_r_Const_long
(
ir_graph
*
irg
,
ir_node
*
block
,
ir_node
*
new_r_Const_long
(
ir_graph
*
irg
,
ir_mode
*
mode
,
long
value
);
ir_mode
*
mode
,
long
value
);
/** Constructor for a Const_type node.
/** Constructor for a Const_type node.
*
* Adds the node to the start 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.
*
*
* @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 *mode The mode of the operands and results.
* @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
*
block
,
ir_node
*
new_r_Const_type
(
ir_graph
*
irg
,
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
ir_mode
*
mode
,
tarval
*
con
,
ir_type
*
tp
);
/** Constructor for a SymConst node.
/** Constructor for a SymConst node.
...
@@ -2932,7 +2938,7 @@ ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
...
@@ -2932,7 +2938,7 @@ ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
/** Constructor for a Const_type node.
/** Constructor for a Const_type node.
*
*
* Adds the node to the
block in current_ir_
block.
* Adds the node to the
start
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.
...
...
ir/ana/irconsconfirm.c
View file @
8ce557f8
...
@@ -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
,
block
,
mode
,
tv
,
tp
);
c
=
new_r_Const_type
(
current_ir_graph
,
mode
,
tv
,
tp
);
}
}
set_irn_n
(
succ
,
pos
,
c
);
set_irn_n
(
succ
,
pos
,
c
);
...
...
ir/be/beabi.c
View file @
8ce557f8
...
@@ -553,7 +553,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
...
@@ -553,7 +553,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
if
(
mode_is_reference
(
mach_mode
))
{
if
(
mode_is_reference
(
mach_mode
))
{
constmode
=
mode_Is
;
constmode
=
mode_Is
;
}
}
addr
=
new_r_Const_long
(
irg
,
bl
,
constmode
,
curr_ofs
);
addr
=
new_r_Const_long
(
irg
,
constmode
,
curr_ofs
);
addr
=
new_r_Add
(
irg
,
bl
,
curr_sp
,
addr
,
mach_mode
);
addr
=
new_r_Add
(
irg
,
bl
,
curr_sp
,
addr
,
mach_mode
);
}
}
}
}
...
@@ -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
,
block
,
mode
,
tv
);
mask
=
new_r_Const
(
irg
,
mode
,
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
,
block
,
mode
,
tv
);
mask
=
new_r_Const
(
irg
,
mode
,
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
;
...
@@ -915,7 +915,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
...
@@ -915,7 +915,7 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
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
),
tarval
*
tv
=
new_tarval_from_long
(
get_type_size_bytes
(
type
),
mode_Iu
);
mode_Iu
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
block
,
mode_Iu
,
tv
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
mode_Iu
,
tv
);
ir_node
*
mul
=
new_rd_Mul
(
dbg
,
irg
,
block
,
get_Alloc_size
(
alloc
),
ir_node
*
mul
=
new_rd_Mul
(
dbg
,
irg
,
block
,
get_Alloc_size
(
alloc
),
cnst
,
mode_Iu
);
cnst
,
mode_Iu
);
size
=
mul
;
size
=
mul
;
...
@@ -985,7 +985,7 @@ static ir_node *adjust_free(be_abi_irg_t *env, ir_node *free, ir_node *curr_sp)
...
@@ -985,7 +985,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
,
block
,
mode_Iu
,
tv
);
ir_node
*
cnst
=
new_rd_Const
(
dbg
,
irg
,
mode_Iu
,
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 @
8ce557f8
...
@@ -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
,
get_irg_start_block
(
cnst_irg
),
mode
,
tv
);
cnst
=
new_r_Const
(
cnst_irg
,
mode
,
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 @
8ce557f8
...
@@ -191,7 +191,7 @@ static int map_Shl(ir_node *call, void *ctx) {
...
@@ -191,7 +191,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
,
block
,
l_mode
,
get_mode_null
(
l_mode
));
l_res
=
new_rd_Const
(
dbg
,
irg
,
l_mode
,
get_mode_null
(
l_mode
));
}
else
{
}
else
{
/* h_res = SHLD a_h, a_l, cnt */
/* h_res = SHLD a_h, a_l, cnt */
...
@@ -215,9 +215,9 @@ static int map_Shl(ir_node *call, void *ctx) {
...
@@ -215,9 +215,9 @@ static int map_Shl(ir_node *call, void *ctx) {
l1
=
new_bd_ia32_l_ShlDep
(
dbg
,
upper
,
a_l
,
cnt
,
h1
,
l_mode
);
l1
=
new_bd_ia32_l_ShlDep
(
dbg
,
upper
,
a_l
,
cnt
,
h1
,
l_mode
);
c_mode
=
get_irn_mode
(
cnt
);
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
upper
,
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
,
upper
,
c_mode
,
get_mode_null
(
c_mode
)));
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
c_mode
,
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
);
...
@@ -227,7 +227,7 @@ static int map_Shl(ir_node *call, void *ctx) {
...
@@ -227,7 +227,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
,
n_block
,
l_mode
,
get_mode_null
(
l_mode
));
l2
=
new_r_Const
(
irg
,
l_mode
,
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
);
...
@@ -278,7 +278,7 @@ static int map_Shr(ir_node *call, void *ctx) {
...
@@ -278,7 +278,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
,
block
,
h_mode
,
get_mode_null
(
h_mode
));
h_res
=
new_rd_Const
(
dbg
,
irg
,
h_mode
,
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 */
...
@@ -301,9 +301,9 @@ static int map_Shr(ir_node *call, void *ctx) {
...
@@ -301,9 +301,9 @@ static int map_Shr(ir_node *call, void *ctx) {
h1
=
new_bd_ia32_l_ShrDep
(
dbg
,
upper
,
a_h
,
cnt
,
l1
,
h_mode
);
h1
=
new_bd_ia32_l_ShrDep
(
dbg
,
upper
,
a_h
,
cnt
,
l1
,
h_mode
);
c_mode
=
get_irn_mode
(
cnt
);
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
upper
,
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
,
upper
,
c_mode
,
get_mode_null
(
c_mode
)));
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
c_mode
,
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
);
...
@@ -313,7 +313,7 @@ static int map_Shr(ir_node *call, void *ctx) {
...
@@ -313,7 +313,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
,
n_block
,
h_mode
,
get_mode_null
(
h_mode
));
h2
=
new_r_Const
(
irg
,
h_mode
,
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
);
...
@@ -366,7 +366,7 @@ static int map_Shrs(ir_node *call, void *ctx) {
...
@@ -366,7 +366,7 @@ static int map_Shrs(ir_node *call, void *ctx) {
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
);
ir_mode
*
c_mode
=
get_irn_mode
(
cnt
);
ir_mode
*
c_mode
=
get_irn_mode
(
cnt
);
h_res
=
new_rd_Shrs
(
dbg
,
irg
,
block
,
a_h
,
new_r_Const_long
(
irg
,
block
,
c_mode
,
31
),
h_mode
);
h_res
=
new_rd_Shrs
(
dbg
,
irg
,
block
,
a_h
,
new_r_Const_long
(
irg
,
c_mode
,
31
),
h_mode
);
l_res
=
new_rd_Shrs
(
dbg
,
irg
,
block
,
conv
,
cnt
,
l_mode
);
l_res
=
new_rd_Shrs
(
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 */
...
@@ -389,9 +389,9 @@ static int map_Shrs(ir_node *call, void *ctx) {
...
@@ -389,9 +389,9 @@ static int map_Shrs(ir_node *call, void *ctx) {
h1
=
new_bd_ia32_l_SarDep
(
dbg
,
upper
,
a_h
,
cnt
,
l1
,
h_mode
);
h1
=
new_bd_ia32_l_SarDep
(
dbg
,
upper
,
a_h
,
cnt
,
l1
,
h_mode
);
c_mode
=
get_irn_mode
(
cnt
);
c_mode
=
get_irn_mode
(
cnt
);
irn
=
new_r_Const_long
(
irg
,
upper
,
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
,
upper
,
c_mode
,
get_mode_null
(
c_mode
)));
irn
=
new_rd_Cmp
(
dbg
,
irg
,
upper
,
irn
,
new_r_Const
(
irg
,
c_mode
,
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
);
...
@@ -401,7 +401,7 @@ static int map_Shrs(ir_node *call, void *ctx) {
...
@@ -401,7 +401,7 @@ static int map_Shrs(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_rd_Shrs
(
dbg
,
irg
,
n_block
,
a_h
,
new_r_Const_long
(
irg
,
block
,
c_mode
,
31
),
h_mode
);
h2
=
new_rd_Shrs
(
dbg
,
irg
,
n_block
,
a_h
,
new_r_Const_long
(
irg
,
c_mode
,
31
),
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
);
...
...
ir/ir/irarch.c
View file @
8ce557f8
...
@@ -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_r_Const
(
current_ir_graph
,
env
->
blk
,
env
->
shf_mode
,
new_tarval_from_long
(
inst
->
shift_count
,
env
->
shf_mode
));
c
=
new_r_Const
(
current_ir_graph
,
env
->
shf_mode
,
new_tarval_from_long
(
inst
->
shift_count
,
env
->
shf_mode
));
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_r_Const
(
current_ir_graph
,
env
->
blk
,
env
->
shf_mode
,
new_tarval_from_long
(
inst
->
shift_count
,
env
->
shf_mode
));
c
=
new_r_Const
(
current_ir_graph
,
env
->
shf_mode
,
new_tarval_from_long
(
inst
->
shift_count
,
env
->
shf_mode
));
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_r_Const
(
current_ir_graph
,
env
->
blk
,
env
->
mode
,
get_mode_null
(
env
->
mode
));
return
inst
->
irn
=
new_r_Const
(
current_ir_graph
,
env
->
mode
,
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_r_Const
(
current_ir_graph
,
block
,
mode
,
mag
.
M
);
c
=
new_r_Const
(
current_ir_graph
,
mode
,
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 */
...
@@ -833,12 +833,12 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
...
@@ -833,12 +833,12 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
/* Do we need the shift */
/* Do we need the shift */
if
(
mag
.
s
>
0
)
{
if
(
mag
.
s
>
0
)
{
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
mag
.
s
);
c
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
mag
.
s
);
q
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
q
,
c
,
mode
);
q
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
q
,
c
,
mode
);
}
}
/* final */
/* final */
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
bits
-
1
);
c
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
bits
-
1
);
t
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
q
,
c
,
mode
);
t
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
q
,
c
,
mode
);
q
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
q
,
t
,
mode
);
q
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
q
,
t
,
mode
);
...
@@ -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_r_Const
(
current_ir_graph
,
block
,
mode
,
mag
.
M
);
c
=
new_r_Const
(
current_ir_graph
,
mode
,
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,19 +855,19 @@ static ir_node *replace_div_by_mulh(ir_node *div, tarval *tv) {
...
@@ -855,19 +855,19 @@ 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_r_Const
(
current_ir_graph
,
block
,
mode_Iu
,
get_mode_one
(
mode_Iu
));
c
=
new_r_Const
(
current_ir_graph
,
mode_Iu
,
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
);
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
mag
.
s
-
1
);
c
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
mag
.
s
-
1
);
q
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
t
,
c
,
mode
);
q
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
t
,
c
,
mode
);
}
else
{
}
else
{
/* use the default scheme */
/* use the default scheme */
q
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
q
,
n
,
mode
);
q
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
q
,
n
,
mode
);
}
}
}
else
if
(
mag
.
s
>
0
)
{
/* default scheme, shift needed */
}
else
if
(
mag
.
s
>
0
)
{
/* default scheme, shift needed */
c
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
mag
.
s
);
c
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
mag
.
s
);
q
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
q
,
c
,
mode
);
q
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
q
,
c
,
mode
);
}
}
}
}
...
@@ -930,11 +930,11 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
...
@@ -930,11 +930,11 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
/* create the correction code for signed values only if there might be a remainder */
/* create the correction code for signed values only if there might be a remainder */
if
(
!
is_Div_remainderless
(
irn
))
{
if
(
!
is_Div_remainderless
(
irn
))
{
if
(
k
!=
1
)
{
if
(
k
!=
1
)
{
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
k
-
1
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
k
-
1
);
curr
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
,
mode
);
curr
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
,
mode
);
}
}
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
bits
-
k
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
bits
-
k
);
curr
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
curr
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
curr
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
left
,
curr
,
mode
);
curr
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
left
,
curr
,
mode
);
...
@@ -942,19 +942,19 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
...
@@ -942,19 +942,19 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
k_node
=
left
;
k_node
=
left
;
}
}
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
k
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
k
);
res
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
res
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
if
(
n_flag
)
{
/* negate the result */
if
(
n_flag
)
{
/* negate the result */
ir_node
*
k_node
;
ir_node
*
k_node
;
k_node
=
new_r_Const
(
current_ir_graph
,
block
,
mode
,
get_mode_null
(
mode
));
k_node
=
new_r_Const
(
current_ir_graph
,
mode
,
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 */
ir_node
*
k_node
;
ir_node
*
k_node
;
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
k
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
k
);
res
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
,
mode
);
res
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
,
mode
);
}
}
}
else
{
}
else
{
...
@@ -1024,23 +1024,23 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn) {
...
@@ -1024,23 +1024,23 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn) {
ir_node
*
curr
=
left
;
ir_node
*
curr
=
left
;
if
(
k
!=
1
)
{
if
(
k
!=
1
)
{
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
k
-
1
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
k
-
1
);
curr
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
,
mode
);
curr
=
new_rd_Shrs
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
,
mode
);
}
}
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode_Iu
,
bits
-
k
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode_Iu
,
bits
-
k
);
curr
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
curr
=
new_rd_Shr
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
curr
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
left
,
curr
,
mode
);
curr
=
new_rd_Add
(
dbg
,
current_ir_graph
,
block
,
left
,
curr
,
mode
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode
,
(
-
1
)
<<
k
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode
,
(
-
1
)
<<
k
);
curr
=
new_rd_And
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
curr
=
new_rd_And
(
dbg
,
current_ir_graph
,
block
,
curr
,
k_node
,
mode
);
res
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
left
,
curr
,
mode
);
res
=
new_rd_Sub
(
dbg
,
current_ir_graph
,
block
,
left
,
curr
,
mode
);
}
else
{
/* unsigned case */
}
else
{
/* unsigned case */
ir_node
*
k_node
;
ir_node
*
k_node
;
k_node
=
new_r_Const_long
(
current_ir_graph
,
block
,
mode
,
(
1
<<
k
)
-
1
);
k_node
=
new_r_Const_long
(
current_ir_graph
,
mode
,
(
1
<<
k
)
-
1
);
res
=
new_rd_And
(
dbg
,
current_ir_graph
,
block
,
left
,
k_node
<