diff options
author | Dan Gohman <gohman@apple.com> | 2008-05-31 19:12:39 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-05-31 19:12:39 +0000 |
commit | a76f0f7031e341667c8a1a8ee6e6b55f1b191353 (patch) | |
tree | ff81abec773dfd1276328b34796f9acee3a9e83c /llvm/lib/VMCore/AsmWriter.cpp | |
parent | ca0256abb26dd11507a7f484632284a811681ba6 (diff) | |
download | bcm5719-llvm-a76f0f7031e341667c8a1a8ee6e6b55f1b191353.tar.gz bcm5719-llvm-a76f0f7031e341667c8a1a8ee6e6b55f1b191353.zip |
AsmWriter support for insertvalue/extractvalue. These instructions can
now round-trip through assembly and bitcode.
llvm-svn: 51823
Diffstat (limited to 'llvm/lib/VMCore/AsmWriter.cpp')
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 3d39553e727..d8372ef0063 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -624,6 +624,12 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, Out << ", "; } + if (CE->hasIndices()) { + const SmallVector<unsigned, 4> &Indices = CE->getIndices(); + for (unsigned i = 0, e = Indices.size(); i != e; ++i) + Out << ", " << Indices[i]; + } + if (CE->isCast()) { Out << " to "; printTypeInt(Out, CE->getType(), TypeTable); @@ -1292,6 +1298,15 @@ void AssemblyWriter::printInstruction(const Instruction &I) { } else if (const GetResultInst *GRI = dyn_cast<GetResultInst>(&I)) { writeOperand(I.getOperand(0), true); Out << ", " << GRI->getIndex(); + } else if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(&I)) { + writeOperand(I.getOperand(0), true); + for (const unsigned *i = EVI->idx_begin(), *e = EVI->idx_end(); i != e; ++i) + Out << ", " << *i; + } else if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(&I)) { + writeOperand(I.getOperand(0), true); Out << ','; + writeOperand(I.getOperand(1), true); + for (const unsigned *i = IVI->idx_begin(), *e = IVI->idx_end(); i != e; ++i) + Out << ", " << *i; } else if (isa<ReturnInst>(I) && !Operand) { Out << " void"; } else if (const CallInst *CI = dyn_cast<CallInst>(&I)) { |