added new licence header
[libfirm] / ir / be / TEMPLATE / bearch_TEMPLATE.c
index c100231..5c4a6bc 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 1995-2007 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.
+ */
+
 /* The main TEMPLATE backend driver file. */
 /* $Id$ */
 #ifdef HAVE_CONFIG_H
@@ -14,7 +33,7 @@
 #include "bitset.h"
 #include "debug.h"
 
-#include "../bearch.h"                /* the general register allocator interface */
+#include "../bearch_t.h"                /* the general register allocator interface */
 #include "../benode_t.h"
 #include "../belower.h"
 #include "../besched_t.h"
@@ -291,13 +310,14 @@ static const arch_code_generator_if_t TEMPLATE_code_gen_if = {
  * Initializes the code generator.
  */
 static void *TEMPLATE_cg_init(be_irg_t *birg) {
-       TEMPLATE_isa_t      *isa = (TEMPLATE_isa_t *)birg->main_env->arch_env->isa;
-       TEMPLATE_code_gen_t *cg  = xmalloc(sizeof(*cg));
+       const arch_env_t    *arch_env = be_get_birg_arch_env(birg);
+       TEMPLATE_isa_t      *isa      = (TEMPLATE_isa_t *) arch_env->isa;
+       TEMPLATE_code_gen_t *cg       = xmalloc(sizeof(*cg));
 
        cg->impl     = &TEMPLATE_code_gen_if;
-       cg->irg      = birg->irg;
+       cg->irg      = be_get_birg_irg(birg);
        cg->reg_set  = new_set(TEMPLATE_cmp_irn_reg_assoc, 1024);
-       cg->arch_env = birg->main_env->arch_env;
+       cg->arch_env = arch_env;
        cg->isa      = isa;
        cg->birg     = birg;
        FIRM_DBG_REGISTER(cg->mod, "firm.be.TEMPLATE.cg");
@@ -329,7 +349,7 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
                -1,                          /* stack direction */
                NULL,                        /* main environment */
        },
-       {},                              /* emitter environment */
+       { NULL, },                       /* emitter environment */
 };
 
 /**
@@ -363,7 +383,7 @@ static void TEMPLATE_done(void *self) {
        TEMPLATE_isa_t *isa = self;
 
        /* emit now all global declarations */
-       be_gas_emit_decls(&isa->emit, isa->arch_isa.main_env);
+       be_gas_emit_decls(&isa->emit, isa->arch_isa.main_env, 0);
 
        be_emit_destroy_env(&isa->emit);
        free(self);