|
LLVM 23.0.0git
|
#include "Mips.h"#include "MipsInstrInfo.h"#include "MipsSubtarget.h"#include "llvm/ADT/BitVector.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/PointerUnion.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/StringRef.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineBranchProbabilityInfo.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/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/PseudoSourceValue.h"#include "llvm/CodeGen/TargetRegisterInfo.h"#include "llvm/CodeGen/TargetSubtargetInfo.h"#include "llvm/MC/MCInstrDesc.h"#include "llvm/MC/MCRegisterInfo.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CodeGen.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Target/TargetMachine.h"#include <cassert>#include <iterator>#include <memory>#include <utility>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "mips-delay-slot-filler" |
Functions | |
| STATISTIC (FilledSlots, "Number of delay slots filled") | |
| STATISTIC (UsefulSlots, "Number of delay slots filled with instructions that" " are not NOP.") | |
| STATISTIC (R5900ShortLoopNops, "Number of delay slots left as NOP for R5900 " "short loop fix") | |
| static bool | hasUnoccupiedSlot (const MachineInstr *MI) |
| static bool | isR5900ShortLoopBranch (const MachineInstr *MI, const MachineBasicBlock &MBB) |
| Check if a branch is a short backward loop that triggers the R5900 erratum. | |
| INITIALIZE_PASS (MipsDelaySlotFiller, DEBUG_TYPE, "Fill delay slot for MIPS", false, false) static void insertDelayFiller(Iter Filler | |
| This function inserts clones of Filler into predecessor blocks. | |
| for (const auto &I :BrMap) | |
| static void | addLiveInRegs (Iter Filler, MachineBasicBlock &MBB) |
| This function adds registers Filler defines to MBB's live-in register list. | |
| static int | getEquivalentCallShort (int Opcode) |
Variables | |
| static cl::opt< bool > | DisableDelaySlotFiller ("disable-mips-delay-filler", cl::init(false), cl::desc("Fill all delay slots with NOPs."), cl::Hidden) |
| static cl::opt< bool > | DisableForwardSearch ("disable-mips-df-forward-search", cl::init(true), cl::desc("Disallow MIPS delay filler to search forward."), cl::Hidden) |
| static cl::opt< bool > | DisableSuccBBSearch ("disable-mips-df-succbb-search", cl::init(true), cl::desc("Disallow MIPS delay filler to search successor basic blocks."), cl::Hidden) |
| static cl::opt< bool > | DisableBackwardSearch ("disable-mips-df-backward-search", cl::init(false), cl::desc("Disallow MIPS delay filler to search backward."), cl::Hidden) |
| cl::opt< CompactBranchPolicy > | MipsCompactBranchPolicy |
| const BB2BrMap & | BrMap |
| #define DEBUG_TYPE "mips-delay-slot-filler" |
Definition at line 50 of file MipsDelaySlotFiller.cpp.
|
static |
This function adds registers Filler defines to MBB's live-in register list.
Definition at line 372 of file MipsDelaySlotFiller.cpp.
References assert(), llvm::TargetRegisterInfo::getAllocatableSet(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), MBB, and llvm::BitVector::test().
Definition at line 361 of file MipsDelaySlotFiller.cpp.
References llvm::MIBundleBuilder::append(), BrMap, and I.
|
static |
Definition at line 629 of file MipsDelaySlotFiller.cpp.
References llvm_unreachable.
|
static |
Definition at line 279 of file MipsDelaySlotFiller.cpp.
References MI.
| INITIALIZE_PASS | ( | MipsDelaySlotFiller | , |
| DEBUG_TYPE | , | ||
| "Fill delay slot for MIPS" | , | ||
| false | , | ||
| false | ) |
This function inserts clones of Filler into predecessor blocks.
References DEBUG_TYPE.
|
static |
Check if a branch is a short backward loop that triggers the R5900 erratum.
Quote from binutils-gdb/gas/config/tc-mips.c:
On the R5900 short loops need to be fixed by inserting a NOP in the branch delay slot.
The short loop bug under certain conditions causes loops to execute only once or twice. We must ensure that the assembler never generates loops that satisfy all of the following conditions:
We need to do this because of a hardware bug in the R5900 chip.
Definition at line 301 of file MipsDelaySlotFiller.cpp.
References InstrCount, MBB, and MI.
| STATISTIC | ( | FilledSlots | , |
| "Number of delay slots filled" | ) |
| STATISTIC | ( | UsefulSlots | , |
| "Number of delay slots filled with instructions that" " are not NOP." | ) |
| const BB2BrMap& BrMap |
Definition at line 358 of file MipsDelaySlotFiller.cpp.
Referenced by for().
|
static |
|
static |
|
static |
|
static |
|
extern |
Referenced by llvm::MipsSubtarget::MipsSubtarget().