Fri May 14 14:28:22 CEST 2004 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / mini / abcremoval.h
1
2 #include "mini.h"
3
4
5 typedef enum {
6         MONO_EQ_RELATION = 1,
7         MONO_LT_RELATION = 2,
8         MONO_GT_RELATION = 4,
9         MONO_NE_RELATION = (MONO_LT_RELATION|MONO_GT_RELATION),
10         MONO_LE_RELATION = (MONO_LT_RELATION|MONO_EQ_RELATION),
11         MONO_GE_RELATION = (MONO_GT_RELATION|MONO_EQ_RELATION),
12         MONO_ANY_RELATION = (MONO_EQ_RELATION|MONO_LT_RELATION|MONO_GT_RELATION),
13         MONO_NO_RELATION = 0
14 } MonoValueRelation;
15
16
17 typedef enum {
18         MONO_CONSTANT_SUMMARIZED_VALUE = 0,
19         MONO_VARIABLE_SUMMARIZED_VALUE,
20         MONO_PHI_SUMMARIZED_VALUE
21 } MonoSummarizedValueType;
22
23
24 typedef struct MonoSummarizedValue {
25         unsigned char relation_with_zero; /* MonoValueRelation */
26         unsigned char relation_with_one; /* MonoValueRelation */
27         unsigned char relation_with_value; /* MonoValueRelation */
28         unsigned char value_type; /* MonoSummarizedValueType */
29         union {
30                 int constant;
31                 gssize variable;
32                 int *phi_variables;
33         } value;
34 } MonoSummarizedValue;
35
36
37 typedef struct MonoBranchCondition {
38         gssize variable;
39         MonoSummarizedValue value;
40 } MonoBranchCondition;
41
42 typedef struct MonoBranchData {
43         MonoBasicBlock *destination_block;
44         int number_of_conditions;
45         MonoBranchCondition *conditions;
46 } MonoBranchData;
47
48 typedef struct MonoSummarizedBasicBlock {
49         MonoBasicBlock *block;
50         unsigned char has_array_access_instructions;
51         int number_of_branches;
52         MonoBranchData* branches;
53 } MonoSummarizedBasicBlock;
54
55 typedef enum {
56         MONO_RELATIONS_EVALUATION_NOT_STARTED,
57         MONO_RELATIONS_EVALUATION_IN_PROGRESS,
58         MONO_RELATIONS_EVALUATION_COMPLETED
59 } MonoRelationsEvaluationStep;
60
61 typedef struct MonoVariableRelations {
62         unsigned char relation_with_zero; /* MonoValueRelation */
63         unsigned char relation_with_one; /* MonoValueRelation */
64         unsigned char evaluation_step; /* MonoRelationsEvaluationStep */
65         unsigned char definition_is_recursive;
66         unsigned char *relations_with_variables; /* many MonoValueRelation */
67 } MonoVariableRelations;
68
69 typedef struct MonoVariableRelationsEvaluationArea {
70         MonoCompile *cfg;
71         MonoMemPool *pool;
72         MonoVariableRelations *variable_relations;
73         MonoSummarizedValue *variable_definitions;
74         MonoSummarizedBasicBlock *blocks;
75 } MonoVariableRelationsEvaluationArea;
76
77 typedef struct MonoRelationsEvaluationContext {
78         struct MonoRelationsEvaluationContext *father_context;
79         gssize variable;
80 } MonoRelationsEvaluationContext;
81
82 extern void
83 mono_perform_abc_removal (MonoCompile *cfg);