本文整理汇总了C++中CallInst::getArgOperandUse方法的典型用法代码示例。如果您正苦于以下问题:C++ CallInst::getArgOperandUse方法的具体用法?C++ CallInst::getArgOperandUse怎么用?C++ CallInst::getArgOperandUse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CallInst
的用法示例。
在下文中一共展示了CallInst::getArgOperandUse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uf
TEST(NousedTest, GepBeforeFail) {
const char Assembly[] = R"(
%struct.ST = type { i32, double, [4 x i32] }
declare void @test(%struct.ST*)
declare void @test2(i32*)
define void @a(){
entry:
%val = alloca %struct.ST, align 8
%0 = getelementptr inbounds %struct.ST* %val, i32 0, i32 0
%1 = load i32* %0
call void @test(%struct.ST* %val)
ret void
exp2:
%v2 = alloca %struct.ST, align 8
%2 = getelementptr inbounds %struct.ST* %v2, i32 0, i32 0
%3 = load i32* %2
call void @test2(i32* %2)
ret void
exp3:
%v3 = alloca %struct.ST, align 8
%4 = getelementptr inbounds %struct.ST* %v3, i32 0, i32 0
call void @test2(i32* %4)
ret void
})";
std::unique_ptr<Module> M = parseAssembly(Assembly);
Function::iterator F_a = M->getFunction("a")->begin();
BasicBlock::iterator B_a_beg = F_a->begin();
LoadInst* LI = cast<LoadInst>(std::next(B_a_beg, 2));
CallInst* Test = cast<CallInst>(std::next(B_a_beg, 3));
CallInst* Test2 = cast<CallInst>(std::next((++F_a)->begin(), 3));
CallInst* Test3 = cast<CallInst>(std::next((++F_a)->begin(), 2));
ResolveEngine RE;
RE.addRule(RE.ibase_rule);
RE.addRule(InitRule(RE.iuse_rule));
EXPECT_TRUE(std::less<Instruction>()(LI,Test));
Use* Q = &Test->getArgOperandUse(0);
iUseFilter uf(Q);
RE.addFilter(std::ref(uf));
Value* V;
RE.resolve(Q, RE.findVisit(V));
EXPECT_EQ(V, nullptr);
auto GEP = isGEP(Test2->getArgOperandUse(0));
RE.addFilter(GEPFilter(GEP));
Q = &Test2->getArgOperandUse(0);
uf.update(Q);
RE.resolve(Q, RE.findVisit(V));
EXPECT_EQ(V, nullptr);
Q = &Test3->getArgOperandUse(0);
uf.update(Q);
RE.resolve(Q, RE.findVisit(V));
EXPECT_EQ(V, nullptr);
}
示例2: ir
TEST(NousedTest, GepBeforeSucc) {
const char Assembly[] = R"(
%struct.ST = type { i32, double, [4 x i32] }
declare void @test(%struct.ST*)
declare void @test2(i32*)
define void @a(){
entry:
%val = alloca %struct.ST, align 8
%0 = getelementptr inbounds %struct.ST* %val, i32 0, i32 0
%1 = load i32* %0
call void @test(%struct.ST* %val)
%2 = load i32* %0
%3 = bitcast %struct.ST* %val to i8*
%4 = load i32* %0
ret void
exp2:
%v2 = alloca %struct.ST, align 8
%5 = getelementptr inbounds %struct.ST* %v2, i32 0, i32 0
call void @test2(i32* %6)
%6 = getelementptr inbounds %struct.ST* %v2, i32 0, i32 0
%7 = load i32* %6
ret void
})";
std::unique_ptr<Module> M = parseAssembly(Assembly);
Function::iterator F_a = M->getFunction("a")->begin();
BasicBlock::iterator B_a_beg = F_a->begin();
CallInst* Test = cast<CallInst>(std::next(B_a_beg, 3));
ResolveEngine RE;
RE.addRule(RE.ibase_rule);
InitRule ir(RE.iuse_rule);
RE.addRule(std::ref(ir));
Value* V = RE.find_visit(&Test->getArgOperandUse(0));
EXPECT_EQ(V, std::next(B_a_beg, 6)); // %4
}