summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2011-05-21 15:57:49 +0000
committerCharles Davis <cdavis@mines.edu>2011-05-21 15:57:49 +0000
commit8e8f59bdfbbcde8c6bcee4774ae337bcdd9647a1 (patch)
tree8dc1e5c711dafed4d2ced3fa57d09fd7333c1ace
parent691731eb9c1bffedcb29b3c8391010b8edab6abf (diff)
downloadbcm5719-llvm-8e8f59bdfbbcde8c6bcee4774ae337bcdd9647a1.tar.gz
bcm5719-llvm-8e8f59bdfbbcde8c6bcee4774ae337bcdd9647a1.zip
A handler for a function in the Win64 EH scheme can be both an unwind handler
and an exception handler. Handle that case. Also, add an 'Emitted' member to the MCWin64EHUnwindInfo struct. It will be needed later. llvm-svn: 131791
-rw-r--r--llvm/include/llvm/MC/MCWin64EH.h17
-rw-r--r--llvm/lib/MC/MCStreamer.cpp8
2 files changed, 15 insertions, 10 deletions
diff --git a/llvm/include/llvm/MC/MCWin64EH.h b/llvm/include/llvm/MC/MCWin64EH.h
index de1e24767a1..a88b5040b8b 100644
--- a/llvm/include/llvm/MC/MCWin64EH.h
+++ b/llvm/include/llvm/MC/MCWin64EH.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file contains the declaration of the MCDwarfFile to support the dwarf
-// .file directive and the .loc directive.
+// This file contains declarations to support the Win64 Exception Handling
+// scheme in MC.
//
//===----------------------------------------------------------------------===//
@@ -59,26 +59,29 @@ namespace llvm {
struct MCWin64EHUnwindInfo {
MCWin64EHUnwindInfo() : Begin(0), End(0), ExceptionHandler(0),
- Function(0), PrologEnd(0), UnwindOnly(false),
- LastFrameInst(-1), ChainedParent(0),
- Instructions() {}
+ Function(0), PrologEnd(0), HandlesUnwind(false),
+ HandlesExceptions(false), LastFrameInst(-1),
+ ChainedParent(0), Instructions(), Emitted(false) {}
MCSymbol *Begin;
MCSymbol *End;
const MCSymbol *ExceptionHandler;
const MCSymbol *Function;
MCSymbol *PrologEnd;
- bool UnwindOnly;
+ bool HandlesUnwind;
+ bool HandlesExceptions;
int LastFrameInst;
MCWin64EHUnwindInfo *ChainedParent;
std::vector<MCWin64EHInstruction> Instructions;
+ bool Emitted;
};
class MCWin64EHUnwindEmitter {
public:
//
- // This emits the unwind info section (.xdata in PE/COFF).
+ // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
//
static void Emit(MCStreamer &streamer);
+ static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info);
};
} // end namespace llvm
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index ab7c798198a..1ec7688a5ed 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -362,10 +362,12 @@ void MCStreamer::EmitWin64EHHandler(const MCSymbol *Sym, bool Unwind,
EnsureValidW64UnwindInfo();
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
CurFrame->ExceptionHandler = Sym;
- if (Unwind)
- CurFrame->UnwindOnly = true;
- else if (!Except)
+ if (!Except && !Unwind)
report_fatal_error("Don't know what kind of handler this is!");
+ if (Unwind)
+ CurFrame->HandlesUnwind = true;
+ if (Except)
+ CurFrame->HandlesExceptions = true;
}
void MCStreamer::EmitWin64EHHandlerData() {
OpenPOWER on IntegriCloud