Lines Matching refs:MBB
150 bool instrumentControlFlow(MachineBasicBlock &MBB,
152 bool endsWithCondControlFlow(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
157 void insertSPToRegTaintPropagation(MachineBasicBlock &MBB,
159 void insertRegToSPTaintPropagation(MachineBasicBlock &MBB,
162 void insertFullSpeculationBarrier(MachineBasicBlock &MBB,
166 bool slhLoads(MachineBasicBlock &MBB);
167 bool makeGPRSpeculationSafe(MachineBasicBlock &MBB,
170 bool lowerSpeculationSafeValuePseudos(MachineBasicBlock &MBB,
172 bool expandSpeculationSafeValue(MachineBasicBlock &MBB,
175 bool insertCSDB(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
187 MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, in endsWithCondControlFlow() argument
190 if (TII->analyzeBranch(MBB, TBB, FBB, analyzeBranchCondCode, false)) in endsWithCondControlFlow()
202 FBB = MBB.getFallThrough(); in endsWithCondControlFlow()
210 assert(MBB.succ_size() == 2); in endsWithCondControlFlow()
218 MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, in insertFullSpeculationBarrier() argument
221 BuildMI(MBB, MBBI, DL, TII->get(AArch64::DSB)).addImm(0xf); in insertFullSpeculationBarrier()
222 BuildMI(MBB, MBBI, DL, TII->get(AArch64::ISB)).addImm(0xf); in insertFullSpeculationBarrier()
241 MachineBasicBlock &MBB, bool &UsesFullSpeculationBarrier) { in instrumentControlFlow() argument
242 LLVM_DEBUG(dbgs() << "Instrument control flow tracking on MBB: " << MBB); in instrumentControlFlow()
249 if (!endsWithCondControlFlow(MBB, TBB, FBB, CondCode)) { in instrumentControlFlow()
258 MachineBasicBlock *SplitEdgeTBB = MBB.SplitCriticalEdge(TBB, *this); in instrumentControlFlow()
259 MachineBasicBlock *SplitEdgeFBB = MBB.SplitCriticalEdge(FBB, *this); in instrumentControlFlow()
265 if (MBB.instr_end() != MBB.instr_begin()) in instrumentControlFlow()
266 DL = (--MBB.instr_end())->getDebugLoc(); in instrumentControlFlow()
289 RS.enterBasicBlock(MBB); in instrumentControlFlow()
291 for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); I++) { in instrumentControlFlow()
299 if (I != MBB.begin()) in instrumentControlFlow()
325 insertFullSpeculationBarrier(MBB, MBB.begin(), in instrumentControlFlow()
326 (MBB.begin())->getDebugLoc()); in instrumentControlFlow()
337 insertRegToSPTaintPropagation(MBB, MI_Reg.first, MI_Reg.second); in instrumentControlFlow()
349 MBB, std::next((MachineBasicBlock::iterator)MI_Reg.first)); in instrumentControlFlow()
351 insertRegToSPTaintPropagation(MBB, MI_Reg.first, MI_Reg.second); in instrumentControlFlow()
359 MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const { in insertSPToRegTaintPropagation() argument
364 insertFullSpeculationBarrier(MBB, MBBI, DebugLoc()); in insertSPToRegTaintPropagation()
369 BuildMI(MBB, MBBI, DebugLoc(), TII->get(AArch64::SUBSXri)) in insertSPToRegTaintPropagation()
375 BuildMI(MBB, MBBI, DebugLoc(), TII->get(AArch64::CSINVXr)) in insertSPToRegTaintPropagation()
383 MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, in insertRegToSPTaintPropagation() argument
392 BuildMI(MBB, MBBI, DebugLoc(), TII->get(AArch64::ADDXri)) in insertRegToSPTaintPropagation()
398 BuildMI(MBB, MBBI, DebugLoc(), TII->get(AArch64::ANDXrs)) in insertRegToSPTaintPropagation()
404 BuildMI(MBB, MBBI, DebugLoc(), TII->get(AArch64::ADDXri)) in insertRegToSPTaintPropagation()
413 for (MachineBasicBlock &MBB : MF) { in functionUsesHardeningRegister()
414 for (MachineInstr &MI : MBB) { in functionUsesHardeningRegister()
431 MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, MachineInstr &MI, in makeGPRSpeculationSafe() argument
450 BuildMI(MBB, MBBI, MI.getDebugLoc(), in makeGPRSpeculationSafe()
459 bool AArch64SpeculationHardening::slhLoads(MachineBasicBlock &MBB) { in slhLoads() argument
462 LLVM_DEBUG(dbgs() << "slhLoads running on MBB: " << MBB); in slhLoads()
466 MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); in slhLoads()
518 Modified |= makeGPRSpeculationSafe(MBB, NextMBBI, MI, Def.getReg()); in slhLoads()
539 Modified |= makeGPRSpeculationSafe(MBB, MBBI, MI, Reg); in slhLoads()
548 MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, in expandSpeculationSafeValue() argument
575 BuildMI(MBB, MBBI, MI.getDebugLoc(), in expandSpeculationSafeValue()
589 bool AArch64SpeculationHardening::insertCSDB(MachineBasicBlock &MBB, in insertCSDB() argument
596 BuildMI(MBB, MBBI, DL, TII->get(AArch64::HINT)).addImm(0x14); in insertCSDB()
602 MachineBasicBlock &MBB, bool UsesFullSpeculationBarrier) { in lowerSpeculationSafeValuePseudos() argument
617 MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); in lowerSpeculationSafeValuePseudos()
638 Modified |= insertCSDB(MBB, MBBI, DL); in lowerSpeculationSafeValuePseudos()
641 expandSpeculationSafeValue(MBB, MBBI, UsesFullSpeculationBarrier); in lowerSpeculationSafeValuePseudos()
647 Modified |= insertCSDB(MBB, MBBI, DL); in lowerSpeculationSafeValuePseudos()
671 for (auto &MBB : MF) in runOnMachineFunction() local
672 Modified |= slhLoads(MBB); in runOnMachineFunction()
689 for (auto &MBB : MF) { in runOnMachineFunction() local
691 Modified |= instrumentControlFlow(MBB, UsesFullSpeculationBarrier); in runOnMachineFunction()
693 lowerSpeculationSafeValuePseudos(MBB, UsesFullSpeculationBarrier); in runOnMachineFunction()