Mercurial > projects > ldc
annotate gen/llvmhelpers.h @ 323:0d52412d5b1a trunk
[svn r344] Fixed some very minor issues with the usage listing when calling llvmdc with no arguments.
Changed the way moduleinfo is registered to use the same approach as DMD, this eliminates the need for correct linking order and should make the way for using a natively compiled runtime library. This should speed up linking tremendously and should now be possible.
Fixed the llvm.used array to only be emitted if really necessary.
author | lindquist |
---|---|
date | Wed, 09 Jul 2008 23:43:51 +0200 |
parents | d59c363fccad |
children | 6057fdf797d8 |
rev | line source |
---|---|
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
1 #ifndef LLVMDC_GEN_LLVMHELPERS_H |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
2 #define LLVMDC_GEN_LLVMHELPERS_H |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
3 |
302 | 4 #include "statement.h" |
5 | |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
6 // 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
|
7 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
|
8 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
|
9 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
|
10 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
|
11 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
|
12 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
13 // assertion generator |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
14 void DtoAssert(Loc* loc, DValue* msg); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
15 |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
302
diff
changeset
|
16 // 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
|
17 LabelStatement* DtoLabelStatement(Identifier* ident); |
302 | 18 // emit goto |
309 | 19 void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosingtryfinally); |
302 | 20 |
21 // generates IR for finally blocks between the 'start' and 'end' statements | |
22 // will begin with the finally block belonging to 'start' and does not include | |
23 // the finally block of 'end' | |
309 | 24 void DtoEnclosingHandlers(EnclosingHandler* start, EnclosingHandler* end); |
25 | |
26 // enters a critical section | |
27 void DtoEnterCritical(LLValue* g); | |
28 // leaves a critical section | |
29 void DtoLeaveCritical(LLValue* g); | |
30 | |
31 // enters a monitor lock | |
32 void DtoEnterMonitor(LLValue* v); | |
33 // leaves a monitor lock | |
34 void DtoLeaveMonitor(LLValue* v); | |
302 | 35 |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
36 // nested variable/class helpers |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
37 LLValue* DtoNestedContext(FuncDeclaration* func); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
38 LLValue* DtoNestedVariable(VarDeclaration* vd); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
39 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
40 // basic operations |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
41 void DtoAssign(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
|
42 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
43 // casts |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
44 DValue* DtoCastInt(DValue* val, Type* to); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
45 DValue* DtoCastPtr(DValue* val, Type* to); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
46 DValue* DtoCastFloat(DValue* val, Type* to); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
47 DValue* DtoCast(DValue* val, Type* to); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
48 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
49 // is template instance check |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
50 bool DtoIsTemplateInstance(Dsymbol* s); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
51 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
52 // generates lazy static initialization code for a global variable |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
53 void DtoLazyStaticInit(bool istempl, LLValue* gvar, Initializer* init, Type* t); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
54 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
55 // these are all basically drivers for the codegeneration called by the main loop |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
56 void DtoResolveDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
57 void DtoDeclareDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
58 void DtoDefineDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
59 void DtoConstInitDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
60 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
|
61 void DtoEmptyResolveList(); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
62 void DtoEmptyDeclareList(); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
63 void DtoEmptyConstInitList(); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
64 void DtoEmptyAllLists(); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
65 void DtoForceDeclareDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
66 void DtoForceConstInitDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
67 void DtoForceDefineDsymbol(Dsymbol* dsym); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
68 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
69 // initializer helpers |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
70 LLConstant* DtoConstInitializer(Type* type, Initializer* init); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
71 LLConstant* DtoConstFieldInitializer(Type* type, Initializer* init); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
72 DValue* DtoInitializer(Initializer* init); |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
73 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
74 // annotation generator |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
75 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
|
76 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
77 // 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
|
78 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
|
79 |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
80 // binary operations |
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
81 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
|
82 DValue* DtoBinSub(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
|
83 DValue* DtoBinMul(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
|
84 DValue* DtoBinDiv(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
|
85 DValue* DtoBinRem(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
|
86 |
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
|
87 // 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
|
88 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
|
89 |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
diff
changeset
|
90 #endif |