本文整理汇总了C++中QualifiedType::irEmbeddedType方法的典型用法代码示例。如果您正苦于以下问题:C++ QualifiedType::irEmbeddedType方法的具体用法?C++ QualifiedType::irEmbeddedType怎么用?C++ QualifiedType::irEmbeddedType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QualifiedType
的用法示例。
在下文中一共展示了QualifiedType::irEmbeddedType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genFunction
bool CodeGenerator::genFunction(FunctionDefn * fdef) {
// Don't generate undefined functions.
if (fdef->isUndefined() || fdef->isAbstract() || fdef->isInterfaceMethod()) {
return true;
}
DASSERT_OBJ(fdef->isSingular(), fdef);
DASSERT_OBJ(fdef->type(), fdef);
DASSERT_OBJ(fdef->type()->isSingular(), fdef);
// Don't generate intrinsic functions.
if (fdef->isIntrinsic()) {
return true;
}
// Don't generate a function if it has been merged to another function
if (fdef->mergeTo() != NULL || fdef->isUndefined()) {
return true;
}
// Create the function
Function * f = genFunctionValue(fdef);
if (fdef->hasBody() && f->getBasicBlockList().empty()) {
FunctionType * ftype = fdef->functionType();
if (fdef->isSynthetic()) {
f->setLinkage(GlobalValue::LinkOnceODRLinkage);
}
if (gcEnabled_) {
if (SsGC) {
f->setGC("shadow-stack");
} else {
f->setGC("tart-gc");
}
}
if (debug_) {
dbgContext_ = genDISubprogram(fdef);
//dbgContext_ = genLexicalBlock(fdef->location());
dbgInlineContext_ = DIScope();
setDebugLocation(fdef->location());
}
BasicBlock * prologue = BasicBlock::Create(context_, "prologue", f);
// Create the LLVM Basic Blocks corresponding to each high level BB.
// BlockList & blocks = fdef->blocks();
// for (BlockList::iterator b = blocks.begin(); b != blocks.end(); ++b) {
// Block * blk = *b;
// blk->setIRBlock(BasicBlock::Create(context_, blk->label(), f));
// }
builder_.SetInsertPoint(prologue);
// Handle the explicit parameters
unsigned param_index = 0;
Function::arg_iterator it = f->arg_begin();
Value * saveStructRet = structRet_;
if (ftype->isStructReturn()) {
it->addAttr(llvm::Attribute::StructRet);
structRet_ = it;
++it;
}
// Handle the 'self' parameter
if (ftype->selfParam() != NULL) {
ParameterDefn * selfParam = ftype->selfParam();
const Type * selfParamType = selfParam->type().unqualified();
DASSERT_OBJ(fdef->storageClass() == Storage_Instance ||
fdef->storageClass() == Storage_Local, fdef);
DASSERT_OBJ(it != f->arg_end(), ftype);
// Check if the self param is a root.
if (selfParamType->isReferenceType()) {
selfParam->setFlag(ParameterDefn::LValueParam, true);
Value * selfAlloca = builder_.CreateAlloca(
selfParam->type()->irEmbeddedType(), 0, "self.alloca");
builder_.CreateStore(it, selfAlloca);
selfParam->setIRValue(selfAlloca);
markGCRoot(selfAlloca, NULL, "self.alloca");
} else {
// Since selfParam is always a pointer, we don't need to mark the object pointed
// to as a root, since the next call frame up is responsible for tracing it.
ftype->selfParam()->setIRValue(it);
}
it->setName("self");
++it;
}
// If this function needs to make allocations, cache a copy of the
// allocation context pointer for this thread, since it can on some
// platforms be expensive to look up.
if (fdef->flags() & FunctionDefn::MakesAllocs) {
Function * gcGetAllocContext = genFunctionValue(gc_allocContext);
gcAllocContext_ = builder_.CreateCall(gcGetAllocContext, "allocCtx");
}
//.........这里部分代码省略.........