blob: def0a59ab0075d0e0fcbc2a34a3065e4a1e7e0fb [file] [log] [blame]
Adrian McCarthydb2736d2018-01-09 23:49:30 +00001//===-- WinCFGuard.h - Windows Control Flow Guard Handling ----*- C++ -*--===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Adrian McCarthydb2736d2018-01-09 23:49:30 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file contains support for writing windows exception info into asm files.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
15
Yonghong Song61b189e2018-12-18 23:10:17 +000016#include "llvm/CodeGen/AsmPrinterHandler.h"
Adrian McCarthydb2736d2018-01-09 23:49:30 +000017#include "llvm/Support/Compiler.h"
18
19namespace llvm {
20
21class LLVM_LIBRARY_VISIBILITY WinCFGuard : public AsmPrinterHandler {
22 /// Target of directive emission.
23 AsmPrinter *Asm;
24
25public:
26 WinCFGuard(AsmPrinter *A);
27 ~WinCFGuard() override;
28
29 void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
30
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000031 /// Emit the Control Flow Guard function ID table
Adrian McCarthydb2736d2018-01-09 23:49:30 +000032 void endModule() override;
33
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000034 /// Gather pre-function debug information.
Adrian McCarthydb2736d2018-01-09 23:49:30 +000035 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
36 /// call.
37 void beginFunction(const MachineFunction *MF) override {}
38
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000039 /// Gather post-function debug information.
Adrian McCarthydb2736d2018-01-09 23:49:30 +000040 /// Please note that some AsmPrinter implementations may not call
41 /// beginFunction at all.
42 void endFunction(const MachineFunction *MF) override {}
43
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000044 /// Process beginning of an instruction.
Adrian McCarthydb2736d2018-01-09 23:49:30 +000045 void beginInstruction(const MachineInstr *MI) override {}
46
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000047 /// Process end of an instruction.
Adrian McCarthydb2736d2018-01-09 23:49:30 +000048 void endInstruction() override {}
49};
50
51} // namespace llvm
52
53#endif