Go to the documentation of this file.
28 #define DEBUG_TYPE "ipt"
29 STATISTIC(NumInstScanned,
"Number of insts scanned while updating ibt");
33 "ipt-expensive-asserts",
34 cl::desc(
"Perform expensive assert validation on every query to Instruction"
35 " Precedence Tracking"),
50 if (FirstSpecialInsts.find(
BB) == FirstSpecialInsts.end()) {
52 assert(FirstSpecialInsts.find(
BB) != FirstSpecialInsts.end() &&
"Must be!");
54 return FirstSpecialInsts[
BB];
69 void InstructionPrecedenceTracking::fill(
const BasicBlock *
BB) {
70 FirstSpecialInsts.erase(
BB);
71 for (
const auto &
I : *
BB) {
74 FirstSpecialInsts[
BB] = &
I;
80 FirstSpecialInsts[
BB] =
nullptr;
84 void InstructionPrecedenceTracking::validate(
const BasicBlock *
BB)
const {
85 auto It = FirstSpecialInsts.find(
BB);
87 if (It == FirstSpecialInsts.end())
93 "Cached first special instruction is wrong!");
97 assert(It->second ==
nullptr &&
98 "Block is marked as having special instructions but in fact it has "
102 void InstructionPrecedenceTracking::validateAll()
const {
104 for (
const auto &It : FirstSpecialInsts)
112 FirstSpecialInsts.erase(
BB);
117 assert(
BB &&
"must be called before instruction is actually removed");
118 if (FirstSpecialInsts.count(
BB) && FirstSpecialInsts[
BB] == Inst)
119 FirstSpecialInsts.erase(
BB);
123 for (
const auto *U : Inst->
users()) {
124 if (
const auto *UI = dyn_cast<Instruction>(U))
130 FirstSpecialInsts.clear();
149 using namespace PatternMatch;
150 if (
match(
Insn, m_Intrinsic<Intrinsic::experimental_widenable_condition>()))
152 return Insn->mayWriteToMemory();
This is an optimization pass for GlobalISel generic memory operations.
const Instruction * getFirstSpecialInstruction(const BasicBlock *BB)
Returns the topmost special instruction from the block BB.
void insertInstructionTo(const Instruction *Inst, const BasicBlock *BB)
Notifies this tracking that we are going to insert a new instruction Inst to the basic block BB.
bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
LLVM Basic Block Representation.
bool match(Val *V, const Pattern &P)
virtual bool isSpecialInstruction(const Instruction *Insn) const =0
A predicate that defines whether or not the instruction Insn is considered special and needs to be tr...
STATISTIC(NumFunctions, "Total number of functions")
bool isPreceededBySpecialInstruction(const Instruction *Insn)
Returns true iff the first special instruction of Insn's block exists and dominates Insn.
bool isSpecialInstruction(const Instruction *Insn) const override
A predicate that defines whether or not the instruction Insn is considered special and needs to be tr...
bool isSpecialInstruction(const Instruction *Insn) const override
A predicate that defines whether or not the instruction Insn is considered special and needs to be tr...
static cl::opt< bool > ExpensiveAsserts("ipt-expensive-asserts", cl::desc("Perform expensive assert validation on every query to Instruction" " Precedence Tracking"), cl::init(false), cl::Hidden)
void removeUsersOf(const Instruction *Inst)
Notifies this tracking that we are going to replace all uses of Inst.
initializer< Ty > init(const Ty &Val)
void removeInstruction(const Instruction *Inst)
Notifies this tracking that we are going to remove the instruction Inst It makes all necessary update...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasSpecialInstructions(const BasicBlock *BB)
Returns true iff at least one instruction from the basic block BB is special.
void clear()
Invalidates all information from this tracking.
SmallVector< AArch64_IMM::ImmInsnModel, 4 > Insn
bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I)
Return true if this function can prove that the instruction I will always transfer execution to one o...
const BasicBlock * getParent() const
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
iterator_range< user_iterator > users()