Permalink
Browse files

[svn r355] Get rid of IRState::exps and topexp.

  • Loading branch information...
1 parent f0d8b9e commit 717d52d4f0ff34a98f34b7b7af638de43bb1b791 @ckamm ckamm committed Jul 12, 2008
Showing with 39 additions and 214 deletions.
  1. +0 −2 gen/arrays.cpp
  2. +0 −6 gen/dvalue.cpp
  3. +11 −8 gen/dvalue.h
  4. +0 −2 gen/functions.cpp
  5. +0 −20 gen/irstate.cpp
  6. +0 −14 gen/irstate.h
  7. +0 −2 gen/statements.cpp
  8. +28 −160 gen/toir.cpp
View
@@ -528,9 +528,7 @@ DSliceValue* DtoCatAssignElement(DValue* array, Expression* exp)
DValue* dptr = new DVarValue(exp->type, ptr, true);
- gIR->exps.push_back(IRExp(0,exp,dptr));
DValue* e = exp->toElem(gIR);
- gIR->exps.pop_back();
if (!e->inPlace())
DtoAssign(dptr, e);
View
@@ -72,12 +72,6 @@ DFuncValue::DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt)
cc = (unsigned)-1;
}
-LLValue* DFuncValue::getLVal()
-{
- assert(0);
- return 0;
-}
-
LLValue* DFuncValue::getRVal()
{
assert(val);
View
@@ -42,6 +42,8 @@ struct DValue : Object
virtual LLValue* getLVal() { assert(0); return 0; }
virtual LLValue* getRVal() { assert(0); return 0; }
+ virtual bool isLVal() { return false; }
+
virtual DImValue* isIm() { return NULL; }
virtual DConstValue* isConst() { return NULL; }
virtual DNullValue* isNull() { return NULL; }
@@ -113,6 +115,7 @@ struct DVarValue : DValue
DVarValue(Type* vd, LLValue* lv, LLValue* rv);
DVarValue(Type* t, LLValue* llvmValue, bool lvalue);
+ virtual bool isLVal() { return val && lval; }
virtual LLValue* getLVal();
virtual LLValue* getRVal();
@@ -134,13 +137,6 @@ struct DThisValue : DVarValue
virtual DThisValue* isThis() { return this; }
};
-// array length d-value
-struct DArrayLenValue : DVarValue
-{
- DArrayLenValue(Type* t, LLValue* llvmValue) : DVarValue(t, llvmValue, true) {}
- virtual DArrayLenValue* isArrayLen() { return this; }
-};
-
// slice d-value
struct DSliceValue : DValue
{
@@ -165,7 +161,6 @@ struct DFuncValue : DValue
DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt = 0);
- virtual LLValue* getLVal();
virtual LLValue* getRVal();
virtual Type* getType() { assert(type); return type; }
@@ -187,6 +182,7 @@ struct DLRValue : DValue
rval = r;
}
+ virtual bool isLVal() { return lval; }
virtual LLValue* getLVal() { assert(lval); return lval; }
virtual LLValue* getRVal() { assert(rval); return rval; }
@@ -196,6 +192,13 @@ struct DLRValue : DValue
virtual DLRValue* isLRValue() { return this; }
};
+// array length d-value
+struct DArrayLenValue : DLRValue
+{
+ DArrayLenValue(Type* lt, LLValue* l, Type* rt, LLValue* r) : DLRValue(lt, l, rt, r) {}
+ virtual DArrayLenValue* isArrayLen() { return this; }
+};
+
// complex number immediate d-value (much like slice)
struct DComplexValue : DValue
{
View
@@ -828,9 +828,7 @@ void DtoVariadicArgument(Expression* argexp, LLValue* dst)
Logger::println("DtoVariadicArgument");
LOG_SCOPE;
DVarValue* vv = new DVarValue(argexp->type, dst, true);
- gIR->exps.push_back(IRExp(NULL, argexp, vv));
DtoAssign(vv, argexp->toElem(gIR));
- gIR->exps.pop_back();
}
//////////////////////////////////////////////////////////////////////////////////////////
View
@@ -95,11 +95,6 @@ IrStruct* IRState::topstruct()
return structs.back();
}
-IRExp* IRState::topexp()
-{
- return exps.empty() ? NULL : &exps.back();
-}
-
IRScope& IRState::scope()
{
assert(!scopes.empty());
@@ -173,18 +168,3 @@ IRBuilder* IRBuilderHelper::operator->()
assert(b.GetInsertBlock() != NULL);
return &b;
}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-IRExp::IRExp()
-{
- e1 = e2 = NULL;
- v = NULL;
-}
-
-IRExp::IRExp(Expression* l, Expression* r, DValue* val)
-{
- e1 = l;
- e2 = r;
- v = val;
-}
View
@@ -59,15 +59,6 @@ struct IRBuilderHelper
IRBuilder* operator->();
};
-struct IRExp
-{
- Expression* e1;
- Expression* e2;
- DValue* v;
- IRExp();
- IRExp(Expression* l, Expression* r, DValue* val);
-};
-
struct IRAsmStmt
{
std::string code;
@@ -161,11 +152,6 @@ struct IRState
bool emitMain;
llvm::Function* mainFunc;
- // expression l/r value handling
- typedef std::vector<IRExp> ExpVec;
- ExpVec exps;
- IRExp* topexp();
-
// basic block scopes
std::vector<IRScope> scopes;
IRScope& scope();
View
@@ -64,9 +64,7 @@ void ReturnStatement::toIR(IRState* p)
DValue* rvar = new DVarValue(f->type->next, f->decl->ir.irFunc->retArg, true);
- p->exps.push_back(IRExp(NULL,exp,rvar));
DValue* e = exp->toElem(p);
- p->exps.pop_back();
if (!e->inPlace())
DtoAssign(rvar, e);
Oops, something went wrong.

0 comments on commit 717d52d

Please sign in to comment.