Merge pull request #310 from redstar/noinline

Add new intrinsic LDC_no_inline.
This commit is contained in:
David Nadlinger
2013-03-11 14:58:20 -07:00
5 changed files with 15 additions and 1 deletions

View File

@@ -927,9 +927,12 @@ struct FuncDeclaration : Declaration
// Functions that wouldn't have gotten semantic3'ed if we weren't inlining set this flag.
bool availableExternally;
// true if overridden with the pragma(allow_inline); stmt
// true if overridden with the pragma(LDC_allow_inline); stmt
bool allowInlining;
// true if set with the pragma(LDC_never_inline); stmt
bool neverInline;
// true if has inline assembler
bool inlineAsm;
#endif

View File

@@ -103,6 +103,7 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageCla
// LDC
isArrayOp = false;
allowInlining = false;
neverInline = false;
availableExternally = true; // assume this unless proven otherwise
// function types in ldc don't merge if the context parameter differs

View File

@@ -278,6 +278,7 @@ Msgtable msgtable[] =
{ "LDC_va_arg" },
{ "LDC_verbose" },
{ "LDC_allow_inline" },
{ "LDC_never_inline" },
{ "LDC_inline_asm" },
{ "LDC_inline_ir" },
{ "LDC_fence" },

View File

@@ -3175,6 +3175,10 @@ Statement *PragmaStatement::semantic(Scope *sc)
{
sc->func->allowInlining = true;
}
else if (ident == Id::LDC_never_inline)
{
sc->func->neverInline = true;
}
#endif
#if DMDV2
else if (ident == Id::startaddress)

View File

@@ -815,6 +815,11 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
}
}
if (fdecl->neverInline)
{
fdecl->ir.irFunc->setNeverInline();
}
if (fdecl->llvmInternal == LLVMglobal_crt_ctor || fdecl->llvmInternal == LLVMglobal_crt_dtor)
{
AppendFunctionToLLVMGlobalCtorsDtors(func, fdecl->priority, fdecl->llvmInternal == LLVMglobal_crt_ctor);