aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-06 21:28:12 +0000
committerChris Lattner <sabre@nondot.org>2001-11-06 21:28:12 +0000
commit268de0464ee9f0938bfa145fdd5e7f1a46b21cf7 (patch)
treeeced24397c4c8a86261ca8e3deb189af37289a12 /lib/VMCore
parent54b7741dff59cd96647cee18e63df7689de28ca2 (diff)
downloadexternal_llvm-268de0464ee9f0938bfa145fdd5e7f1a46b21cf7.zip
external_llvm-268de0464ee9f0938bfa145fdd5e7f1a46b21cf7.tar.gz
external_llvm-268de0464ee9f0938bfa145fdd5e7f1a46b21cf7.tar.bz2
Print out the abridged form of the call instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index ba4db9e..dda9f73 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -529,8 +529,21 @@ void AssemblyWriter::printInstruction(const Instruction *I) {
} else if (isa<ReturnInst>(I) && !Operand) {
Out << " void";
} else if (isa<CallInst>(I)) {
- // TODO: Should try to print out short form of the Call instruction
- writeOperand(Operand, true);
+ const PointerType *PTy = dyn_cast<PointerType>(Operand->getType());
+ const MethodType *MTy = PTy ? dyn_cast<MethodType>(PTy->getValueType()) :0;
+ const Type *RetTy = MTy ? MTy->getReturnType() : 0;
+
+ // If possible, print out the short form of the call instruction, but we can
+ // only do this if the first argument is a pointer to a nonvararg method,
+ // and if the value returned is not a pointer to a method.
+ //
+ if (RetTy && !MTy->isVarArg() &&
+ (!isa<PointerType>(RetTy)||!isa<MethodType>(cast<PointerType>(RetTy)))){
+ Out << " "; printType(RetTy);
+ writeOperand(Operand, false);
+ } else {
+ writeOperand(Operand, true);
+ }
Out << "(";
if (I->getNumOperands() > 1) writeOperand(I->getOperand(1), true);
for (unsigned op = 2, Eop = I->getNumOperands(); op < Eop; ++op) {