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
10c94da4
Commit
10c94da4
authored
Sep 15, 2011
by
Manuel Mohr
Browse files
sparc: Keep stack pointer 8 bytes aligned when generating code for MemPerm.
parent
69e2d762
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/sparc/sparc_emitter.c
View file @
10c94da4
...
...
@@ -572,11 +572,20 @@ static void emit_be_Perm(const ir_node *irn)
be_emit_finish_line_gas
(
irn
);
}
/* The stack pointer must always be 8 bytes aligned, so get the next bigger
* integer that's evenly divisible by 8. */
static
unsigned
get_aligned_sp_change
(
int
memperm_arity
)
{
const
unsigned
bytes
=
((
unsigned
)
memperm_arity
)
*
4
;
return
(
bytes
+
7
)
&
~
7U
;
}
static
void
emit_be_MemPerm
(
const
ir_node
*
node
)
{
int
i
;
int
memperm_arity
;
int
sp_change
=
0
;
int
i
;
int
memperm_arity
;
unsigned
aligned_sp_change
;
int
sp_change
=
0
;
ir_graph
*
irg
=
get_irn_irg
(
node
);
be_stack_layout_t
*
layout
=
be_get_irg_stack_layout
(
irg
);
...
...
@@ -591,7 +600,8 @@ static void emit_be_MemPerm(const ir_node *node)
if
(
memperm_arity
>
8
)
panic
(
"memperm with more than 8 inputs not supported yet"
);
be_emit_irprintf
(
"
\t
sub %%sp, %d, %%sp"
,
memperm_arity
*
4
);
aligned_sp_change
=
get_aligned_sp_change
(
memperm_arity
);
be_emit_irprintf
(
"
\t
sub %%sp, %u, %%sp"
,
aligned_sp_change
);
be_emit_finish_line_gas
(
node
);
for
(
i
=
0
;
i
<
memperm_arity
;
++
i
)
{
...
...
@@ -622,7 +632,7 @@ static void emit_be_MemPerm(const ir_node *node)
be_emit_finish_line_gas
(
node
);
}
be_emit_irprintf
(
"
\t
add %%sp, %
d
, %%sp"
,
memperm_arity
*
4
);
be_emit_irprintf
(
"
\t
add %%sp, %
u
, %%sp"
,
aligned_sp_change
);
be_emit_finish_line_gas
(
node
);
assert
(
sp_change
==
0
);
...
...
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