This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mono / mini / abcremoval.h
1 /*
2  * abcremoval.h: Array bounds check removal
3  *
4  * Author:
5  *   Massimiliano Mantione (massi@ximian.com)
6  *
7  * (C) 2004 Ximian, Inc.  http://www.ximian.com
8  */
9
10 #ifndef __MONO_ABCREMOVAL_H__
11 #define __MONO_ABCREMOVAL_H__
12
13 #include "mini.h"
14
15
16 typedef enum {
17         MONO_EQ_RELATION = 1,
18         MONO_LT_RELATION = 2,
19         MONO_GT_RELATION = 4,
20         MONO_NE_RELATION = (MONO_LT_RELATION|MONO_GT_RELATION),
21         MONO_LE_RELATION = (MONO_LT_RELATION|MONO_EQ_RELATION),
22         MONO_GE_RELATION = (MONO_GT_RELATION|MONO_EQ_RELATION),
23         MONO_ANY_RELATION = (MONO_EQ_RELATION|MONO_LT_RELATION|MONO_GT_RELATION),
24         MONO_NO_RELATION = 0
25 } MonoValueRelation;
26
27
28 typedef enum {
29         MONO_CONSTANT_SUMMARIZED_VALUE = 0,
30         MONO_VARIABLE_SUMMARIZED_VALUE,
31         MONO_PHI_SUMMARIZED_VALUE
32 } MonoSummarizedValueType;
33
34
35 typedef struct MonoSummarizedValue {
36         unsigned char relation_with_zero; /* MonoValueRelation */
37         unsigned char relation_with_one; /* MonoValueRelation */
38         unsigned char relation_with_value; /* MonoValueRelation */
39         unsigned char value_type; /* MonoSummarizedValueType */
40         union {
41                 int constant;
42                 gssize variable;
43                 int *phi_variables;
44         } value;
45 } MonoSummarizedValue;
46
47
48 typedef struct MonoBranchCondition {
49         gssize variable;
50         MonoSummarizedValue value;
51 } MonoBranchCondition;
52
53 typedef struct MonoBranchData {
54         MonoBasicBlock *destination_block;
55         int number_of_conditions;
56         MonoBranchCondition *conditions;
57 } MonoBranchData;
58
59 typedef struct MonoSummarizedBasicBlock {
60         MonoBasicBlock *block;
61         unsigned char has_array_access_instructions;
62         int number_of_branches;
63         MonoBranchData* branches;
64 } MonoSummarizedBasicBlock;
65
66 typedef enum {
67         MONO_RELATIONS_EVALUATION_NOT_STARTED,
68         MONO_RELATIONS_EVALUATION_IN_PROGRESS,
69         MONO_RELATIONS_EVALUATION_COMPLETED
70 } MonoRelationsEvaluationStep;
71
72 typedef struct MonoVariableRelations {
73         unsigned char relation_with_zero; /* MonoValueRelation */
74         unsigned char relation_with_one; /* MonoValueRelation */
75         unsigned char evaluation_step; /* MonoRelationsEvaluationStep */
76         unsigned char definition_is_recursive;
77         unsigned char *relations_with_variables; /* many MonoValueRelation */
78 } MonoVariableRelations;
79
80 typedef struct MonoVariableRelationsEvaluationArea {
81         MonoCompile *cfg;
82         MonoMemPool *pool;
83         MonoVariableRelations *variable_relations;
84         MonoSummarizedValue *variable_definitions;
85         MonoSummarizedBasicBlock *blocks;
86 } MonoVariableRelationsEvaluationArea;
87
88 typedef struct MonoRelationsEvaluationContext {
89         struct MonoRelationsEvaluationContext *father_context;
90         gssize variable;
91 } MonoRelationsEvaluationContext;
92
93 #endif /* __MONO_ABCREMOVAL_H__ */
94