annotate gen/llvmhelpers.h @ 314:8d98e42ece93 trunk

[svn r335] The basics of exception handling are in place. Still need to make sure calls are turned into invokes everywhere. (NewExpression for instance) Still some rough edges and corner cases to figure out. Needs testing!
author ChristianK
date Wed, 02 Jul 2008 22:20:18 +0200
parents d59c363fccad
children 6057fdf797d8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
4 #include "statement.h"
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
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
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
18 // emit goto
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
19 void DtoGoto(Loc* loc, Identifier* target, EnclosingHandler* enclosingtryfinally);
302
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
20
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
21 // generates IR for finally blocks between the 'start' and 'end' statements
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
22 // will begin with the finally block belonging to 'start' and does not include
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
23 // the finally block of 'end'
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
24 void DtoEnclosingHandlers(EnclosingHandler* start, EnclosingHandler* end);
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
25
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
26 // enters a critical section
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
27 void DtoEnterCritical(LLValue* g);
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
28 // leaves a critical section
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
29 void DtoLeaveCritical(LLValue* g);
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
30
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
31 // enters a monitor lock
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
32 void DtoEnterMonitor(LLValue* v);
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
33 // leaves a monitor lock
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 305
diff changeset
34 void DtoLeaveMonitor(LLValue* v);
302
bef811104734 [svn r323] Branching out of inline asm works.
ChristianK
parents: 284
diff changeset
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