30 #define DEBUG_TYPE "aarch64-fix-cortex-a53-835769" 32 STATISTIC(NumNopsAdded,
"Number of Nops added to work around erratum 835769");
43 case AArch64::PRFMroW:
44 case AArch64::PRFMroX:
61 case AArch64::MSUBXrrr:
62 case AArch64::MADDXrrr:
63 case AArch64::SMADDLrrr:
64 case AArch64::SMSUBLrrr:
65 case AArch64::UMADDLrrr:
66 case AArch64::UMSUBLrrr:
96 return "Workaround A53 erratum 835769 pass";
112 "AArch64 fix for A53 erratum 835769",
false,
false)
119 bool Changed =
false;
120 TII = F.getSubtarget().getInstrInfo();
122 for (
auto &MBB : F) {
144 if (S == PrevBB && !TII->
analyzeBranch(*PrevBB, TBB, FBB, Cond) && !TBB &&
175 if (MI == &MBB.
front()) {
177 assert(I &&
"Expected instruction");
183 BuildMI(MBB, MI, DL, TII->
get(AArch64::HINT)).addImm(0);
191 bool Changed =
false;
193 <<
" - scanning instructions...\n");
199 std::vector<MachineInstr*> Sequences;
207 for (
auto &
MI : MBB) {
212 <<
" CurrInstr: " << *CurrInstr
213 <<
" isFirstInstructionInSequence(PrevInstr): " 215 <<
" isSecondInstructionInSequence(CurrInstr): " 219 LLVM_DEBUG(
dbgs() <<
" ** pattern found at Idx " << Idx <<
"!\n");
220 Sequences.push_back(CurrInstr);
224 PrevInstr = CurrInstr;
229 <<
" occurrences of pattern found.\n");
232 for (
auto &
MI : Sequences) {
243 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.
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...
static bool runOnBasicBlock(MachineBasicBlock *MBB, unsigned BasicBlockNum, VRegRenamer &Renamer)
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.
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.
Register getReg() const
getReg - Returns the register number.
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)