void EmitFrames(bool usingCFI);
MCWin64EHUnwindInfo *getCurrentW64UnwindInfo(){return CurrentW64UnwindInfo;}
+ void EmitW64Tables();
public:
virtual ~MCStreamer();
return FrameInfos[i];
}
+ unsigned getNumW64UnwindInfos() {
+ return W64UnwindInfos.size();
+ }
+
+ MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
+ return W64UnwindInfos[i];
+ }
+
/// @name Assembly File Formatting.
/// @{
if (EmitDebugFrame)
MCDwarfFrameEmitter::Emit(*this, usingCFI, false);
}
+
+void MCStreamer::EmitW64Tables() {
+ if (!getNumW64UnwindInfos())
+ return;
+
+ MCWin64EHUnwindEmitter::Emit(*this);
+}
}
static void EmitRuntimeFunction(MCStreamer &streamer,
- MCWin64EHUnwindInfo *info) {
+ const MCWin64EHUnwindInfo *info) {
MCContext &context = streamer.getContext();
streamer.EmitValue(MCSymbolRefExpr::Create(info->Begin, context), 4);
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