31 #define DEBUG_TYPE "aarch64-fix-cortex-a53-835769" 33 STATISTIC(NumNopsAdded,
"Number of Nops added to work around erratum 835769");
44 case AArch64::PRFMroW:
45 case AArch64::PRFMroX:
62 case AArch64::MSUBXrrr:
63 case AArch64::MADDXrrr:
64 case AArch64::SMADDLrrr:
65 case AArch64::SMSUBLrrr:
66 case AArch64::UMADDLrrr:
67 case AArch64::UMSUBLrrr:
97 return "Workaround A53 erratum 835769 pass";
113 "AArch64 fix for A53 erratum 835769",
false,
false)
120 bool Changed =
false;
121 TII = F.getSubtarget().getInstrInfo();
123 for (
auto &MBB : F) {
145 if (S == PrevBB && !TII->
analyzeBranch(*PrevBB, TBB, FBB, Cond) && !TBB &&
176 if (MI == &MBB.
front()) {
178 assert(I &&
"Expected instruction");
184 BuildMI(MBB, MI, DL, TII->
get(AArch64::HINT)).addImm(0);
192 bool Changed =
false;
194 <<
" - scanning instructions...\n");
200 std::vector<MachineInstr*> Sequences;
208 for (
auto &
MI : MBB) {
213 <<
" CurrInstr: " << *CurrInstr
214 <<
" isFirstInstructionInSequence(PrevInstr): " 216 <<
" isSecondInstructionInSequence(CurrInstr): " 220 LLVM_DEBUG(
dbgs() <<
" ** pattern found at Idx " << Idx <<
"!\n");
221 Sequences.push_back(CurrInstr);
225 PrevInstr = CurrInstr;
230 <<
" occurrences of pattern found.\n");
233 for (
auto &
MI : Sequences) {
244 return new AArch64A53Fix835769();
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void initializeAArch64A53Fix835769Pass(PassRegistry &)
This class represents lattice values for constants.
static MachineBasicBlock * getBBFallenThrough(MachineBasicBlock *MBB, const TargetInstrInfo *TII)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned getReg() const
getReg - Returns the register number.
static MachineInstr * getLastNonPseudo(MachineBasicBlock &MBB, const TargetInstrInfo *TII)
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
STATISTIC(NumFunctions, "Total number of functions")
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
static bool isSecondInstructionInSequence(MachineInstr *MI)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
virtual MachineFunctionProperties getRequiredProperties() const
reverse_iterator rbegin()
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
bool isPseudo(QueryType Type=IgnoreBundle) const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction...
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
iterator_range< pred_iterator > predecessors()
virtual bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Iterator for intrusive lists based on ilist_node.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass * createAArch64A53Fix835769()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool runOnBasicBlock(MachineBasicBlock *MBB, std::vector< StringRef > &bbNames, std::vector< unsigned > &renamedInOtherBB, unsigned &basicBlockNum, unsigned &VRegGapIndex, NamedVRegCursor &NVC)
const MachineBasicBlock * getParent() const
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
INITIALIZE_PASS(AArch64A53Fix835769, "aarch64-fix-cortex-a53-835769-pass", "AArch64 fix for A53 erratum 835769", false, false) bool AArch64A53Fix835769
static bool isFirstInstructionInSequence(MachineInstr *MI)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineFunctionPass(char &ID)
StringRef - Represent a constant reference to a string, i.e.
const MachineOperand & getOperand(unsigned i) const
Properties which a MachineFunction may have at a given point in time.
static void insertNopBeforeInstruction(MachineBasicBlock &MBB, MachineInstr *MI, const TargetInstrInfo *TII)