29 : NextInstPos(0), BB(BasicB) {
30 LastInstFound = BB->
end();
35 bool OrderedBasicBlock::comesBefore(
const Instruction *A,
38 assert(!(LastInstFound == BB->
end() && NextInstPos != 0) &&
39 "Instruction supposed to be in NumberedInsts");
40 assert(A->
getParent() == BB &&
"Instruction supposed to be in the block!");
41 assert(B->
getParent() == BB &&
"Instruction supposed to be in the block!");
44 auto II = BB->
begin();
46 if (LastInstFound !=
IE)
47 II = std::next(LastInstFound);
50 for (; II !=
IE; ++II) {
51 Inst = cast<Instruction>(II);
52 NumberedInsts[Inst] = NextInstPos++;
53 if (Inst == A || Inst == B)
57 assert(II !=
IE &&
"Instruction not found?");
58 assert((Inst == A || Inst == B) &&
"Should find A or B");
69 "Instructions must be in the same basic block!");
70 assert(A->
getParent() == BB &&
"Instructions must be in the tracked block!");
78 auto NAI = NumberedInsts.find(A);
79 auto NBI = NumberedInsts.find(B);
80 if (NAI != NumberedInsts.end() && NBI != NumberedInsts.end())
81 return NAI->second < NBI->second;
82 if (NAI != NumberedInsts.end())
84 if (NBI != NumberedInsts.end())
87 return comesBefore(A, B);
OrderedBasicBlock(const BasicBlock *BasicB)
This class represents lattice values for constants.
bool dominates(const Instruction *A, const Instruction *B)
Find out whether A dominates B, meaning whether A comes before B in BB.
iterator begin()
Instruction iterator methods.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
LLVM Basic Block Representation.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const BasicBlock * getParent() const