[llvm-commits] CVS: llvm/utils/TableGen/CodeGenIntrinsics.h CodeGenTarget.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 27 16:15:12 PST 2006



Changes in directory llvm/utils/TableGen:

CodeGenIntrinsics.h updated: 1.9 -> 1.10
CodeGenTarget.cpp updated: 1.61 -> 1.62
---
Log message:

Only compute intrinsic valuetypes when in a target .td file.


---
Diffs of the changes:  (+16 -3)

 CodeGenIntrinsics.h |    5 ++++-
 CodeGenTarget.cpp   |   14 ++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)


Index: llvm/utils/TableGen/CodeGenIntrinsics.h
diff -u llvm/utils/TableGen/CodeGenIntrinsics.h:1.9 llvm/utils/TableGen/CodeGenIntrinsics.h:1.10
--- llvm/utils/TableGen/CodeGenIntrinsics.h:1.9	Mon Mar 27 18:03:08 2006
+++ llvm/utils/TableGen/CodeGenIntrinsics.h	Mon Mar 27 18:15:00 2006
@@ -34,7 +34,10 @@
     /// of the arguments.  These are things like Type::UIntTyID.
     std::vector<std::string> 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<MVT::ValueType> ArgVTs;
     
     /// ArgTypeDefs - The records for each argument type.


Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.61 llvm/utils/TableGen/CodeGenTarget.cpp:1.62
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.61	Mon Mar 27 18:03:08 2006
+++ llvm/utils/TableGen/CodeGenTarget.cpp	Mon Mar 27 18:15:00 2006
@@ -362,8 +362,17 @@
   std::vector<Record*> I = RC.getAllDerivedDefinitions("Intrinsic");
   
   std::vector<CodeGenIntrinsic> 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 @@
     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)






More information about the llvm-commits mailing list