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
87986ce0
Commit
87986ce0
authored
Oct 31, 2016
by
Christoph Mallon
Browse files
be: Handle emitting jump labels centrally in BE_EMITF().
parent
05f29a7b
Changes
6
Hide whitespace changes
Inline
Side-by-side
ir/be/TEMPLATE/TEMPLATE_emitter.c
View file @
87986ce0
...
...
@@ -52,15 +52,6 @@ static void TEMPLATE_emit_dest_register(const ir_node *node, int pos)
emit_register
(
reg
);
}
/**
* Returns the target label for a control flow node.
*/
static
void
TEMPLATE_emit_cfop_target
(
const
ir_node
*
node
)
{
ir_node
*
block
=
be_emit_get_cfop_target
(
node
);
be_gas_emit_block_name
(
block
);
}
void
TEMPLATE_emitf
(
const
ir_node
*
node
,
const
char
*
format
,
...)
{
BE_EMITF
(
node
,
format
,
ap
,
false
)
{
...
...
@@ -109,11 +100,6 @@ void TEMPLATE_emitf(const ir_node *node, const char *format, ...)
break
;
}
case
'L'
:
{
TEMPLATE_emit_cfop_target
(
node
);
break
;
}
default:
unknown:
panic
(
"unknown format conversion"
);
...
...
@@ -126,7 +112,7 @@ unknown:
*/
static
void
emit_TEMPLATE_Jmp
(
const
ir_node
*
node
)
{
TEMPLATE_emitf
(
node
,
"jmp %L"
);
TEMPLATE_emitf
(
node
,
"jmp %L"
,
node
);
}
static
void
emit_be_IncSP
(
const
ir_node
*
node
)
...
...
ir/be/amd64/amd64_emitter.c
View file @
87986ce0
...
...
@@ -421,12 +421,6 @@ end_of_mods:
break
;
}
case
'L'
:
{
ir_node
*
const
block
=
be_emit_get_cfop_target
(
node
);
be_gas_emit_block_name
(
block
);
break
;
}
case
'P'
:
{
x86_condition_code_t
cc
;
if
(
*
fmt
==
'X'
)
{
...
...
@@ -629,9 +623,9 @@ static void emit_amd64_jmp(const ir_node *node)
ir_node
const
*
const
block
=
get_nodes_block
(
node
);
ir_node
const
*
const
target
=
be_emit_get_cfop_target
(
node
);
if
(
be_emit_get_prev_block
(
target
)
!=
block
)
{
amd64_emitf
(
node
,
"jmp %L"
);
amd64_emitf
(
node
,
"jmp %L"
,
node
);
}
else
if
(
be_options
.
verbose_asm
)
{
amd64_emitf
(
node
,
"/* fallthrough to %L */"
);
amd64_emitf
(
node
,
"/* fallthrough to %L */"
,
node
);
}
}
...
...
@@ -693,20 +687,20 @@ static void emit_amd64_jcc(const ir_node *irn)
/* Some floating point comparisons require a test of the parity flag,
* which indicates that the result is unordered */
if
(
cc
&
x86_cc_negated
)
{
amd64_emitf
(
projs
.
t
,
"jp %L"
);
amd64_emitf
(
irn
,
"jp %L"
,
projs
.
t
);
}
else
{
amd64_emitf
(
projs
.
f
,
"jp %L"
);
amd64_emitf
(
irn
,
"jp %L"
,
projs
.
f
);
}
}
/* emit the true proj */
amd64_emitf
(
projs
.
t
,
"j%PX %L"
,
(
int
)
cc
);
amd64_emitf
(
irn
,
"j%PX %L"
,
(
int
)
cc
,
projs
.
t
);
ir_node
const
*
const
false_target
=
be_emit_get_cfop_target
(
projs
.
f
);
if
(
be_emit_get_prev_block
(
false_target
)
!=
block
)
{
amd64_emitf
(
projs
.
f
,
"jmp %L"
);
amd64_emitf
(
irn
,
"jmp %L"
,
projs
.
f
);
}
else
if
(
be_options
.
verbose_asm
)
{
amd64_emitf
(
projs
.
f
,
"/* fallthrough to %L */"
);
amd64_emitf
(
irn
,
"/* fallthrough to %L */"
,
projs
.
f
);
}
}
...
...
ir/be/arm/arm_emitter.c
View file @
87986ce0
...
...
@@ -321,12 +321,6 @@ void arm_emitf(const ir_node *node, const char *format, ...)
break
;
}
case
't'
:
{
const
ir_node
*
n
=
va_arg
(
ap
,
const
ir_node
*
);
arm_emit_cfop_target
(
n
);
break
;
}
default:
unknown:
panic
(
"unknown format conversion"
);
...
...
@@ -431,13 +425,13 @@ static void emit_arm_B(const ir_node *irn)
}
/* emit the true proj */
arm_emitf
(
irn
,
"b%s %
t
"
,
suffix
,
projs
.
t
);
arm_emitf
(
irn
,
"b%s %
L
"
,
suffix
,
projs
.
t
);
ir_node
const
*
const
false_target
=
be_emit_get_cfop_target
(
projs
.
f
);
if
(
be_emit_get_prev_block
(
false_target
)
!=
block
)
{
arm_emitf
(
irn
,
"b %
t
"
,
projs
.
f
);
arm_emitf
(
irn
,
"b %
L
"
,
projs
.
f
);
}
else
if
(
be_options
.
verbose_asm
)
{
arm_emitf
(
irn
,
"/* fallthrough to %
t
*/"
,
projs
.
f
);
arm_emitf
(
irn
,
"/* fallthrough to %
L
*/"
,
projs
.
f
);
}
}
...
...
@@ -537,9 +531,9 @@ static void emit_arm_Jmp(const ir_node *node)
ir_node
const
*
const
block
=
get_nodes_block
(
node
);
ir_node
const
*
const
target
=
be_emit_get_cfop_target
(
node
);
if
(
be_emit_get_prev_block
(
target
)
!=
block
)
{
arm_emitf
(
node
,
"b %
t
"
,
node
);
arm_emitf
(
node
,
"b %
L
"
,
node
);
}
else
if
(
be_options
.
verbose_asm
)
{
arm_emitf
(
node
,
"/* fallthrough to %
t
*/"
,
node
);
arm_emitf
(
node
,
"/* fallthrough to %
L
*/"
,
node
);
}
}
...
...
ir/be/beemithlp.h
View file @
87986ce0
...
...
@@ -97,6 +97,9 @@ be_cond_branch_projs_t be_get_cond_branch_projs(ir_node const *node);
} else if (*++fmt == '%') { \
++fmt; \
be_emit_char('%'); \
} else if (*fmt == 'L') { \
++fmt; \
be_gas_emit_block_name(be_emit_get_cfop_target(va_arg(ap, ir_node const*))); \
} else
#endif
ir/be/ia32/ia32_emitter.c
View file @
87986ce0
...
...
@@ -493,10 +493,6 @@ emit_I:
}
break
;
case
'L'
:
ia32_emit_cfop_target
(
node
);
break
;
case
'M'
:
{
ia32_attr_t
const
*
const
attr
=
get_ia32_attr_const
(
node
);
if
(
mod
&
EMIT_32BIT_REG
)
{
...
...
@@ -721,19 +717,19 @@ static void emit_ia32_Jcc(const ir_node *node)
/* Some floating point comparisons require a test of the parity flag,
* which indicates that the result is unordered */
if
(
cc
&
x86_cc_negated
)
{
ia32_emitf
(
projs
.
t
,
"jp %L"
);
ia32_emitf
(
node
,
"jp %L"
,
projs
.
t
);
}
else
{
/* we need a local label if the false proj is a fallthrough
* as the falseblock might have no label emitted then */
if
(
fallthrough
)
{
need_parity_label
=
true
;
ia32_emitf
(
projs
.
f
,
"jp 1f"
);
ia32_emitf
(
node
,
"jp 1f"
,
projs
.
f
);
}
else
{
ia32_emitf
(
projs
.
f
,
"jp %L"
);
ia32_emitf
(
node
,
"jp %L"
,
projs
.
f
);
}
}
}
ia32_emitf
(
projs
.
t
,
"j%PX %L"
,
(
int
)
cc
);
ia32_emitf
(
node
,
"j%PX %L"
,
(
int
)
cc
,
projs
.
t
);
if
(
need_parity_label
)
{
be_emit_cstring
(
"1:
\n
"
);
be_emit_write_line
();
...
...
@@ -741,9 +737,9 @@ static void emit_ia32_Jcc(const ir_node *node)
/* the second Proj might be a fallthrough */
if
(
!
fallthrough
)
{
ia32_emitf
(
projs
.
f
,
"jmp %L"
);
ia32_emitf
(
node
,
"jmp %L"
,
projs
.
f
);
}
else
if
(
be_options
.
verbose_asm
)
{
ia32_emitf
(
projs
.
f
,
"/* fallthrough to %L */"
);
ia32_emitf
(
node
,
"/* fallthrough to %L */"
,
projs
.
f
);
}
}
...
...
@@ -814,9 +810,9 @@ static void emit_ia32_Jmp(const ir_node *node)
ir_node
*
block
=
get_nodes_block
(
node
);
ir_node
*
target
=
be_emit_get_cfop_target
(
node
);
if
(
!
fallthrough_possible
(
block
,
target
))
{
ia32_emitf
(
node
,
"jmp %L"
);
ia32_emitf
(
node
,
"jmp %L"
,
node
);
}
else
if
(
be_options
.
verbose_asm
)
{
ia32_emitf
(
node
,
"/* fallthrough to %L */"
);
ia32_emitf
(
node
,
"/* fallthrough to %L */"
,
node
);
}
}
...
...
ir/be/sparc/sparc_emitter.c
View file @
87986ce0
...
...
@@ -560,12 +560,6 @@ void sparc_emitf(ir_node const *const node, char const *fmt, ...)
sparc_emit_high_immediate
(
node
);
break
;
case
'L'
:
{
ir_node
*
n
=
va_arg
(
ap
,
ir_node
*
);
sparc_emit_cfop_target
(
n
);
break
;
}
case
'M'
:
switch
(
*
fmt
++
)
{
case
'L'
:
sparc_emit_load_mode
(
node
);
break
;
...
...
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