[llvm-commits] [llvm] r62071 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp utils/TableGen/IntrinsicEmitter.cpp

Chris Lattner sabre at nondot.org
Sun Jan 11 18:41:37 PST 2009


Author: lattner
Date: Sun Jan 11 20:41:37 2009
New Revision: 62071

URL: http://llvm.org/viewvc/llvm-project?rev=62071&view=rev
Log:
make tblgen autogenerate the nocapture intrinsics for 
llvm.memcpy/memset/memmove.  This allows removal of some 
hackish code from basicaa.

Modified:
    llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
    llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=62071&r1=62070&r2=62071&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Jan 11 20:41:37 2009
@@ -69,10 +69,6 @@
       if (cast<CallInst>(I)->paramHasAttr(UI.getOperandNo(), 
                                           Attribute::NoCapture))
         continue;
-
-      // FIXME: MemIntrinsics should have their operands marked nocapture!
-      if (isa<MemIntrinsic>(I))
-        continue;  // next use
       return true;
     case Instruction::Invoke:
       // If the argument to the call has the nocapture attribute, then the call

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

==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Sun Jan 11 20:41:37 2009
@@ -423,8 +423,7 @@
   OS << "    break;\n";
   OS << "  }\n";
   OS << "  AttributeWithIndex AWI[" << MaxArgAttrs+1 << "];\n";
-  OS << "  AWI[0] = AttributeWithIndex::get(~0, Attr);\n";
-  OS << "  unsigned NumAttrs = 1;\n";
+  OS << "  unsigned NumAttrs = 0;\n";
   OS << "  switch (id) {\n";
   OS << "  default: break;\n";
   
@@ -441,17 +440,33 @@
 
     unsigned NumArgsWithAttrs = 0;
 
-    // FIXME: EMIT ATTRS
-    
+    while (!ArgAttrs.empty()) {
+      unsigned ArgNo = ArgAttrs[0].first;
+      
+      OS << "    AWI[" << NumArgsWithAttrs++ << "] = AttributeWithIndex::get("
+         << ArgNo+1 << ", 0";
+
+      while (!ArgAttrs.empty() && ArgAttrs[0].first == ArgNo) {
+        switch (ArgAttrs[0].second) {
+        default: assert(0 && "Unknown arg attribute");
+        case CodeGenIntrinsic::NoCapture:
+          OS << "|Attribute::NoCapture";
+          break;
+        }
+        ArgAttrs.erase(ArgAttrs.begin());
+      }
+      OS << ");\n";
+    }
     
-    OS << "    NumAttrs = " << NumArgsWithAttrs+1 << ";\n";
+    OS << "    NumAttrs = " << NumArgsWithAttrs << ";\n";
     OS << "    break;\n";
   }
   
   OS << "  }\n";
-  OS << "  return AttrListPtr::get(AWI, NumAttrs);\n";
+  OS << "  AWI[NumAttrs] = AttributeWithIndex::get(~0, Attr);\n";
+  OS << "  return AttrListPtr::get(AWI, NumAttrs+1);\n";
   OS << "}\n";
-  OS << "#endif\n\n";
+  OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n";
 }
 
 void IntrinsicEmitter::





More information about the llvm-commits mailing list