diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-01-18 01:01:34 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-01-18 01:01:34 +0000 |
commit | 3d309f9d62a6f9f634b869937139d533ccd7265b (patch) | |
tree | edebe93bfd90e6cf526952c13ce467d5b1c7e399 /lib/AST/APValue.cpp | |
parent | 334a802eeb5acb959f99b8227ee995725b2624aa (diff) |
Add support for vectors to APValue. Vector constant evaluator and tests coming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62438 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/APValue.cpp')
-rw-r--r-- | lib/AST/APValue.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp index 38a89aa99e..87d9fc3442 100644 --- a/lib/AST/APValue.cpp +++ b/lib/AST/APValue.cpp @@ -23,6 +23,8 @@ const APValue &APValue::operator=(const APValue &RHS) { MakeInt(); else if (RHS.isFloat()) MakeFloat(); + else if (RHS.isVector()) + MakeVector(); else if (RHS.isComplexInt()) MakeComplexInt(); else if (RHS.isComplexFloat()) @@ -34,6 +36,8 @@ const APValue &APValue::operator=(const APValue &RHS) { setInt(RHS.getInt()); else if (isFloat()) setFloat(RHS.getFloat()); + else if (isVector()) + setVector(((Vec*)(void*)RHS.Data)->Elts, RHS.getVectorLength()); else if (isComplexInt()) setComplexInt(RHS.getComplexIntReal(), RHS.getComplexIntImag()); else if (isComplexFloat()) @@ -48,6 +52,8 @@ void APValue::MakeUninit() { ((APSInt*)(void*)Data)->~APSInt(); else if (Kind == Float) ((APFloat*)(void*)Data)->~APFloat(); + else if (Kind == Vector) + ((Vec*)(void*)Data)->~Vec(); else if (Kind == ComplexInt) ((ComplexAPSInt*)(void*)Data)->~ComplexAPSInt(); else if (Kind == ComplexFloat) @@ -55,6 +61,7 @@ void APValue::MakeUninit() { else if (Kind == LValue) { ((LV*)(void*)Data)->~LV(); } + Kind = Uninitialized; } void APValue::dump() const { @@ -83,6 +90,9 @@ void APValue::print(llvm::raw_ostream &OS) const { case Float: OS << "Float: " << GetApproxValue(getFloat()); return; + case Vector: + OS << "Vector: <todo>"; + return; case ComplexInt: OS << "ComplexInt: " << getComplexIntReal() << ", " << getComplexIntImag(); return; |