X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firprog.c;h=42af15b654381604d81f24e706cab8d14c20cfc6;hb=eda9d668d0e8c8246015b4c5e743316a6a835a23;hp=cc01bcd113486a542c3eb824ef0a228b44dfd550;hpb=cdd903d8e390c19bf09b67bb991b45dde115050e;p=libfirm diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index cc01bcd11..42af15b65 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -1,15 +1,29 @@ /* - * Project: libFIRM - * File name: ir/ir/irprog.c - * Purpose: Entry point to the representation of a whole program. - * Author: Goetz Lindenmaier - * Modified by: - * Created: 2000 - * CVS-ID: $Id$ - * Copyright: (c) 2000-2003 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * 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. */ +/** + * @file + * @brief Entry point to the representation of a whole program. + * @author Goetz Lindenmaier + * @date 2000 + * @version $Id$ + */ #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -25,6 +39,7 @@ #include "obst.h" #include "typegmod.h" #include "irop_t.h" +#include "irmemory.h" /** The name of the Global Type. */ #define GLOBAL_TYPE_NAME "GlobalType" @@ -73,6 +88,14 @@ static ir_prog *complete_ir_prog(ir_prog *irp) { remove_irp_type(irp->glob_type); remove_irp_type(irp->tls_type); + /* Set these flags for debugging. */ + irp->glob_type->flags |= tf_global_type; + irp->tls_type->flags |= tf_tls_type; + + /* The global type is a class, but we cannot derive from it, so set + the final property to assist optimizations that checks for it. */ + set_class_final(irp->glob_type, 1); + irp->const_code_irg = new_const_code_irg(); irp->phase_state = phase_building; @@ -80,6 +103,7 @@ static ir_prog *complete_ir_prog(ir_prog *irp) { irp->ip_outedges = NULL; irp->trouts_state = outs_none; irp->class_cast_state = ir_class_casts_transitive; + irp->globals_adr_taken_state = ir_address_taken_not_computed; return irp; } @@ -102,7 +126,7 @@ ir_prog *new_ir_prog (void) { /* frees all memory used by irp. Types in type list, irgs in irg list and entities in global type must be freed by hand before. */ -void free_ir_prog(void) { +void free_ir_prog(void) { if (irp->glob_type) free_type(irp->glob_type); if (irp->tls_type) @@ -125,7 +149,7 @@ void free_ir_prog(void) { /* Access the main routine of the compiled program. */ ir_graph *get_irp_main_irg(void) { - assert (irp); + assert(irp); return irp->main_irg; } @@ -192,8 +216,8 @@ ir_graph *(get_irp_irg)(int pos){ } void set_irp_irg(int pos, ir_graph *irg) { - assert (irp && irg); - assert (pos < (ARR_LEN(irp->graphs))); + assert(irp && irg); + assert(pos < (ARR_LEN(irp->graphs))); irp->graphs[pos] = irg; } @@ -217,7 +241,7 @@ ir_graph *get_irp_allirg(int pos) { /* Adds type to the list of types in irp. */ void add_irp_type(ir_type *typ) { - assert (typ != NULL); + assert(typ != NULL); assert(irp); ARR_APP1 (ir_type *, irp->types, typ); } @@ -247,8 +271,8 @@ ir_type *(get_irp_type) (int pos) { } void set_irp_type(int pos, ir_type *typ) { - assert (irp && typ); - assert (pos < (ARR_LEN((irp)->types))); + assert(irp && typ); + assert(pos < (ARR_LEN((irp)->types))); irp->types[pos] = typ; } @@ -279,11 +303,11 @@ void add_irp_opcode(ir_op *opcode) { /* Removes opcode from the list of opcodes and shrinks the list by one. */ void remove_irp_opcode(ir_op *opcode) { int i; - assert(opcode); + assert(opcode); for (i = ARR_LEN(irp->opcodes) -1; i >= 0; i--) { if (irp->opcodes[i] == opcode) { - for(; i < (ARR_LEN(irp->opcodes)) - 1; i++) { + for (; i < (ARR_LEN(irp->opcodes)) - 1; i++) { irp->opcodes[i] = irp->opcodes[i+1]; } ARR_SETLEN(ir_op *, irp->opcodes, (ARR_LEN(irp->opcodes)) - 1); @@ -334,7 +358,7 @@ ir_graph *(get_const_code_irg)(void) { irg_phase_state get_irp_phase_state(void) { return irp->phase_state; } -void set_irp_phase_state(irg_phase_state s) { +void set_irp_phase_state(irg_phase_state s) { irp->phase_state = s; } @@ -346,13 +370,11 @@ void set_irp_ip_outs_inconsistent(void) { irp->outs_state = outs_inconsistent; } -void set_irp_ip_outedges(ir_node ** ip_outedges) -{ +void set_irp_ip_outedges(ir_node ** ip_outedges) { irp->ip_outedges = ip_outedges; } -ir_node** get_irp_ip_outedges(void) -{ +ir_node** get_irp_ip_outedges(void) { return irp->ip_outedges; }