static void amd64_after_ra(ir_graph *irg)
{
- be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
+ be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
+ bool at_begin = stack_layout->sp_relative ? true : false;
+ be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
/* create and coalesce frame entities */
irg_walk_graph(irg, NULL, amd64_collect_frame_entity_nodes, fec_env);
- be_assign_entities(fec_env, amd64_set_frame_entity);
+ be_assign_entities(fec_env, amd64_set_frame_entity, at_begin);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, amd64_after_ra_walker, NULL);
static void arm_after_ra(ir_graph *irg)
{
- be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
+ be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
+ bool at_begin = stack_layout->sp_relative ? true : false;
+ be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
irg_walk_graph(irg, NULL, arm_collect_frame_entity_nodes, fec_env);
- be_assign_entities(fec_env, arm_set_frame_entity);
+ be_assign_entities(fec_env, arm_set_frame_entity, at_begin);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, arm_after_ra_walker, NULL);
affinity_edge_t **affinity_edges;
set *memperms;
set_frame_entity_func set_frame_entity;
+ bool at_begin; /**< frame entities should be allocate at
+ the beginning of the stackframe */
};
/** Compare 2 affinity edges (used in quicksort) */
static ir_entity* create_stack_entity(be_fec_env_t *env, spill_slot_t *slot)
{
- ir_graph *irg = env->irg;
- ir_type *frame = get_irg_frame_type(irg);
- /* TODO: backend should be able to specify wether we want spill slots
- * at begin or end of frame */
- int at_start = 1;
- ir_entity *res = frame_alloc_area(frame, slot->size, slot->align, at_start);
+ ir_graph *irg = env->irg;
+ ir_type *frame = get_irg_frame_type(irg);
+ ir_entity *res = frame_alloc_area(frame, slot->size, slot->align,
+ env->at_begin);
/* adjust size of the entity type... */
ir_type *enttype = get_entity_type(res);
}
void be_assign_entities(be_fec_env_t *env,
- set_frame_entity_func set_frame_entity)
+ set_frame_entity_func set_frame_entity,
+ bool alloc_entities_at_begin)
{
env->set_frame_entity = set_frame_entity;
+ env->at_begin = alloc_entities_at_begin;
stat_ev_dbl("spillslots", set_count(env->spills));
#ifndef FIRM_BE_BESPILLSLOTS_H
#define FIRM_BE_BESPILLSLOTS_H
+#include <stdbool.h>
#include "beirg.h"
typedef struct be_fec_env_t be_fec_env_t;
* Assigned frame entities to all the nodes added by be_node_needs_frame_entity.
* Adds memory perms where needed.
*/
-void be_assign_entities(be_fec_env_t *env, set_frame_entity_func set_frame);
+void be_assign_entities(be_fec_env_t *env, set_frame_entity_func set_frame,
+ bool alloc_entities_at_begin);
#endif
*/
static void ia32_after_ra(ir_graph *irg)
{
- be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
+ be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
+ bool at_begin = stack_layout->sp_relative ? true : false;
+ be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
/* create and coalesce frame entities */
irg_walk_graph(irg, NULL, ia32_collect_frame_entity_nodes, fec_env);
- be_assign_entities(fec_env, ia32_set_frame_entity);
+ be_assign_entities(fec_env, ia32_set_frame_entity, at_begin);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, ia32_after_ra_walker, NULL);
static void sparc_after_ra(ir_graph *irg)
{
- be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
+ be_stack_layout_t *stack_layout = be_get_irg_stack_layout(irg);
+ bool at_begin = stack_layout->sp_relative ? true : false;
+ be_fec_env_t *fec_env = be_new_frame_entity_coalescer(irg);
irg_walk_graph(irg, NULL, sparc_collect_frame_entity_nodes, fec_env);
- be_assign_entities(fec_env, sparc_set_frame_entity);
+ be_assign_entities(fec_env, sparc_set_frame_entity, at_begin);
be_free_frame_entity_coalescer(fec_env);
irg_block_walk_graph(irg, NULL, sparc_after_ra_walker, NULL);