38 auto [It, Inserted] = FirstSpecialInsts.try_emplace(BB);
40 for (
const auto &
I : *BB) {
59 return MaybeFirstSpecial && MaybeFirstSpecial->
comesBefore(Insn);
63void InstructionPrecedenceTracking::validate(
const BasicBlock *BB)
const {
64 auto It = FirstSpecialInsts.find(BB);
66 if (It == FirstSpecialInsts.end())
71 assert(It->second == &Insn &&
72 "Cached first special instruction is wrong!");
76 assert(It->second ==
nullptr &&
77 "Block is marked as having special instructions but in fact it has "
81void InstructionPrecedenceTracking::validateAll()
const {
83 for (
const auto &It : FirstSpecialInsts)
91 FirstSpecialInsts.erase(BB);
96 assert(BB &&
"must be called before instruction is actually removed");
97 auto It = FirstSpecialInsts.find(BB);
98 if (It != FirstSpecialInsts.end() && It->second == Inst)
99 FirstSpecialInsts.erase(It);
103 for (
const auto *U : Inst->
users()) {
110 FirstSpecialInsts.clear();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
LLVM Basic Block Representation.
LLVM_ABI LLVMContext & getContext() const
Get the context in which this basic block lives.
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...
LLVM_ABI void clear()
Invalidates all information from this tracking.
LLVM_ABI void removeUsersOf(const Instruction *Inst)
Notifies this tracking that we are going to replace all uses of Inst.
LLVM_ABI 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.
LLVM_ABI void removeInstruction(const Instruction *Inst)
Notifies this tracking that we are going to remove the instruction Inst It makes all necessary update...
LLVM_ABI 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...
LLVM_ABI bool hasSpecialInstructions(const BasicBlock *BB)
Returns true iff at least one instruction from the basic block BB is special.
LLVM_ABI bool isPreceededBySpecialInstruction(const Instruction *Insn)
Returns true iff the first special instruction of Insn's block exists and dominates Insn.
LLVM_ABI bool mayWriteToMemory() const LLVM_READONLY
Return true if this instruction may modify memory.
LLVM_ABI bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
iterator_range< user_iterator > users()
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...
const ParentTy * getParent() const
bool match(Val *V, const Pattern &P)
auto m_Intrinsic(const Ts &...Ops)
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
const AnalysisOptions & getAnalysisOptions(const LLVMContext &C)
LLVM_ABI bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I)
Return true if this function can prove that the instruction I will always transfer execution to one o...