本文整理汇总了C++中FunctionSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionSet::size方法的具体用法?C++ FunctionSet::size怎么用?C++ FunctionSet::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionSet
的用法示例。
在下文中一共展示了FunctionSet::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
//
// Write one function entry in one format: server, C or text.
//
static void
dump_function_entry(void *addr, const char *comment)
{
num_entries_total++;
if (server_mode()) {
syserv_add_addr(addr, function_entries.size());
return;
}
if (c_mode()) {
if (num_entries_total > 1) {
printf(",\n");
}
printf(" 0x%" PRIxPTR " /* %s */", (uintptr_t) addr, comment);
return;
}
// default is text mode
printf("0x%" PRIxPTR " %s\n", (uintptr_t) addr, comment);
}
示例2: initialise
//.........这里部分代码省略.........
long loadInsts = 0;
long storeInsts = 0;
long intrinsInsts = 0;
for (Function& F : M.functions()) {
if (F.hasAddressTaken()) numAddFuncs++;
bool hasFPcall = false;
for (Instruction& I : instructions(&F)) {
numInsts++;
if (IntrinsicInst* II = dyn_cast<IntrinsicInst>(&I)) {
intrinsInsts++;
}
else if (CallInst* C = dyn_cast<CallInst>(&I)) {
if (CallGraphUtils::isIndirectCall(C)) {
hasFPcall = true;
numFPcalls++;
}
}
else if (LoadInst* L = dyn_cast<LoadInst>(&I)) {
loadInsts++;
}
else if (StoreInst* S = dyn_cast<StoreInst>(&I)) {
storeInsts++;
}
}
if (hasFPcall) {
numFPFuncs++;
}
numFuncs++;
}
dbgs() << "Num of funcs (total): " << numFuncs << "\n";
dbgs() << "Num of funcs (w/ fp calls): " << numFPFuncs << "\n";
dbgs() << "Num of funcs (addr. taken): " << numAddFuncs << "\n";
dbgs() << "Num of fp calls: " << numFPcalls << "\n";
dbgs() << "Num of instructions: " << numInsts << "\n";
dbgs() << INDENT_1 << "loads: " << loadInsts << "\n";
dbgs() << INDENT_1 << "stores: " << storeInsts << "\n";
dbgs() << INDENT_1 << "intrinsics: " << intrinsInsts << "\n";
}
for (Function& F : M.functions()) {
if (F.isDeclaration()) continue;
SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << F.getName() << "\n");
for (Instruction& I : instructions(&F)) {
ContextVector contexts = ContextUtils::getContextsForInstruction(&I, contextInsensitive, sandboxes, M);
if (StoreInst* S = dyn_cast<StoreInst>(&I)) { // assignments
//SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << F->getName() << ": " << *S);
Value* Rval = S->getValueOperand()->stripInBoundsConstantOffsets();
if (Function* T = dyn_cast<Function>(Rval)) {
fpTargetsUniv.insert(T);
// we are assigning a function
Value* Lvar = S->getPointerOperand()->stripInBoundsConstantOffsets();
for (Context* C : contexts) {
setBitVector(state[C][Lvar], T);
SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << "Adding " << Lvar->getName() << " to worklist\n");
addToWorklist(Lvar, C, worklist);
if (isa<GetElementPtrInst>(Lvar)) {
SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << "Rewinding back to alloca\n");
ValueSet visited;
propagateToAggregate(Lvar, C, Lvar, visited, worklist, sandboxes, M);
}
}
}
}
else if (SelectInst* S = dyn_cast<SelectInst>(&I)) {
if (Function* F = dyn_cast<Function>(S->getTrueValue()->stripPointerCasts())) {
addInferredFunction(F, contexts, S, worklist);
}
if (Function* F = dyn_cast<Function>(S->getFalseValue()->stripPointerCasts())) {
addInferredFunction(F, contexts, S, worklist);
}
}
else if (CallInst* C = dyn_cast<CallInst>(&I)) { // passing functions as params
if (Function* callee = CallGraphUtils::getDirectCallee(C)) {
int argIdx = 0;
for (Argument& AI : callee->args()) {
Value* Arg = C->getArgOperand(argIdx)->stripPointerCasts();
if (Function* T = dyn_cast<Function>(Arg)) {
addInferredFunction(T, contexts, &AI, worklist);
}
argIdx++;
}
}
}
}
}
SDEBUG("soaap.analysis.infoflow.fp.infer", 3, dbgs() << "Globals:\n");
// In some applications, functions are stored within globals aggregates like arrays
// We search for such arrays conflating any structure contained within
ValueSet visited;
for (GlobalVariable& G : M.globals()) {
findAllFunctionPointersInValue(&G, worklist, visited);
}
if (debug) {
dbgs() << "num of fp targets: " << fpTargetsUniv.size() << "\n";
}
}
示例3: link
//.........这里部分代码省略.........
//
// Write global variables
//
if (!globalSymMap.empty())
{
for (std::map<std::string,GlslSymbol*>::iterator sit = globalSymMap.begin(); sit != globalSymMap.end(); sit++)
{
sit->second->writeDecl(shader,false,false);
shader << ";\n";
if ( sit->second->getIsMutable() )
{
sit->second->writeDecl(shader, true, false);
shader << ";\n";
}
}
}
//
// Write function declarations and definitions
//
EmitCalledFunctions (shader, calledFunctions);
//
// Gather the uniforms into the uniform list
//
for (std::map<std::string, GlslSymbol*>::iterator it = globalSymMap.begin(); it != globalSymMap.end(); it++)
{
if (it->second->getQualifier() != EqtUniform)
continue;
ShUniformInfo infoStruct;
infoStruct.name = new char[it->first.size()+1];
strcpy( infoStruct.name, it->first.c_str());
if (it->second->getSemantic() != "")
{
infoStruct.semantic = new char[it->second->getSemantic().size()+1];
strcpy( infoStruct.semantic, it->second->getSemantic().c_str());
}
else
infoStruct.semantic = 0;
//gigantic hack, the enumerations are kept in alignment
infoStruct.type = (EShType)it->second->getType();
infoStruct.arraySize = it->second->getArraySize();
if ( it->second->hasInitializer() )
{
int initSize = it->second->initializerSize();
infoStruct.init = new float[initSize];
memcpy( infoStruct.init, it->second->getInitializer(), sizeof(float) * initSize);
}
else
infoStruct.init = 0;
//TODO: need to add annotation
uniforms.push_back( infoStruct);
}
//
// Generate the main function
//
std::stringstream attrib;