tagged release 0.7.1
[parrot.git] / compilers / imcc / unit.h
blob1847e339655977a7962a847840f46c0fee8f3d2c
1 /*
2 * $Id$
3 * Copyright (C) 2003-2008, The Perl Foundation.
4 */
6 #ifndef PARROT_IMCC_UNIT_H_GUARD
7 #define PARROT_IMCC_UNIT_H_GUARD
9 /* A IMC compilation unit or atomic metadata item.
10 * The unit holds the instruction list as well as
11 * all of the compiler state info, (reg allocator, cfg, etc.)
12 * for the unit of instructions.
15 typedef enum {
16 IMC_PASM = 0x01,
17 IMC_PCCSUB = 0x02,
18 IMC_HAS_SELF = 0x10
19 } IMC_Unit_Type;
22 * Optimization statistics -- we track the number of times each of these
23 * optimizations is performed.
25 struct imcc_ostat {
26 int deleted_labels;
27 int if_branch;
28 int branch_branch;
29 int branch_cond_loop;
30 int invariants_moved;
31 int deleted_ins;
32 int used_once;
33 } ;
35 typedef struct _IMC_Unit {
36 INTVAL type;
37 Instruction *instructions;
38 Instruction *last_ins;
39 SymHash hash;
40 int bb_list_size;
41 unsigned int n_basic_blocks;
42 Basic_block **bb_list;
43 Set **dominators;
44 int *idoms;
45 Set **dominance_frontiers;
46 int n_loops;
47 Loop_info **loop_info;
48 Edge *edge_list;
50 /* register allocation */
51 unsigned int *interference_graph;
52 SymReg **reglist;
53 int n_symbols;
54 int max_color;
55 struct _IMC_Unit *prev;
56 struct _IMC_Unit *next;
58 SymReg *_namespace;
59 int pasm_file;
60 const char *file;
61 int n_vars_used[4]; /* INSP in PIR */
62 int n_regs_used[4]; /* INSP in PBC */
63 int first_avail[4]; /* INSP */
64 SymReg *outer;
65 PMC *sub_pmc; /* this sub */
66 int is_vtable_method; /* 1 if a v-table method */
67 char *vtable_name; /* v-table method name, if any */
68 char *instance_of; /* PMC or class this is an instance of
69 * if any */
70 SymReg *lexid; /* Unique lexical scope id */
72 struct imcc_ostat ostat;
73 } IMC_Unit;
76 /* HEADERIZER BEGIN: compilers/imcc/unit.c */
77 /* HEADERIZER END: compilers/imcc/unit.c */
79 #endif /* PARROT_IMCC_UNIT_H_GUARD */
83 * Local variables:
84 * c-file-style: "parrot"
85 * End:
86 * vim: expandtab shiftwidth=4: