mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 17:29:19 +00:00
This changes Win64EHEmitter into a utility WinEH UnwindEmitter that can be shared across multiple architectures and a target specific bit which is overridden (Win64::UnwindEmitter). This enables sharing the section selection code across X86 and the intended use in ARM for emitting unwind information for Windows on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215050 91177308-0d34-0410-b5e6-96231b3b80d8
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
//===-- X86WinCOFFStreamer.cpp - X86 Target WinCOFF Streamer ----*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "X86MCTargetDesc.h"
|
|
#include "llvm/MC/MCWin64EH.h"
|
|
#include "llvm/MC/MCWinCOFFStreamer.h"
|
|
|
|
using namespace llvm;
|
|
|
|
namespace {
|
|
class X86WinCOFFStreamer : public MCWinCOFFStreamer {
|
|
Win64EH::UnwindEmitter EHStreamer;
|
|
public:
|
|
X86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB, MCCodeEmitter *CE,
|
|
raw_ostream &OS)
|
|
: MCWinCOFFStreamer(C, AB, *CE, OS) { }
|
|
|
|
void EmitWinEHHandlerData() override;
|
|
void EmitWindowsUnwindTables() override;
|
|
void FinishImpl() override;
|
|
};
|
|
|
|
void X86WinCOFFStreamer::EmitWinEHHandlerData() {
|
|
MCStreamer::EmitWinEHHandlerData();
|
|
|
|
// We have to emit the unwind info now, because this directive
|
|
// actually switches to the .xdata section!
|
|
EHStreamer.EmitUnwindInfo(*this, getCurrentWinFrameInfo());
|
|
}
|
|
|
|
void X86WinCOFFStreamer::EmitWindowsUnwindTables() {
|
|
if (!getNumWinFrameInfos())
|
|
return;
|
|
EHStreamer.Emit(*this);
|
|
}
|
|
|
|
void X86WinCOFFStreamer::FinishImpl() {
|
|
EmitFrames(nullptr);
|
|
EmitWindowsUnwindTables();
|
|
|
|
MCWinCOFFStreamer::FinishImpl();
|
|
}
|
|
}
|
|
|
|
namespace llvm {
|
|
MCStreamer *createX86WinCOFFStreamer(MCContext &C, MCAsmBackend &AB,
|
|
MCCodeEmitter *CE, raw_ostream &OS,
|
|
bool RelaxAll) {
|
|
X86WinCOFFStreamer *S = new X86WinCOFFStreamer(C, AB, CE, OS);
|
|
S->getAssembler().setRelaxAll(RelaxAll);
|
|
return S;
|
|
}
|
|
}
|
|
|