diff options
author | Chris Lattner <sabre@nondot.org> | 2003-05-08 02:44:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-05-08 02:44:12 +0000 |
commit | 8f77daef04355c00b78b645f5aae5694e7a8b631 (patch) | |
tree | 44b5b785fe68c331d24b79ca5f6faa3850b9d586 /lib/VMCore | |
parent | 97b315a58581261ec4bd6430ec9b438ba5fb728e (diff) |
Add support for the new va_arg instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 9 | ||||
-rw-r--r-- | lib/VMCore/Instruction.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 8 |
3 files changed, 15 insertions, 5 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index c060a8df20..28f26c833a 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -3,8 +3,7 @@ // This library implements the functionality defined in llvm/Assembly/Writer.h // // Note that these routines must be extremely tolerant of various errors in the -// LLVM code, because of of the primary uses of it is for debugging -// transformations. +// LLVM code, because it can be used for debugging transformations. // //===----------------------------------------------------------------------===// @@ -814,9 +813,13 @@ void AssemblyWriter::printInstruction(const Instruction &I) { writeOperand(AI->getArraySize(), true); } } else if (isa<CastInst>(I)) { - if (Operand) writeOperand(Operand, true); + writeOperand(Operand, true); Out << " to "; printType(I.getType()); + } else if (isa<VarArgInst>(I)) { + writeOperand(Operand, true); + Out << ", "; + printType(I.getType()); } else if (Operand) { // Print the normal way... // PrintAllTypes - Instructions who have operands of all the same type diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 01381faed6..ce1423a863 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -91,7 +91,8 @@ const char *Instruction::getOpcodeName(unsigned OpCode) { case Call: return "call"; case Shl: return "shl"; case Shr: return "shr"; - + case VarArg: return "va_arg"; + default: return "<Invalid operator> "; } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index f7bcf5044d..66ee9de4c1 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -130,6 +130,7 @@ namespace { // Anonymous namespace for class void visitPHINode(PHINode &PN); void visitBinaryOperator(BinaryOperator &B); void visitShiftInst(ShiftInst &SI); + void visitVarArgInst(VarArgInst &VAI); void visitCallInst(CallInst &CI); void visitGetElementPtrInst(GetElementPtrInst &GEP); void visitLoadInst(LoadInst &LI); @@ -402,7 +403,12 @@ void Verifier::visitShiftInst(ShiftInst &SI) { visitInstruction(SI); } - +void Verifier::visitVarArgInst(VarArgInst &VAI) { + Assert1(VAI.getParent()->getParent()->getFunctionType()->isVarArg(), + "va_arg instruction may only occur in function with variable args!", + &VAI); + visitInstruction(VAI); +} void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) { const Type *ElTy = |