[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Instruction.cpp Instructions.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu May 5 22:51:08 PDT 2005



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.176 -> 1.177
Instruction.cpp updated: 1.45 -> 1.46
Instructions.cpp updated: 1.17 -> 1.18
---
Log message:

Add a 'tail' marker for call instructions, patch contributed by
Alexander Friedman.



---
Diffs of the changes:  (+9 -2)

 AsmWriter.cpp    |    8 ++++++--
 Instruction.cpp  |    2 ++
 Instructions.cpp |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.176 llvm/lib/VMCore/AsmWriter.cpp:1.177
--- llvm/lib/VMCore/AsmWriter.cpp:1.176	Thu Apr 21 18:46:51 2005
+++ llvm/lib/VMCore/AsmWriter.cpp	Fri May  6 00:50:54 2005
@@ -1043,10 +1043,14 @@
   if (I.hasName())
     Out << getLLVMName(I.getName()) << " = ";
 
-  // If this is a volatile load or store, print out the volatile marker
+  // If this is a volatile load or store, print out the volatile marker.
   if ((isa<LoadInst>(I)  && cast<LoadInst>(I).isVolatile()) ||
-      (isa<StoreInst>(I) && cast<StoreInst>(I).isVolatile()))
+      (isa<StoreInst>(I) && cast<StoreInst>(I).isVolatile())) {
       Out << "volatile ";
+  } else if (isa<CallInst>(I) && cast<CallInst>(I).isTailCall()) {
+    // If this is a call, check if it's a tail call.
+    Out << "tail ";
+  }
 
   // Print out the opcode...
   Out << I.getOpcodeName();


Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.45 llvm/lib/VMCore/Instruction.cpp:1.46
--- llvm/lib/VMCore/Instruction.cpp:1.45	Thu Apr 21 18:46:51 2005
+++ llvm/lib/VMCore/Instruction.cpp	Fri May  6 00:50:54 2005
@@ -141,6 +141,8 @@
     return SI->isVolatile() == cast<StoreInst>(I)->isVolatile();
   if (const VANextInst *VAN = dyn_cast<VANextInst>(this))
     return VAN->getArgType() == cast<VANextInst>(I)->getArgType();
+  if (const CallInst *CI = dyn_cast<CallInst>(this))
+    return CI->isTailCall() == cast<CallInst>(I)->isTailCall();
   return true;
 }
 


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.17 llvm/lib/VMCore/Instructions.cpp:1.18
--- llvm/lib/VMCore/Instructions.cpp:1.17	Tue May  3 11:44:45 2005
+++ llvm/lib/VMCore/Instructions.cpp	Fri May  6 00:50:54 2005
@@ -249,6 +249,7 @@
 CallInst::CallInst(const CallInst &CI)
   : Instruction(CI.getType(), Instruction::Call, new Use[CI.getNumOperands()],
                 CI.getNumOperands()) {
+  setTailCall(CI.isTailCall());
   Use *OL = OperandList;
   Use *InOL = CI.OperandList;
   for (unsigned i = 0, e = CI.getNumOperands(); i != e; ++i)






More information about the llvm-commits mailing list