some workaround to avoid condeval creating Phibs which not all backends like
[libfirm] / ir / be / ppc32 / ppc32_emitter.c
index 211cf6f..fc785ea 100644 (file)
@@ -319,16 +319,6 @@ const lc_arg_env_t *ppc32_get_arg_env(void) {
        return env;
 }
 
-/*
- * Add a number to a prefix. This number will not be used a second time.
- */
-static char *get_unique_label(char *buf, size_t buflen, const char *prefix) {
-       static unsigned long id = 0;
-       snprintf(buf, buflen, "%s%lu", prefix, ++id);
-       return buf;
-}
-
-
 /**
  * Returns the target label for a control flow node.
  */
@@ -358,7 +348,7 @@ static void emit_Jmp(const ir_node *irn, ppc32_emit_env_t *env) {
  */
 static void emit_be_Call(const ir_node *irn, ppc32_emit_env_t *env) {
        FILE *F = env->out;
-       entity *call_ent = be_Call_get_entity(irn);
+       ir_entity *call_ent = be_Call_get_entity(irn);
 
        if(call_ent)
        {
@@ -454,11 +444,11 @@ static void emit_be_Copy(const ir_node *n, ppc32_emit_env_t *env) {
        FILE *F = env->out;
        const arch_register_class_t *regclass = arch_get_irn_reg_class(env->arch_env, n, 0);
 
-       if (regclass == &ppc32_reg_classes[CLASS_ppc32_general_purpose])
+       if (regclass == &ppc32_reg_classes[CLASS_ppc32_gp])
        {
                lc_efprintf(ppc32_get_arg_env(), F, "\tmr      %1D, %1S\t\t\t/* Move register */\n",n,n);
        }
-       else if (regclass == &ppc32_reg_classes[CLASS_ppc32_floating_point])
+       else if (regclass == &ppc32_reg_classes[CLASS_ppc32_fp])
        {
                lc_efprintf(ppc32_get_arg_env(), F, "\tfmr     %1D, %1S\t\t\t/* Move register */\n",n,n);
        }
@@ -476,13 +466,13 @@ static void emit_be_Perm(const ir_node *n, ppc32_emit_env_t *env) {
        FILE *F = env->out;
        const arch_register_class_t *regclass = arch_get_irn_reg_class(env->arch_env, n, 0);
 
-       if (regclass == &ppc32_reg_classes[CLASS_ppc32_general_purpose])
+       if (regclass == &ppc32_reg_classes[CLASS_ppc32_gp])
        {
                lc_efprintf(ppc32_get_arg_env(), F, "\txor     %1S, %1S, %2S\t\t\t/* Swap %1S, %2S with XOR */\n",n,n,n,n,n);
                lc_efprintf(ppc32_get_arg_env(), F, "\txor     %2S, %1S, %2S\t\t\t/* (continued) */\n",n,n,n);
                lc_efprintf(ppc32_get_arg_env(), F, "\txor     %1S, %1S, %2S\t\t\t/* (continued) */\n",n,n,n);
        }
-       else if (regclass == &ppc32_reg_classes[CLASS_ppc32_floating_point])
+       else if (regclass == &ppc32_reg_classes[CLASS_ppc32_fp])
        {
                lc_efprintf(ppc32_get_arg_env(), F, "\tfmr     f0, %1S\t\t\t/* Swap %1S, %2S with moves */\n",n,n,n);
                lc_efprintf(ppc32_get_arg_env(), F, "\tfmr     %1S, %2S\t\t\t/* (continued) */\n",n,n);
@@ -518,15 +508,14 @@ static void emit_Proj(const ir_node *irn, ppc32_emit_env_t *env) {
 
 static void emit_be_IncSP(const ir_node *irn, ppc32_emit_env_t *emit_env) {
        FILE          *F    = emit_env->out;
-       unsigned       offs = be_get_IncSP_offset(irn);
-       be_stack_dir_t dir  = be_get_IncSP_direction(irn);
+       int offs = be_get_IncSP_offset(irn);
 
-       fprintf(F, "\t\t\t\t\t/* ignored IncSP with %c%i */\n", dir==be_stack_dir_expand ? '-' : ' ', offs);
+       fprintf(F, "\t\t\t\t\t/* ignored IncSP with %d */\n", -offs);
 
 //     if (offs) {
 //             assert(offs<=0x7fff);
-//             lc_efprintf(ppc32_get_arg_env(), F, "\taddi    %1S, %1S,%s%u\t\t\t/* %+F (IncSP) */\n", irn, irn,
-//                     (dir == be_stack_dir_expand) ? " -" : " ", offs, irn);
+//             lc_efprintf(ppc32_get_arg_env(), F, "\taddi    %1S, %1S, %d\t\t\t/* %+F (IncSP) */\n", irn, irn,
+//                     -offs, irn);
 //     }
 //     else {
 //             fprintf(F, "\t\t\t\t\t/* omitted IncSP with 0 */\n");
@@ -535,7 +524,7 @@ static void emit_be_IncSP(const ir_node *irn, ppc32_emit_env_t *emit_env) {
 
 /*static void emit_Spill(const ir_node *irn, ppc32_emit_env_t *emit_env) {
        ir_node *context = be_get_Spill_context(irn);
-       entity *entity = be_get_spill_entity(irn);
+       ir_entity *entity = be_get_spill_entity(irn);
 }*/
 
 /***********************************************************************************
@@ -574,10 +563,10 @@ static void ppc32_register_emitters(void) {
  * Emits code for a node.
  */
 static void ppc32_emit_node(ir_node *irn, void *env) {
-       ppc32_emit_env_t *emit_env   = env;
-       firm_dbg_module_t *mod = emit_env->mod;
-       FILE              *F   = emit_env->out;
-       ir_op             *op = get_irn_op(irn);
+       ppc32_emit_env_t  *emit_env = env;
+       FILE              *F        = emit_env->out;
+       ir_op             *op       = get_irn_op(irn);
+       DEBUG_ONLY(firm_dbg_module_t *mod = emit_env->mod;)
 
        DBG((mod, LEVEL_1, "emitting code for %+F\n", irn));
 
@@ -612,15 +601,15 @@ static void ppc32_gen_block(ir_node *block, void *env) {
  * Emits code for function start.
  */
 void ppc32_emit_start(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
-       const char *irg_name = get_entity_ld_name(get_irg_entity(irg));
-       int framesize = get_type_size_bytes(get_irg_frame_type(env->cg->irg));
+       const char *irg_name  = get_entity_ld_name(get_irg_entity(irg));
+       int         framesize = get_type_size_bytes(get_irg_frame_type(env->cg->irg));
 
-       if(!strcmp(irg_name, "main"))                                              // XXX: underscore hack
+       if(! strcmp(irg_name, "main"))                                             // XXX: underscore hack
        {
                fprintf(F, "\t.text\n");
-               fprintf(F, "\t.globl _main\n", irg_name);
+               fprintf(F, "\t.globl _main\n");
                fprintf(F, "\t.align 4\n");
-               fprintf(F, "_main:\n", irg_name);
+               fprintf(F, "_main:\n");
        }
        else
        {
@@ -630,7 +619,7 @@ void ppc32_emit_start(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
                fprintf(F, "%s:\n", irg_name);
        }
 
-       if(framesize>24)
+       if(framesize > 24)
        {
                fprintf(F, "\tmflr    r0\n");
                fprintf(F, "\tstw     r0, 8(r1)\n");
@@ -638,7 +627,7 @@ void ppc32_emit_start(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
        }
        else
        {
-               fprintf(F, "\t\t\t\t\t/* set new frame omitted */\n", framesize);
+               fprintf(F, "\t\t\t\t\t/* set new frame (%d) omitted */\n", framesize);
        }
 
 
@@ -655,7 +644,6 @@ void ppc32_emit_start(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
  * Emits code for function end
  */
 void ppc32_emit_end(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
-       const char *irg_name = get_entity_ld_name(get_irg_entity(irg));
        int framesize = get_type_size_bytes(get_irg_frame_type(env->cg->irg));
 
 /*     if(!isleaf)
@@ -666,7 +654,7 @@ void ppc32_emit_end(FILE *F, ir_graph *irg, ppc32_emit_env_t *env) {
                fprintf(F, "\taddi    r1, r1, 4\n");
                fprintf(F, "\tmtlr    r0\n");
        }*/
-       if(framesize>24)
+       if(framesize > 24)
        {
                fprintf(F, "\tlwz     r1, 0(r1)\n");
                fprintf(F, "\tlwz     r0, 8(r1)\n");