#include "X86.h"
#include "X86FrameLowering.h"
#include "X86InstrInfo.h"
#include "X86Subtarget.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/IR/Module.h"
#include <iterator>
usingnamespacellvm;
#define DEBUG_TYPE …
namespace {
class X86WinFixupBufferSecurityCheckPass : public MachineFunctionPass { … };
}
char X86WinFixupBufferSecurityCheckPass::ID = …;
INITIALIZE_PASS(…)
FunctionPass *llvm::createX86WinFixupBufferSecurityCheckPass() { … }
void X86WinFixupBufferSecurityCheckPass::SplitBasicBlock(
MachineBasicBlock *CurMBB, MachineBasicBlock *NewRetMBB,
MachineBasicBlock::iterator SplitIt) { … }
std::pair<MachineBasicBlock *, MachineInstr *>
X86WinFixupBufferSecurityCheckPass::getSecurityCheckerBasicBlock(
MachineFunction &MF) { … }
void X86WinFixupBufferSecurityCheckPass::getGuardCheckSequence(
MachineBasicBlock *CurMBB, MachineInstr *CheckCall,
MachineInstr *SeqMI[5]) { … }
std::pair<MachineInstr *, MachineInstr *>
X86WinFixupBufferSecurityCheckPass::CreateFailCheckSequence(
MachineBasicBlock *CurMBB, MachineBasicBlock *FailMBB,
MachineInstr *SeqMI[5]) { … }
void X86WinFixupBufferSecurityCheckPass::FinishBlock(MachineBasicBlock *MBB) { … }
void X86WinFixupBufferSecurityCheckPass::FinishFunction(
MachineBasicBlock *FailMBB, MachineBasicBlock *NewRetMBB) { … }
bool X86WinFixupBufferSecurityCheckPass::runOnMachineFunction(
MachineFunction &MF) { … }