Go to the documentation of this file.
31 #define DEBUG_TYPE "aarch64-fix-cortex-a53-835769"
33 STATISTIC(NumNopsAdded,
"Number of Nops added to work around erratum 835769");
42 switch (
MI->getOpcode()) {
44 case AArch64::PRFMroW:
45 case AArch64::PRFMroX:
50 return MI->mayLoadOrStore();
59 switch (
MI->getOpcode()) {
62 case AArch64::MSUBXrrr:
63 case AArch64::MADDXrrr:
64 case AArch64::SMADDLrrr:
65 case AArch64::SMSUBLrrr:
66 case AArch64::UMADDLrrr:
67 case AArch64::UMSUBLrrr:
70 return MI->getOperand(3).getReg() != AArch64::XZR;
97 return "Workaround A53 erratum 835769 pass";
113 "AArch64 fix for A53 erratum 835769",
false,
false)
122 if (!STI.fixCortexA53_835769())
125 bool Changed =
false;
126 TII = STI.getInstrInfo();
128 for (
auto &
MBB :
F) {
183 assert(
I &&
"Expected instruction");
197 bool Changed =
false;
199 <<
" - scanning instructions...\n");
205 std::vector<MachineInstr*> Sequences;
213 for (
auto &
MI :
MBB) {
218 <<
" CurrInstr: " << *CurrInstr
219 <<
" isFirstInstructionInSequence(PrevInstr): "
221 <<
" isSecondInstructionInSequence(CurrInstr): "
225 LLVM_DEBUG(
dbgs() <<
" ** pattern found at Idx " << Idx <<
"!\n");
227 Sequences.push_back(CurrInstr);
231 PrevInstr = CurrInstr;
236 <<
" occurrences of pattern found.\n");
239 for (
auto &
MI : Sequences) {
250 return new AArch64A53Fix835769();
static MachineInstr * getLastNonPseudo(MachineBasicBlock &MBB, const TargetInstrInfo *TII)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
static bool runOnBasicBlock(MachineBasicBlock *MBB, unsigned BasicBlockNum, VRegRenamer &Renamer)
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
Analyze the branching code at the end of MBB, returning true if it cannot be understood (e....
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
static MachineBasicBlock * getBBFallenThrough(MachineBasicBlock *MBB, const TargetInstrInfo *TII)
void initializeAArch64A53Fix835769Pass(PassRegistry &)
Properties which a MachineFunction may have at a given point in time.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
FunctionPass * createAArch64A53Fix835769()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
TargetInstrInfo - Interface to description of machine instruction set.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Represent the analysis usage information of a pass.
const HexagonInstrInfo * TII
bool isPseudo(QueryType Type=IgnoreBundle) const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction.
MachineFunctionProperties & set(Property P)
STATISTIC(NumFunctions, "Total number of functions")
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Representation of each machine instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
iterator_range< pred_iterator > predecessors()
SmallVector< MachineOperand, 4 > Cond
void setPreservesCFG()
This function should be called by the pass, iff they do not:
StringRef - Represent a constant reference to a string, i.e.
MachineBasicBlock MachineBasicBlock::iterator MBBI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static bool isSecondInstructionInSequence(MachineInstr *MI)
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
static void insertNopBeforeInstruction(MachineBasicBlock &MBB, MachineInstr *MI, const TargetInstrInfo *TII)
Iterator for intrusive lists based on ilist_node.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
FunctionPass class - This class is used to implement most global optimizations.
INITIALIZE_PASS(AArch64A53Fix835769, "aarch64-fix-cortex-a53-835769-pass", "AArch64 fix for A53 erratum 835769", false, false) bool AArch64A53Fix835769
static bool isFirstInstructionInSequence(MachineInstr *MI)