mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Fixed compilation of functions that does not have return statement but contain inline asm
This commit is contained in:
@@ -93,7 +93,6 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageCla
|
||||
isArrayOp = false;
|
||||
allowInlining = false;
|
||||
availableExternally = true; // assume this unless proven otherwise
|
||||
inlineAsm = true;
|
||||
|
||||
// function types in ldc don't merge if the context parameter differs
|
||||
// so we actually don't care about the function declaration, but only
|
||||
|
||||
@@ -162,10 +162,8 @@ Statement *AsmStatement::semantic(Scope *sc)
|
||||
|
||||
//puts(toChars());
|
||||
|
||||
sc->func->inlineAsm = true;
|
||||
sc->func->hasReturnExp |= 8;
|
||||
sc->func->inlineStatus = ILSno; // %% not sure
|
||||
// %% need to set DECL_UNINLINABLE too?
|
||||
sc->func->hasReturnExp = 1; // %% DMD does this, apparently...
|
||||
|
||||
// empty statement -- still do the above things because they might be expected?
|
||||
if (! tokens)
|
||||
@@ -193,7 +191,8 @@ int AsmStatement::blockExit()
|
||||
if (mustNotThrow)
|
||||
error("asm statements are assumed to throw", toChars());
|
||||
#endif
|
||||
return BEfallthru | BEreturn | BEgoto | BEhalt;
|
||||
// Assume the worst
|
||||
return BEfallthru | BEthrow | BEreturn | BEgoto | BEhalt;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -203,7 +202,7 @@ AsmStatement::toIR(IRState * irs)
|
||||
LOG_SCOPE;
|
||||
|
||||
// sanity check
|
||||
assert(irs->func()->decl->inlineAsm);
|
||||
assert(irs->func()->decl->hasReturnExp & 8);
|
||||
|
||||
// get asm block
|
||||
IRAsmBlock* asmblock = irs->asmBlock;
|
||||
|
||||
@@ -689,7 +689,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
||||
|
||||
// this hack makes sure the frame pointer elimination optimization is disabled.
|
||||
// this this eliminates a bunch of inline asm related issues.
|
||||
if (fd->inlineAsm)
|
||||
if (fd->hasReturnExp & 8) // has inline asm
|
||||
{
|
||||
// emit a call to llvm_eh_unwind_init
|
||||
LLFunction* hack = GET_INTRINSIC_DECL(eh_unwind_init);
|
||||
|
||||
Reference in New Issue
Block a user