LLVM  14.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  MCSymbol *lookupImpSymbol(const MCSymbol *Sym);
28 
29 public:
31  ~WinCFGuard() override;
32 
33  void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
34 
35  /// Emit the Control Flow Guard function ID table.
36  void endModule() override;
37 
38  /// Gather pre-function debug information.
39  /// Every beginFunction(MF) call should be followed by an endFunction(MF)
40  /// call.
41  void beginFunction(const MachineFunction *MF) override {}
42 
43  /// Gather post-function debug information.
44  /// Please note that some AsmPrinter implementations may not call
45  /// beginFunction at all.
46  void endFunction(const MachineFunction *MF) override;
47 
48  /// Process beginning of an instruction.
49  void beginInstruction(const MachineInstr *MI) override {}
50 
51  /// Process end of an instruction.
52  void endInstruction() override {}
53 };
54 
55 } // namespace llvm
56 
57 #endif
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:103
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
AsmPrinterHandler.h
llvm::WinCFGuard::endInstruction
void endInstruction() override
Process end of an instruction.
Definition: WinCFGuard.h:52
llvm::WinCFGuard
Definition: WinCFGuard.h:23
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
uint64_t
llvm::WinCFGuard::beginInstruction
void beginInstruction(const MachineInstr *MI) override
Process beginning of an instruction.
Definition: WinCFGuard.h:49
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::WinCFGuard::beginFunction
void beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
Definition: WinCFGuard.h:41
Compiler.h
LLVM_LIBRARY_VISIBILITY
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
Definition: Compiler.h:131
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:82
llvm::AsmPrinterHandler
Collects and handles AsmPrinter objects required to build debug or EH information.
Definition: AsmPrinterHandler.h:33
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::WinCFGuard::setSymbolSize
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
Definition: WinCFGuard.h:33