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
dcf410b0
Commit
dcf410b0
authored
Feb 04, 2014
by
Matthias Braun
Browse files
some cleanups
parent
9e445b9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/x86_address_mode.c
View file @
dcf410b0
...
...
@@ -45,7 +45,7 @@ static bool tarval_possible(ir_tarval *tv)
*
* @return true if the DAG represents an immediate, false else
*/
static
bool
do_is_immediate
(
const
ir_node
*
node
,
bool
*
symconst
_allowed
,
static
bool
do_is_immediate
(
const
ir_node
*
node
,
bool
*
entity
_allowed
,
bool
negate
)
{
switch
(
get_irn_opcode
(
node
))
{
...
...
@@ -56,11 +56,10 @@ static bool do_is_immediate(const ir_node *node, bool *symconst_allowed,
/* unfortunately the assembler/linker doesn't support -symconst */
if
(
negate
)
return
false
;
if
(
!*
symconst
_allowed
)
if
(
!*
entity
_allowed
)
return
false
;
/* only 1 symconst allowed */
*
symconst_allowed
=
false
;
*
entity_allowed
=
false
;
return
true
;
case
iro_Unknown
:
...
...
@@ -74,10 +73,10 @@ static bool do_is_immediate(const ir_node *node, bool *symconst_allowed,
return
false
;
ir_node
*
left
=
get_binop_left
(
node
);
if
(
!
do_is_immediate
(
left
,
symconst
_allowed
,
negate
))
if
(
!
do_is_immediate
(
left
,
entity
_allowed
,
negate
))
return
false
;
ir_node
*
right
=
get_binop_right
(
node
);
if
(
!
do_is_immediate
(
right
,
symconst
_allowed
,
if
(
!
do_is_immediate
(
right
,
entity
_allowed
,
is_Sub
(
node
)
?
!
negate
:
negate
))
return
false
;
...
...
@@ -91,16 +90,12 @@ static bool do_is_immediate(const ir_node *node, bool *symconst_allowed,
/**
* Check if a DAG starting with root node can be folded into an address mode
* as an immediate.
*
* @param addr the address mode data so far
* @param node the node
* @param negate if set, the immediate must be negated
*/
static
int
is_immediate
(
const
ir_node
*
node
,
bool
negate
,
bool
init_
symconst
_allowed
)
bool
init_
entity
_allowed
)
{
bool
symconst
_allowed
=
init_
symconst
_allowed
;
return
do_is_immediate
(
node
,
&
symconst
_allowed
,
negate
);
bool
entity
_allowed
=
init_
entity
_allowed
;
return
do_is_immediate
(
node
,
&
entity
_allowed
,
negate
);
}
/**
...
...
@@ -177,28 +172,26 @@ static ir_node *eat_immediates(x86_address_t *addr, ir_node *node,
if
(
is_Add
(
node
))
{
ir_node
*
left
=
get_Add_left
(
node
);
ir_node
*
right
=
get_Add_right
(
node
);
bool
symconst_ok
=
addr
->
entity
!=
NULL
&&
bool
entity_ok
=
addr
->
entity
!=
NULL
&&
((
flags
&
x86_create_am_entities_ip_relative
)
==
0
||
(
addr
->
base
==
NULL
));
if
(
is_immediate
(
left
,
false
,
symconst
_ok
))
{
if
(
is_immediate
(
left
,
false
,
entity
_ok
))
{
eat_immediate
(
addr
,
left
,
false
);
return
eat_immediates
(
addr
,
right
,
x86_create_am_normal
);
}
if
(
is_immediate
(
right
,
false
,
symconst
_ok
))
{
if
(
is_immediate
(
right
,
false
,
entity
_ok
))
{
eat_immediate
(
addr
,
right
,
false
);
return
eat_immediates
(
addr
,
left
,
x86_create_am_normal
);
}
}
else
if
(
is_Sub
(
node
))
{
ir_node
*
left
=
get_Sub_left
(
node
);
ir_node
*
right
=
get_Sub_right
(
node
);
bool
symconst_ok
=
addr
->
entity
!=
NULL
&&
bool
entity_ok
=
addr
->
entity
!=
NULL
&&
((
flags
&
x86_create_am_entities_ip_relative
)
==
0
||
(
addr
->
base
==
NULL
));
if
(
is_immediate
(
right
,
true
,
symconst
_ok
))
{
if
(
is_immediate
(
right
,
true
,
entity
_ok
))
{
eat_immediate
(
addr
,
right
,
true
);
return
eat_immediates
(
addr
,
left
,
x86_create_am_normal
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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