本文整理汇总了C++中GlobalValue::setSection方法的典型用法代码示例。如果您正苦于以下问题:C++ GlobalValue::setSection方法的具体用法?C++ GlobalValue::setSection怎么用?C++ GlobalValue::setSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobalValue
的用法示例。
在下文中一共展示了GlobalValue::setSection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: llvm_asm_file_end
// llvm_asm_file_end - Finish the .s file.
void llvm_asm_file_end(void) {
timevar_push(TV_LLVM_PERFILE);
llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
if (flag_pch_file) {
writeLLVMTypesStringTable();
writeLLVMValues();
}
// Add an llvm.global_ctors global if needed.
if (!StaticCtors.empty())
CreateStructorsList(StaticCtors, "llvm.global_ctors");
// Add an llvm.global_dtors global if needed.
if (!StaticDtors.empty())
CreateStructorsList(StaticDtors, "llvm.global_dtors");
if (!AttributeUsedGlobals.empty()) {
const Type *SBP = PointerType::get(Type::Int8Ty);
ArrayType *AT = ArrayType::get(SBP, AttributeUsedGlobals.size());
Constant *Init = ConstantArray::get(AT, AttributeUsedGlobals);
GlobalValue* gv = new GlobalVariable(AT, false,
GlobalValue::AppendingLinkage, Init,
"llvm.used", TheModule);
gv->setSection("llvm.metadata");
AttributeUsedGlobals.clear();
}
// Add llvm.noinline
if (!AttributeNoinlineFunctions.empty()) {
const Type *SBP= PointerType::get(Type::Int8Ty);
ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size());
Constant *Init = ConstantArray::get(AT, AttributeNoinlineFunctions);
GlobalValue *gv = new GlobalVariable(AT, false,
GlobalValue::AppendingLinkage, Init,
"llvm.noinline", TheModule);
gv->setSection("llvm.metadata");
// Clear vector
AttributeNoinlineFunctions.clear();
}
// Add llvm.global.annotations
if (!AttributeAnnotateGlobals.empty()) {
Constant *Array =
ConstantArray::get(ArrayType::get(AttributeAnnotateGlobals[0]->getType(),
AttributeAnnotateGlobals.size()),
AttributeAnnotateGlobals);
GlobalValue *gv = new GlobalVariable(Array->getType(), false,
GlobalValue::AppendingLinkage, Array,
"llvm.global.annotations", TheModule);
gv->setSection("llvm.metadata");
AttributeAnnotateGlobals.clear();
}
// Finish off the per-function pass.
if (PerFunctionPasses)
PerFunctionPasses->doFinalization();
// Run module-level optimizers, if any are present.
if (PerModulePasses)
PerModulePasses->run(*TheModule);
// Run the code generator, if present.
if (CodeGenPasses) {
CodeGenPasses->doInitialization();
for (Module::iterator I = TheModule->begin(), E = TheModule->end();
I != E; ++I)
if (!I->isDeclaration())
CodeGenPasses->run(*I);
CodeGenPasses->doFinalization();
}
AsmOutStream->flush();
fflush(asm_out_file);
delete AsmOutStream;
AsmOutStream = 0;
delete AsmOutFile;
AsmOutFile = 0;
timevar_pop(TV_LLVM_PERFILE);
}