[svn r248] Fixed: labels in inline asm block now work for the normal case.

Fixed: inline asm blocks are now emitted as a single asm entity.
This commit is contained in:
Tomas Lindquist Olsen
2008-06-08 06:15:51 +02:00
parent 3e62d80b4f
commit fd8cec14e1
9 changed files with 235 additions and 85 deletions

View File

@@ -3186,7 +3186,7 @@ Statement *Parser::parseStatement(int flags)
}
break;
}
s = new CompoundStatement(loc, statements);
s = new AsmBlockStatement(loc, statements);
nextToken();
break;
}

View File

@@ -467,7 +467,7 @@ Statement *CompoundStatement::semantic(Scope *sc)
}
i++;
}
if (statements->dim == 1)
if (statements->dim == 1 && !isAsmBlockStatement())
return s;
return this;
}
@@ -3593,9 +3593,7 @@ LabelDsymbol::LabelDsymbol(Identifier *ident)
: Dsymbol(ident)
{
statement = NULL;
#if IN_GCC
asmLabelNum = 0;
#endif
}
LabelDsymbol *LabelDsymbol::isLabel() // is this a LabelDsymbol()?

View File

@@ -41,6 +41,7 @@ struct CompoundStatement;
struct Argument;
struct StaticAssert;
struct AsmStatement;
struct AsmBlockStatement;
struct GotoStatement;
struct ScopeStatement;
struct TryCatchStatement;
@@ -90,6 +91,7 @@ struct Statement : Object
virtual TryCatchStatement *isTryCatchStatement() { return NULL; }
virtual GotoStatement *isGotoStatement() { return NULL; }
virtual AsmStatement *isAsmStatement() { return NULL; }
virtual AsmBlockStatement *isAsmBlockStatement() { return NULL; }
#ifdef _DH
int incontract;
#endif
@@ -754,7 +756,8 @@ struct LabelStatement : Statement
Statement *inlineScan(InlineScanState *iss);
void toIR(IRState *irs);
// LLVMDC
llvm::BasicBlock* llvmBB;
};
@@ -788,4 +791,13 @@ struct AsmStatement : Statement
void toIR(IRState *irs);
};
struct AsmBlockStatement : CompoundStatement
{
AsmBlockStatement(Loc loc, Statements *s);
Statements *flatten(Scope *sc);
AsmBlockStatement *isAsmBlockStatement() { return this; }
void toIR(IRState *irs);
};
#endif /* DMD_STATEMENT_H */