2014-07-17 05:08:50 +02:00
|
|
|
//===- MCWinEH.h - Windows Unwinding Support --------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCWINEH_H
|
|
|
|
#define LLVM_MC_MCWINEH_H
|
|
|
|
|
2014-08-03 20:51:17 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2014-07-17 05:08:50 +02:00
|
|
|
namespace llvm {
|
2014-08-07 04:59:41 +02:00
|
|
|
class MCSection;
|
|
|
|
class MCStreamer;
|
2014-07-17 05:08:50 +02:00
|
|
|
class MCSymbol;
|
|
|
|
|
|
|
|
namespace WinEH {
|
|
|
|
struct Instruction {
|
|
|
|
const MCSymbol *Label;
|
|
|
|
const unsigned Offset;
|
|
|
|
const unsigned Register;
|
|
|
|
const unsigned Operation;
|
|
|
|
|
|
|
|
Instruction(unsigned Op, MCSymbol *L, unsigned Reg, unsigned Off)
|
|
|
|
: Label(L), Offset(Off), Register(Reg), Operation(Op) {}
|
|
|
|
};
|
2014-08-03 20:51:17 +02:00
|
|
|
|
|
|
|
struct FrameInfo {
|
2016-05-03 01:22:18 +02:00
|
|
|
const MCSymbol *Begin = nullptr;
|
|
|
|
const MCSymbol *End = nullptr;
|
|
|
|
const MCSymbol *ExceptionHandler = nullptr;
|
|
|
|
const MCSymbol *Function = nullptr;
|
|
|
|
const MCSymbol *PrologEnd = nullptr;
|
|
|
|
const MCSymbol *Symbol = nullptr;
|
|
|
|
const MCSection *TextSection = nullptr;
|
2014-08-03 20:51:17 +02:00
|
|
|
|
2016-05-03 01:22:18 +02:00
|
|
|
bool HandlesUnwind = false;
|
|
|
|
bool HandlesExceptions = false;
|
2014-08-03 20:51:17 +02:00
|
|
|
|
2016-05-03 01:22:18 +02:00
|
|
|
int LastFrameInst = -1;
|
|
|
|
const FrameInfo *ChainedParent = nullptr;
|
2014-08-03 20:51:17 +02:00
|
|
|
std::vector<Instruction> Instructions;
|
|
|
|
|
2016-05-03 01:22:18 +02:00
|
|
|
FrameInfo() = default;
|
2014-08-03 20:51:17 +02:00
|
|
|
FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel)
|
2016-05-03 01:22:18 +02:00
|
|
|
: Begin(BeginFuncEHLabel), Function(Function) {}
|
2014-08-03 20:51:17 +02:00
|
|
|
FrameInfo(const MCSymbol *Function, const MCSymbol *BeginFuncEHLabel,
|
|
|
|
const FrameInfo *ChainedParent)
|
2016-05-03 01:22:18 +02:00
|
|
|
: Begin(BeginFuncEHLabel), Function(Function),
|
|
|
|
ChainedParent(ChainedParent) {}
|
2014-08-03 20:51:17 +02:00
|
|
|
};
|
2016-10-11 00:49:37 +02:00
|
|
|
|
|
|
|
class UnwindEmitter {
|
|
|
|
public:
|
|
|
|
virtual ~UnwindEmitter();
|
|
|
|
|
|
|
|
/// This emits the unwind info sections (.pdata and .xdata in PE/COFF).
|
|
|
|
virtual void Emit(MCStreamer &Streamer) const = 0;
|
|
|
|
virtual void EmitUnwindInfo(MCStreamer &Streamer, FrameInfo *FI) const = 0;
|
|
|
|
};
|
2015-06-23 11:49:53 +02:00
|
|
|
}
|
|
|
|
}
|
2014-07-17 05:08:50 +02:00
|
|
|
|
|
|
|
#endif
|