forked from OSchip/llvm-project
parent
26c73f93e0
commit
686240a97e
|
@ -190,12 +190,12 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
|
|||
EmitBlock(IndirectBranch->getParent());
|
||||
Builder.ClearInsertionPoint();
|
||||
}
|
||||
|
||||
|
||||
// Remove the AllocaInsertPt instruction, which is just a convenience for us.
|
||||
llvm::Instruction *Ptr = AllocaInsertPt;
|
||||
AllocaInsertPt = 0;
|
||||
Ptr->eraseFromParent();
|
||||
|
||||
|
||||
// If someone took the address of a label but never did an indirect goto, we
|
||||
// made a zero entry PHI node, which is illegal, zap it now.
|
||||
if (IndirectBranch) {
|
||||
|
@ -261,27 +261,27 @@ void CodeGenFunction::EmitMCountInstrumentation() {
|
|||
static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
|
||||
CodeGenModule &CGM,llvm::LLVMContext &Context,
|
||||
llvm::SmallVector <llvm::Value*, 5> &kernelMDArgs) {
|
||||
|
||||
|
||||
// Create MDNodes that represents the kernel arg metadata.
|
||||
// Each MDNode is a list in the form of "key", N number of values which is
|
||||
// the same number of values as their are kernel arguments.
|
||||
|
||||
|
||||
// MDNode for the kernel argument names.
|
||||
SmallVector<llvm::Value*, 8> argNames;
|
||||
argNames.push_back(llvm::MDString::get(Context, "kernel_arg_name"));
|
||||
|
||||
|
||||
for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
|
||||
const ParmVarDecl *parm = FD->getParamDecl(i);
|
||||
|
||||
|
||||
// Get argument name.
|
||||
argNames.push_back(llvm::MDString::get(Context, parm->getName()));
|
||||
|
||||
|
||||
}
|
||||
// Add MDNode to the list of all metadata.
|
||||
kernelMDArgs.push_back(llvm::MDNode::get(Context, argNames));
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,
|
||||
void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,
|
||||
llvm::Function *Fn)
|
||||
{
|
||||
if (!FD->hasAttr<OpenCLKernelAttr>())
|
||||
|
@ -294,7 +294,7 @@ void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,
|
|||
|
||||
if (CGM.getCodeGenOpts().EmitOpenCLArgMetadata)
|
||||
GenOpenCLArgMetadata(FD, Fn, CGM, Context, kernelMDArgs);
|
||||
|
||||
|
||||
if (FD->hasAttr<WorkGroupSizeHintAttr>()) {
|
||||
WorkGroupSizeHintAttr *attr = FD->getAttr<WorkGroupSizeHintAttr>();
|
||||
llvm::Value *attrMDArgs[] = {
|
||||
|
@ -329,7 +329,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
|
|||
const FunctionArgList &Args,
|
||||
SourceLocation StartLoc) {
|
||||
const Decl *D = GD.getDecl();
|
||||
|
||||
|
||||
DidCallStackSave = false;
|
||||
CurCodeDecl = CurFuncDecl = D;
|
||||
FnRetTy = RetTy;
|
||||
|
@ -339,7 +339,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
|
|||
|
||||
// Pass inline keyword to optimizer if it appears explicitly on any
|
||||
// declaration.
|
||||
if (!CGM.getCodeGenOpts().NoInline)
|
||||
if (!CGM.getCodeGenOpts().NoInline)
|
||||
if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D))
|
||||
for (FunctionDecl::redecl_iterator RI = FD->redecls_begin(),
|
||||
RE = FD->redecls_end(); RI != RE; ++RI)
|
||||
|
@ -496,7 +496,7 @@ static void TryMarkNoThrow(llvm::Function *F) {
|
|||
void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
|
||||
const CGFunctionInfo &FnInfo) {
|
||||
const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
|
||||
|
||||
|
||||
// Check if we should generate debug info for this function.
|
||||
if (!FD->hasAttr<NoDebugAttr>())
|
||||
maybeInitializeDebugInfo();
|
||||
|
@ -581,7 +581,7 @@ bool CodeGenFunction::ContainsLabel(const Stmt *S, bool IgnoreCaseStmts) {
|
|||
// can't jump to one from outside their declared region.
|
||||
if (isa<LabelStmt>(S))
|
||||
return true;
|
||||
|
||||
|
||||
// If this is a case/default statement, and we haven't seen a switch, we have
|
||||
// to emit the code.
|
||||
if (isa<SwitchCase>(S) && !IgnoreCaseStmts)
|
||||
|
@ -611,15 +611,15 @@ bool CodeGenFunction::containsBreak(const Stmt *S) {
|
|||
if (isa<SwitchStmt>(S) || isa<WhileStmt>(S) || isa<DoStmt>(S) ||
|
||||
isa<ForStmt>(S))
|
||||
return false;
|
||||
|
||||
|
||||
if (isa<BreakStmt>(S))
|
||||
return true;
|
||||
|
||||
|
||||
// Scan subexpressions for verboten breaks.
|
||||
for (Stmt::const_child_range I = S->children(); I; ++I)
|
||||
if (containsBreak(*I))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -632,7 +632,7 @@ bool CodeGenFunction::ConstantFoldsToSimpleInteger(const Expr *Cond,
|
|||
llvm::APSInt ResultInt;
|
||||
if (!ConstantFoldsToSimpleInteger(Cond, ResultInt))
|
||||
return false;
|
||||
|
||||
|
||||
ResultBool = ResultInt.getBoolValue();
|
||||
return true;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (CondBOp->getOpcode() == BO_LOr) {
|
||||
// If we have "0 || X", simplify the code. "1 || X" would have constant
|
||||
// folded if the case was simple enough.
|
||||
|
@ -784,7 +784,7 @@ void CodeGenFunction::ErrorUnsupported(const Stmt *S, const char *Type,
|
|||
/// base element of the array
|
||||
/// \param sizeInChars - the total size of the VLA, in chars
|
||||
static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType,
|
||||
llvm::Value *dest, llvm::Value *src,
|
||||
llvm::Value *dest, llvm::Value *src,
|
||||
llvm::Value *sizeInChars) {
|
||||
std::pair<CharUnits,CharUnits> baseSizeAndAlign
|
||||
= CGF.getContext().getTypeInfoInChars(baseType);
|
||||
|
@ -824,7 +824,7 @@ static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType,
|
|||
cur->addIncoming(next, loopBB);
|
||||
|
||||
CGF.EmitBlock(contBB);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) {
|
||||
|
@ -844,7 +844,7 @@ CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) {
|
|||
DestPtr = Builder.CreateBitCast(DestPtr, BP);
|
||||
|
||||
// Get size and alignment info for this aggregate.
|
||||
std::pair<CharUnits, CharUnits> TypeInfo =
|
||||
std::pair<CharUnits, CharUnits> TypeInfo =
|
||||
getContext().getTypeInfoInChars(Ty);
|
||||
CharUnits Size = TypeInfo.first;
|
||||
CharUnits Align = TypeInfo.second;
|
||||
|
@ -885,9 +885,9 @@ CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) {
|
|||
|
||||
llvm::Constant *NullConstant = CGM.EmitNullConstant(Ty);
|
||||
|
||||
llvm::GlobalVariable *NullVariable =
|
||||
llvm::GlobalVariable *NullVariable =
|
||||
new llvm::GlobalVariable(CGM.getModule(), NullConstant->getType(),
|
||||
/*isConstant=*/true,
|
||||
/*isConstant=*/true,
|
||||
llvm::GlobalVariable::PrivateLinkage,
|
||||
NullConstant, Twine());
|
||||
llvm::Value *SrcPtr =
|
||||
|
@ -898,12 +898,12 @@ CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) {
|
|||
// Get and call the appropriate llvm.memcpy overload.
|
||||
Builder.CreateMemCpy(DestPtr, SrcPtr, SizeVal, Align.getQuantity(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Otherwise, just memset the whole thing to zero. This is legal
|
||||
// because in LLVM, all default initializers (other than the ones we just
|
||||
// handled above) are guaranteed to have a bit pattern of all zeros.
|
||||
Builder.CreateMemSet(DestPtr, Builder.getInt8(0), SizeVal,
|
||||
Builder.CreateMemSet(DestPtr, Builder.getInt8(0), SizeVal,
|
||||
Align.getQuantity(), false);
|
||||
}
|
||||
|
||||
|
@ -911,9 +911,9 @@ llvm::BlockAddress *CodeGenFunction::GetAddrOfLabel(const LabelDecl *L) {
|
|||
// Make sure that there is a block for the indirect goto.
|
||||
if (IndirectBranch == 0)
|
||||
GetIndirectGotoBlock();
|
||||
|
||||
|
||||
llvm::BasicBlock *BB = getJumpDestForLabel(L).getBlock();
|
||||
|
||||
|
||||
// Make sure the indirect branch includes all of the address-taken blocks.
|
||||
IndirectBranch->addDestination(BB);
|
||||
return llvm::BlockAddress::get(CurFn, BB);
|
||||
|
@ -922,13 +922,13 @@ llvm::BlockAddress *CodeGenFunction::GetAddrOfLabel(const LabelDecl *L) {
|
|||
llvm::BasicBlock *CodeGenFunction::GetIndirectGotoBlock() {
|
||||
// If we already made the indirect branch for indirect goto, return its block.
|
||||
if (IndirectBranch) return IndirectBranch->getParent();
|
||||
|
||||
|
||||
CGBuilderTy TmpBuilder(createBasicBlock("indirectgoto"));
|
||||
|
||||
|
||||
// Create the PHI node that indirect gotos will add entries to.
|
||||
llvm::Value *DestVal = TmpBuilder.CreatePHI(Int8PtrTy, 0,
|
||||
"indirect.goto.dest");
|
||||
|
||||
|
||||
// Create the indirect branch instruction.
|
||||
IndirectBranch = TmpBuilder.CreateIndirectBr(DestVal);
|
||||
return IndirectBranch->getParent();
|
||||
|
@ -1192,7 +1192,7 @@ llvm::Value* CodeGenFunction::EmitVAListRef(const Expr* E) {
|
|||
return EmitLValue(E).getAddress();
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitDeclRefExprDbgValue(const DeclRefExpr *E,
|
||||
void CodeGenFunction::EmitDeclRefExprDbgValue(const DeclRefExpr *E,
|
||||
llvm::Constant *Init) {
|
||||
assert (Init && "Invalid DeclRefExpr initializer!");
|
||||
if (CGDebugInfo *Dbg = getDebugInfo())
|
||||
|
|
Loading…
Reference in New Issue