mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-21 19:41:49 +01:00
[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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user