llvm/llvm/lib/Target/ARM/ARMSLSHardening.cpp

//===- ARMSLSHardening.cpp - Harden Straight Line Missspeculation ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains a pass to insert code to mitigate against side channel
// vulnerabilities that may happen under straight line miss-speculation.
//
//===----------------------------------------------------------------------===//

#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 {};

} // end anonymous namespace

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[] =;

// An enum for tracking whether Arm and Thumb thunks have been inserted into the
// current module so far.
enum ArmInsertedThunks {};

inline ArmInsertedThunks &operator|=(ArmInsertedThunks &X,
                                     ArmInsertedThunks Y) {}

namespace {
struct SLSBLRThunkInserter
    : ThunkInserter<SLSBLRThunkInserter, ArmInsertedThunks> {};
} // namespace

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> {};
} // end anonymous namespace

char ARMIndirectThunks::ID =;

FunctionPass *llvm::createARMIndirectThunks() {}