diff 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
line wrap: on
line diff
--- a/gen/irstate.h	Tue Oct 23 07:16:02 2007 +0200
+++ b/gen/irstate.h	Wed Oct 24 01:37:34 2007 +0200
@@ -88,6 +88,15 @@
     LLVMBuilder* operator->();
 };
 
+struct IRExp
+{
+    Expression* e1;
+    Expression* e2;
+    llvm::Value* v;
+    IRExp();
+    IRExp(Expression* l, Expression* r, llvm::Value* val);
+};
+
 // represents the module
 struct IRState
 {
@@ -119,11 +128,10 @@
     bool emitMain;
     llvm::Function* mainFunc;
 
-    // L-values
-    bool inLvalue;
-    typedef std::vector<llvm::Value*> LvalVec;
-    LvalVec lvals;
-    llvm::Value* toplval();
+    // expression l/r value handling
+    typedef std::vector<IRExp> ExpVec;
+    ExpVec exps;
+    IRExp* topexp();
 
     // basic block scopes
     std::vector<IRScope> scopes;
@@ -141,7 +149,7 @@
     // might be a better way but it works. problem is I only get a
     // VarDeclaration for __dollar, but I can't see how to get the
     // array pointer from this :(
-    LvalVec arrays;
+    std::vector<llvm::Value*> arrays;
 
     // builder helper
     IRBuilderHelper ir;