aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-03-02 02:48:09 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-03-02 02:48:09 +0000
commitfc82fabe00b0b820e3c0d7fc9e289bace0295f11 (patch)
tree963a736756189f58a4bd042ddf745b895e40cbac /lib/VMCore/AsmWriter.cpp
parentfe0753efbac4e15d5e1b8a58b06788a86d7e2545 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 55d037db14..595f478c72 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/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);