mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
AsmWriter support for insertvalue/extractvalue. These instructions can
now round-trip through assembly and bitcode. llvm-svn: 51823
This commit is contained in:
parent
1e195a735e
commit
06d49b3c5b
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user