1 /* 2 * Copyright (C) 2003-2010, Parrot Foundation. 3 */ 4 5 #ifndef PARROT_IMCC_UNIT_H_GUARD 6 #define PARROT_IMCC_UNIT_H_GUARD 7 8 /* A IMC compilation unit or atomic metadata item. 9 * The unit holds the instruction list as well as 10 * all of the compiler state info, (reg allocator, cfg, etc.) 11 * for the unit of instructions. 12 */ 13 14 typedef enum { 15 IMC_PASM = 0x01, 16 IMC_PCCSUB = 0x02, 17 IMC_HAS_SELF = 0x10 18 } IMC_Unit_Type; 19 20 /* 21 * Optimization statistics -- we track the number of times each of these 22 * optimizations is performed. 23 */ 24 struct imcc_ostat { 25 int deleted_labels; 26 int if_branch; 27 int branch_branch; 28 int branch_cond_loop; 29 int invariants_moved; 30 int deleted_ins; 31 int used_once; 32 } ; 33 34 struct IMC_Unit { 35 INTVAL type; 36 Instruction *instructions; 37 Instruction *last_ins; 38 SymHash hash; 39 int bb_list_size; 40 unsigned int n_basic_blocks; 41 Basic_block **bb_list; 42 Set **dominators; 43 int *idoms; 44 Set **dominance_frontiers; 45 int n_loops; 46 Loop_info **loop_info; 47 Edge *edge_list; 48 49 /* register allocation */ 50 SymReg **reglist; 51 unsigned int n_symbols; 52 int max_color; 53 IMC_Unit *prev; 54 IMC_Unit *next; 55 56 SymReg *_namespace; 57 int owns_namespace; /* should this unit free *_namespace */ 58 int pasm_file; 59 STRING *file; 60 int n_vars_used[4]; /* INSP in PIR */ 61 int n_regs_used[4]; /* INSP in PBC */ 62 int first_avail[4]; /* INSP */ 63 SymReg *outer; 64 PMC *sub_pmc; /* this sub */ 65 int is_vtable_method; /* 1 if a vtable */ 66 int is_method; /* 1 if a method */ 67 int has_ns_entry_name;/* 1 if in ns */ 68 char *vtable_name; /* vtable name, if any */ 69 char *method_name; /* method name, if any */ 70 char *ns_entry_name; /* ns entry name, if any */ 71 char *instance_of; /* PMC or class this is an instance of if any */ 72 INTVAL hll_id; /* HLL ID for this sub */ 73 SymReg *subid; /* Unique subroutine id */ 74 75 struct imcc_ostat ostat; 76 }; 77 78 79 /* HEADERIZER BEGIN: compilers/imcc/unit.c */ 80 /* HEADERIZER END: compilers/imcc/unit.c */ 81 82 #endif /* PARROT_IMCC_UNIT_H_GUARD */ 83 84 85 /* 86 * Local variables: 87 * c-file-style: "parrot" 88 * End: 89 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' : 90 */ 91