16BBIterator &BBIterator::operator++() {
18 assert(It != ItE &&
"Already at end!");
23 unsigned Num = NextI.getNumOfIRInstrs();
24 assert(Num > 0 &&
"Bad getNumOfIRInstrs()");
25 It = std::next(It, Num - 1);
29BBIterator &BBIterator::operator--() {
30 assert(It != BB->begin() &&
"Already at begin!");
31 if (It == BB->end()) {
36 unsigned Num = CurrI.getNumOfIRInstrs();
37 assert(Num > 0 &&
"Bad getNumOfIRInstrs()");
38 assert(std::prev(It, Num - 1) != BB->begin() &&
"Already at begin!");
39 It = std::prev(It, Num);
43BasicBlock *BBIterator::getNodeParent()
const {
44 llvm::BasicBlock *Parent =
const_cast<BBIterator *
>(
this)->It.getNodeParent();
48BasicBlock::iterator::pointer
55 auto *
F = BB->getParent();
65 Ctx.getOrCreateValue(
I);
70 Ctx.getOrCreateValue(
Op);
82 auto *
V = Ctx.getValue(&*BB->
begin());
83 assert(V !=
nullptr &&
"No SandboxIR for BB->begin()!");
85 unsigned Num =
I->getNumOfIRInstrs();
86 assert(Num >= 1u &&
"Bad getNumOfIRInstrs()");
87 It = std::next(It, Num - 1);
102 assert(SBI !=
nullptr &&
"Expected Instr!");
110 assert(SBI !=
nullptr &&
"Expected Instr!");
117 const auto &Name = BB->
getName();
124 return Ctx.getValue(&
I) ==
nullptr;
126 OS <<
"<Crash-proof mode!>\n";
129 Value *SBV = Ctx.getValue(&IRef);
131 OS << IRef <<
" *** No SandboxIR ***\n";
134 if (SBI ==
nullptr) {
135 OS << IRef <<
" *** Not a SBInstruction!!! ***\n";
137 if (Visited.
insert(SBI).second)
143 for (
auto &SBI : *
this) {
150void BasicBlock::verify()
const {
152 for (
const auto &
I : *
this) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineInstr unsigned OpIdx
LLVM Basic Block Representation.
iterator begin()
Instruction iterator methods.
const Function * getParent() const
Return the enclosing method, or null if none.
reverse_iterator rbegin()
const Instruction & back() const
const Instruction & front() const
InstListType::iterator iterator
Instruction iterators...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Implements a dense probed hash-table based set.
LLVM Value Representation.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
std::pair< iterator, bool > insert(const ValueT &V)
This class implements an extremely fast bulk output stream that can only output to a stream.
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
Context & getContext() const
void verify() const final
LLVM_ABI Instruction * getTerminator() const
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
auto cast_or_null(const Y &Val)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
auto reverse(ContainerTy &&C)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.