1 //===-- AArch64ReturnProtectorLowering.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 AArch64 implementation of ReturnProtectorLowering 11 // class. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64RETURNPROTECTORLOWERING_H 16 #define LLVM_LIB_TARGET_AARCH64_AARCH64RETURNPROTECTORLOWERING_H 17 18 #include "llvm/CodeGen/ReturnProtectorLowering.h" 19 20 namespace llvm { 21 22 class AArch64ReturnProtectorLowering : public ReturnProtectorLowering { 23 public: 24 /// insertReturnProtectorPrologue/Epilogue - insert return protector 25 /// instrumentation in prologue or epilogue. 26 virtual void 27 insertReturnProtectorPrologue(MachineFunction &MF, MachineBasicBlock &MBB, 28 GlobalVariable *cookie) const override; 29 virtual void 30 insertReturnProtectorEpilogue(MachineFunction &MF, MachineInstr &MI, 31 GlobalVariable *cookie) const override; 32 33 /// opcodeIsReturn - Reuturn true is the given opcode is a return 34 /// instruction needing return protection, false otherwise. 35 virtual bool opcodeIsReturn(unsigned opcode) const override; 36 37 /// fillTempRegisters - Fill the list of available temp registers we can 38 /// use as a return protector register. 39 virtual void 40 fillTempRegisters(MachineFunction &MF, 41 std::vector<unsigned> &TempRegs) const override; 42 43 /// saveReturnProtectorRegister - Allows the target to save the 44 /// CalculationRegister in the CalleeSavedInfo vector if needed. 45 virtual void 46 saveReturnProtectorRegister(MachineFunction &MF, 47 std::vector<CalleeSavedInfo> &CSI) const override; 48 }; 49 50 } // namespace llvm 51 52 #endif 53