xref: /freebsd/contrib/llvm-project/llvm/lib/CodeGen/AsmPrinter/WinCFGuard.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===-- WinCFGuard.h - Windows Control Flow Guard Handling ----*- C++ -*--===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric //
9*0b57cec5SDimitry Andric // This file contains support for writing windows exception info into asm files.
10*0b57cec5SDimitry Andric //
11*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
12*0b57cec5SDimitry Andric 
13*0b57cec5SDimitry Andric #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
14*0b57cec5SDimitry Andric #define LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
15*0b57cec5SDimitry Andric 
16*0b57cec5SDimitry Andric #include "llvm/CodeGen/AsmPrinterHandler.h"
17*0b57cec5SDimitry Andric #include "llvm/Support/Compiler.h"
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric namespace llvm {
20*0b57cec5SDimitry Andric 
21*0b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY WinCFGuard : public AsmPrinterHandler {
22*0b57cec5SDimitry Andric   /// Target of directive emission.
23*0b57cec5SDimitry Andric   AsmPrinter *Asm;
24*0b57cec5SDimitry Andric 
25*0b57cec5SDimitry Andric public:
26*0b57cec5SDimitry Andric   WinCFGuard(AsmPrinter *A);
27*0b57cec5SDimitry Andric   ~WinCFGuard() override;
28*0b57cec5SDimitry Andric 
29*0b57cec5SDimitry Andric   void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
30*0b57cec5SDimitry Andric 
31*0b57cec5SDimitry Andric   /// Emit the Control Flow Guard function ID table
32*0b57cec5SDimitry Andric   void endModule() override;
33*0b57cec5SDimitry Andric 
34*0b57cec5SDimitry Andric   /// Gather pre-function debug information.
35*0b57cec5SDimitry Andric   /// Every beginFunction(MF) call should be followed by an endFunction(MF)
36*0b57cec5SDimitry Andric   /// call.
37*0b57cec5SDimitry Andric   void beginFunction(const MachineFunction *MF) override {}
38*0b57cec5SDimitry Andric 
39*0b57cec5SDimitry Andric   /// Gather post-function debug information.
40*0b57cec5SDimitry Andric   /// Please note that some AsmPrinter implementations may not call
41*0b57cec5SDimitry Andric   /// beginFunction at all.
42*0b57cec5SDimitry Andric   void endFunction(const MachineFunction *MF) override {}
43*0b57cec5SDimitry Andric 
44*0b57cec5SDimitry Andric   /// Process beginning of an instruction.
45*0b57cec5SDimitry Andric   void beginInstruction(const MachineInstr *MI) override {}
46*0b57cec5SDimitry Andric 
47*0b57cec5SDimitry Andric   /// Process end of an instruction.
48*0b57cec5SDimitry Andric   void endInstruction() override {}
49*0b57cec5SDimitry Andric };
50*0b57cec5SDimitry Andric 
51*0b57cec5SDimitry Andric } // namespace llvm
52*0b57cec5SDimitry Andric 
53*0b57cec5SDimitry Andric #endif
54