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

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 9 14:38:04 PST 2006



Changes in directory llvm/utils/TableGen:

IntrinsicEmitter.cpp updated: 1.4 -> 1.5
IntrinsicEmitter.h updated: 1.4 -> 1.5
---
Log message:

generate side-effect info


---
Diffs of the changes:  (+27 -0)

 IntrinsicEmitter.cpp |   25 +++++++++++++++++++++++++
 IntrinsicEmitter.h   |    2 ++
 2 files changed, 27 insertions(+)


Index: llvm/utils/TableGen/IntrinsicEmitter.cpp
diff -u llvm/utils/TableGen/IntrinsicEmitter.cpp:1.4 llvm/utils/TableGen/IntrinsicEmitter.cpp:1.5
--- llvm/utils/TableGen/IntrinsicEmitter.cpp:1.4	Thu Mar  9 16:30:49 2006
+++ llvm/utils/TableGen/IntrinsicEmitter.cpp	Thu Mar  9 16:37:52 2006
@@ -100,6 +100,9 @@
   
   // Emit mod/ref info for each function.
   EmitModRefInfo(Ints, OS);
+  
+  // Emit side effect info for each function.
+  EmitSideEffectInfo(Ints, OS);
 }
 
 void IntrinsicEmitter::EmitEnumInfo(const std::vector<CodeGenIntrinsic> &Ints,
@@ -191,3 +194,25 @@
   }
   OS << "#endif\n\n";
 }
+
+void IntrinsicEmitter::
+EmitSideEffectInfo(const std::vector<CodeGenIntrinsic> &Ints, std::ostream &OS){
+  OS << "// isInstructionTriviallyDead code.\n";
+  OS << "#ifdef GET_SIDE_EFFECT_INFO\n";
+  OS << "  switch (F->getIntrinsicID()) {\n";
+  OS << "  default: break;\n";
+  for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
+    switch (Ints[i].ModRef) {
+      default: break;
+      case CodeGenIntrinsic::NoMem:
+      case CodeGenIntrinsic::ReadArgMem:
+      case CodeGenIntrinsic::ReadMem:
+        OS << "  case Intrinsic::" << Ints[i].EnumName << ":\n";
+        break;
+    }
+  }
+  OS << "    return true; // These intrinsics have no side effects.\n";
+  OS << "  }\n";
+  OS << "#endif\n\n";
+  
+}


Index: llvm/utils/TableGen/IntrinsicEmitter.h
diff -u llvm/utils/TableGen/IntrinsicEmitter.h:1.4 llvm/utils/TableGen/IntrinsicEmitter.h:1.5
--- llvm/utils/TableGen/IntrinsicEmitter.h:1.4	Thu Mar  9 16:30:49 2006
+++ llvm/utils/TableGen/IntrinsicEmitter.h	Thu Mar  9 16:37:52 2006
@@ -35,6 +35,8 @@
                       std::ostream &OS);
     void EmitModRefInfo(const std::vector<CodeGenIntrinsic> &Ints, 
                         std::ostream &OS);
+    void EmitSideEffectInfo(const std::vector<CodeGenIntrinsic> &Ints, 
+                            std::ostream &OS);
   };
 
 } // End llvm namespace






More information about the llvm-commits mailing list