2011-05-19 00:48:24 +02:00
|
|
|
//===- MCWin64EH.h - Machine Code Win64 EH support --------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-05-19 00:48:24 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-05-21 17:57:49 +02:00
|
|
|
// This file contains declarations to support the Win64 Exception Handling
|
|
|
|
// scheme in MC.
|
2011-05-19 00:48:24 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCWIN64EH_H
|
|
|
|
#define LLVM_MC_MCWIN64EH_H
|
|
|
|
|
2014-07-17 05:08:50 +02:00
|
|
|
#include "llvm/MC/MCWinEH.h"
|
2011-05-19 00:48:24 +02:00
|
|
|
#include "llvm/Support/Win64EH.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2014-08-07 04:59:41 +02:00
|
|
|
class MCStreamer;
|
|
|
|
class MCSymbol;
|
2011-05-19 00:48:24 +02:00
|
|
|
|
2014-07-17 05:08:50 +02:00
|
|
|
namespace Win64EH {
|
|
|
|
struct Instruction {
|
|
|
|
static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg) {
|
|
|
|
return WinEH::Instruction(Win64EH::UOP_PushNonVol, L, Reg, -1);
|
2014-07-13 21:03:45 +02:00
|
|
|
}
|
2014-07-17 05:08:50 +02:00
|
|
|
static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size) {
|
|
|
|
return WinEH::Instruction(Size > 128 ? UOP_AllocLarge : UOP_AllocSmall, L,
|
|
|
|
-1, Size);
|
2014-07-13 21:03:45 +02:00
|
|
|
}
|
2014-07-17 05:08:50 +02:00
|
|
|
static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code) {
|
|
|
|
return WinEH::Instruction(UOP_PushMachFrame, L, -1, Code ? 1 : 0);
|
|
|
|
}
|
|
|
|
static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg,
|
|
|
|
unsigned Offset) {
|
|
|
|
return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveNonVolBig
|
|
|
|
: UOP_SaveNonVol,
|
|
|
|
L, Reg, Offset);
|
|
|
|
}
|
|
|
|
static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg,
|
|
|
|
unsigned Offset) {
|
|
|
|
return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveXMM128Big
|
|
|
|
: UOP_SaveXMM128,
|
|
|
|
L, Reg, Offset);
|
|
|
|
}
|
|
|
|
static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off) {
|
|
|
|
return WinEH::Instruction(UOP_SetFPReg, L, Reg, Off);
|
2014-07-13 21:03:45 +02:00
|
|
|
}
|
|
|
|
};
|
2011-05-19 00:48:24 +02:00
|
|
|
|
2016-10-11 00:49:37 +02:00
|
|
|
class UnwindEmitter : public WinEH::UnwindEmitter {
|
2014-08-07 04:59:41 +02:00
|
|
|
public:
|
2016-10-11 00:49:37 +02:00
|
|
|
void Emit(MCStreamer &Streamer) const override;
|
2020-11-13 21:35:22 +01:00
|
|
|
void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI,
|
|
|
|
bool HandlerData) const override;
|
2014-08-07 04:59:41 +02:00
|
|
|
};
|
2018-10-27 08:13:06 +02:00
|
|
|
|
|
|
|
class ARM64UnwindEmitter : public WinEH::UnwindEmitter {
|
|
|
|
public:
|
|
|
|
void Emit(MCStreamer &Streamer) const override;
|
2020-11-13 21:35:22 +01:00
|
|
|
void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI,
|
|
|
|
bool HandlerData) const override;
|
2018-10-27 08:13:06 +02:00
|
|
|
};
|
|
|
|
|
2015-06-23 11:49:53 +02:00
|
|
|
}
|
2011-05-19 00:48:24 +02:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|