diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-27 22:48:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-27 22:48:18 +0000 |
commit | 8850a1bcef0c2a785f918395fe0a05054914b349 (patch) | |
tree | 9a089c6a87ca9b2e620c534d796095aed393143a /utils/TableGen/CodeGenTarget.cpp | |
parent | e1562c82ca9a3be3582d4c80ac6fa298e8137990 (diff) |
Add support for decoding iPTR to the right pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenTarget.cpp')
-rw-r--r-- | utils/TableGen/CodeGenTarget.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index 42864f54f3..6bee477f31 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -29,8 +29,13 @@ AsmWriterNum("asmwriternum", cl::init(0), /// getValueType - Return the MCV::ValueType that the specified TableGen record /// corresponds to. -MVT::ValueType llvm::getValueType(Record *Rec) { - return (MVT::ValueType)Rec->getValueAsInt("Value"); +MVT::ValueType llvm::getValueType(Record *Rec, const CodeGenTarget *CGT) { + MVT::ValueType VT = (MVT::ValueType)Rec->getValueAsInt("Value"); + if (VT == MVT::iPTR) { + assert(CGT && "Use a pointer type in a place that isn't supported yet!"); + VT = CGT->getPointerType(); + } + return VT; } std::string llvm::getName(MVT::ValueType T) { @@ -355,10 +360,15 @@ ComplexPattern::ComplexPattern(Record *R) { std::vector<CodeGenIntrinsic> llvm::LoadIntrinsics(const RecordKeeper &RC) { std::vector<Record*> I = RC.getAllDerivedDefinitions("Intrinsic"); - return std::vector<CodeGenIntrinsic>(I.begin(), I.end()); + + std::vector<CodeGenIntrinsic> Result; + CodeGenTarget CGT; + for (unsigned i = 0, e = I.size(); i != e; ++i) + Result.push_back(CodeGenIntrinsic(I[i], CGT)); + return Result; } -CodeGenIntrinsic::CodeGenIntrinsic(Record *R) { +CodeGenIntrinsic::CodeGenIntrinsic(Record *R, CodeGenTarget &CGT) { TheDef = R; std::string DefName = R->getName(); ModRef = WriteMem; @@ -405,7 +415,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) { assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!"); ArgTypes.push_back(TyEl->getValueAsString("TypeVal")); - ArgVTs.push_back(getValueType(TyEl->getValueAsDef("VT"))); + ArgVTs.push_back(getValueType(TyEl->getValueAsDef("VT"), &CGT)); ArgTypeDefs.push_back(TyEl); } if (ArgTypes.size() == 0) |