diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2008-03-02 02:48:09 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2008-03-02 02:48:09 +0000 |
commit | 3cc9be0b5955278e7f8166b8db3e9ba697902190 (patch) | |
tree | c83f9867eeaff118b40bc0d3b010909e7911e45d /llvm/lib/VMCore/AsmWriter.cpp | |
parent | 20bcdba9cadb47c3d8fbf1dd31f2942a7d43b2de (diff) | |
download | bcm5719-llvm-3cc9be0b5955278e7f8166b8db3e9ba697902190.tar.gz bcm5719-llvm-3cc9be0b5955278e7f8166b8db3e9ba697902190.zip |
Add an unwind_to field to basic blocks, making them Users instead of Values.
This is the first checkin for PR1269, the new EH infrastructure.
llvm-svn: 47802
Diffstat (limited to 'llvm/lib/VMCore/AsmWriter.cpp')
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 55d037db141..595f478c72a 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -1130,7 +1130,7 @@ void AssemblyWriter::printFunction(const Function *F) { if (F->isDeclaration()) { Out << "\n"; } else { - Out << " {"; + Out << " {\n"; // Output all of its basic blocks... for the function for (Function::const_iterator I = F->begin(), E = F->end(); I != E; ++I) @@ -1162,10 +1162,19 @@ void AssemblyWriter::printArgument(const Argument *Arg, /// printBasicBlock - This member is called for each basic block in a method. /// void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { - if (BB->hasName()) { // Print out the label if it exists... - Out << "\n" << getLLVMName(BB->getName(), LabelPrefix) << ':'; - } else if (!BB->use_empty()) { // Don't print block # of no uses... - Out << "\n; <label>:"; + if (BB->hasName()) // Print out the label if it exists... + Out << getLLVMName(BB->getName(), LabelPrefix) << ':'; + + if (const BasicBlock* unwindDest = BB->getUnwindDest()) { + if (BB->hasName()) + Out << ' '; + + Out << "unwind_to"; + writeOperand(unwindDest, false); + } + + if (!BB->hasName() && !BB->use_empty()) { // Don't print block # of no uses... + Out << "; <label>:"; int Slot = Machine.getLocalSlot(BB); if (Slot != -1) Out << Slot; @@ -1194,7 +1203,9 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { } } - Out << "\n"; + if (BB->hasName() || !BB->use_empty() || BB->getUnwindDest() || + BB != &BB->getParent()->getEntryBlock()) + Out << "\n"; if (AnnotationWriter) AnnotationWriter->emitBasicBlockStartAnnot(BB, Out); |