xref: /openbsd-src/gnu/llvm/llvm/lib/Target/X86/X86ReturnProtectorLowering.h (revision 09467b48e8bc8b4905716062da846024139afbf2)
1 //===-- X86ReturnProtectorLowering.h - ------------------------- -*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the X86 implementation of ReturnProtectorLowering class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_X86_X86RETURNPROTECTORLOWERING_H
15 #define LLVM_LIB_TARGET_X86_X86RETURNPROTECTORLOWERING_H
16 
17 #include "llvm/CodeGen/ReturnProtectorLowering.h"
18 
19 namespace llvm {
20 
21 class X86ReturnProtectorLowering : public ReturnProtectorLowering {
22 public:
23   /// insertReturnProtectorPrologue/Epilogue - insert return protector
24   /// instrumentation in prologue or epilogue.
25   virtual void
26   insertReturnProtectorPrologue(MachineFunction &MF, MachineBasicBlock &MBB,
27                                 GlobalVariable *cookie) const override;
28   virtual void
29   insertReturnProtectorEpilogue(MachineFunction &MF, MachineInstr &MI,
30                                 GlobalVariable *cookie) const override;
31 
32   /// opcodeIsReturn - Reuturn true is the given opcode is a return
33   /// instruction needing return protection, false otherwise.
34   virtual bool opcodeIsReturn(unsigned opcode) const override;
35 
36   /// fillTempRegisters - Fill the list of available temp registers we can
37   /// use as a return protector register.
38   virtual void
39   fillTempRegisters(MachineFunction &MF,
40                     std::vector<unsigned> &TempRegs) const override;
41 };
42 
43 } // namespace llvm
44 
45 #endif
46