becopyopt: Use the set of admissible registers from bechordal.
[libfirm] / ir / be / sparc / bearch_sparc.c
index 1af0d49..5da59e5 100644 (file)
@@ -1,20 +1,6 @@
 /*
- * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
- *
  * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
  */
 
 /**
 #include "array_t.h"
 #include "error.h"
 #include "util.h"
-
+#include "be_t.h"
 #include "bearch.h"
 #include "benode.h"
 #include "belower.h"
 #include "besched.h"
-#include "be.h"
 #include "bemodule.h"
-#include "beirg.h"
 #include "begnuas.h"
 #include "belistsched.h"
 #include "beflags.h"
@@ -141,8 +125,7 @@ static void sparc_prepare_graph(ir_graph *irg)
 
 static bool sparc_modifies_flags(const ir_node *node)
 {
-       unsigned n_outs = arch_get_irn_n_outs(node);
-       for (unsigned o = 0; o < n_outs; ++o) {
+       be_foreach_out(node, o) {
                const arch_register_req_t *req = arch_get_irn_register_req_out(node, o);
                if (req->cls == &sparc_reg_classes[CLASS_sparc_flags_class])
                        return true;
@@ -152,8 +135,7 @@ static bool sparc_modifies_flags(const ir_node *node)
 
 static bool sparc_modifies_fp_flags(const ir_node *node)
 {
-       unsigned n_outs = arch_get_irn_n_outs(node);
-       for (unsigned o = 0; o < n_outs; ++o) {
+       be_foreach_out(node, o) {
                const arch_register_req_t *req = arch_get_irn_register_req_out(node, o);
                if (req->cls == &sparc_reg_classes[CLASS_sparc_fpflags_class])
                        return true;
@@ -182,7 +164,6 @@ static sparc_isa_t sparc_isa_template = {
                &sparc_registers[REG_FRAME_POINTER], /* base pointer register */
                3,                                   /* power of two stack alignment
                                                        for calls */
-               NULL,                                /* main environment */
                7,                                   /* costs for a spill instruction */
                5,                                   /* costs for a reload instruction */
                true,                                /* custom abi handling */
@@ -428,18 +409,14 @@ static void sparc_finish(void)
        sparc_free_opcodes();
 }
 
-static arch_env_t *sparc_begin_codegeneration(const be_main_env_t *env)
+static arch_env_t *sparc_begin_codegeneration(void)
 {
        sparc_isa_t *isa = XMALLOC(sparc_isa_t);
        *isa = sparc_isa_template;
        isa->constants = pmap_create();
 
-       be_gas_elf_type_char      = '#';
-       be_gas_object_file_format = OBJECT_FILE_FORMAT_ELF;
-       be_gas_elf_variant        = ELF_VARIANT_SPARC;
-
-       be_emit_init(env->file_handle);
-       be_gas_begin_compilation_unit(env);
+       be_gas_elf_type_char = '#';
+       be_gas_elf_variant   = ELF_VARIANT_SPARC;
 
        return &isa->base;
 }
@@ -450,12 +427,7 @@ static arch_env_t *sparc_begin_codegeneration(const be_main_env_t *env)
 static void sparc_end_codegeneration(void *self)
 {
        sparc_isa_t *isa = (sparc_isa_t*)self;
-
-       /* emit now all global declarations */
-       be_gas_end_compilation_unit(isa->base.main_env);
-
        pmap_destroy(isa->constants);
-       be_emit_exit();
        free(isa);
 }