Skip to content

Commit 03904bb

Browse files
committed
Current LDC frontend diff
This pull request is not meant to be merged. It is merely there for @yebblies and others to judge the current state.
1 parent 779e52c commit 03904bb

54 files changed

Lines changed: 1977 additions & 312 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/aggregate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ class AggregateDeclaration : public ScopeDsymbol
121121
Prot prot();
122122

123123
Type *handleType() { return type; } // 'this' type
124+
#if IN_DMD
124125

125126
// Back end
126127
Symbol *stag; // tag symbol for debug data
127128
Symbol *sinit;
129+
#endif
128130

129131
AggregateDeclaration *isAggregateDeclaration() { return this; }
130132
void accept(Visitor *v) { v->visit(this); }
@@ -287,8 +289,10 @@ class ClassDeclaration : public AggregateDeclaration
287289

288290
void addLocalClass(ClassDeclarations *);
289291

292+
#if IN_DMD
290293
// Back end
291294
Symbol *vtblsym;
295+
#endif
292296

293297
ClassDeclaration *isClassDeclaration() { return (ClassDeclaration *)this; }
294298
void accept(Visitor *v) { v->visit(this); }

src/argtypes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ TypeTuple *toArgTypes(Type *t)
7575
case Tfloat32:
7676
case Tint64:
7777
case Tuns64:
78+
case Tint128:
79+
case Tuns128:
7880
case Tfloat64:
7981
case Tfloat80:
8082
t1 = t;

src/arrayop.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ Expression *buildArrayLoop(Expression *e, Parameters *fparams);
3434
* Hash table of array op functions already generated or known about.
3535
*/
3636

37+
#if IN_DMD
3738
AA *arrayfuncs;
39+
#endif
3840

3941
/**************************************
4042
* Structure to contain information needed to insert an array op call
@@ -50,7 +52,6 @@ FuncDeclaration *buildArrayOp(Identifier *ident, BinExp *exp, Scope *sc, Loc loc
5052
* loopbody;
5153
* return p;
5254
*/
53-
5455
Parameter *p = (*fparams)[0];
5556
// foreach (i; 0 .. p.length)
5657
Statement *s1 = new ForeachRangeStatement(Loc(), TOKforeach,
@@ -209,7 +210,11 @@ Expression *arrayOp(BinExp *e, Scope *sc)
209210
char *name = buf.peekString();
210211
Identifier *ident = Identifier::idPool(name);
211212

213+
#if IN_LLVM
214+
FuncDeclaration **pFd = (FuncDeclaration **)dmd_aaGet(&sc->module->arrayfuncs, (void *)ident);
215+
#else
212216
FuncDeclaration **pFd = (FuncDeclaration **)dmd_aaGet(&arrayfuncs, (void *)ident);
217+
#endif
213218
FuncDeclaration *fd = *pFd;
214219

215220
if (!fd)

src/attrib.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include "parse.h"
3030
#include "template.h"
3131
#include "utf.h"
32+
#if IN_LLVM
33+
#include "../gen/pragma.h"
34+
#endif
3235

3336

3437
/********************************* AttribDeclaration ****************************/
@@ -820,6 +823,11 @@ void PragmaDeclaration::semantic(Scope *sc)
820823
{
821824
// Should be merged with PragmaStatement
822825

826+
#if IN_LLVM
827+
Pragma llvm_internal = LLVMnone;
828+
std::string arg1str;
829+
#endif
830+
823831
//printf("\tPragmaDeclaration::semantic '%s'\n",toChars());
824832
if (ident == Id::msg)
825833
{
@@ -997,6 +1005,12 @@ void PragmaDeclaration::semantic(Scope *sc)
9971005
}
9981006
#endif
9991007
}
1008+
#if IN_LLVM
1009+
else if ((llvm_internal = DtoGetPragma(sc, this, arg1str)) != LLVMnone)
1010+
{
1011+
// nothing to do anymore
1012+
}
1013+
#endif
10001014
else if (global.params.ignoreUnsupportedPragmas)
10011015
{
10021016
if (global.params.verbose)
@@ -1009,7 +1023,11 @@ void PragmaDeclaration::semantic(Scope *sc)
10091023
for (size_t i = 0; i < args->dim; i++)
10101024
{
10111025
Expression *e = (*args)[i];
1012-
1026+
#if IN_LLVM
1027+
// ignore errors in ignored pragmas.
1028+
global.gag++;
1029+
unsigned errors_save = global.errors;
1030+
#endif
10131031
sc = sc->startCTFE();
10141032
e = e->semantic(sc);
10151033
e = resolveProperties(sc, e);
@@ -1021,13 +1039,17 @@ void PragmaDeclaration::semantic(Scope *sc)
10211039
else
10221040
fprintf(global.stdmsg, ",");
10231041
fprintf(global.stdmsg, "%s", e->toChars());
1042+
#if IN_LLVM
1043+
// restore error state.
1044+
global.gag--;
1045+
global.errors = errors_save;
1046+
#endif
10241047
}
10251048
if (args->dim)
10261049
fprintf(global.stdmsg, ")");
10271050
}
10281051
fprintf(global.stdmsg, "\n");
10291052
}
1030-
goto Lnodecl;
10311053
}
10321054
else
10331055
error("unrecognized pragma(%s)", ident->toChars());
@@ -1055,6 +1077,13 @@ void PragmaDeclaration::semantic(Scope *sc)
10551077
error("can only apply to a single declaration");
10561078
}
10571079
}
1080+
#if IN_LLVM
1081+
else
1082+
{
1083+
DtoCheckPragma(this, s, llvm_internal, arg1str);
1084+
}
1085+
#endif
1086+
10581087
}
10591088
}
10601089
return;

0 commit comments

Comments
 (0)