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
2966b954
Commit
2966b954
authored
Jul 19, 2015
by
Matthias Braun
Browse files
ia32: Remove no_pic_adjust flag
The flag has been superseded by the immediate kind.
parent
92ed4713
Changes
7
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/ia32_emitter.c
View file @
2966b954
...
...
@@ -174,7 +174,7 @@ static void emit_register(const arch_register_t *reg, ir_mode *mode)
be_emit_string
(
name
);
}
static
void
ia32_emit_entity
(
x86_imm32_t
const
*
const
imm
,
bool
no_pic_adjust
)
static
void
ia32_emit_entity
(
x86_imm32_t
const
*
const
imm
)
{
assert
(
imm
->
kind
!=
X86_IMM_VALUE
);
ir_entity
*
entity
=
imm
->
entity
;
...
...
@@ -189,18 +189,12 @@ static void ia32_emit_entity(x86_imm32_t const *const imm, bool no_pic_adjust)
}
if
(
imm
->
kind
==
X86_IMM_PICBASE_REL
)
{
assert
(
be_options
.
pic
&&
!
no_pic_adjust
&&
get_entity_type
(
entity
)
!=
get_code_type
());
be_emit_char
(
'-'
);
be_emit_string
(
pic_base_label
);
}
else
{
assert
(
!
be_options
.
pic
||
no_pic_adjust
||
get_entity_type
(
entity
)
==
get_code_type
());
}
}
static
void
emit_ia32_immediate
(
bool
const
prefix
,
bool
const
no_pic_adjust
,
x86_imm32_t
const
*
const
imm
)
static
void
emit_ia32_immediate
(
bool
const
prefix
,
x86_imm32_t
const
*
const
imm
)
{
if
(
prefix
)
be_emit_char
(
'$'
);
...
...
@@ -208,7 +202,7 @@ static void emit_ia32_immediate(bool const prefix, bool const no_pic_adjust,
int32_t
const
offset
=
imm
->
offset
;
if
(
entity
!=
NULL
)
{
assert
(
imm
->
kind
!=
X86_IMM_VALUE
);
ia32_emit_entity
(
imm
,
no_pic_adjust
);
ia32_emit_entity
(
imm
);
if
(
offset
!=
0
)
be_emit_irprintf
(
"%+"
PRId32
,
offset
);
}
else
{
...
...
@@ -220,7 +214,7 @@ static void emit_ia32_immediate(bool const prefix, bool const no_pic_adjust,
static
void
emit_ia32_immediate_attr
(
bool
const
prefix
,
ir_node
const
*
const
node
)
{
ia32_immediate_attr_t
const
*
const
attr
=
get_ia32_immediate_attr_const
(
node
);
emit_ia32_immediate
(
prefix
,
attr
->
no_pic_adjust
,
&
attr
->
imm
);
emit_ia32_immediate
(
prefix
,
&
attr
->
imm
);
}
static
void
ia32_emit_mode_suffix_mode
(
const
ir_mode
*
mode
)
...
...
@@ -379,7 +373,7 @@ static void ia32_emit_am(ir_node const *const node)
if
(
entity
)
{
assert
(
attr
->
am_imm
.
kind
!=
X86_IMM_VALUE
);
const
ia32_attr_t
*
attr
=
get_ia32_attr_const
(
node
);
ia32_emit_entity
(
&
attr
->
am_imm
,
attr
->
am_sc_no_pic_adjust
);
ia32_emit_entity
(
&
attr
->
am_imm
);
if
(
offset
!=
0
)
be_emit_irprintf
(
"%+"
PRId32
,
offset
);
}
else
if
(
offset
!=
0
||
(
!
base
&&
!
idx
))
{
...
...
@@ -955,7 +949,7 @@ static void emit_ia32_asm_operand(ir_node const *const node, char const modifier
}
case
ASM_OP_IMMEDIATE
:
emit_ia32_immediate
(
true
,
true
,
&
op
->
u
.
imm32
);
emit_ia32_immediate
(
true
,
&
op
->
u
.
imm32
);
return
;
}
panic
(
"invalid asm operand kind"
);
...
...
ir/be/ia32/ia32_new_nodes.c
View file @
2966b954
...
...
@@ -137,18 +137,14 @@ static void ia32_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
fputc
(
' '
,
F
);
ir_entity
*
entity
=
attr
->
imm
.
entity
;
if
(
entity
)
{
if
(
entity
)
fputs
(
get_entity_name
(
entity
),
F
);
}
int32_t
offset
=
attr
->
imm
.
offset
;
if
(
offset
!=
0
||
entity
==
NULL
)
{
if
(
offset
>
0
&&
entity
!=
NULL
)
{
fputc
(
'+'
,
F
);
}
fprintf
(
F
,
"%"
PRId32
,
offset
);
if
(
attr
->
no_pic_adjust
)
{
fputs
(
"(no_pic_adjust)"
,
F
);
}
}
}
else
{
const
ia32_attr_t
*
attr
=
get_ia32_attr_const
(
n
);
...
...
@@ -158,12 +154,8 @@ static void ia32_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
if
(
entity
!=
NULL
||
offset
!=
0
)
{
fputs
(
" ["
,
F
);
if
(
entity
!=
NULL
)
{
if
(
entity
!=
NULL
)
fputs
(
get_entity_name
(
entity
),
F
);
if
(
attr
->
am_sc_no_pic_adjust
)
{
fputs
(
"(no_pic_adjust)"
,
F
);
}
}
if
(
offset
!=
0
)
{
if
(
offset
>
0
&&
entity
!=
NULL
)
{
fputc
(
'+'
,
F
);
...
...
@@ -536,7 +528,6 @@ void ia32_copy_am_attrs(ir_node *to, const ir_node *from)
ia32_attr_t
const
*
const
from_attr
=
get_ia32_attr_const
(
from
);
ia32_attr_t
*
const
to_attr
=
get_ia32_attr
(
to
);
to_attr
->
am_imm
=
from_attr
->
am_imm
;
to_attr
->
am_sc_no_pic_adjust
=
from_attr
->
am_sc_no_pic_adjust
;
set_ia32_ls_mode
(
to
,
get_ia32_ls_mode
(
from
));
set_ia32_am_scale
(
to
,
get_ia32_am_scale
(
from
));
...
...
@@ -776,8 +767,7 @@ static void init_ia32_x87_attributes(ir_node *res)
}
static
void
init_ia32_immediate_attributes
(
ir_node
*
res
,
x86_imm32_t
const
*
const
imm
,
bool
no_pic_adjust
)
x86_imm32_t
const
*
const
imm
)
{
ia32_immediate_attr_t
*
attr
=
(
ia32_immediate_attr_t
*
)
get_irn_generic_attr
(
res
);
...
...
@@ -785,7 +775,6 @@ static void init_ia32_immediate_attributes(ir_node *res,
attr
->
attr
.
attr_type
|=
IA32_ATTR_ia32_immediate_attr_t
;
#endif
attr
->
imm
=
*
imm
;
attr
->
no_pic_adjust
=
no_pic_adjust
;
}
static
void
init_ia32_call_attributes
(
ir_node
*
res
,
unsigned
pop
,
...
...
@@ -864,7 +853,6 @@ static int ia32_attrs_equal_(const ia32_attr_t *a, const ia32_attr_t *b)
return
a
->
tp
==
b
->
tp
&&
a
->
am_scale
==
b
->
am_scale
&&
x86_imm32_equal
(
&
a
->
am_imm
,
&
b
->
am_imm
)
&&
a
->
am_sc_no_pic_adjust
==
b
->
am_sc_no_pic_adjust
&&
a
->
ls_mode
==
b
->
ls_mode
&&
a
->
frame_use
==
b
->
frame_use
&&
a
->
frame_ent
==
b
->
frame_ent
...
...
@@ -922,8 +910,7 @@ static int ia32_immediate_attrs_equal(const ir_node *a, const ir_node *b)
{
const
ia32_immediate_attr_t
*
attr_a
=
get_ia32_immediate_attr_const
(
a
);
const
ia32_immediate_attr_t
*
attr_b
=
get_ia32_immediate_attr_const
(
b
);
return
x86_imm32_equal
(
&
attr_a
->
imm
,
&
attr_b
->
imm
)
&&
attr_a
->
no_pic_adjust
==
attr_b
->
no_pic_adjust
;
return
x86_imm32_equal
(
&
attr_a
->
imm
,
&
attr_b
->
imm
);
}
/** Compare node attributes for x87 nodes. */
...
...
ir/be/ia32/ia32_nodes_attr.h
View file @
2966b954
...
...
@@ -97,7 +97,6 @@ struct ia32_attr_t {
unsigned
am_arity
:
2
;
/**< Indicates the address mode type supported by this node. */
unsigned
am_scale
:
2
;
/**< The address mode scale for index register. */
unsigned
am_sc_no_pic_adjust
:
1
;
/**< AM entity can be relative to EIP */
unsigned
am_tls_segment
:
1
;
/**< addresses are relative to TLS */
ENUMBF
(
ia32_frame_use_t
)
frame_use
:
2
;
/**< Whether an entity on the frame is used and its size. */
unsigned
has_except_label
:
1
;
/**< Set if this node needs a label because of possible exception. */
...
...
@@ -169,7 +168,6 @@ typedef struct ia32_immediate_attr_t ia32_immediate_attr_t;
struct
ia32_immediate_attr_t
{
ia32_attr_t
attr
;
/**< generic attribute */
x86_imm32_t
imm
;
unsigned
no_pic_adjust
:
1
;
/**< constant can be relative to EIP */
};
/**
...
...
ir/be/ia32/ia32_optimize.c
View file @
2966b954
...
...
@@ -804,7 +804,7 @@ static void peephole_ia32_Lea(ir_node *node)
}
ir_graph
*
const
irg
=
get_irn_irg
(
node
);
ia32_attr_t
const
*
const
attr
=
get_ia32_attr_const
(
node
);
op2
=
ia32_create_Immediate_full
(
irg
,
&
attr
->
am_imm
,
attr
->
am_sc_no_pic_adjust
);
op2
=
ia32_create_Immediate_full
(
irg
,
&
attr
->
am_imm
);
}
else
if
(
has_disp
)
{
return
;
/* Lea has base, index and displacement. */
}
...
...
ir/be/ia32/ia32_spec.pl
View file @
2966b954
...
...
@@ -114,7 +114,7 @@ $custom_init_attr_func = \&ia32_custom_init_attr;
"
\t
init_ia32_copyb_attributes(res, size);
",
ia32_immediate_attr_t
=>
"
\t
init_ia32_attributes(res, irn_flags_, in_reqs, n_res);
\n
"
.
"
\t
init_ia32_immediate_attributes(res, imm
, no_pic_adjust
);
",
"
\t
init_ia32_immediate_attributes(res, imm);
",
ia32_x87_attr_t
=>
"
\t
init_ia32_attributes(res, irn_flags_, in_reqs, n_res);
\n
"
.
"
\t
init_ia32_x87_attributes(res);
",
...
...
@@ -385,7 +385,7 @@ Immediate => {
op_flags
=>
[
"
constlike
"
],
irn_flags
=>
[
"
not_scheduled
"
],
out_reqs
=>
[
"
gp_NOREG:I
"
],
attr
=>
"
const x86_imm32_t *imm
, bool no_pic_adjust
",
attr
=>
"
const x86_imm32_t *imm
",
attr_type
=>
"
ia32_immediate_attr_t
",
hash_func
=>
"
ia32_hash_Immediate
",
latency
=>
0
,
...
...
@@ -864,7 +864,7 @@ IJmp => {
Const
=>
{
template
=>
$valueop
,
emit
=>
"
movl %I, %D0
",
attr
=>
"
const x86_imm32_t *imm
, bool no_pic_adjust
",
attr
=>
"
const x86_imm32_t *imm
",
attr_type
=>
"
ia32_immediate_attr_t
",
latency
=>
1
,
},
...
...
ir/be/ia32/ia32_transform.c
View file @
2966b954
...
...
@@ -266,12 +266,11 @@ static ir_node *get_initial_fpcw(ir_graph *irg)
}
ir_node
*
ia32_create_Immediate_full
(
ir_graph
*
const
irg
,
x86_imm32_t
const
*
const
imm
,
bool
const
no_pic_adjust
)
x86_imm32_t
const
*
const
imm
)
{
ir_node
*
const
start_block
=
get_irg_start_block
(
irg
);
ir_node
*
const
immediate
=
new_bd_ia32_Immediate
(
NULL
,
start_block
,
imm
,
no_pic_adjust
);
=
new_bd_ia32_Immediate
(
NULL
,
start_block
,
imm
);
arch_set_irn_register
(
immediate
,
&
ia32_registers
[
REG_GP_NOREG
]);
return
immediate
;
}
...
...
@@ -291,7 +290,7 @@ static ir_node *try_create_Immediate(const ir_node *node, char const constraint)
adjust_pic
(
&
immediate
);
ir_graph
*
const
irg
=
get_irn_irg
(
node
);
return
ia32_create_Immediate_full
(
irg
,
&
immediate
,
false
);
return
ia32_create_Immediate_full
(
irg
,
&
immediate
);
}
static
ir_type
*
get_prim_type
(
const
ir_mode
*
mode
)
...
...
@@ -389,7 +388,7 @@ static ir_node *gen_Const(ir_node *node)
x86_imm32_t
imm
=
{
.
offset
=
be_get_tv_bits32
(
tv
,
0
),
};
ir_node
*
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
,
false
);
ir_node
*
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
);
load
=
new_bd_ia32_xMovd
(
dbgi
,
block
,
cnst
);
set_ia32_ls_mode
(
load
,
mode
);
res
=
load
;
...
...
@@ -459,7 +458,7 @@ end:
}
x86_imm32_t
imm
=
{
.
offset
=
get_tarval_long
(
tv
)
};
ir_node
*
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
,
false
);
ir_node
*
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
);
SET_IA32_ORIG_NODE
(
cnst
,
node
);
return
cnst
;
...
...
@@ -493,7 +492,7 @@ static ir_node *gen_Address(ir_node *node)
attr
->
am_imm
=
imm
;
cnst
=
lea
;
}
else
{
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
,
false
);
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
);
}
SET_IA32_ORIG_NODE
(
cnst
,
node
);
return
cnst
;
...
...
@@ -1563,7 +1562,7 @@ static ir_node *gen_Add(ir_node *node)
/* a constant? */
if
(
addr
.
base
==
NULL
&&
addr
.
index
==
NULL
)
{
new_node
=
new_bd_ia32_Const
(
dbgi
,
new_block
,
&
addr
.
imm
,
false
);
new_node
=
new_bd_ia32_Const
(
dbgi
,
new_block
,
&
addr
.
imm
);
SET_IA32_ORIG_NODE
(
new_node
,
node
);
return
new_node
;
}
...
...
@@ -1871,7 +1870,7 @@ static ir_node *create_Div(ir_node *const node, ir_node *const op1, ir_node *con
cons
=
new_bd_ia32_IDiv
;
}
else
{
x86_imm32_t
imm
=
{
.
offset
=
0
};
ext
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
,
false
);
ext
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
);
cons
=
new_bd_ia32_Div
;
}
ir_node
*
const
new_node
=
cons
(
dbgi
,
block
,
addr
->
base
,
addr
->
index
,
new_mem
,
am
.
new_op2
,
am
.
new_op1
,
ext
);
...
...
@@ -2929,7 +2928,6 @@ static ir_node *gen_Switch(ir_node *node)
.
kind
=
X86_IMM_ADDR
,
.
entity
=
entity
,
};
get_ia32_attr
(
new_node
)
->
am_sc_no_pic_adjust
=
true
;
return
new_node
;
}
...
...
@@ -4904,7 +4902,7 @@ static ir_node *gen_CopyB(ir_node *node)
size
>>=
2
;
x86_imm32_t
imm
=
{
.
offset
=
size
};
ir_node
*
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
,
false
);
ir_node
*
cnst
=
new_bd_ia32_Const
(
dbgi
,
block
,
&
imm
);
ir_node
*
copyb
=
new_bd_ia32_CopyB
(
dbgi
,
block
,
new_dst
,
new_src
,
cnst
,
new_mem
,
rem
);
SET_IA32_ORIG_NODE
(
copyb
,
node
);
...
...
@@ -4954,7 +4952,6 @@ static ir_node *gen_Call(ir_node *node)
ia32_immediate_attr_t
*
const
attr
=
get_ia32_immediate_attr
(
am
.
new_op2
);
if
(
attr
->
imm
.
kind
==
X86_IMM_PICBASE_REL
)
attr
->
imm
.
kind
=
X86_IMM_ADDR
;
attr
->
no_pic_adjust
=
true
;
}
ir_node
*
const
block
=
be_transform_node
(
old_block
);
...
...
ir/be/ia32/ia32_transform.h
View file @
2966b954
...
...
@@ -50,14 +50,13 @@ ir_node *ia32_new_IncSP(ir_node *block, ir_node *old_sp, int offset,
const
arch_register_t
*
ia32_get_clobber_register
(
const
char
*
clobber
);
ir_node
*
ia32_create_Immediate_full
(
ir_graph
*
irg
,
const
x86_imm32_t
*
imm
,
bool
no_pic_adjust
);
ir_node
*
ia32_create_Immediate_full
(
ir_graph
*
irg
,
const
x86_imm32_t
*
imm
);
static
inline
ir_node
*
ia32_create_Immediate
(
ir_graph
*
const
irg
,
int32_t
const
val
)
{
x86_imm32_t
imm
=
{
.
offset
=
val
};
return
ia32_create_Immediate_full
(
irg
,
&
imm
,
false
);
return
ia32_create_Immediate_full
(
irg
,
&
imm
);
}
#endif
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