Merge branch 'default' into 'merge'.

This commit is contained in:
David Nadlinger
2011-07-29 00:37:30 +02:00
4 changed files with 35 additions and 18 deletions

View File

@@ -2464,7 +2464,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaLen_fd = NULL;
if(!aaLen_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); // FIXME: Real parameter type is AA.
aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen);
}
@@ -2485,7 +2485,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaKeys_fd = NULL;
if(!aaKeys_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); // FIXME: Real parameter type is AA.
args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL));
aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys);
}
@@ -2506,7 +2506,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaValues_fd = NULL;
if(!aaValues_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); // FIXME: Real parameter type is AA.
args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL));
args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL));
aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues);
@@ -2531,7 +2531,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaRehash_fd = NULL;
if(!aaRehash_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); // FIXME: Real parameter type is AA*.
args->push(new Parameter(STCin, Type::typeinfo->type, NULL, NULL));
aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash);
}

View File

@@ -1801,21 +1801,21 @@ Statement *ForeachStatement::semantic(Scope *sc)
Parameters* dgargs = new Parameters;
dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
aaApply2_dg = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
aaApply2_dg = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd));
args->push(new Parameter(STCin, aaApply2_dg, NULL, NULL));
aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply2");
aaApply2_fd = FuncDeclaration::genCfunc(args, Type::tint32, "_aaApply2");
}
static FuncDeclaration *aaApply_fd = NULL;
static TypeDelegate* aaApply_dg;
if(!aaApply_fd) {
Parameters* args = new Parameters;
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Parameter(STCin, Type::tvoid->pointerTo(), NULL, NULL)); // FIXME: Real parameter type is AA.
args->push(new Parameter(STCin, Type::tsize_t, NULL, NULL));
Parameters* dgargs = new Parameters;
dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
aaApply_dg = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
aaApply_dg = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd));
args->push(new Parameter(STCin, aaApply_dg, NULL, NULL));
aaApply_fd = FuncDeclaration::genCfunc(args, Type::tindex, "_aaApply");
aaApply_fd = FuncDeclaration::genCfunc(args, Type::tint32, "_aaApply");
}
FuncDeclaration *fdapply;
if (dim == 2) {
@@ -1840,7 +1840,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
}
exps->push(flde);
e = new CallExp(loc, ec, exps);
e->type = Type::tindex; // don't run semantic() on e
e->type = Type::tint32; // don't run semantic() on e
}
else if (tab->ty == Tarray || tab->ty == Tsarray)
{
@@ -1884,15 +1884,15 @@ Statement *ForeachStatement::semantic(Scope *sc)
Parameters* dgargs = new Parameters;
dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd));
args->push(new Parameter(STCin, dgty, NULL, NULL));
fdapply = FuncDeclaration::genCfunc(args, Type::tindex, fdname);
fdapply = FuncDeclaration::genCfunc(args, Type::tint32, fdname);
} else {
Parameters* dgargs = new Parameters;
dgargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tindex, 0, LINKd));
dgty = new TypeDelegate(new TypeFunction(dgargs, Type::tint32, 0, LINKd));
args->push(new Parameter(STCin, dgty, NULL, NULL));
fdapply = FuncDeclaration::genCfunc(args, Type::tindex, fdname);
fdapply = FuncDeclaration::genCfunc(args, Type::tint32, fdname);
}
ec = new VarExp(0, fdapply);
@@ -1909,7 +1909,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
}
exps->push(flde);
e = new CallExp(loc, ec, exps);
e->type = Type::tindex; // don't run semantic() on e
e->type = Type::tint32; // don't run semantic() on e
}
else if (tab->ty == Tdelegate)
{
@@ -3787,14 +3787,14 @@ Statement *SynchronizedStatement::semantic(Scope *sc)
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
Parameters* enterargs = new Parameters;
enterargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
enterargs->push(new Parameter(STCin, ClassDeclaration::object->type, NULL, NULL));
FuncDeclaration *fdenter = FuncDeclaration::genCfunc(enterargs, Type::tvoid, Id::monitorenter);
Expression *e = new CallExp(loc, new VarExp(loc, fdenter), new VarExp(loc, tmp));
e->type = Type::tvoid; // do not run semantic on e
cs->push(new ExpStatement(loc, e));
Parameters* exitargs = new Parameters;
exitargs->push(new Parameter(STCin, Type::tvoidptr, NULL, NULL));
exitargs->push(new Parameter(STCin, ClassDeclaration::object->type, NULL, NULL));
FuncDeclaration *fdexit = FuncDeclaration::genCfunc(exitargs, Type::tvoid, Id::monitorexit);
e = new CallExp(loc, new VarExp(loc, fdexit), new VarExp(loc, tmp));
e->type = Type::tvoid; // do not run semantic on e

View File

@@ -1898,6 +1898,20 @@ namespace AsmParserx8664
else
stmt->error("instruction allows only ST as second argument");
}
if ( op == Op_FCmpFlgP )
{
// Explicitly add %st as second argument to fucomip it should
// be implicit, but the GNU as shipping with Mac OS X (Apple Inc
// version cctools-800~26, GNU assembler version 1.38) chokes on
// it otherwise.
assert ( nOperands == 1 );
nOperands = 2;
operands[1] = operands[0];
memset ( operands, 0, sizeof( Operand ) );
operands[0].cls = Opr_Reg;
operands[0].reg = Reg_ST;
}
if ( opInfo->needsType )
{

View File

@@ -479,8 +479,11 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
// construct function
const llvm::FunctionType* functype = DtoFunctionType(fdecl);
llvm::Function* func = vafunc ? vafunc : gIR->module->getFunction(mangled_name);
if (!func)
if (!func) {
func = llvm::Function::Create(functype, DtoLinkage(fdecl), mangled_name, gIR->module);
} else if (func->getFunctionType() != functype) {
error(fdecl->loc, "Function type does not match previously declared function with the same mangled name: %s", fdecl->mangle());
}
if (Logger::enabled())
Logger::cout() << "func = " << *func << std::endl;