Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
bd0bfb9f
Commit
bd0bfb9f
authored
Jun 18, 2015
by
Matthias Braun
Browse files
remove arch_register_req_type_limited, look whether the limited pointer is != NULL instead
parent
c85d04f8
Changes
17
Hide whitespace changes
Inline
Side-by-side
ir/be/bearch.c
View file @
bd0bfb9f
...
...
@@ -73,7 +73,7 @@ bool arch_reg_is_allocatable(const arch_register_req_t *req,
return
false
;
if
(
reg
->
is_virtual
)
return
true
;
if
(
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
!=
NULL
)
return
rbitset_is_set
(
req
->
limited
,
reg
->
index
);
return
true
;
}
...
...
ir/be/bearch.h
View file @
bd0bfb9f
...
...
@@ -24,10 +24,8 @@
* Different types of register allocation requirements.
*/
typedef
enum
arch_register_req_type_t
{
/**
All registers in the class are allowed
. */
/**
No special type, but may still have a limited array set
. */
arch_register_req_type_none
=
0
,
/** Only a real subset of the class is allowed. */
arch_register_req_type_limited
=
1U
<<
0
,
/** The register should be equal to another one at the node. */
arch_register_req_type_should_be_same
=
1U
<<
1
,
/** The register must be unequal from some other at the node. */
...
...
@@ -231,7 +229,7 @@ struct arch_register_req_t {
/** The register class this constraint belongs to. */
const
arch_register_class_t
*
cls
;
/** allowed register bitset (in case of wide-values this is only about the
* first register) */
* first register)
. NULL if all registers are allowed.
*/
const
unsigned
*
limited
;
arch_register_req_type_t
type
;
/**< The type of the constraint. */
/** Bitmask of ins which should use the same register (should_be_same). */
...
...
ir/be/beasm.c
View file @
bd0bfb9f
...
...
@@ -51,7 +51,7 @@ arch_register_req_t const *be_make_register_req(struct obstack *obst, be_asm_con
*
limited
=
c
->
allowed_registers
;
memset
(
req
,
0
,
sizeof
(
*
req
));
req
->
type
=
arch_register_req_type_
limited
;
req
->
type
=
arch_register_req_type_
none
;
req
->
cls
=
c
->
cls
;
req
->
limited
=
limited
;
req
->
width
=
1
;
...
...
@@ -173,8 +173,7 @@ static bool can_match(arch_register_req_t const *const in, arch_register_req_t c
{
if
(
in
->
cls
!=
out
->
cls
)
return
false
;
if
(
!
arch_register_req_is
(
in
,
limited
)
||
!
arch_register_req_is
(
out
,
limited
))
if
(
in
->
limited
==
NULL
||
out
->
limited
==
NULL
)
return
true
;
return
(
*
in
->
limited
&
*
out
->
limited
)
!=
0
;
}
...
...
@@ -248,7 +247,7 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
continue
;
/* add a new (dummy) input which occupies the register */
assert
(
arch_register_req_is
(
outreq
,
limited
)
);
assert
(
outreq
->
limited
!=
NULL
);
ARR_APP1
(
arch_register_req_t
const
*
,
in_reqs
,
outreq
);
ARR_APP1
(
ir_node
*
,
in
,
be_new_AnyVal
(
block
,
outreq
->
cls
));
}
...
...
@@ -260,7 +259,7 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
continue
;
/* add a new (dummy) output which occupies the register */
assert
(
arch_register_req_is
(
inreq
,
limited
)
);
assert
(
inreq
->
limited
!=
NULL
);
ARR_APP1
(
arch_register_req_t
const
*
,
out_reqs
,
inreq
);
}
}
...
...
ir/be/bechordal_common.c
View file @
bd0bfb9f
...
...
@@ -154,7 +154,7 @@ ir_node *pre_process_constraints(be_chordal_env_t *env, be_insn_t **the_insn)
* limited, is a hack. It will break when multiple differently constrained
* inputs use the same value. */
arch_register_req_t
const
*
const
req
=
arch_get_irn_register_req_in
(
irn
,
i
);
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
arch_set_irn_register_req_out
(
perm
,
get_Proj_num
(
proj
),
req
);
}
...
...
ir/be/becopyheur4.c
View file @
bd0bfb9f
...
...
@@ -148,7 +148,7 @@ static co_mst_irn_t *co_mst_irn_init(co_mst_env_t *env, const ir_node *irn)
/* Exclude colors not assignable to the irn */
arch_register_req_t
const
*
const
req
=
arch_get_irn_register_req
(
irn
);
if
(
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
!=
NULL
)
rbitset_and
(
adm
->
data
,
req
->
limited
,
n_regs
);
/* compute the constraint factor */
...
...
ir/be/becopyilp.c
View file @
bd0bfb9f
...
...
@@ -116,7 +116,7 @@ static void sr_remove(ilp_env_t *const ienv)
redo
=
false
;
be_ifg_foreach_node
(
ifg
,
irn
)
{
const
arch_register_req_t
*
req
=
arch_get_irn_register_req
(
irn
);
if
(
arch_register_req_is
(
req
,
limited
)
||
sr_is_removed
(
ienv
,
irn
))
if
(
req
->
limited
!=
NULL
||
sr_is_removed
(
ienv
,
irn
))
continue
;
if
(
co_gs_is_optimizable
(
ienv
->
co
,
irn
))
continue
;
...
...
ir/be/becopyilp2.c
View file @
bd0bfb9f
...
...
@@ -91,7 +91,7 @@ static void build_coloring_cstr(ilp_env_t *ienv)
req
=
arch_get_irn_register_req
(
irn
);
/* get assignable colors */
if
(
arch_register_req_is
(
req
,
limited
)
)
{
if
(
req
->
limited
!=
NULL
)
{
rbitset_copy
(
colors
,
req
->
limited
,
n_regs
);
}
else
{
rbitset_copy
(
colors
,
allocatable_colors
,
n_regs
);
...
...
ir/be/becopyopt.c
View file @
bd0bfb9f
...
...
@@ -662,11 +662,11 @@ bool co_gs_is_optimizable(copy_opt_t const *const co, ir_node *const irn)
static
bool
co_dump_appel_disjoint_constraints
(
ir_node
*
const
a
,
ir_node
*
const
b
)
{
arch_register_req_t
const
*
const
reqa
=
arch_get_irn_register_req
(
a
);
if
(
!
arch_register_req_is
(
reqa
,
limited
)
)
if
(
reqa
->
limited
==
NULL
)
return
false
;
arch_register_req_t
const
*
const
reqb
=
arch_get_irn_register_req
(
b
);
if
(
!
arch_register_req_is
(
reqb
,
limited
)
)
if
(
reqb
->
limited
==
NULL
)
return
false
;
return
!
rbitsets_have_common
(
reqa
->
limited
,
reqb
->
limited
,
reqa
->
cls
->
n_regs
);
...
...
@@ -719,7 +719,7 @@ static void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
int
idx
=
node_map
[
get_irn_idx
(
irn
)];
affinity_node_t
*
a
=
get_affinity_info
(
co
,
irn
);
if
(
arch_register_req_is
(
req
,
limited
)
)
{
if
(
req
->
limited
!=
NULL
)
{
for
(
unsigned
i
=
0
;
i
<
co
->
cls
->
n_regs
;
++
i
)
{
if
(
!
rbitset_is_set
(
req
->
limited
,
i
)
&&
color_map
[
i
]
>=
0
)
fprintf
(
f
,
"%d %d -1
\n
"
,
color_map
[
i
],
idx
);
...
...
ir/be/bedump.c
View file @
bd0bfb9f
...
...
@@ -191,7 +191,7 @@ static void dump_register_req(FILE *const F, arch_register_req_t const *const re
fputs
(
cls
->
name
,
F
);
if
(
arch_register_req_is
(
req
,
limited
)
)
{
if
(
req
->
limited
!=
NULL
)
{
fputs
(
" limited to"
,
F
);
for
(
unsigned
i
=
0
,
n_regs
=
cls
->
n_regs
;
i
<
n_regs
;
++
i
)
{
if
(
rbitset_is_set
(
req
->
limited
,
i
))
...
...
ir/be/beinsn.c
View file @
bd0bfb9f
...
...
@@ -29,7 +29,7 @@ be_insn_t *be_scan_insn(be_chordal_env_t *const env, ir_node *const irn)
bool
has_constraints
=
false
;
be_foreach_definition
(
irn
,
cls
,
p
,
req
,
/* found a def: create a new operand */
if
(
arch_register_req_is
(
req
,
limited
)
)
{
if
(
req
->
limited
!=
NULL
)
{
o
.
regs
=
req
->
limited
;
has_constraints
=
true
;
}
else
{
...
...
@@ -46,7 +46,7 @@ be_insn_t *be_scan_insn(be_chordal_env_t *const env, ir_node *const irn)
/* now collect the uses for this node */
be_foreach_use
(
irn
,
cls
,
in_req
,
op
,
op_req
,
/* found a register use, create an operand */
if
(
arch_register_req_is
(
in_req
,
limited
)
)
{
if
(
in_req
->
limited
!=
NULL
)
{
o
.
regs
=
in_req
->
limited
;
has_constraints
=
true
;
}
else
{
...
...
ir/be/benode.c
View file @
bd0bfb9f
...
...
@@ -346,7 +346,7 @@ const arch_register_req_t *be_create_reg_req(struct obstack *obst,
=
rbitset_obstack_alloc
(
obst
,
cls
->
n_regs
);
rbitset_set
(
limited
,
reg
->
index
);
arch_register_req_t
*
req
=
OALLOC
(
obst
,
arch_register_req_t
);
req
->
type
=
arch_register_req_type_limited
|
additional_types
;
req
->
type
=
additional_types
;
req
->
cls
=
cls
;
req
->
limited
=
limited
;
req
->
width
=
1
;
...
...
@@ -395,7 +395,7 @@ static unsigned get_start_reg_index(ir_graph *irg, const arch_register_t *reg)
be_foreach_out
(
start
,
i
)
{
arch_register_req_t
const
*
const
out_req
=
arch_get_irn_register_req_out
(
start
,
i
);
if
(
!
arch_register_req_is
(
out_req
,
limited
)
)
if
(
out_req
->
limited
==
NULL
)
continue
;
if
(
out_req
->
cls
!=
reg
->
cls
)
continue
;
...
...
ir/be/beprefalloc.c
View file @
bd0bfb9f
...
...
@@ -237,7 +237,7 @@ static void give_penalties_for_limits(const ir_nodeset_t *live_nodes,
*/
static
void
check_defs
(
ir_nodeset_t
const
*
const
live_nodes
,
float
const
weight
,
ir_node
*
const
node
,
arch_register_req_t
const
*
const
req
)
{
if
(
arch_register_req_is
(
req
,
limited
)
)
{
if
(
req
->
limited
!=
NULL
)
{
const
unsigned
*
limited
=
req
->
limited
;
float
penalty
=
weight
*
DEF_FACTOR
;
give_penalties_for_limits
(
live_nodes
,
penalty
,
limited
,
node
);
...
...
@@ -313,7 +313,7 @@ static void analyze_block(ir_node *block, void *data)
/* update weights based on usage constraints */
be_foreach_use
(
node
,
cls
,
req
,
op
,
op_req
,
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
give_penalties_for_limits
(
&
live_nodes
,
weight
*
USE_FACTOR
,
req
->
limited
,
op
);
...
...
@@ -691,7 +691,7 @@ static void assign_reg(ir_node const *const block, ir_node *const node, arch_reg
DB
((
dbg
,
LEVEL_2
,
"
\n
"
));
const
unsigned
*
allowed_regs
=
normal_regs
;
if
(
arch_register_req_is
(
req
,
limited
)
)
{
if
(
req
->
limited
!=
NULL
)
{
allowed_regs
=
req
->
limited
;
}
...
...
@@ -982,7 +982,7 @@ static void solve_lpp(ir_nodeset_t *live_nodes, ir_node *node,
/** mark some edges as forbidden */
be_foreach_use
(
node
,
cls
,
req
,
op
,
op_req
,
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
const
unsigned
*
limited
=
req
->
limited
;
...
...
@@ -1127,7 +1127,7 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node,
continue
;
}
}
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
const
unsigned
*
limited
=
req
->
limited
;
...
...
@@ -1144,7 +1144,7 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node,
(
void
)
value
;
if
(
req
->
width
>
1
)
double_width
=
true
;
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
if
(
live_through_regs
==
NULL
)
{
live_through_regs
=
rbitset_alloca
(
n_regs
);
...
...
@@ -1198,7 +1198,7 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node,
}
be_foreach_use
(
node
,
cls
,
req
,
op
,
op_req
,
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
const
unsigned
*
limited
=
req
->
limited
;
...
...
ir/be/bespillutil.c
View file @
bd0bfb9f
...
...
@@ -706,7 +706,7 @@ static void prepare_constr_insn(ir_node *const node)
rbitset_is_set
(
birg
->
allocatable_regs
,
reg
->
global_index
))
continue
;
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
if
(
rbitset_is_set
(
req
->
limited
,
reg
->
index
))
continue
;
...
...
@@ -727,7 +727,7 @@ static void prepare_constr_insn(ir_node *const node)
const
arch_register_class_t
*
const
cls
=
req
->
cls
;
if
(
cls
==
NULL
)
continue
;
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
ir_node
*
in
=
get_irn_n
(
node
,
i
);
...
...
@@ -740,7 +740,7 @@ static void prepare_constr_insn(ir_node *const node)
=
arch_get_irn_register_req_in
(
node
,
i2
);
if
(
req2
->
cls
!=
cls
)
continue
;
if
(
!
arch_register_req_is
(
req2
,
limited
)
)
if
(
req2
->
limited
==
NULL
)
continue
;
ir_node
*
in2
=
get_irn_n
(
node
,
i2
);
...
...
@@ -770,7 +770,7 @@ static void prepare_constr_insn(ir_node *const node)
const
arch_register_class_t
*
const
cls
=
req
->
cls
;
if
(
cls
==
NULL
)
continue
;
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
if
(
def_constr
==
NULL
)
def_constr
=
rbitset_alloca
(
isa_if
->
n_registers
);
...
...
@@ -795,7 +795,7 @@ static void prepare_constr_insn(ir_node *const node)
const
arch_register_class_t
*
const
cls
=
req
->
cls
;
if
(
cls
==
NULL
)
continue
;
if
(
!
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
==
NULL
)
continue
;
ir_node
*
in
=
get_irn_n
(
node
,
i
);
const
arch_register_req_t
*
const
in_req
...
...
ir/be/bestat.c
View file @
bd0bfb9f
...
...
@@ -232,7 +232,7 @@ static void block_count_values(ir_node *block, void *data)
++
stats
->
values
;
if
(
arch_register_req_is
(
req
,
should_be_same
)
||
is_Phi
(
value
))
++
stats
->
should_be_sames
;
if
(
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
!=
NULL
)
++
stats
->
constrained_values
;
);
for
(
int
i
=
0
,
arity
=
get_irn_arity
(
node
);
i
<
arity
;
++
i
)
{
...
...
@@ -246,11 +246,11 @@ static void block_count_values(ir_node *block, void *data)
++
stats
->
unused_values
;
const
arch_register_req_t
*
const
req
=
arch_get_irn_register_req
(
value
);
if
(
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
!=
NULL
)
++
stats
->
unused_constrained_values
;
}
}
if
(
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
!=
NULL
)
++
stats
->
constrained_uses
;
}
}
...
...
ir/be/ia32/bearch_ia32.c
View file @
bd0bfb9f
...
...
@@ -314,7 +314,7 @@ static bool ia32_possible_memory_operand(const ir_node *irn, unsigned int i)
/* we can't swap left/right for limited registers
* (As this (currently) breaks constraint handling copies) */
arch_register_req_t
const
*
const
req
=
arch_get_irn_register_req_in
(
irn
,
n_ia32_binary_left
);
if
(
arch_register_req_is
(
req
,
limited
)
)
if
(
req
->
limited
!=
NULL
)
return
false
;
break
;
}
...
...
ir/be/scripts/generate_new_opcodes.pl
View file @
bd0bfb9f
...
...
@@ -1069,16 +1069,13 @@ EOF
die
("
Fatal error: Could not build subset for requirements '
$reqs
' of '
$op
' pos
$idx
... exiting.
\n
");
}
if
(
defined
(
$limit_bitset
)
&&
$limit_bitset
ne
"
NULL
")
{
push
(
@req_type_mask
,
"
arch_register_req_type_limited
");
}
if
(
$same_pos
!=
0
)
{
push
(
@req_type_mask
,
"
arch_register_req_type_should_be_same
");
}
if
(
$different_pos
!=
0
)
{
push
(
@req_type_mask
,
"
arch_register_req_type_must_be_different
");
}
my
$reqtype
=
join
("
|
",
@req_type_mask
);
my
$reqtype
=
join
("
|
",
@req_type_mask
)
||
"
arch_register_req_type_none
"
;
if
(
!
defined
(
$limit_bitset
))
{
$limit_bitset
=
"
NULL
";
...
...
ir/be/scripts/generate_regalloc_if.pl
View file @
bd0bfb9f
...
...
@@ -190,7 +190,7 @@ EOF
$single_constraints
.=
<<EOF;
static const unsigned ${arch}_limited_${old_classname}_${name} [] = ${limitedarray};
const arch_register_req_t ${arch}_single_reg_req_${old_classname}_${name} = {
.type = arch_register_req_type_
limited
,
.type = arch_register_req_type_
none
,
.cls = ${class_ptr},
.limited = ${arch}_limited_${old_classname}_${name},
.other_same = 0,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment