28#define DEBUG_TYPE "ipt"
29STATISTIC(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.contains(BB)) {
52 assert(FirstSpecialInsts.contains(BB) &&
"Must be!");
54 return FirstSpecialInsts[BB];
69void InstructionPrecedenceTracking::fill(
const BasicBlock *BB) {
70 FirstSpecialInsts.erase(BB);
71 for (
const auto &
I : *BB) {
74 FirstSpecialInsts[BB] = &
I;
80 FirstSpecialInsts[BB] =
nullptr;
84void 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 "
102void 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();
SmallVector< AArch64_IMM::ImmInsnModel, 4 > Insn
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
LLVM Basic Block Representation.
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...
void clear()
Invalidates all information from this tracking.
void removeUsersOf(const Instruction *Inst)
Notifies this tracking that we are going to replace all uses of Inst.
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.
void removeInstruction(const Instruction *Inst)
Notifies this tracking that we are going to remove the instruction Inst It makes all necessary update...
const Instruction * getFirstSpecialInstruction(const BasicBlock *BB)
Returns the topmost special instruction from the block BB.
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...
bool hasSpecialInstructions(const BasicBlock *BB)
Returns true iff at least one instruction from the basic block BB is special.
bool isPreceededBySpecialInstruction(const Instruction *Insn)
Returns true iff the first special instruction of Insn's block exists and dominates Insn.
bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
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...
iterator_range< user_iterator > users()
const ParentTy * getParent() const
bool match(Val *V, const Pattern &P)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I)
Return true if this function can prove that the instruction I will always transfer execution to one o...