Skip to content

Commit e2577a6

Browse files
committed
Current LDC frontend diff
This pull request is not meant to be merged. It is merely there to provide an overview of the current state for @yebblies and others. LDC commit 7526de529d9808433e487608833de6be9c44fef1.
1 parent 83be084 commit e2577a6

45 files changed

Lines changed: 2029 additions & 73 deletions

Some content is hidden

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

src/arrayop.d

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import ddmd.visitor;
2727
/**************************************
2828
* Hash table of array op functions already generated or known about.
2929
*/
30+
version(IN_LLVM) {}
31+
else
3032
extern (C++) __gshared AA* arrayfuncs;
3133

3234
/**************************************
@@ -179,7 +181,14 @@ extern (C++) Expression arrayOp(BinExp e, Scope* sc)
179181
buf.writestring(e.type.toBasetype().nextOf().toBasetype().mutableOf().deco);
180182
char* name = buf.peekString();
181183
Identifier ident = Identifier.idPool(name);
182-
FuncDeclaration* pFd = cast(FuncDeclaration*)dmd_aaGet(&arrayfuncs, cast(void*)ident);
184+
version(IN_LLVM)
185+
{
186+
FuncDeclaration* pFd = cast(FuncDeclaration*)dmd_aaGet(&(sc._module.arrayfuncs), cast(void*)ident);
187+
}
188+
else
189+
{
190+
FuncDeclaration* pFd = cast(FuncDeclaration*)dmd_aaGet(&arrayfuncs, cast(void*)ident);
191+
}
183192
FuncDeclaration fd = *pFd;
184193
if (!fd)
185194
fd = buildArrayOp(ident, e, sc, e.loc);

src/attrib.d

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ import ddmd.tokens;
3737
import ddmd.utf;
3838
import ddmd.visitor;
3939

40+
version(IN_LLVM)
41+
{
42+
import gen.dpragma;
43+
}
44+
45+
4046
/***********************************************************
4147
*/
4248
extern (C++) class AttribDeclaration : Dsymbol
@@ -741,6 +747,13 @@ public:
741747
{
742748
// Should be merged with PragmaStatement
743749
//printf("\tPragmaDeclaration::semantic '%s'\n",toChars());
750+
751+
version(IN_LLVM)
752+
{
753+
LDCPragma llvm_internal = LDCPragma.LLVMnone;
754+
const(char)* arg1str = null;
755+
}
756+
744757
if (ident == Id.msg)
745758
{
746759
if (args)
@@ -908,6 +921,11 @@ public:
908921
}
909922
}
910923
}
924+
// IN_LLVM
925+
else if ((llvm_internal = DtoGetPragma(sc, this, arg1str)) != LDCPragma.LLVMnone)
926+
{
927+
// nothing to do anymore
928+
}
911929
else if (global.params.ignoreUnsupportedPragmas)
912930
{
913931
if (global.params.verbose)
@@ -920,6 +938,12 @@ public:
920938
for (size_t i = 0; i < args.dim; i++)
921939
{
922940
Expression e = (*args)[i];
941+
version(IN_LLVM)
942+
{
943+
// ignore errors in ignored pragmas.
944+
global.gag++;
945+
uint errors_save = global.errors;
946+
}
923947
sc = sc.startCTFE();
924948
e = e.semantic(sc);
925949
e = resolveProperties(sc, e);
@@ -930,13 +954,20 @@ public:
930954
else
931955
fprintf(global.stdmsg, ",");
932956
fprintf(global.stdmsg, "%s", e.toChars());
957+
version(IN_LLVM)
958+
{
959+
// restore error state.
960+
global.gag--;
961+
global.errors = errors_save;
962+
}
933963
}
934964
if (args.dim)
935965
fprintf(global.stdmsg, ")");
936966
}
937967
fprintf(global.stdmsg, "\n");
938968
}
939-
goto Lnodecl;
969+
static if (!IN_LLVM)
970+
goto Lnodecl;
940971
}
941972
else
942973
error("unrecognized pragma(%s)", ident.toChars());
@@ -961,6 +992,11 @@ public:
961992
error("can only apply to a single declaration");
962993
}
963994
}
995+
// IN_LLVM: add else clause
996+
else
997+
{
998+
DtoCheckPragma(this, s, llvm_internal, arg1str);
999+
}
9641000
}
9651001
if (sc2 != sc)
9661002
sc2.pop();

src/backend.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ struct block;
1414
struct Blockx;
1515
struct elem;
1616

17+
version(IN_LLVM) {}
18+
else
19+
{
1720
// type.h
1821

1922
alias tym_t = uint;
@@ -153,3 +156,4 @@ enum
153156

154157
TYMAX = 0x48,
155158
}
159+
}

0 commit comments

Comments
 (0)