New compilation engine for Mono
[mono.git] / mono / mini / mini.h
1 #ifndef __MONO_MINI_H__
2 #define __MONO_MINI_H__
3
4 #include <glib.h>
5 #include <signal.h>
6 #include <mono/metadata/loader.h>
7 #include <mono/metadata/mempool.h>
8 #include <mono/utils/monobitset.h>
9 #include <mono/metadata/class.h>
10 #include <mono/metadata/object.h>
11 #include <mono/metadata/opcodes.h>
12 #include <mono/metadata/tabledefs.h>
13 #include "regalloc.h"
14
15 /* fixme: configure should set this */
16 #define SIZEOF_VOID_P 4
17
18 #define MONO_USE_AOT_COMPILER
19
20 #if 1
21 #define mono_bitset_test_fast(set,n) (((guint32*)set)[2+(n)/32] & (1 << ((n) % 32)))
22 #else
23 #define mono_bitset_test_fast(set,n) mono_bitset_test(set,n)
24 #endif
25
26 #if 0
27 #define mono_bitset_foreach_bit(set,b,n) \
28         for (b = 0; b < n; b++)\
29                 if (mono_bitset_test_fast(set,b))
30 #define mono_bitset_foreach_bit_rev(set,b,n) \
31         for (b = n - 1; b >= 0; b--)\
32                 if (mono_bitset_test_fast(set,b))
33 #else
34 #define mono_bitset_foreach_bit(set,b,n) \
35         for (b = mono_bitset_find_first (set, -1); b < n && b >= 0; b = mono_bitset_find_first (set, b))
36 #define mono_bitset_foreach_bit_rev(set,b,n) \
37         for (b = mono_bitset_find_last (set, n - 1); b >= 0; b = b ? mono_bitset_find_last (set, b) : -1)
38  
39 #endif
40
41 /*
42  * Pull the list of opcodes
43  */
44 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
45         a = i,
46
47 enum {
48 #include "mono/cil/opcode.def"
49         CEE_LASTOP
50 };
51 #undef OPDEF
52
53 #define MONO_VARINFO(cfg,varnum) ((cfg)->vars [varnum])
54
55 #define MONO_INST_NEW(cfg,dest,op) do { \
56                 (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst));       \
57                 (dest)->opcode = (op);  \
58         } while (0)
59
60 #define MONO_INST_NEW_CALL(cfg,dest,op) do {    \
61                 (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoCallInst));   \
62                 (dest)->inst.opcode = (op);     \
63         } while (0)
64
65 #define MONO_ADD_INS(b,inst) do {       \
66                 if ((b)->last_ins) {    \
67                         (b)->last_ins->next = (inst);   \
68                         (b)->last_ins = (inst); \
69                 } else {        \
70                         (b)->code = (b)->last_ins = (inst);     \
71                 }       \
72         } while (0)
73
74 typedef struct MonoInst MonoInst;
75 typedef struct MonoCallInst MonoCallInst;
76 typedef struct MonoEdge MonoEdge;
77 typedef struct MonoMethodVar MonoMethodVar;
78 typedef struct MonoBasicBlock MonoBasicBlock;
79 typedef struct MonoLMF MonoLMF;
80 typedef struct MonoSpillInfo MonoSpillInfo;
81
82 extern guint32 mono_jit_tls_id;
83 extern gboolean mono_jit_trace_calls;
84 extern gboolean mono_break_on_exc;
85 extern int mono_exc_esp_offset;
86 extern gboolean mono_compile_aot;
87 extern gboolean mono_trace_coverage;
88 extern gboolean mono_jit_profile;
89
90 extern CRITICAL_SECTION *metadata_section;
91
92 struct MonoEdge {
93         MonoEdge *next;
94         MonoBasicBlock *bb;
95         /* add edge type? */
96 };
97
98 struct MonoSpillInfo {
99         MonoSpillInfo *next;
100         int offset;
101 };
102
103 /*
104  * The IR-level basic block.  
105  *
106  * A basic block can have multiple exits just fine, as long as the point of
107  * 'departure' is the last instruction in the basic block. Extended basic
108  * blocks, on the other hand, may have instructions that leave the block
109  * midstream. The important thing is that they cannot be _entered_
110  * midstream, ie, execution of a basic block (or extened bb) always start
111  * at the beginning of the block, never in the middle.
112  */
113 struct MonoBasicBlock {
114         MonoInst *last_ins;
115
116         /* Points to the start of the CIL code that initiated this BB */
117         unsigned char* cil_code;
118
119         /* Length of the CIL block */
120         gint32 cil_length;
121
122         /* The address of the generated code, used for fixups */
123         int native_offset;
124         int max_offset;
125         
126         gint32 dfn;
127
128         /* unique block number identification */
129         gint32 block_num;
130
131         /* Visited and reachable flags */
132         guint32 flags;
133
134         /* Basic blocks: incoming and outgoing counts and pointers */
135         gint16 out_count, in_count;
136         MonoBasicBlock **in_bb;
137         MonoBasicBlock **out_bb;
138
139         /* the next basic block in the order it appears in IL */
140         MonoBasicBlock *next_bb;
141
142         /*
143          * Before instruction selection it is the first tree in the
144          * forest and the first item in the list of trees. After
145          * instruction selection it is the first instruction and the
146          * first item in the list of instructions.
147          */
148         MonoInst *code;
149
150         /*
151          * SSA and loop based flags
152          */
153         MonoBitSet *dominators;
154         MonoBitSet *dfrontier;
155         MonoBasicBlock *idom;
156         GList *dominated;
157         /* fast dominator algorithm */
158         MonoBasicBlock *df_parent, *ancestor, *child, *label;
159         MonoEdge *bucket;
160         int size, sdom, idomn;
161         
162         /* loop nesting and recognition */
163         GList *loop_blocks;
164         gint8  nesting;
165
166         /* use for liveness analysis */
167         MonoBitSet *gen_set;
168         MonoBitSet *kill_set;
169         MonoBitSet *live_in_set;
170         MonoBitSet *live_out_set;
171
172         /* fields to deal with non-empty stack slots at bb boundary */
173         guint16 out_scount, in_scount;
174         MonoInst **out_stack;
175         MonoInst **in_stack;
176
177         /* we use that to prevent merging of bblock covered by different clauses*/
178         guint real_offset;
179         guint region;
180
181         /* The current symbolic register number, used in local register allocation. */
182         guint16 max_ireg, max_freg;
183 };
184
185 /* BBlock flags */
186 #define BB_VISITED 1
187 #define BB_REACHABLE 2
188
189 struct MonoInst {
190         union {
191                 union {
192                         MonoInst *src;
193                         MonoMethodVar *var;
194                         gint32 const_val;
195                         gpointer p;
196                         MonoMethod *method;
197                         MonoMethodSignature *signature;
198                         MonoBasicBlock **many_blocks;
199                         MonoBasicBlock *target_block;
200                         MonoInst **args;
201                         MonoType *vtype;
202                         MonoClass *klass;
203                         int *phi_args;
204                 } op [2];
205                 gint64 i8const;
206                 double r8const;
207         } data;
208         guint16 opcode;
209         guint8  type; /* stack type */
210         guint   ssa_op : 3;
211         guint8  flags  : 5;
212         
213         /* used by the register allocator */
214         gint16 dreg, sreg1, sreg2, unused;
215         
216         MonoInst *next;
217         MonoClass *klass;
218         const unsigned char* cil_code; /* for debugging and bblock splitting */
219 };
220         
221 struct MonoCallInst {
222         MonoInst inst;
223         MonoMethodSignature *signature;
224         MonoMethod *method;
225         MonoInst **args;
226         gconstpointer fptr;
227         guint stack_usage;
228         guint32 used_iregs;
229         guint32 used_fregs;
230 };
231
232 /* 
233  * flags for MonoInst
234  * Note: some of the values overlap, because they can't appear
235  * in the same MonoInst.
236  */
237 enum {
238         MONO_INST_HAS_METHOD = 1,
239         /* temp local created by a DUP: used only within a BB */
240         MONO_INST_IS_TEMP    = 1,
241         MONO_INST_INIT       = 1, /* in localloc */
242         MONO_INST_IS_DEAD    = 2,
243         MONO_INST_TAILCALL   = 4,
244         MONO_INST_VOLATILE   = 4,
245         MONO_INST_BRLABEL    = 4,
246         MONO_INST_UNALIGNED  = 8,
247         /* the address of the variable has been taken */
248         MONO_INST_INDIRECT   = 16
249 };
250
251 #define inst_c0 data.op[0].const_val
252 #define inst_c1 data.op[1].const_val
253 #define inst_i0 data.op[0].src
254 #define inst_i1 data.op[1].src
255 #define inst_p0 data.op[0].p
256 #define inst_p1 data.op[1].p
257 #define inst_l  data.i8const
258 #define inst_r  data.r8const
259 #define inst_left  data.op[0].src
260 #define inst_right data.op[1].src
261
262 #define inst_newa_len   data.op[0].src
263 #define inst_newa_class data.op[1].klass
264
265 #define inst_switch data.op[0].switch_blocks
266 #define inst_var    data.op[0].var
267 #define inst_vtype  data.op[1].vtype
268 /* in branch instructions */
269 #define inst_many_bb   data.op[1].many_blocks
270 #define inst_target_bb data.op[0].target_block
271 #define inst_true_bb   data.op[1].many_blocks[0]
272 #define inst_false_bb  data.op[1].many_blocks[1]
273
274 #define inst_basereg sreg1
275 #define inst_indexreg sreg2
276 #define inst_destbasereg dreg
277 #define inst_offset data.op[0].const_val
278 #define inst_imm    data.op[1].const_val
279
280 #define inst_phi_args   data.op[1].phi_args
281
282 /* instruction description for use in regalloc/scheduling */
283 enum {
284         MONO_INST_DEST,
285         MONO_INST_SRC1,
286         MONO_INST_SRC2,
287         MONO_INST_FLAGS,
288         MONO_INST_CLOB,
289         MONO_INST_COST,
290         MONO_INST_DELAY,
291         MONO_INST_RES,
292         MONO_INST_LEN,
293         MONO_INST_MAX
294 };
295
296 typedef union {
297         struct {
298                 guint16 tid; /* tree number */
299                 guint16 bid; /* block number */
300         } pos ;
301         guint32 abs_pos; 
302 } MonoPosition;
303
304 typedef struct {
305         MonoPosition first_use, last_use;
306 } MonoLiveRange;
307
308 /*
309  * Additional information about a variable
310  */
311 struct MonoMethodVar {
312         guint           idx; /* inside cfg->varinfo, cfg->vars */
313         guint           last_name;
314         MonoBitSet     *dfrontier;
315         MonoLiveRange   range; /* generated by liveness analysis */
316         int             reg; /* != -1 if allocated into a register */
317         int             spill_costs;
318         MonoBitSet     *def_in; /* used by SSA */
319         MonoInst       *def;    /* used by SSA */
320         MonoBasicBlock *def_bb; /* used by SSA */
321         GList          *uses;   /* used by SSA */
322         char            cpstate;  /* used by SSA conditional  constant propagation */
323 };
324
325 typedef struct {
326         gpointer          end_of_stack;
327         MonoLMF          *lmf;
328         void            (*abort_func) (MonoObject *object);
329 } MonoJitTlsData;
330
331 typedef enum {
332         MONO_PATCH_INFO_BB,
333         MONO_PATCH_INFO_ABS,
334         MONO_PATCH_INFO_LABEL,
335         MONO_PATCH_INFO_METHOD,
336         MONO_PATCH_INFO_METHODCONST,
337         MONO_PATCH_INFO_INTERNAL_METHOD,
338         MONO_PATCH_INFO_SWITCH,
339         MONO_PATCH_INFO_EXC,
340         MONO_PATCH_INFO_CLASS,
341         MONO_PATCH_INFO_IMAGE,
342         MONO_PATCH_INFO_FIELD,
343         MONO_PATCH_INFO_R4,
344         MONO_PATCH_INFO_R8,
345         MONO_PATCH_INFO_IP
346 } MonoJumpInfoType;
347
348 typedef struct MonoJumpInfo MonoJumpInfo;
349 struct MonoJumpInfo {
350         MonoJumpInfo *next;
351         union {
352                 int i;
353                 guint8 *p;
354                 MonoInst *label;
355         } ip;
356
357         MonoJumpInfoType type;
358         union {
359                 gconstpointer   target;
360                 int             offset;
361                 MonoBasicBlock *bb;
362                 MonoBasicBlock **table;
363                 MonoInst       *inst;
364                 MonoMethod     *method;
365                 MonoClass      *klass;
366                 MonoClassField *field;
367                 MonoImage      *image;
368                 const char     *name;
369         } data;
370
371         int table_size; /* use by switch */
372 };
373
374 /* optimization flags: keep up to date with the name array in mini.c */
375 enum {
376         MONO_OPT_PEEPHOLE = 1 << 0,
377         MONO_OPT_BRANCH   = 1 << 1,
378         MONO_OPT_INLINE   = 1 << 2,
379         MONO_OPT_CFOLD    = 1 << 3,
380         MONO_OPT_CONSPROP = 1 << 4,
381         MONO_OPT_COPYPROP = 1 << 5,
382         MONO_OPT_DEADCE   = 1 << 6,
383         MONO_OPT_LINEARS  = 1 << 7,
384         MONO_OPT_CMOV     = 1 << 8,
385         MONO_OPT_SAHRED   = 1 << 9,
386         MONO_OPT_SCHED    = 1 << 10,
387         MONO_OPT_INTRINS  = 1 << 11,
388         MONO_OPT_TAILC    = 1 << 12,
389         MONO_OPT_LOOP     = 1 << 13,
390         MONO_OPT_FCMOV    = 1 << 14
391 };
392
393 /*
394  * Control Flow Graph and compilation unit information
395  */
396 typedef struct {
397         MonoMethod      *method;
398         MonoMemPool     *mempool;
399         MonoInst       **varinfo;
400         MonoMethodVar  **vars;
401         MonoInst        *ret;
402         MonoBasicBlock  *bb_entry;
403         MonoBasicBlock  *bb_exit;
404         MonoBasicBlock  *bb_init;
405         MonoBasicBlock **bblocks;
406         GHashTable      *bb_hash;
407         MonoMemPool     *state_pool; /* used by instruction selection */
408         MonoBasicBlock  *cbb;        /* used by instruction selection */
409         MonoInst        *prev_ins;   /* in decompose */
410         MonoJumpInfo    *patch_info;
411         guint            num_bblocks;
412         guint            locals_start;
413         guint            num_varinfo; /* used items in varinfo */
414         guint            varinfo_count; /* total storage in varinfo */
415         gint             stack_offset;
416         MonoRegState    *rs;
417         MonoSpillInfo   *spill_info;
418         gint             spill_count;
419         // unsigned char   *cil_code;
420
421         MonoInst        *exvar; /* the exception object passed to catch/filter blocks */
422         MonoInst        *domainvar; /* a cache for the current domain */
423         
424         MonoDomain      *domain;
425
426         unsigned char   *native_code;
427         guint            code_size;
428         guint            code_len;
429         guint            prolog_end;
430         guint            epilog_begin;
431         guint32          used_int_regs;
432         guint32          opt;
433         guint32          flags;
434         guint32          comp_done;
435         guint32          verbose_level;
436         guint32          stack_usage;
437         guint32          param_area;
438         gboolean         disable_aot;
439         gboolean         disable_ssa;
440         gpointer         debug_info;
441 } MonoCompile;
442
443 typedef enum {
444         MONO_CFG_HAS_ALLOCA = 1 << 0,
445         MONO_CFG_HAS_CALLS  = 1 << 1
446 } MonoCompileFlags;
447
448 typedef struct {
449         int entries;
450         struct {
451                 int iloffset;
452                 int count;
453         } data [0];
454 } MonoCoverageInfo;
455
456 typedef struct {
457         gulong methods_compiled;
458         gulong methods_aot;
459         gulong methods_lookups;
460         gulong method_trampolines;
461         gulong allocate_var;
462         gulong analyze_stack_repeat;
463         gulong cil_code_size;
464         gulong native_code_size;
465         gulong code_reallocs;
466         gulong max_code_size_ratio;
467         gulong biggest_method_size;
468         gulong allocated_code_size;
469         gulong inlineable_methods;
470         gulong inlined_methods;
471         gulong basic_blocks;
472         gulong max_basic_blocks;
473         MonoMethod *max_ratio_method;
474         MonoMethod *biggest_method;
475         gboolean enabled;
476 } MonoJitStats;
477
478 extern MonoJitStats mono_jit_stats;
479
480 /* values for MonoInst.ssa_op */
481 enum {
482         MONO_SSA_NOP,
483         MONO_SSA_LOAD,
484         MONO_SSA_STORE,
485         MONO_SSA_MAYBE_LOAD,
486         MONO_SSA_MAYBE_STORE
487 };
488
489 #define OP_CEQ    (256+CEE_CEQ)
490 #define OP_CLT    (256+CEE_CLT)
491 #define OP_CLT_UN (256+CEE_CLT_UN)
492 #define OP_CGT    (256+CEE_CGT)
493 #define OP_CGT_UN (256+CEE_CGT_UN)
494 #define OP_LOCALLOC (256+CEE_LOCALLOC)
495
496 /* opcodes: value assigned after all the CIL opcodes */
497 #ifdef MINI_OP
498 #undef MINI_OP
499 #endif
500 #define MINI_OP(a,b) a,
501 enum {
502         OP_START = MONO_CEE_LAST,
503 #include "mini-ops.h"
504         OP_LAST
505 };
506 #undef MINI_OP
507
508 /* make this depend on 32bit platform (use OP_LADD otherwise) */
509 #define OP_PADD CEE_ADD
510 #define OP_PNEG CEE_NEG
511 #define OP_PCONV_TO_U2 CEE_CONV_U2
512 #define OP_PCONV_TO_OVF_I1_UN CEE_CONV_OVF_I1_UN
513 #define OP_PCONV_TO_OVF_I1 CEE_CONV_OVF_I1
514 #define OP_PCEQ CEE_CEQ
515
516 enum {
517         STACK_INV,
518         STACK_I4,
519         STACK_I8,
520         STACK_PTR,
521         STACK_R8,
522         STACK_MP,
523         STACK_OBJ,
524         STACK_VTYPE,
525         STACK_MAX
526 };
527
528 typedef struct {
529         union {
530                 double   r8;
531                 gint32   i4;
532                 gint64   i8;
533                 gpointer p;
534                 MonoClass *klass;
535         } data;
536         int type;
537 } StackSlot;
538
539 enum {
540         MONO_COMP_DOM = 1,
541         MONO_COMP_IDOM = 2,
542         MONO_COMP_DFRONTIER = 4,
543         MONO_COMP_DOM_REV = 8,
544         MONO_COMP_LIVENESS = 16,
545         MONO_COMP_SSA = 32,
546         MONO_COMP_SSA_DEF_USE = 64,
547         MONO_COMP_REACHABILITY = 128,
548         MONO_COMP_LOOPS = 256
549 };
550
551 typedef enum {
552         MONO_GRAPH_CFG = 1,
553         MONO_GRAPH_DTREE = 2,
554         MONO_GRAPH_CFG_CODE = 4,
555         MONO_GRAPH_CFG_SSA = 8,
556         MONO_GRAPH_CFG_OPTCODE = 16
557 } MonoGraphOptions;
558
559 typedef struct {
560         char *name;
561         gconstpointer func;
562         gconstpointer wrapper;
563         MonoMethodSignature *sig;
564 } MonoJitICallInfo;
565
566 typedef void (*MonoInstFunc) (MonoInst *tree, gpointer data);
567
568 /* main function */
569 int         mini_main                      (int argc, char* argv[]);
570 void        mini_set_defaults              (int verbose_level, guint32 opts);
571 MonoDomain* mini_init                      (const char *filename);
572 void        mini_cleanup                   (MonoDomain *domain);
573
574 /* helper methods */
575 int       mini_parse_default_optimizations  (const char* p);
576 void      mono_bblock_add_inst              (MonoBasicBlock *bb, MonoInst *inst);
577 void      mono_constant_fold                (MonoCompile *cfg);
578 void      mono_constant_fold_inst           (MonoInst *inst, gpointer data);
579 void      mono_cprop_local                  (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **acp, int acp_size);
580 MonoInst* mono_compile_create_var           (MonoCompile *cfg, MonoType *type, int opcode);
581 void      mono_blockset_print               (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom);
582 void      mono_print_tree                   (MonoInst *tree);
583 int       mono_spillvar_offset              (MonoCompile *cfg, int spillvar);
584 void      mono_select_instructions          (MonoCompile *cfg);
585 const char* mono_inst_name                  (int op);
586 void      mono_inst_foreach                 (MonoInst *tree, MonoInstFunc func, gpointer data);
587 void      mono_disassemble_code             (guint8 *code, int size, char *id);
588 guint     mono_type_to_ldind                (MonoType *t);
589 guint     mono_type_to_stind                (MonoType *t);
590 void      mono_add_patch_info               (MonoCompile *cfg, int ip, MonoJumpInfoType type, gconstpointer target);
591 void      mono_remove_patch_info            (MonoCompile *cfg, int ip);
592 gpointer  mono_get_lmf_addr                 (void);
593 GList    *mono_varlist_insert_sorted        (MonoCompile *cfg, GList *list, MonoMethodVar *mv, gboolean sort_end);
594 void      mono_analyze_liveness             (MonoCompile *cfg);
595 void      mono_linear_scan                  (MonoCompile *cfg, GList *vars, GList *regs, guint32 *used_mask);
596 void      mono_create_jump_table            (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
597 int       mono_compile_assembly             (MonoAssembly *ass, guint32 opts);
598 MonoCompile *mini_method_compile            (MonoMethod *method, guint32 opts, MonoDomain *domain, int parts);
599 void      mono_destroy_compile              (MonoCompile *cfg);
600 gpointer  mono_aot_get_method               (MonoMethod *method);
601 gboolean  mono_method_blittable             (MonoMethod *method);
602 void      mono_register_opcode_emulation    (int opcode, MonoMethodSignature *sig, gpointer func);
603 void      mono_arch_register_lowlevel_calls (void);
604 void      mono_draw_graph                   (MonoCompile *cfg, MonoGraphOptions draw_options);
605 void      mono_add_varcopy_to_end           (MonoCompile *cfg, MonoBasicBlock *bb, int src, int dest);
606
607 int               mono_find_method_opcode      (MonoMethod *method);
608 MonoJitICallInfo *mono_find_jit_icall_by_name  (const char *name);
609 MonoJitICallInfo *mono_find_jit_icall_by_addr  (gconstpointer addr);
610 MonoJitICallInfo *mono_register_jit_icall      (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
611
612 MonoCoverageInfo *mono_allocate_coverage_info (MonoMethod *method, int size);
613 MonoCoverageInfo *mono_get_coverage_info      (MonoMethod *method);
614
615 /* methods that must be provided by the arch-specific port */
616 guint32   mono_arch_cpu_optimizazions           (void);
617 void      mono_arch_instrument_mem_needs        (MonoMethod *method, int *stack, int *code);
618 void     *mono_arch_instrument_prolog           (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments);
619 void     *mono_arch_instrument_epilog           (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments);
620 MonoCallInst *mono_arch_call_opcode             (MonoCompile *cfg, MonoBasicBlock* bb, MonoCallInst *call, int is_virtual);
621 void      mono_codegen                          (MonoCompile *cfg);
622 const char *mono_arch_regname                   (int reg);
623 gpointer  mono_arch_get_throw_exception         (void);
624 gpointer  mono_arch_get_throw_exception_by_name (void);
625 gpointer  mono_arch_create_jit_trampoline       (MonoMethod *method);
626 GList    *mono_arch_get_allocatable_int_vars    (MonoCompile *cfg);
627 GList    *mono_arch_get_global_int_regs         (MonoCompile *cfg);
628 gboolean  mono_arch_handle_exception            (struct sigcontext *ctx, gpointer obj, gboolean test_only);
629 void      mono_arch_patch_code                  (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji);
630 void      mono_arch_flush_icache                (guint8 *code, gint size);
631 int       mono_arch_max_epilog_size             (MonoCompile *cfg);
632 guint8   *mono_arch_emit_prolog                 (MonoCompile *cfg);
633 void      mono_arch_emit_epilog                 (MonoCompile *cfg);
634 void      mono_arch_local_regalloc              (MonoCompile *cfg, MonoBasicBlock *bb);
635 void      mono_arch_output_basic_block          (MonoCompile *cfg, MonoBasicBlock *bb);
636 gboolean  mono_arch_has_unwind_info             (gconstpointer addr);
637 void      mono_arch_allocate_vars               (MonoCompile *m);
638 void      mono_jit_walk_stack                   (MonoStackWalk func, gpointer user_data);
639 MonoArray *ves_icall_get_trace                  (MonoException *exc, gint32 skip, MonoBoolean need_file_info);
640 MonoBoolean ves_icall_get_frame_info            (gint32 skip, MonoBoolean need_file_info, 
641                                                  MonoReflectionMethod **method, 
642                                                  gint32 *iloffset, gint32 *native_offset,
643                                                  MonoString **file, gint32 *line, gint32 *column);
644
645 /* Dominator/SSA methods */
646 void        mono_compile_dominator_info         (MonoCompile *cfg, int dom_flags);
647 void        mono_compute_natural_loops          (MonoCompile *cfg);
648 MonoBitSet* mono_compile_iterated_dfrontier     (MonoCompile *cfg, MonoBitSet *set);
649 void        mono_ssa_compute                    (MonoCompile *cfg);
650 void        mono_ssa_remove                     (MonoCompile *cfg);
651 void        mono_ssa_cprop                      (MonoCompile *cfg);
652 void        mono_ssa_deadce                     (MonoCompile *cfg);
653 void        mono_ssa_strength_reduction         (MonoCompile *cfg);
654
655 /* debugging support */
656 void      mono_debug_init_method                (MonoCompile *cfg, MonoBasicBlock *start_block);
657 void      mono_debug_open_method                (MonoCompile *cfg);
658 void      mono_debug_close_method               (MonoCompile *cfg);
659 void      mono_debug_open_block                 (MonoCompile *cfg, MonoBasicBlock *bb, guint32 address);
660 void      mono_debug_record_line_number         (MonoCompile *cfg, MonoInst *ins, guint32 address);
661
662 #endif /* __MONO_MINI_H__ */