LLVM  12.0.0git
WinCFGuard.h
Go to the documentation of this file.
1 //===-- WinCFGuard.h - Windows Control Flow Guard Handling ----*- C++ -*--===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains support for writing the metadata for Windows Control Flow
10 // Guard, including address-taken functions, and valid longjmp targets.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
16 
18 #include "llvm/Support/Compiler.h"
19 #include <vector>
20 
21 namespace llvm {
22 
24  /// Target of directive emission.
25  AsmPrinter *Asm;
26  std::vector<const MCSymbol *> LongjmpTargets;
27 
28 public:
30  ~WinCFGuard() override;
31 
32  void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
33 
34  /// Emit the Control Flow Guard function ID table.
35  void endModule() override;
36 
37  /// Gather pre-function debug information.
38  /// Every beginFunction(MF) call should be followed by an endFunction(MF)
39  /// call.
40  void beginFunction(const MachineFunction *MF) override {}
41 
42  /// Gather post-function debug information.
43  /// Please note that some AsmPrinter implementations may not call
44  /// beginFunction at all.
45  void endFunction(const MachineFunction *MF) override;
46 
47  /// Process beginning of an instruction.
48  void beginInstruction(const MachineInstr *MI) override {}
49 
50  /// Process end of an instruction.
51  void endInstruction() override {}
52 };
53 
54 } // namespace llvm
55 
56 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
Definition: WinCFGuard.h:48
Collects and handles AsmPrinter objects required to build debug or EH information.
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:81
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
Definition: Compiler.h:130
void endInstruction() override
Process end of an instruction.
Definition: WinCFGuard.h:51
Representation of each machine instruction.
Definition: MachineInstr.h:62
uint32_t Size
Definition: Profile.cpp:46
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
Definition: WinCFGuard.h:32
IRTranslator LLVM IR MI
void beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
Definition: WinCFGuard.h:40