annotate gen/llvmhelpers.h @ 1638:0de4525a9ed6

Apply workaround for #395 by klickverbot.
author Christian Kamm <kamm incasoftware de>
date Mon, 08 Mar 2010 20:06:08 +0100
parents 1e5a14691e77
children 8f121883bce8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
664
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 632
diff changeset
1 #ifndef LDC_GEN_LLVMHELPERS_H
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 632
diff changeset
2 #define LDC_GEN_LLVMHELPERS_H
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
3
347
6057fdf797d8 [svn r368] Fixed custom class allocators with arbitrary user arguments. Closes #25
lindquist
parents: 309
diff changeset
4 #include "gen/llvm.h"
1207
83d3b25c2213 Isolate all knowledge of what a function's nested context looks like in a
Frits van Bommel <fvbommel wxs.nl>
parents: 1185
diff changeset
5 #include "gen/dvalue.h"
83d3b25c2213 Isolate all knowledge of what a function's nested context looks like in a
Frits van Bommel <fvbommel wxs.nl>
parents: 1185
diff changeset
6
302
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
7 #include "statement.h"
1207
83d3b25c2213 Isolate all knowledge of what a function's nested context looks like in a
Frits van Bommel <fvbommel wxs.nl>
parents: 1185
diff changeset
8 #include "mtype.h"
302
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
9
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
10 // this is used for tracking try-finally, synchronized and volatile scopes
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
11 struct EnclosingHandler
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
12 {
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
13 virtual void emitCode(IRState* p) = 0;
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
14 };
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
15 struct EnclosingTryFinally : EnclosingHandler
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
16 {
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
17 TryFinallyStatement* tf;
1412
3f5ea912149d Fix #308 by giving finally code emitted by EnclosingTryFinally a different landing pad.
Christian Kamm <kamm incasoftware de>
parents: 1351
diff changeset
18 llvm::BasicBlock* landingPad;
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
19 void emitCode(IRState* p);
1412
3f5ea912149d Fix #308 by giving finally code emitted by EnclosingTryFinally a different landing pad.
Christian Kamm <kamm incasoftware de>
parents: 1351
diff changeset
20 EnclosingTryFinally(TryFinallyStatement* _tf, llvm::BasicBlock* _pad)
3f5ea912149d Fix #308 by giving finally code emitted by EnclosingTryFinally a different landing pad.
Christian Kamm <kamm incasoftware de>
parents: 1351
diff changeset
21 : tf(_tf), landingPad(_pad) {}
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
22 };
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
23 struct EnclosingVolatile : EnclosingHandler
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
24 {
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
25 VolatileStatement* v;
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
26 void emitCode(IRState* p);
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
27 EnclosingVolatile(VolatileStatement* _tf) : v(_tf) {}
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
28 };
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
29 struct EnclosingSynchro : EnclosingHandler
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
30 {
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
31 SynchronizedStatement* s;
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
32 void emitCode(IRState* p);
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
33 EnclosingSynchro(SynchronizedStatement* _tf) : s(_tf) {}
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
34 };
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
35
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
36
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
37 // dynamic memory helpers
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
38 LLValue* DtoNew(Type* newtype);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
39 void DtoDeleteMemory(LLValue* ptr);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
40 void DtoDeleteClass(LLValue* inst);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
41 void DtoDeleteInterface(LLValue* inst);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
42 void DtoDeleteArray(DValue* arr);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
43
479
672eb4893b55 Move AllocaInst creation into DtoAlloca helper. Will enable special zero-init of fp80 reals' padding.
Christian Kamm <kamm incasoftware de>
parents: 468
diff changeset
44 // emit an alloca
1350
15e9762bb620 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1271
diff changeset
45 llvm::AllocaInst* DtoAlloca(Type* type, const char* name = "");
15e9762bb620 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1271
diff changeset
46 llvm::AllocaInst* DtoArrayAlloca(Type* type, unsigned arraysize, const char* name = "");
15e9762bb620 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1271
diff changeset
47 llvm::AllocaInst* DtoRawAlloca(const llvm::Type* lltype, size_t alignment, const char* name = "");
479
672eb4893b55 Move AllocaInst creation into DtoAlloca helper. Will enable special zero-init of fp80 reals' padding.
Christian Kamm <kamm incasoftware de>
parents: 468
diff changeset
48
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
49 // assertion generator
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
50 void DtoAssert(Module* M, Loc loc, DValue* msg);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
51
305
2b72433d5c8c [svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents: 302
diff changeset
52 // return the LabelStatement from the current function with the given identifier or NULL if not found
2b72433d5c8c [svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents: 302
diff changeset
53 LabelStatement* DtoLabelStatement(Identifier* ident);
1160
7d28dcbff23e Reenable error for gotos into or out of finally blocks.
Christian Kamm <kamm incasoftware de>
parents: 1152
diff changeset
54
7d28dcbff23e Reenable error for gotos into or out of finally blocks.
Christian Kamm <kamm incasoftware de>
parents: 1152
diff changeset
55 /// emits goto to LabelStatement with the target identifier
7d28dcbff23e Reenable error for gotos into or out of finally blocks.
Christian Kamm <kamm incasoftware de>
parents: 1152
diff changeset
56 /// the sourceFinally is only used for error checking
7d28dcbff23e Reenable error for gotos into or out of finally blocks.
Christian Kamm <kamm incasoftware de>
parents: 1152
diff changeset
57 void DtoGoto(Loc loc, Identifier* target, TryFinallyStatement* sourceFinally);
302
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
58
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
59 // Generates IR for enclosing handlers between the current state and
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
60 // the scope created by the 'target' statement.
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1067
diff changeset
61 void DtoEnclosingHandlers(Loc loc, Statement* target);
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
62
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
63 /// Enters a critical section.
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
64 void DtoEnterCritical(LLValue* g);
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
65 /// leaves a critical section.
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
66 void DtoLeaveCritical(LLValue* g);
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
67
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
68 /// Enters a monitor lock.
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
69 void DtoEnterMonitor(LLValue* v);
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
70 /// Leaves a monitor lock.
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
71 void DtoLeaveMonitor(LLValue* v);
302
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
72
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
73 // basic operations
399
0e6b4d65d3f8 Give error messages for invalid casts.
Christian Kamm <kamm incasoftware de>
parents: 372
diff changeset
74 void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
75
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
76 /// Create a null DValue.
372
83ade4f4025a [svn r393] Started implementation for DtoNullValue.
ChristianK
parents: 365
diff changeset
77 DValue* DtoNullValue(Type* t);
83ade4f4025a [svn r393] Started implementation for DtoNullValue.
ChristianK
parents: 365
diff changeset
78
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
79 // casts
399
0e6b4d65d3f8 Give error messages for invalid casts.
Christian Kamm <kamm incasoftware de>
parents: 372
diff changeset
80 DValue* DtoCastInt(Loc& loc, DValue* val, Type* to);
0e6b4d65d3f8 Give error messages for invalid casts.
Christian Kamm <kamm incasoftware de>
parents: 372
diff changeset
81 DValue* DtoCastPtr(Loc& loc, DValue* val, Type* to);
0e6b4d65d3f8 Give error messages for invalid casts.
Christian Kamm <kamm incasoftware de>
parents: 372
diff changeset
82 DValue* DtoCastFloat(Loc& loc, DValue* val, Type* to);
419
023fa78c1203 Fixed delegate casts.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 414
diff changeset
83 DValue* DtoCastDelegate(Loc& loc, DValue* val, Type* to);
399
0e6b4d65d3f8 Give error messages for invalid casts.
Christian Kamm <kamm incasoftware de>
parents: 372
diff changeset
84 DValue* DtoCast(Loc& loc, DValue* val, Type* to);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
85
715
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
86 // return the same val as passed in, modified to the target type, if possible, otherwise returns a new DValue
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
87 DValue* DtoPaintType(Loc& loc, DValue* val, Type* to);
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
88
940
39519a1ff603 Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 936
diff changeset
89 // is template instance check, returns module where instantiated
1067
7ce8355fbcc6 Improved template emission control for singleobj building.
Christian Kamm <kamm incasoftware de>
parents: 1029
diff changeset
90 TemplateInstance* DtoIsTemplateInstance(Dsymbol* s);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
91
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
92 /// Generate code for the symbol.
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
93 /// Dispatches as appropriate.
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
94 void DtoResolveDsymbol(Dsymbol* dsym);
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
95
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
96 /// Generates the constant initializer for a global variable.
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
97 void DtoConstInitGlobal(VarDeclaration* vd);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
98
433
b5f55f471e0b Move DeclarationExp code into a helper function so it can call itself for template mixin members.
Christian Kamm <kamm incasoftware de>
parents: 422
diff changeset
99 // declaration inside a declarationexp
b5f55f471e0b Move DeclarationExp code into a helper function so it can call itself for template mixin members.
Christian Kamm <kamm incasoftware de>
parents: 422
diff changeset
100 DValue* DtoDeclarationExp(Dsymbol* declaration);
1185
8baf611f0009 Fix nested references to 'ref' foreach variables.
Frits van Bommel <fvbommel wxs.nl>
parents: 1160
diff changeset
101 LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr = 0);
433
b5f55f471e0b Move DeclarationExp code into a helper function so it can call itself for template mixin members.
Christian Kamm <kamm incasoftware de>
parents: 422
diff changeset
102
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
103 // initializer helpers
797
340acf1535d0 Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 796
diff changeset
104 LLConstant* DtoConstInitializer(Loc loc, Type* type, Initializer* init);
340acf1535d0 Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 796
diff changeset
105 LLConstant* DtoConstExpInit(Loc loc, Type* t, Expression* exp);
482
aa8c050dfd19 Move zero init of padding to DtoInitializer in order to respect void initializers.
Christian Kamm <kamm incasoftware de>
parents: 479
diff changeset
106 DValue* DtoInitializer(LLValue* target, Initializer* init);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
107
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
108 // annotation generator
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
109 void DtoAnnotation(const char* str);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
110
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
111 // getting typeinfo of type, base=true casts to object.TypeInfo
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
112 LLConstant* DtoTypeInfoOf(Type* ty, bool base=true);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
113
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
114 // binary operations
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
115 DValue* DtoBinAdd(DValue* lhs, DValue* rhs);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
116 DValue* DtoBinSub(DValue* lhs, DValue* rhs);
524
ca2dfe98036c Binary ops had the wrong result type for real op imaginary.
Christian Kamm <kamm incasoftware de>
parents: 502
diff changeset
117 // these binops need an explicit result type to handling
ca2dfe98036c Binary ops had the wrong result type for real op imaginary.
Christian Kamm <kamm incasoftware de>
parents: 502
diff changeset
118 // to give 'ifloat op float' and 'float op ifloat' the correct type
ca2dfe98036c Binary ops had the wrong result type for real op imaginary.
Christian Kamm <kamm incasoftware de>
parents: 502
diff changeset
119 DValue* DtoBinMul(Type* resulttype, DValue* lhs, DValue* rhs);
ca2dfe98036c Binary ops had the wrong result type for real op imaginary.
Christian Kamm <kamm incasoftware de>
parents: 502
diff changeset
120 DValue* DtoBinDiv(Type* resulttype, DValue* lhs, DValue* rhs);
ca2dfe98036c Binary ops had the wrong result type for real op imaginary.
Christian Kamm <kamm incasoftware de>
parents: 502
diff changeset
121 DValue* DtoBinRem(Type* resulttype, DValue* lhs, DValue* rhs);
1503
cc5fee7836dc Made is and !is use the same numeric comparison as == and !=, fixes #328
Christian Kamm <kamm incasoftware de>
parents: 1479
diff changeset
122 LLValue* DtoBinNumericEquals(Loc loc, DValue* lhs, DValue* rhs, TOK op);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
123
284
70c370e97944 [svn r305] Started support for custom class allocators/deallocators. Allocators with more than one argument still need to be fixed.
lindquist
parents: 244
diff changeset
124 // target stuff
70c370e97944 [svn r305] Started support for custom class allocators/deallocators. Allocators with more than one argument still need to be fixed.
lindquist
parents: 244
diff changeset
125 void findDefaultTarget();
70c370e97944 [svn r305] Started support for custom class allocators/deallocators. Allocators with more than one argument still need to be fixed.
lindquist
parents: 244
diff changeset
126
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
127 /// Fixup an overloaded intrinsic name string.
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 524
diff changeset
128 void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, std::string& name);
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 524
diff changeset
129
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
130 /// Returns true if the symbol should be defined in the current module, not just declared.
940
39519a1ff603 Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 936
diff changeset
131 bool mustDefineSymbol(Dsymbol* s);
39519a1ff603 Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 936
diff changeset
132
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
133 /// Returns true if the symbol needs template linkage, or just external.
940
39519a1ff603 Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 936
diff changeset
134 bool needsTemplateLinkage(Dsymbol* s);
39519a1ff603 Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 936
diff changeset
135
1151
3cf0066e6faf - Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1148
diff changeset
136 /// Returns true if there is any unaligned type inside the aggregate.
1029
4d366a75d95f Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 940
diff changeset
137 bool hasUnalignedFields(Type* t);
4d366a75d95f Added hasUnalignedFields helper to check if a type has unaligned fields - as per request from fvbommel. Result is cached in TypeStruct.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 940
diff changeset
138
1152
521dd1626d76 Added initial support for raw LLVM inline asm.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1151
diff changeset
139 ///
521dd1626d76 Added initial support for raw LLVM inline asm.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1151
diff changeset
140 DValue* DtoInlineAsmExpr(Loc loc, FuncDeclaration* fd, Expressions* arguments);
521dd1626d76 Added initial support for raw LLVM inline asm.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1151
diff changeset
141
1271
0686701178d3 Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1255
diff changeset
142 /// Create the IrModule if necessary and returns it.
0686701178d3 Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1255
diff changeset
143 IrModule* getIrModule(Module* M);
0686701178d3 Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1255
diff changeset
144
1351
8d501abecd24 Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1350
diff changeset
145 /// Update an offset to make sure it follows both the D and LLVM alignments.
8d501abecd24 Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1350
diff changeset
146 /// Returns the offset rounded up to the closest safely aligned offset.
8d501abecd24 Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1350
diff changeset
147 size_t realignOffset(size_t offset, Type* type);
8d501abecd24 Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1350
diff changeset
148
414
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
149 ////////////////////////////////////////////
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
150 // gen/tocall.cpp stuff below
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
151 ////////////////////////////////////////////
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
152
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
153 /// convert DMD calling conv to LLVM
933
d3a6f1a96731 Replace assertion with errormessage for unsupported calling conventions. like Pascal. See dstress/run/e/extern_10_A.d
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 920
diff changeset
154 unsigned DtoCallingConv(Loc loc, LINK l);
414
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
155
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
156 ///
435
74101be2a553 Added type param to DVarValue as DMD sometimes overrides the type of the VarDeclaration.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 433
diff changeset
157 TypeFunction* DtoTypeFunction(DValue* fnval);
414
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
158
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
159 ///
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
160 DValue* DtoVaArg(Loc& loc, Type* type, Expression* valistArg);
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
161
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
162 ///
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
163 LLValue* DtoCallableValue(DValue* fn);
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
164
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
165 ///
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
166 const LLFunctionType* DtoExtractFunctionType(const LLType* type);
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
167
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
168 ///
632
df196c8dea26 Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 527
diff changeset
169 void DtoBuildDVarArgList(std::vector<LLValue*>& args, llvm::AttrListPtr& palist, TypeFunction* tf, Expressions* arguments, size_t argidx);
414
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
170
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
171 ///
422
fa91b03d9cd7 Error message for calling a function with a missing 'this' arg.
Christian Kamm <kamm incasoftware de>
parents: 419
diff changeset
172 DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* arguments);
414
ac1fcc138e42 Fixed issue with internal real representation, incorrect for non x86-32 architectures.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 399
diff changeset
173
1504
855f188aab7a Added a stripModifiers() function to remove shared|const|immutable storage classes in D2 (should eventually be moved to a dhelpers file rather than llvm helpers).
Robert Clipsham <robert@octarineparrot.com>
parents: 1479
diff changeset
174 Type* stripModifiers(Type* type);
855f188aab7a Added a stripModifiers() function to remove shared|const|immutable storage classes in D2 (should eventually be moved to a dhelpers file rather than llvm helpers).
Robert Clipsham <robert@octarineparrot.com>
parents: 1479
diff changeset
175
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff changeset
176 #endif