mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-15 12:23:13 +01:00
Merge pull request #310 from redstar/noinline
Add new intrinsic LDC_no_inline.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user