[llvm-commits] [llvm] r62066 - in /llvm/trunk: lib/VMCore/Function.cpp utils/TableGen/IntrinsicEmitter.cpp

Chris Lattner sabre at nondot.org
Sun Jan 11 17:18:58 PST 2009


Author: lattner
Date: Sun Jan 11 19:18:58 2009
New Revision: 62066

URL: http://llvm.org/viewvc/llvm-project?rev=62066&view=rev
Log:
make tblgen emit the entire Intrinsic::getAttributes method, 
not a random piece of it.  No functionality change.


Modified:
    llvm/trunk/lib/VMCore/Function.cpp
    llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=62066&r1=62065&r2=62066&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Sun Jan 11 19:18:58 2009
@@ -359,20 +359,11 @@
   return FunctionType::get(ResultTy, ArgTys, IsVarArg); 
 }
 
-AttrListPtr Intrinsic::getAttributes(ID id) {
-  Attributes Attr = Attribute::None;
-
+/// This defines the "Intrinsic::getAttributes(ID id)" method.
 #define GET_INTRINSIC_ATTRIBUTES
 #include "llvm/Intrinsics.gen"
 #undef GET_INTRINSIC_ATTRIBUTES
 
-  // Intrinsics cannot throw exceptions.
-  Attr |= Attribute::NoUnwind;
-
-  AttributeWithIndex PAWI = AttributeWithIndex::get(~0, Attr);
-  return AttrListPtr::get(&PAWI, 1);
-}
-
 Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys, 
                                     unsigned numTys) {
   // There can never be multiple globals with the same name of different types,

Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=62066&r1=62065&r2=62066&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Sun Jan 11 19:18:58 2009
@@ -387,10 +387,14 @@
   OS << "#endif\n\n";
 }
 
+/// EmitAttributes - This emits the Intrinsic::getAttributes method.
 void IntrinsicEmitter::
 EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS) {
   OS << "// Add parameter attributes that are not common to all intrinsics.\n";
   OS << "#ifdef GET_INTRINSIC_ATTRIBUTES\n";
+  OS << "AttrListPtr Intrinsic::getAttributes(ID id) {";
+  OS << "  // No intrinsic can throw exceptions.\n";
+  OS << "  Attributes Attr = Attribute::NoUnwind;\n";
   OS << "  switch (id) {\n";
   OS << "  default: break;\n";
   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
@@ -415,6 +419,9 @@
   OS << "    Attr |= Attribute::ReadOnly; // These do not write memory.\n";
   OS << "    break;\n";
   OS << "  }\n";
+  OS << "  AttributeWithIndex PAWI = AttributeWithIndex::get(~0, Attr);\n";
+  OS << "  return AttrListPtr::get(&PAWI, 1);\n";
+  OS << "}\n";
   OS << "#endif\n\n";
 }
 





More information about the llvm-commits mailing list