Remove unnecessary global variable.
[libfirm] / ir / be / ppc32 / ppc32_emitter.c
index 6acdf71..24a5089 100644 (file)
@@ -23,9 +23,7 @@
  * @author  Moritz Kroll, Jens Mueller
  * @version $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <limits.h>
 
@@ -56,9 +54,6 @@ static char printbuf[SNPRINTF_BUF_LEN];
 
 extern int isleaf;
 
-static const arch_env_t       *arch_env;
-static const ppc32_code_gen_t *cg;
-
 
 /*************************************************************
  *             _       _    __   _          _
@@ -83,7 +78,7 @@ static const arch_register_t *get_in_reg(const ir_node *irn, int pos) {
           in register we need. */
        op = get_irn_n(irn, pos);
 
-       reg = arch_get_irn_register(arch_env, op);
+       reg = arch_get_irn_register(op);
 
        assert(reg && "no in register found");
        return reg;
@@ -104,7 +99,7 @@ static const arch_register_t *get_out_reg(const ir_node *irn, int pos) {
        /*           Proj with the corresponding projnum for the register */
 
        if (get_irn_mode(irn) != mode_T) {
-               reg = arch_get_irn_register(arch_env, irn);
+               reg = arch_get_irn_register(irn);
        } else if (is_ppc32_irn(irn)) {
                reg = get_ppc32_out_reg(irn, pos);
        } else {
@@ -114,7 +109,7 @@ static const arch_register_t *get_out_reg(const ir_node *irn, int pos) {
                        proj = get_edge_src_irn(edge);
                        assert(is_Proj(proj) && "non-Proj from mode_T node");
                        if (get_Proj_proj(proj) == pos) {
-                               reg = arch_get_irn_register(arch_env, proj);
+                               reg = arch_get_irn_register(proj);
                                break;
                        }
                }
@@ -393,7 +388,7 @@ static void emit_ppc32_Switch(const ir_node *irn) {
  * Emits code for a backend Copy node
  */
 static void emit_be_Copy(const ir_node *irn) {
-       const arch_register_class_t *regclass = arch_get_irn_reg_class(arch_env, irn, 0);
+       const arch_register_class_t *regclass = arch_get_irn_reg_class(irn, 0);
 
        if (regclass == &ppc32_reg_classes[CLASS_ppc32_gp]) {
                be_emit_cstring("\tmr ");
@@ -415,7 +410,7 @@ static void emit_be_Copy(const ir_node *irn) {
  * Emits code for a backend Perm node
  */
 static void emit_be_Perm(const ir_node *irn) {
-       const arch_register_class_t *regclass = arch_get_irn_reg_class(arch_env, irn, 0);
+       const arch_register_class_t *regclass = arch_get_irn_reg_class(irn, 0);
 
        if (regclass == &ppc32_reg_classes[CLASS_ppc32_gp]) {
                be_emit_cstring("\txor ");
@@ -494,7 +489,7 @@ static void emit_be_Perm(const ir_node *irn) {
 static void emit_Proj(const ir_node *irn) {
        ir_node *pred = get_Proj_pred(irn);
 
-       if (get_irn_op(pred) == op_Start) {
+       if (is_Start(pred)) {
                if (get_Proj_proj(irn) == pn_Start_X_initial_exec) {
                        emit_Jmp(irn);
                }
@@ -539,7 +534,7 @@ typedef void (emit_func)(const ir_node *irn);
 /**
  * Set a node emitter. Make it a bit more type safe.
  */
-static INLINE void set_emitter(ir_op *op, emit_func ppc32_emit_node) {
+static inline void set_emitter(ir_op *op, emit_func ppc32_emit_node) {
        op->ops.generic = (op_func)ppc32_emit_node;
 }
 
@@ -602,7 +597,7 @@ static void ppc32_gen_block(const ir_node *block) {
  */
 static void ppc32_emit_start(ir_graph *irg) {
        const char *irg_name  = get_entity_ld_name(get_irg_entity(irg));
-       int         framesize = get_type_size_bytes(get_irg_frame_type(cg->irg));
+       int         framesize = get_type_size_bytes(get_irg_frame_type(irg));
 
        if(! strcmp(irg_name, "main")) {                                           // XXX: underscore hack
                irg_name = "_main";
@@ -632,7 +627,7 @@ static void ppc32_emit_start(ir_graph *irg) {
  * Emits code for function end
  */
 static void ppc32_emit_end(ir_graph *irg) {
-       int framesize = get_type_size_bytes(get_irg_frame_type(cg->irg));
+       int framesize = get_type_size_bytes(get_irg_frame_type(irg));
        (void) irg;
 
 /*     if(!isleaf) {
@@ -671,14 +666,11 @@ void ppc32_gen_labels(ir_node *block, void *env) {
 /**
  * Main driver: generates code for one routine
  */
-void ppc32_gen_routine(const ppc32_code_gen_t *ppc32_cg, ir_graph *irg)
+void ppc32_gen_routine(const ppc32_code_gen_t *cg, ir_graph *irg)
 {
        ir_node *block;
        int i, n;
 
-       cg       = ppc32_cg;
-       arch_env = cg->arch_env;
-
        ppc32_register_emitters();
 
        ppc32_emit_start(irg);