本文整理汇总了C++中llvm::Function::dump方法的典型用法代码示例。如果您正苦于以下问题:C++ Function::dump方法的具体用法?C++ Function::dump怎么用?C++ Function::dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::Function
的用法示例。
在下文中一共展示了Function::dump方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runOnFunction
bool IndependentBlocks::runOnFunction(llvm::Function &F) {
bool Changed = false;
RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
SD = &getAnalysis<ScopDetection>();
SE = &getAnalysis<ScalarEvolution>();
AllocaBlock = &F.getEntryBlock();
DEBUG(dbgs() << "Run IndepBlock on " << F.getName() << '\n');
for (const Region *R : *SD) {
Changed |= createIndependentBlocks(R);
Changed |= eliminateDeadCode(R);
// This may change the RegionTree.
if (!DisableIntraScopScalarToArray || !PollyModelPHINodes)
Changed |= splitExitBlock(const_cast<Region *>(R));
}
DEBUG(dbgs() << "Before Scalar to Array------->\n");
DEBUG(F.dump());
if (!DisableIntraScopScalarToArray || !PollyModelPHINodes)
for (const Region *R : *SD)
Changed |= translateScalarToArray(R);
DEBUG(dbgs() << "After Independent Blocks------------->\n");
DEBUG(F.dump());
verifyAnalysis();
return Changed;
}
示例2: runOnFunction
bool Unboxing::runOnFunction(llvm::Function & f) {
//std::cout << "running Unboxing optimization..." << std::endl;
m = reinterpret_cast<RiftModule*>(f.getParent());
ta = &getAnalysis<TypeAnalysis>();
for (auto & b : f) {
auto i = b.begin();
while (i != b.end()) {
ins = i;
bool erase = false;
if (CallInst * ci = dyn_cast<CallInst>(ins)) {
StringRef s = ci->getCalledFunction()->getName();
if (s == "genericAdd") {
erase = genericArithmetic(Instruction::FAdd);
} else if (s == "genericSub") {
erase = genericArithmetic(Instruction::FSub);
} else if (s == "genericMul") {
erase = genericArithmetic(Instruction::FMul);
} else if (s == "genericDiv") {
erase = genericArithmetic(Instruction::FDiv);
} else if (s == "genericLt") {
erase = genericRelational(FCmpInst::FCMP_OLT);
} else if (s == "genericGt") {
erase = genericRelational(FCmpInst::FCMP_OGT);
} else if (s == "genericEq") {
erase = genericRelational(FCmpInst::FCMP_OEQ);
} else if (s == "genericNeq") {
erase = genericRelational(FCmpInst::FCMP_ONE);
} else if (s == "genericGetElement") {
erase = genericGetElement();
}
}
if (erase) {
llvm::Instruction * v = i;
++i;
state().erase(v);
v->eraseFromParent();
} else {
++i;
}
}
}
if (DEBUG) {
cout << "After unboxing optimization: --------------------------------" << endl;
f.dump();
state().print(cout);
}
return false;
}
示例3: runOnFunction
bool TypeAnalysis::runOnFunction(llvm::Function & f) {
state.clear();
if (DEBUG) std::cout << "runnning TypeAnalysis..." << std::endl;
// for all basic blocks, for all instructions
do {
// cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << endl;
state.iterationStart();
for (auto & b : f) {
for (auto & i : b) {
if (CallInst * ci = dyn_cast<CallInst>(&i)) {
StringRef s = ci->getCalledFunction()->getName();
if (s == "doubleVectorLiteral") {
// when creating literal from a double, it is
// always double scalar
llvm::Value * op = ci->getOperand(0);
AType * t = new AType(AType::Kind::D);
state.update(op, t);
state.update(ci, new AType(AType::Kind::DV, t));
} else if (s == "characterVectorLiteral") {
state.update(ci, new AType(AType::Kind::CV));
} else if (s == "fromDoubleVector") {
state.update(ci,
new AType(AType::Kind::R,
state.get(ci->getOperand(0))));
} else if (s == "fromCharacterVector") {
state.update(ci,
new AType(AType::Kind::R,
state.get(ci->getOperand(0))));
} else if (s == "fromFunction") {
state.update(ci,
new AType(AType::Kind::R,
state.get(ci->getOperand(0))));
} else if (s == "genericGetElement") {
genericGetElement(ci);
} else if (s == "genericSetElement") {
// don't do anything for set element as it does not
// produce any new value
} else if (s == "genericAdd") {
genericArithmetic(ci);
} else if (s == "genericSub") {
genericArithmetic(ci);
} else if (s == "genericMul") {
genericArithmetic(ci);
} else if (s == "genericDiv") {
genericArithmetic(ci);
} else if (s == "genericEq") {
genericRelational(ci);
} else if (s == "genericNeq") {
genericRelational(ci);
} else if (s == "genericLt") {
genericRelational(ci);
} else if (s == "genericGt") {
genericRelational(ci);
} else if (s == "length") {
// result of length operation is always
// double scalar
state.update(ci, new AType(AType::Kind::D));
} else if (s == "type") {
// result of type operation is always
// character vector
state.update(ci, new AType(AType::Kind::CV));
} else if (s == "c") {
// make sure the types to c are correct
AType * t1 = state.get(ci->getArgOperand(1));
for (unsigned i = 2; i < ci->getNumArgOperands(); ++i)
t1 = t1->merge(state.get(ci->getArgOperand(i)));
if (t1->isScalar())
// concatenation of scalars is a vector
t1 = new AType(AType::Kind::R, AType::Kind::DV);
state.update(ci, t1);
} else if (s == "genericEval") {
state.update(ci, new AType(AType::Kind::R));
} else if (s == "envGet") {
state.update(ci, new AType(AType::Kind::R));
}
} else if (PHINode * phi = dyn_cast<PHINode>(&i)) {
AType * first = state.get(phi->getOperand(0));
AType * second = state.get(phi->getOperand(1));
AType * result = first->merge(second);
state.update(phi, result);
}
}
}
} while (!state.hasReachedFixpoint());
if (DEBUG) {
f.dump();
cout << state << endl;
}
return false;
}