Commit 13113d43 authored by Matthias Braun's avatar Matthias Braun
Browse files

Move ir_prog struct from irtypes.h to irprog_t.h, cleanup

Also move ir_nodemap struct into a new irnodemap_t.h file.
parent d9fe5a25
......@@ -17,6 +17,7 @@
#include "irmode_t.h"
#include "irnode_t.h"
#include "iropt_t.h"
#include "irprog_t.h"
#include "tv_t.h"
#include "util.h"
......
......@@ -33,6 +33,7 @@
#include "irgraph_t.h"
#include "entity_t.h"
#include "irprintf.h"
#include "irprog_t.h"
#include "irdump.h"
#include "iredges_t.h"
#include "debug.h"
......
......@@ -9,10 +9,9 @@
* @date 2011-09-22
* @author Manuel Mohr
*/
#include "irprog.h"
#include "iroptimize.h"
#include "irprog_t.h"
#include "typerep.h"
#include "irtypes.h"
#include <assert.h>
......
......@@ -14,11 +14,11 @@
#ifndef FIRM_IRNODEMAP_H
#define FIRM_IRNODEMAP_H
#include "irnodemap_t.h"
#include "firm_types.h"
#include "array.h"
#include "irtypes.h"
typedef struct ir_nodemap ir_nodemap;
#include "irnode_t.h"
#include "irgraph_t.h"
/**
* Allocate and initialize a new nodemap object
......
/*
* This file is part of libFirm.
* Copyright (C) 2015 Matthias Braun
*/
/**
* @file
* @brief nodemap -- private header.
* @author Matthias Braun
*/
#ifndef FIRM_IRNODEMAP_T_H
#define FIRM_IRNODEMAP_T_H
typedef struct ir_nodemap {
void **data;
} ir_nodemap;
#endif
......@@ -13,12 +13,12 @@
#define FIRM_IR_IRPROG_T_H
#include "irprog.h"
#include "irtypes.h"
#include "irmemory.h"
#include "callgraph.h"
#include "array.h"
#include "callgraph.h"
#include "irmemory.h"
#include "pmap.h"
#include "typerep.h"
/* Inline functions. */
#define get_irp_n_irgs() get_irp_n_irgs_()
......@@ -34,7 +34,50 @@
#define irp_free_resources(irp, resources) irp_free_resources_(irp, resources)
#define irp_resources_reserved(irp) irp_resources_reserved_(irp)
/* inline functions */
/**
* Data structure that holds central information about a program / module /
* translation unit.
*/
struct ir_prog {
ident *name; /**< A file name or the like. */
ir_graph *main_irg; /**< The entry point to the compiled program
or NULL if no point exists. */
ir_graph **graphs; /**< A list of all graphs in the ir. */
/** This graph holds nodes for global entity initialization expressions.
* It is not a function. */
ir_graph *const_code_irg;
ir_entity *unknown_entity; /**< unique 'unknown'-entity */
ir_type *segment_types[IR_SEGMENT_LAST+1];
ir_type **types; /**< A list of all types in the ir. */
ir_type *code_type; /**< unique 'code'-type */
ir_type *unknown_type; /**< unique 'unknown'-type */
ir_type *dummy_owner; /**< owner for internal entities */
ir_type *byte_type; /**< type for a 'byte' */
ident **global_asms; /**< An array of global ASM insertions. */
/** Validity of callee information. Lowest value for all irgs. */
irg_callee_info_state callee_info_state;
/** State of transitive closure of inheritance relations. */
inh_transitive_closure_state inh_trans_closure_state;
irp_callgraph_state callgraph_state; /**< State of callgraph. */
/** Outermost callgraph loop */
ir_loop *outermost_cg_loop;
/** State of loop nesting depth information. */
loop_nesting_depth_state lnd_state;
ir_entity_usage_computed_state globals_entity_usage_state;
ir_label_t last_label_nr; /**< Highest number for unique labels. */
size_t max_irg_idx; /**< highest unused irg index */
long max_node_nr; /**< Highest number unique node numbers. */
unsigned dump_nr; /**< number of program info dumps */
/** Maps ident* to ir_entity* of the compilerlib */
pmap *compilerlib_entities;
#ifndef NDEBUG
/** Bitset for tracking used global resources. */
irp_resources_t reserved_resources;
#endif
};
static inline ir_type *get_segment_type_(ir_segment_t segment)
{
assert(segment <= IR_SEGMENT_LAST);
......
......@@ -30,10 +30,6 @@
#include "obst.h"
#include "vrp.h"
struct ir_nodemap {
void **data; /**< maps node indices to void* */
};
/* note: we use "long" here because that is the type used for Proj-Numbers */
typedef struct ir_switch_table_entry {
ir_tarval *min;
......@@ -288,57 +284,4 @@ struct ir_node {
Must be last field of struct ir_node. */
};
/**
* Data structure that holds central information about a program
* or a module.
* One irp is created by libFirm on construction, so irp should never be NULL.
*
* - main_irg: The ir graph that is the entry point to the program.
* (Anything not reachable from here may be optimized away
* if this irp represents a whole program.
* - graphs: List of all ir graphs in the program or module.
* - types: A list containing all types known to the translated program.
* Some types can have several entries in this list (as a result of
* using exchange_types()).
*/
struct ir_prog {
ident *name; /**< A file name or the like. */
ir_graph *main_irg; /**< The entry point to the compiled program
or NULL if no point exists. */
ir_graph **graphs; /**< A list of all graphs in the ir. */
ir_graph *const_code_irg; /**< This ir graph gives the proper environment
to allocate nodes the represent values
of constant entities. It is not meant as
a procedure. */
ir_entity *unknown_entity; /**< unique 'unknown'-entity */
ir_type *segment_types[IR_SEGMENT_LAST+1];
ir_type **types; /**< A list of all types in the ir. */
ir_type *code_type; /**< unique 'code'-type */
ir_type *unknown_type; /**< unique 'unknown'-type */
ir_type *dummy_owner; /**< owner for internal entities */
ir_type *byte_type; /**< type for a 'byte' */
ident **global_asms; /**< An array of global ASM insertions. */
/* -- states of and access to generated information -- */
irg_callee_info_state callee_info_state; /**< Validity of callee information.
Contains the lowest value or all irgs. */
inh_transitive_closure_state inh_trans_closure_state; /**< State of transitive closure
of inheritance relations. */
irp_callgraph_state callgraph_state; /**< The state of the callgraph. */
ir_loop *outermost_cg_loop; /**< For callgraph analysis: entry point
to looptree over callgraph. */
loop_nesting_depth_state lnd_state; /**< The state of loop nesting depth information. */
ir_entity_usage_computed_state globals_entity_usage_state;
ir_label_t last_label_nr; /**< The highest label number for generating unique labels. */
size_t max_irg_idx; /**< highest unused irg index */
long max_node_nr; /**< to generate unique numbers for nodes. */
unsigned dump_nr; /**< number of program info dumps */
pmap *compilerlib_entities; /**< maps ident* to ir_entity* of the compilerlib */
#ifndef NDEBUG
irp_resources_t reserved_resources; /**< Bitset for tracking used global resources. */
#endif
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment