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
ae63e7fb
Commit
ae63e7fb
authored
Sep 06, 2015
by
Matthias Braun
Browse files
ia32: Cleanup PIC switchtable code
Thanks to Christoph for the code review.
parent
e28729a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/ia32/ia32_transform.c
View file @
ae63e7fb
...
...
@@ -2944,37 +2944,23 @@ static ir_node *gen_Switch(ir_node *node)
ir_node
*
switchjmp
;
ir_node
*
table_am
;
ir_node
*
target
;
switch
(
ia32_pic_style
)
{
case
IA32_PIC_NONE
:
if
(
ia32_pic_style
==
IA32_PIC_NONE
)
{
switchjmp
=
new_bd_ia32_SwitchJmp
(
dbgi
,
block
,
base
,
new_sel
,
n_outs
,
table
,
entity
);
table_am
=
switchjmp
;
goto
finish
;
case
IA32_PIC_ELF_PLT
:
case
IA32_PIC_ELF_NO_PLT
:
{
ir_node
*
const
load
=
new_bd_ia32_Load
(
dbgi
,
block
,
base
,
new_sel
,
nomem
);
table_am
=
load
;
ir_node
*
const
load_res
=
be_new_Proj
(
load
,
pn_ia32_Load_res
);
target
=
new_bd_ia32_Lea
(
dbgi
,
block
,
base
,
load_res
);
goto
simple_jmp
;
}
case
IA32_PIC_MACH_O
:
{
target
=
new_bd_ia32_Add
(
dbgi
,
block
,
base
,
new_sel
,
nomem
,
base
,
noreg_GP
);
set_ia32_commutative
(
target
);
table_am
=
target
;
simple_jmp:
switchjmp
=
new_bd_ia32_SwitchJmp
(
dbgi
,
block
,
target
,
noreg_GP
,
n_outs
,
}
else
{
assert
(
ia32_pic_style
==
IA32_PIC_ELF_PLT
||
ia32_pic_style
==
IA32_PIC_ELF_NO_PLT
||
ia32_pic_style
==
IA32_PIC_MACH_O
);
ir_node
*
const
add
=
new_bd_ia32_Add
(
dbgi
,
block
,
base
,
new_sel
,
nomem
,
base
,
noreg_GP
);
set_ia32_commutative
(
add
);
table_am
=
add
;
switchjmp
=
new_bd_ia32_SwitchJmp
(
dbgi
,
block
,
add
,
noreg_GP
,
n_outs
,
table
,
entity
);
set_ia32_op_type
(
switchjmp
,
ia32_Normal
);
set_ia32_ls_mode
(
switchjmp
,
ia32_mode_gp
);
goto
finish
;
}
}
panic
(
"invalid PIC style"
);
finish:
set_ia32_am_scale
(
table_am
,
2
);
set_ia32_op_type
(
table_am
,
ia32_AddrModeS
);
set_ia32_ls_mode
(
table_am
,
ia32_mode_gp
);
...
...
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