File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1693,6 +1693,8 @@ class BBIterator {
1693
1693
// / \Returns the SBInstruction that corresponds to this iterator, or null if
1694
1694
// / the instruction is not found in the IR-to-SandboxIR tables.
1695
1695
pointer get () const { return getInstr (It); }
1696
+ // / \Returns the parent BB.
1697
+ BasicBlock *getNodeParent () const ;
1696
1698
};
1697
1699
1698
1700
// / Contains a list of sandboxir::Instruction's.
Original file line number Diff line number Diff line change @@ -306,6 +306,11 @@ BBIterator &BBIterator::operator--() {
306
306
return *this ;
307
307
}
308
308
309
+ BasicBlock *BBIterator::getNodeParent () const {
310
+ llvm::BasicBlock *Parent = const_cast <BBIterator *>(this )->It .getNodeParent ();
311
+ return cast<BasicBlock>(Ctx->getValue (Parent));
312
+ }
313
+
309
314
const char *Instruction::getOpcodeName (Opcode Opc) {
310
315
switch (Opc) {
311
316
#define OP (OPC ) \
Original file line number Diff line number Diff line change @@ -1575,12 +1575,16 @@ define void @foo(i32 %v1) {
1575
1575
for (sandboxir::Instruction &I : BB0) {
1576
1576
EXPECT_EQ (&I, Ctx.getValue (LLVMI));
1577
1577
LLVMI = LLVMI->getNextNode ();
1578
+ // Check getNodeParent().
1579
+ EXPECT_EQ (I.getIterator ().getNodeParent (), &BB0);
1578
1580
}
1579
1581
LLVMI = &*LLVMBB1->begin ();
1580
1582
for (sandboxir::Instruction &I : BB1) {
1581
1583
EXPECT_EQ (&I, Ctx.getValue (LLVMI));
1582
1584
LLVMI = LLVMI->getNextNode ();
1583
1585
}
1586
+ // Check NodeParent() for BB::end().
1587
+ EXPECT_EQ (BB0.end ().getNodeParent (), &BB0);
1584
1588
1585
1589
// Check BB.getTerminator()
1586
1590
EXPECT_EQ (BB0.getTerminator (), Ctx.getValue (LLVMBB0->getTerminator ()));
You can’t perform that action at this time.
0 commit comments