# HG changeset patch # User lindquist # Date 1212955630 -7200 # Node ID fa691b1c0498690f46ffec2c9ceecbb93fcabda1 # Parent 346cba22f4b8aa070ed02b780f460e04cca3154d [svn r256] AsmBlockStatement was still being flattened in some cases. Function parameters passed as arguments to inline asm was not given storage. diff -r 346cba22f4b8 -r fa691b1c0498 dmd/statement.h --- a/dmd/statement.h Sun Jun 08 21:23:09 2008 +0200 +++ b/dmd/statement.h Sun Jun 08 22:07:10 2008 +0200 @@ -170,13 +170,13 @@ CompoundStatement(Loc loc, Statements *s); CompoundStatement(Loc loc, Statement *s1, Statement *s2); - Statement *syntaxCopy(); + virtual Statement *syntaxCopy(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); Statement *semantic(Scope *sc); int usesEH(); int fallOffEnd(); int comeFrom(); - Statements *flatten(Scope *sc); + virtual Statements *flatten(Scope *sc); ReturnStatement *isReturnStatement(); Expression *interpret(InterState *istate); @@ -184,9 +184,9 @@ Expression *doInline(InlineDoState *ids); Statement *inlineScan(InlineScanState *iss); - void toIR(IRState *irs); + virtual void toIR(IRState *irs); - CompoundStatement *isCompoundStatement() { return this; } + virtual CompoundStatement *isCompoundStatement() { return this; } }; /* The purpose of this is so that continue will go to the next @@ -795,6 +795,9 @@ { AsmBlockStatement(Loc loc, Statements *s); Statements *flatten(Scope *sc); + Statement *syntaxCopy(); + + CompoundStatement *isCompoundStatement() { return NULL; } AsmBlockStatement *isAsmBlockStatement() { return this; } void toIR(IRState *irs); diff -r 346cba22f4b8 -r fa691b1c0498 gen/asmstmt.cpp --- a/gen/asmstmt.cpp Sun Jun 08 21:23:09 2008 +0200 +++ b/gen/asmstmt.cpp Sun Jun 08 22:07:10 2008 +0200 @@ -245,7 +245,6 @@ static std::string i_cns = "i"; static std::string p_cns = "i"; - static std::string l_cns = "X"; static std::string m_cns = "*m"; static std::string mw_cns = "=*m"; static std::string mrw_cns = "+*m"; @@ -497,6 +496,7 @@ // create asm block structure assert(!p->asmBlock); IRAsmBlock* asmblock = new IRAsmBlock; + assert(asmblock); p->asmBlock = asmblock; // do asm statements @@ -595,3 +595,18 @@ { return NULL; } + +Statement *AsmBlockStatement::syntaxCopy() +{ + Statements *a = new Statements(); + a->setDim(statements->dim); + for (size_t i = 0; i < statements->dim; i++) + { + Statement *s = (Statement *)statements->data[i]; + if (s) + s = s->syntaxCopy(); + a->data[i] = s; + } + AsmBlockStatement *cs = new AsmBlockStatement(loc, a); + return cs; +} \ No newline at end of file diff -r 346cba22f4b8 -r fa691b1c0498 gen/d-asm-i386.h --- a/gen/d-asm-i386.h Sun Jun 08 21:23:09 2008 +0200 +++ b/gen/d-asm-i386.h Sun Jun 08 22:07:10 2008 +0200 @@ -2044,6 +2044,7 @@ } } else if (exp->op == TOKvar) { VarDeclaration * v = ((VarExp *) exp)->var->isVarDeclaration(); + v->needsStorage = true; if (v && v->storage_class & STCfield) { operand->constDisplacement += v->offset;