36 "Errata workaround pass",
false,
false)
48 while (
I ==
MBB->end()) {
49 if (
MBB->getFallThrough() ==
nullptr)
51 MBB =
MBB->getFallThrough();
54 }
while (
I->isMetaInstruction() ||
I->isInlineAsm());
61 BuildMI(*
I->getParent(),
I,
I->getDebugLoc(),
TII->get(SP::NOP));
65 if (
I->getNumOperands() == 0)
68 if (!
I->getOperand(0).isReg())
71 unsigned reg =
I->getOperand(0).getReg();
80 switch (
I->getOpcode()) {
91 switch (
I->getOpcode()) {
109 switch (
I->getOpcode()) {
127 if (
MI->mayStore() ||
MI->mayLoad())
149 switch (
I->getOpcode()) {
182 if (
I->isBranch() &&
I->getOperand(0).isMBB()) {
186 while (
MI != TargetMBB->
end() &&
MI->isMetaInstruction())
189 if (
MI == TargetMBB->
end())
211 while (
I !=
MBB.end() &&
I->isMetaInstruction())
226 if (
I->getOpcode() != SP::BCOND &&
I->getOpcode() != SP::BCONDA)
232 while (
MI != TargetMBB->
end() &&
MI->isMetaInstruction())
235 if (
MI == TargetMBB->
end())
261 unsigned dstReg =
I->getOperand(0).getReg();
267 if (
MI->isBranch()) {
274 unsigned fpFound = 0;
275 for (
unsigned i = 0; i < 4; i++) {
283 if (
MI->readsRegister(dstReg,
TRI))
310 if (!(ST->fixTN0009() || ST->fixTN0010() || ST->fixTN0012() ||
320 for (
auto &
MBB : MF) {
321 for (
auto &
I :
MBB) {
322 if (ST->fixTN0009()) {
367 if (!Subtarget->insertNOPLoad())
377 unsigned Opcode =
MI.getOpcode();
378 if (Opcode >= SP::LDDArr && Opcode <= SP::LDrr) {
418 if (!Subtarget->detectRoundChange())
424 unsigned Opcode =
MI.getOpcode();
425 if (Opcode == SP::CALL &&
MI.getNumOperands() > 0) {
431 errs() <<
"Error: You are using the detectroundchange "
432 "option to detect rounding changes that will "
433 "cause LEON errata. The only way to fix this "
434 "is to remove the call to fesetround from "
435 "the source code.\n";
480 if (!Subtarget->fixAllFDIVSQRT())
490 unsigned Opcode =
MI.getOpcode();
496 if (Opcode == SP::FSQRTD || Opcode == SP::FDIVD) {
497 for (
int InsertedCount = 0; InsertedCount < 5; InsertedCount++)
501 for (
int InsertedCount = 0; InsertedCount < 28; InsertedCount++)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const HexagonInstrInfo * TII
static bool detectRoundChangeOnMachineFunction(MachineFunction &MF)
static bool isDivSqrt(MachineBasicBlock::iterator I)
static bool fixAllFDIVSQRTInMachineFunction(MachineFunction &MF)
static bool insertNOPLoadInMachineFunction(MachineFunction &MF)
static bool isFloat(MachineBasicBlock::iterator I)
static bool checkSeqTN0010First(MachineBasicBlock &MBB, const TargetInstrInfo *TII)
static bool checkSeqTN0010(MachineBasicBlock::iterator I, const TargetInstrInfo *TII)
static bool isAtomic(MachineBasicBlock::iterator I)
static bool runErrataWorkaroundOnMachineFunction(MachineFunction &MF)
static bool checkSeqTN0009A(MachineBasicBlock::iterator I, const TargetInstrInfo *TII)
static bool checkSeqTN0013(MachineBasicBlock::iterator I, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
static void insertNop(MachineBasicBlock::iterator I, const TargetInstrInfo *TII)
static bool checkSeqTN0012(MachineBasicBlock::iterator I, const TargetInstrInfo *TII)
static bool checkSeqTN0009B(MachineBasicBlock::iterator I, const TargetInstrInfo *TII)
Register const TargetRegisterInfo * TRI
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Represents analyses that only rely on functions' control flow.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass(char &ID)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const MachineBasicBlock & front() const
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
SparcDetectRoundChangeLegacy()
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
SparcErrataWorkaroundLegacy()
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
SparcFixAllFDIVSQRTLegacy()
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
SparcInsertNOPLoadLegacy()
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
const SparcInstrInfo * getInstrInfo() const override
Represent a constant reference to a string, i.e.
LLVM_ABI int compare_insensitive(StringRef RHS) const
Compare two strings, ignoring case.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
Pass manager infrastructure for declaring and invalidating analyses.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
void initializeSparcErrataWorkaroundLegacyPass(PassRegistry &)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.