From 6a160fba223a472f8ce4d0adef044660f69b4417 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 28 Mar 2006 00:15:00 +0000 Subject: Only compute intrinsic valuetypes when in a target .td file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27197 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/CodeGenIntrinsics.h | 5 ++++- utils/TableGen/CodeGenTarget.cpp | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'utils/TableGen') diff --git a/utils/TableGen/CodeGenIntrinsics.h b/utils/TableGen/CodeGenIntrinsics.h index f986ed1995..4bae8f15a5 100644 --- a/utils/TableGen/CodeGenIntrinsics.h +++ b/utils/TableGen/CodeGenIntrinsics.h @@ -34,7 +34,10 @@ namespace llvm { /// of the arguments. These are things like Type::UIntTyID. std::vector ArgTypes; - /// ArgVTs - The MVT::ValueType for each argument type. + /// ArgVTs - The MVT::ValueType for each argument type. Note that this list + /// is only populated when in the context of a target .td file. When + /// building Intrinsics.td, this isn't available, because we don't know the + /// target pointer size. std::vector ArgVTs; /// ArgTypeDefs - The records for each argument type. diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index e8c133578f..f9bae9f961 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -362,8 +362,17 @@ std::vector llvm::LoadIntrinsics(const RecordKeeper &RC) { std::vector I = RC.getAllDerivedDefinitions("Intrinsic"); std::vector Result; + + // If we are in the context of a target .td file, get the target info so that + // we can decode the current intptr_t. + CodeGenTarget *CGT = 0; + if (Records.getClass("Target") && + Records.getAllDerivedDefinitions("Target").size() == 1) + CGT = new CodeGenTarget(); + for (unsigned i = 0, e = I.size(); i != e; ++i) - Result.push_back(CodeGenIntrinsic(I[i], 0)); + Result.push_back(CodeGenIntrinsic(I[i], CGT)); + delete CGT; return Result; } @@ -414,7 +423,8 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R, CodeGenTarget *CGT) { assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!"); ArgTypes.push_back(TyEl->getValueAsString("TypeVal")); - ArgVTs.push_back(getValueType(TyEl->getValueAsDef("VT"), 0)); + if (CGT) + ArgVTs.push_back(getValueType(TyEl->getValueAsDef("VT"), CGT)); ArgTypeDefs.push_back(TyEl); } if (ArgTypes.size() == 0) -- cgit v1.2.3