[llvm-commits] [llvm] r131833 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCStreamer.cpp lib/MC/MCWin64EH.cpp lib/MC/WinCOFFStreamer.cpp
Charles Davis
cdavis at mines.edu
Sat May 21 21:15:07 PDT 2011
Author: cdavis
Date: Sat May 21 23:15:07 2011
New Revision: 131833
URL: http://llvm.org/viewvc/llvm-project?rev=131833&view=rev
Log:
Implement emission of all Win64 exception tables. Make the COFF streamer emit
these tables.
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCStreamer.cpp
llvm/trunk/lib/MC/MCWin64EH.cpp
llvm/trunk/lib/MC/WinCOFFStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=131833&r1=131832&r2=131833&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Sat May 21 23:15:07 2011
@@ -81,6 +81,7 @@
void EmitFrames(bool usingCFI);
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
+ void EmitW64Tables();
public:
virtual ~MCStreamer();
@@ -95,6 +96,14 @@
return FrameInfos[i];
}
+ unsigned getNumW64UnwindInfos() {
+ return W64UnwindInfos.size();
+ }
+
+ MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
+ return W64UnwindInfos[i];
+ }
+
/// @name Assembly File Formatting.
/// @{
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=131833&r1=131832&r2=131833&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Sat May 21 23:15:07 2011
@@ -506,3 +506,10 @@
if (EmitDebugFrame)
MCDwarfFrameEmitter::Emit(*this, usingCFI, false);
}
+
+void MCStreamer::EmitW64Tables() {
+ if (!getNumW64UnwindInfos())
+ return;
+
+ MCWin64EHUnwindEmitter::Emit(*this);
+}
Modified: llvm/trunk/lib/MC/MCWin64EH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCWin64EH.cpp?rev=131833&r1=131832&r2=131833&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCWin64EH.cpp (original)
+++ llvm/trunk/lib/MC/MCWin64EH.cpp Sat May 21 23:15:07 2011
@@ -110,7 +110,7 @@
}
static void EmitRuntimeFunction(MCStreamer &streamer,
- MCWin64EHUnwindInfo *info) {
+ const MCWin64EHUnwindInfo *info) {
MCContext &context = streamer.getContext();
streamer.EmitValue(MCSymbolRefExpr::Create(info->Begin, context), 4);
@@ -185,5 +185,20 @@
llvm::EmitUnwindInfo(streamer, info);
}
+void MCWin64EHUnwindEmitter::Emit(MCStreamer &streamer) {
+ MCContext &context = streamer.getContext();
+ // Emit the unwind info structs first.
+ const TargetAsmInfo &asmInfo = context.getTargetAsmInfo();
+ const MCSection *xdataSect = asmInfo.getWin64EHTableSection();
+ streamer.SwitchSection(xdataSect);
+ for (unsigned i = 0; i < streamer.getNumW64UnwindInfos(); ++i)
+ llvm::EmitUnwindInfo(streamer, &streamer.getW64UnwindInfo(i));
+ // Now emit RUNTIME_FUNCTION entries.
+ const MCSection *pdataSect = asmInfo.getWin64EHFuncTableSection();
+ streamer.SwitchSection(pdataSect);
+ for (unsigned i = 0; i < streamer.getNumW64UnwindInfos(); ++i)
+ EmitRuntimeFunction(streamer, &streamer.getW64UnwindInfo(i));
+}
+
} // End of namespace llvm
Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=131833&r1=131832&r2=131833&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Sat May 21 23:15:07 2011
@@ -388,6 +388,7 @@
}
void WinCOFFStreamer::Finish() {
+ EmitW64Tables();
MCObjectStreamer::Finish();
}
More information about the llvm-commits
mailing list