#include "ARM.h"
#include "ARMInstrInfo.h"
#include "ARMSubtarget.h"
#include "llvm/CodeGen/IndirectThunks.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/IR/DebugLoc.h"
#include <cassert>
usingnamespacellvm;
#define DEBUG_TYPE …
#define ARM_SLS_HARDENING_NAME …
namespace {
class ARMSLSHardening : public MachineFunctionPass { … };
}
char ARMSLSHardening::ID = …;
INITIALIZE_PASS(…)
static void insertSpeculationBarrier(const ARMSubtarget *ST,
MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
DebugLoc DL,
bool AlwaysUseISBDSB = false) { … }
bool ARMSLSHardening::runOnMachineFunction(MachineFunction &MF) { … }
bool ARMSLSHardening::hardenReturnsAndBRs(MachineBasicBlock &MBB) const { … }
static const char SLSBLRNamePrefix[] = …;
static const struct ThunkNameRegMode { … } SLSBLRThunks[] = …;
enum ArmInsertedThunks { … };
inline ArmInsertedThunks &operator|=(ArmInsertedThunks &X,
ArmInsertedThunks Y) { … }
namespace {
struct SLSBLRThunkInserter
: ThunkInserter<SLSBLRThunkInserter, ArmInsertedThunks> { … };
}
ArmInsertedThunks
SLSBLRThunkInserter::insertThunks(MachineModuleInfo &MMI, MachineFunction &MF,
ArmInsertedThunks InsertedThunks) { … }
void SLSBLRThunkInserter::populateThunk(MachineFunction &MF) { … }
MachineBasicBlock &ARMSLSHardening::ConvertIndirectCallToIndirectJump(
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const { … }
bool ARMSLSHardening::hardenIndirectCalls(MachineBasicBlock &MBB) const { … }
FunctionPass *llvm::createARMSLSHardeningPass() { … }
namespace {
class ARMIndirectThunks : public ThunkInserterPass<SLSBLRThunkInserter> { … };
}
char ARMIndirectThunks::ID = …;
FunctionPass *llvm::createARMIndirectThunks() { … }