#include "irargs_t.h"
#include "../besched.h"
+#include "../beblocksched.h"
+#include "../beirg_t.h"
#include "arm_emitter.h"
#include "gen_arm_emitter.h"
case SECTION_DATA:
fprintf(f, "\t.data\n");
break;
+
+ default:
+ assert(0);
}
}
ir_op *irn_op = get_irn_op(n);
if (irn_op == op_be_StackParam) {
- entity *ent = be_get_frame_entity(n);
- offset = get_entity_offset_bytes(ent);
+ ir_entity *ent = be_get_frame_entity(n);
+ offset = get_entity_offset(ent);
} else if (irn_op == op_be_Reload || irn_op == op_be_Spill) {
- entity * ent = be_get_spill_entity(n);
- offset = get_entity_offset_bytes(ent);
+ ir_entity *ent = be_get_frame_entity(n);
+ offset = get_entity_offset(ent);
} else if (irn_op == op_be_IncSP) {
- int offs = be_get_IncSP_offset(n);
- be_stack_dir_t dir = be_get_IncSP_direction(n);
- offset = (dir == be_stack_dir_expand) ? -offs : offs;
+ offset = - be_get_IncSP_offset(n);
} else {
return "node_offset_to_str will fuer diesen Knotentyp noch implementiert werden";
}
return ++id;
}
-
-/**
- * Returns the target label for a control flow node.
- */
-static char *get_cfop_target(const ir_node *irn, char *buf) {
- ir_node *bl = get_irn_link(irn);
-
- snprintf(buf, SNPRINTF_BUF_LEN, "BLOCK_%d", get_irn_node_nr(bl));
- return buf;
-}
-
/**
* Emit a SymConst
*/
if (proj_num == pn_Cmp_False) {
/* always false: should not happen */
- fprintf(out, "\tb BLOCK_%d\t\t\t/* false case */\n", get_irn_node_nr(false_block));
+ fprintf(out, "\tb BLOCK_%ld\t\t\t/* false case */\n", get_irn_node_nr(false_block));
} else if (proj_num == pn_Cmp_True) {
/* always true: should not happen */
- fprintf(out, "\tb BLOCK_%d\t\t\t/* true case */\n", get_irn_node_nr(true_block));
+ fprintf(out, "\tb BLOCK_%ld\t\t\t/* true case */\n", get_irn_node_nr(true_block));
} else {
ir_node *block = get_nodes_block(irn);
ir_node **projs;
int n_projs;
int block_nr;
- int default_block_num;
+ int default_block_num = -1;
block_nr = get_irn_node_nr(irn);
n_projs = get_arm_n_projs(irn);
projs[get_Proj_proj(proj)] = proj;
}
+ assert(default_block_num >= 0);
// CMP %1S, n_projs - 1
// BHI default
static void emit_be_Call(ir_node *irn, void *env) {
arm_emit_env_t *emit_env = env;
FILE *F = emit_env->out;
- entity *ent = be_Call_get_entity(irn);
+ ir_entity *ent = be_Call_get_entity(irn);
char cmd_buf[SNPRINTF_BUF_LEN], cmnt_buf[SNPRINTF_BUF_LEN];
if (ent)
/** Emit an IncSP node */
static void emit_be_IncSP(const ir_node *irn, arm_emit_env_t *emit_env) {
FILE *F = emit_env->out;
- unsigned offs = be_get_IncSP_offset(irn);
- if (offs) {
+ int offs = be_get_IncSP_offset(irn);
+
+ if (offs != 0) {
char cmd_buf[SNPRINTF_BUF_LEN], cmnt_buf[SNPRINTF_BUF_LEN];
lc_esnprintf(arm_get_arg_env(), cmd_buf, SNPRINTF_BUF_LEN, "add %1D, %1S, #%O", irn, irn, irn );
lc_esnprintf(arm_get_arg_env(), cmnt_buf, SNPRINTF_BUF_LEN, "/* IncSP(%O) */", irn);
static void emit_be_Perm(const ir_node* irn, arm_emit_env_t *emit_env) {
FILE *F = emit_env->out;
- ir_mode *mode = get_irn_mode(irn);
const lc_arg_env_t *arm_env = arm_get_arg_env();
char cmd_buf[SNPRINTF_BUF_LEN], cmnt_buf[SNPRINTF_BUF_LEN];
void arm_gen_block(ir_node *block, void *env) {
ir_node *irn;
- fprintf(((arm_emit_env_t *)env)->out, "BLOCK_%d:\n", get_irn_node_nr(block));
+ fprintf(((arm_emit_env_t *)env)->out, "BLOCK_%ld:\n", get_irn_node_nr(block));
sched_foreach(block, irn) {
arm_emit_node(irn, env);
}
* Emits code for function start.
*/
void arm_emit_start(FILE *F, ir_graph *irg) {
- entity *ent = get_irg_entity(irg);
+ ir_entity *ent = get_irg_entity(irg);
const char *irg_name = get_entity_ld_name(ent);
arm_switch_section(F, SECTION_TEXT);
fprintf(F, "\t.align 2\n");
arm_register_emitters();
/* create the block schedule. For now, we don't need it earlier. */
- blk_sched = sched_create_block_schedule(cg->irg);
+ blk_sched = be_create_block_schedule(cg->irg, cg->birg->exec_freq);
arm_emit_start(F, irg);
irg_block_walk_graph(irg, arm_gen_labels, NULL, &emit_env);