Add more IN_LLVM sections and minimize more differences to DMD.

This commit is contained in:
kai
2013-11-02 19:56:47 +01:00
parent 27ccce3d1f
commit 1310337d6e
4 changed files with 44 additions and 26 deletions

View File

@@ -735,7 +735,11 @@ void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (haliassym)
{
#if IN_LLVM
buf->writestring(haliassym->toChars());
#else
haliassym->toCBuffer(buf, hgs);
#endif
buf->writeByte(' ');
buf->writestring(ident->toChars());
}
@@ -747,10 +751,10 @@ void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
if (aliassym)
{
#if !IN_LLVM
aliassym->toCBuffer(buf, hgs);
#else
#if IN_LLVM
buf->writestring(aliassym->toChars());
#else
aliassym->toCBuffer(buf, hgs);
#endif
buf->writeByte(' ');
buf->writestring(ident->toChars());
@@ -2661,3 +2665,4 @@ Dsymbol *ThisDeclaration::syntaxCopy(Dsymbol *s)
assert(0); // should never be produced by syntax
return NULL;
}

View File

@@ -105,7 +105,7 @@ enum PURE;
const StorageClass STCStorageClass = (STCauto | STCscope | STCstatic | STCextern | STCconst | STCfinal |
STCabstract | STCsynchronized | STCdeprecated | STCoverride | STClazy | STCalias |
STCout | STCin |
STCmanifest | STCimmutable | STCshared | STCnothrow | STCpure | STCref | STCtls |
STCmanifest | STCimmutable | STCshared | STCwild | STCnothrow | STCpure | STCref | STCtls |
STCgshared | STCproperty | STCsafe | STCtrusted | STCsystem | STCdisable);
struct Match

View File

@@ -47,9 +47,6 @@ struct InterState;
#if IN_DMD
struct Symbol; // back end symbol
#endif
struct OverloadSet;
struct Initializer;
struct StringExp;
class OverloadSet;
class Initializer;
class StringExp;

View File

@@ -3788,10 +3788,13 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident, int f
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
arguments = new Expressions();
arguments->push(e);
#if IN_LLVM
// LDC, we don't support the getInternalTypeInfo
// optimization arbitrarily, not yet at least...
arguments->push(n->getTypeInfo(sc));
e = new CallExp(e->loc, ec, arguments);
#else
arguments->push(n->ty == Tsarray
? n->getTypeInfo(sc) // don't convert to dynamic array
: n->getInternalTypeInfo(sc));
#endif
e = new CallExp(e->loc, ec, arguments);
@@ -5426,10 +5429,10 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, int flag)
{
case LINKd: mc = 'F'; break;
case LINKc: mc = 'U'; break;
case LINKwindows: mc = 'W'; break;
case LINKpascal: mc = 'V'; break;
case LINKintrinsic: mc = 'Q'; break;
case LINKcpp: mc = 'R'; break;
#if IN_LLVM
// LDC
case LINKintrinsic: mc = 'Q'; break;
#endif
@@ -5521,10 +5524,10 @@ void TypeFunction::toCBufferWithAttributes(OutBuffer *buf, Identifier *ident, Hd
{
case LINKd: p = NULL; break;
case LINKc: p = "C"; break;
// LDC
case LINKintrinsic: p = "Intrinsic"; break;
case LINKwindows: p = "Windows"; break;
case LINKpascal: p = "Pascal"; break;
case LINKcpp: p = "C++"; break;
#if IN_LLVM
// LDC
case LINKintrinsic: p = "Intrinsic"; break;
#endif
@@ -5578,10 +5581,10 @@ void functionToCBuffer2(TypeFunction *t, OutBuffer *buf, HdrGenState *hgs, int m
{
case LINKd: p = NULL; break;
case LINKc: p = "C"; break;
// LDC
case LINKintrinsic: p = "Intrinsic"; break;
case LINKwindows: p = "Windows"; break;
case LINKpascal: p = "Pascal"; break;
case LINKcpp: p = "C++"; break;
#if IN_LLVM
// LDC
case LINKintrinsic: p = "Intrinsic"; break;
#endif
@@ -6487,14 +6490,30 @@ Expression *TypeDelegate::dotExp(Scope *sc, Expression *e, Identifier *ident, in
{
#if LOGDOTEXP
printf("TypeDelegate::dotExp(e = '%s', ident = '%s')\n", e->toChars(), ident->toChars());
#endif
if (ident == Id::ptr)
e->type = tvoidptr;
{
#if IN_LLVM
e = new GEPExp(e->loc, e, ident, 0);
#endif
e->type = tvoidptr;
return e;
}
e->type = next->pointerTo();
else if (ident == Id::funcptr)
{
#if IN_LLVM
e = new GEPExp(e->loc, e, ident, 1);
#else
if (!e->isLvalue())
{
Identifier *idtmp = Lexer::uniqueId("__dgtmp");
VarDeclaration *tmp = new VarDeclaration(e->loc, this, idtmp, new ExpInitializer(Loc(), e));
tmp->storage_class |= STCctfe;
e = new DeclarationExp(e->loc, tmp);
e = new CommaExp(e->loc, e, new VarExp(e->loc, tmp));
e = e->semantic(sc);
}
e = e->addressOf(sc);
e->type = tvoidptr;
e = new AddExp(e->loc, e, new IntegerExp(Target::ptrsize));
e->type = tvoidptr;
@@ -9590,11 +9609,8 @@ void Parameter::argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Parameters *argu
else if (arg->storageClass & STCin)
buf->writestring("in ");
else if (arg->storageClass & STClazy)
StorageClassDeclaration::stcToCBuffer(buf,
stc & (STCconst | STCimmutable | STCshared | STCscope));
argbuf.reset();
buf->writestring("lazy ");
else if (arg->storageClass & STCalias)
buf->writestring("alias ");
StorageClass stc = arg->storageClass;