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
bb523cb9
Commit
bb523cb9
authored
Mar 07, 2011
by
Matthias Braun
Browse files
bestack: add support for nodes resetting the stack
parent
23df3482
Changes
4
Hide whitespace changes
Inline
Side-by-side
ir/be/bearch.h
View file @
bb523cb9
...
...
@@ -40,6 +40,13 @@
#include "beirg.h"
#include "error.h"
/**
* this constant is returned by the get_sp_bias functions if the stack
* is reset (usually because the frame pointer is copied to the stack
* pointer
*/
#define SP_BIAS_RESET INT_MIN
typedef
enum
arch_register_class_flags_t
{
arch_register_class_flag_none
=
0
,
/** don't do automatic register allocation for this class */
...
...
ir/be/bestack.c
View file @
bb523cb9
...
...
@@ -183,9 +183,8 @@ static int process_stack_bias(ir_node *bl, int real_bias)
* If the node modifies the stack pointer by a constant offset,
* record that in the bias.
*/
ofs
=
arch_get_sp_bias
(
irn
);
if
(
be_is_IncSP
(
irn
))
{
ofs
=
be_get_IncSP_offset
(
irn
);
/* fill in real stack frame size */
if
(
ofs
==
BE_STACK_FRAME_SIZE_EXPAND
)
{
ir_type
*
frame_type
=
get_irg_frame_type
(
irg
);
...
...
@@ -217,10 +216,18 @@ static int process_stack_bias(ir_node *bl, int real_bias)
}
}
}
real_bias
+=
ofs
;
wanted_bias
+=
ofs
;
}
else
{
ofs
=
arch_get_sp_bias
(
irn
);
if
(
ofs
==
SP_BIAS_RESET
)
{
real_bias
=
0
;
wanted_bias
=
0
;
}
else
{
real_bias
+=
ofs
;
wanted_bias
+=
ofs
;
}
}
real_bias
+=
ofs
;
wanted_bias
+=
ofs
;
}
assert
(
real_bias
==
wanted_bias
);
...
...
ir/be/ia32/bearch_ia32.c
View file @
bb523cb9
...
...
@@ -258,6 +258,11 @@ static int ia32_get_sp_bias(const ir_node *node)
if
(
is_ia32_Pop
(
node
)
||
is_ia32_PopMem
(
node
))
return
-
4
;
if
(
is_ia32_Leave
(
node
)
||
(
be_is_Copy
(
node
)
&&
arch_get_irn_register
(
node
)
==
&
ia32_registers
[
REG_ESP
]))
{
return
SP_BIAS_RESET
;
}
return
0
;
}
...
...
ir/be/sparc/bearch_sparc.c
View file @
bb523cb9
...
...
@@ -117,6 +117,8 @@ static int sparc_get_sp_bias(const ir_node *node)
* calculates that! */
assert
(
attr
->
immediate_value
<=
-
SPARC_MIN_STACKSIZE
);
return
attr
->
immediate_value
+
SPARC_MIN_STACKSIZE
;
}
else
if
(
is_sparc_RestoreZero
(
node
))
{
return
SP_BIAS_RESET
;
}
return
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