comparison gen/irstate.h @ 54:28e99b04a132 trunk

[svn r58] Fixed cond expression resulting in a non-basic type. Fixed identity expression for dynamic arrays. Revamped the system to keep track of lvalues and rvalues and their relations. Typedef declaration now generate the custom typeinfo. Other bugfixes.
author lindquist
date Wed, 24 Oct 2007 01:37:34 +0200
parents 8b0e809563df
children b706170e24a9
comparison
equal deleted inserted replaced
53:06ccc817acd4 54:28e99b04a132
86 { 86 {
87 IRState* state; 87 IRState* state;
88 LLVMBuilder* operator->(); 88 LLVMBuilder* operator->();
89 }; 89 };
90 90
91 struct IRExp
92 {
93 Expression* e1;
94 Expression* e2;
95 llvm::Value* v;
96 IRExp();
97 IRExp(Expression* l, Expression* r, llvm::Value* val);
98 };
99
91 // represents the module 100 // represents the module
92 struct IRState 101 struct IRState
93 { 102 {
94 IRState(); 103 IRState();
95 104
117 126
118 // D main function 127 // D main function
119 bool emitMain; 128 bool emitMain;
120 llvm::Function* mainFunc; 129 llvm::Function* mainFunc;
121 130
122 // L-values 131 // expression l/r value handling
123 bool inLvalue; 132 typedef std::vector<IRExp> ExpVec;
124 typedef std::vector<llvm::Value*> LvalVec; 133 ExpVec exps;
125 LvalVec lvals; 134 IRExp* topexp();
126 llvm::Value* toplval();
127 135
128 // basic block scopes 136 // basic block scopes
129 std::vector<IRScope> scopes; 137 std::vector<IRScope> scopes;
130 IRScope& scope(); 138 IRScope& scope();
131 llvm::BasicBlock* scopebegin(); 139 llvm::BasicBlock* scopebegin();
139 147
140 // this holds the array being indexed or sliced so $ will work 148 // this holds the array being indexed or sliced so $ will work
141 // might be a better way but it works. problem is I only get a 149 // might be a better way but it works. problem is I only get a
142 // VarDeclaration for __dollar, but I can't see how to get the 150 // VarDeclaration for __dollar, but I can't see how to get the
143 // array pointer from this :( 151 // array pointer from this :(
144 LvalVec arrays; 152 std::vector<llvm::Value*> arrays;
145 153
146 // builder helper 154 // builder helper
147 IRBuilderHelper ir; 155 IRBuilderHelper ir;
148 }; 156 };
149 157