[svn r253] Removed -inlineasm option. inline asm is now enabled by default unless the new -noasm option is passed.

Tried adding a stack trace print when compiler crashes, not sure it's working though.
Changed data layouts to match that of llvm-gcc.
Fixed casting function pointers.
Added support checks in AsmStatement.
This commit is contained in:
Tomas Lindquist Olsen
2008-06-08 19:09:24 +02:00
parent c1d240582d
commit 6ededdd9e3
14 changed files with 85 additions and 46 deletions

View File

@@ -198,7 +198,20 @@ bool d_have_inline_asm() { return true; }
Statement *AsmStatement::semantic(Scope *sc)
{
bool err = false;
if (global.params.cpu != ARCHx86)
{
error("inline asm is not supported for the \"%s\" architecture", global.params.llvmArch);
err = true;
}
if (!global.params.useInlineAsm)
{
error("inline asm is not allowed when the -noasm switch is used");
err = true;
}
if (err)
fatal();
sc->func->inlineAsm = 1;
sc->func->inlineStatus = ILSno; // %% not sure
// %% need to set DECL_UNINLINABLE too?
@@ -262,8 +275,6 @@ AsmStatement::toIR(IRState * irs)
LLValue* arg_val = 0;
std::string cns;
std::cout << std::endl;
switch (arg->type) {
case Arg_Integer:
arg_val = arg->expr->toElem(irs)->getRVal();
@@ -379,7 +390,7 @@ assert(0);
++p;
}
printf("final: %.*s\n", code->insnTemplateLen, code->insnTemplate);
Logger::println("final asm: %.*s", code->insnTemplateLen, code->insnTemplate);
std::string insnt(code->insnTemplate, code->insnTemplateLen);

View File

@@ -1117,7 +1117,7 @@ DValue* DtoCastPtr(DValue* val, Type* to)
Type* totype = DtoDType(to);
Type* fromtype = DtoDType(val->getType());
assert(fromtype->ty == Tpointer);
assert(fromtype->ty == Tpointer || fromtype->ty == Tfunction);
LLValue* rval;
@@ -1256,7 +1256,7 @@ DValue* DtoCast(DValue* val, Type* to)
else if (fromtype->ty == Tarray || fromtype->ty == Tsarray) {
return DtoCastArray(val, to);
}
else if (fromtype->ty == Tpointer) {
else if (fromtype->ty == Tpointer || fromtype->ty == Tfunction) {
return DtoCastPtr(val, to);
}
else {