Mercurial > projects > ldc
annotate gen/tollvm.h @ 100:5071469303d4 trunk
[svn r104] TONS OF FIXES.
Split up declaration, constant initializer gen and definition for globals, structs, classes and functions.
Improved ClassInfo support (not complete), not in vtable yet.
Fixed a bunch of forward reference problems.
Much more. Major commit! :)
author | lindquist |
---|---|
date | Fri, 16 Nov 2007 08:21:47 +0100 |
parents | c4e161556a21 |
children | 027b8d8b71ec |
rev | line source |
---|---|
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
1 #ifndef LLVMDC_GEN_TOLLVM_H |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
2 #define LLVMDC_GEN_TOLLVM_H |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
3 |
1 | 4 // D -> LLVM helpers |
5 | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
6 struct DValue; |
1 | 7 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
8 const llvm::Type* DtoType(Type* t); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
9 bool DtoIsPassedByRef(Type* type); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
10 Type* DtoDType(Type* t); |
1 | 11 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
12 const llvm::StructType* DtoDelegateType(Type* t); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
13 llvm::Value* DtoNullDelegate(llvm::Value* v); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
14 llvm::Value* DtoDelegateCopy(llvm::Value* dst, llvm::Value* src); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
15 llvm::Value* DtoCompareDelegate(TOK op, llvm::Value* lhs, llvm::Value* rhs); |
1 | 16 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
17 llvm::GlobalValue::LinkageTypes DtoLinkage(PROT prot, uint stc); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
18 unsigned DtoCallingConv(LINK l); |
1 | 19 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
20 llvm::Value* DtoPointedType(llvm::Value* ptr, llvm::Value* val); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
21 llvm::Value* DtoBoolean(llvm::Value* val); |
1 | 22 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
23 const llvm::Type* DtoSize_t(); |
1 | 24 |
90 | 25 const llvm::StructType* DtoComplexType(const llvm::Type* base); |
26 | |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
27 llvm::Constant* DtoConstInitializer(Type* type, Initializer* init); |
100 | 28 llvm::Constant* DtoConstFieldInitializer(Type* type, Initializer* init); |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
29 DValue* DtoInitializer(Initializer* init); |
1 | 30 |
4
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
31 llvm::Function* LLVM_DeclareMemSet32(); |
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
32 llvm::Function* LLVM_DeclareMemSet64(); |
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
33 llvm::Function* LLVM_DeclareMemCpy32(); |
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
34 llvm::Function* LLVM_DeclareMemCpy64(); |
e116aa1488e6
[svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents:
1
diff
changeset
|
35 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
36 llvm::Value* DtoGEP(llvm::Value* ptr, llvm::Value* i0, llvm::Value* i1, const std::string& var, llvm::BasicBlock* bb=NULL); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
37 llvm::Value* DtoGEP(llvm::Value* ptr, const std::vector<unsigned>& src, const std::string& var, llvm::BasicBlock* bb=NULL); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
38 llvm::Value* DtoGEPi(llvm::Value* ptr, unsigned i0, const std::string& var, llvm::BasicBlock* bb=NULL); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
39 llvm::Value* DtoGEPi(llvm::Value* ptr, unsigned i0, unsigned i1, const std::string& var, llvm::BasicBlock* bb=NULL); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
40 |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
41 llvm::Value* DtoRealloc(llvm::Value* ptr, const llvm::Type* ty); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
42 llvm::Value* DtoRealloc(llvm::Value* ptr, llvm::Value* len); |
29
253a5fc4033a
[svn r33] * Added support for assignment to function arguments
lindquist
parents:
11
diff
changeset
|
43 |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
44 void DtoAssert(llvm::Value* cond, Loc* loc, DValue* msg); |
34 | 45 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
46 llvm::Value* DtoArgument(const llvm::Type* paramtype, Argument* fnarg, Expression* argexp); |
34 | 47 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
48 llvm::Value* DtoNestedVariable(VarDeclaration* vd); |
40 | 49 |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
50 llvm::ConstantInt* DtoConstSize_t(size_t); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
51 llvm::ConstantInt* DtoConstUint(unsigned i); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
52 llvm::ConstantInt* DtoConstInt(int i); |
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
53 llvm::Constant* DtoConstString(const char*); |
82
d8dd47ef3973
[svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
81
diff
changeset
|
54 llvm::Constant* DtoConstStringPtr(const char* str, const char* section = 0); |
81
3587401b6eeb
[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed.
lindquist
parents:
77
diff
changeset
|
55 llvm::Constant* DtoConstBool(bool); |
54
28e99b04a132
[svn r58] Fixed cond expression resulting in a non-basic type.
lindquist
parents:
53
diff
changeset
|
56 |
88
058d3925950e
[svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
86
diff
changeset
|
57 bool DtoIsTemplateInstance(Dsymbol* s); |
77
714057ff2dbb
[svn r81] Fixed: Union support was very buggy. Should be fairly solid now.
lindquist
parents:
72
diff
changeset
|
58 |
88
058d3925950e
[svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
86
diff
changeset
|
59 void DtoLazyStaticInit(bool istempl, llvm::Value* gvar, Initializer* init, Type* t); |
85
f869c636a113
[svn r89] Fixed a bunch of problems with template instance across multiple modules.
lindquist
parents:
82
diff
changeset
|
60 |
100 | 61 void DtoDefineDsymbol(Dsymbol* dsym); |
62 void DtoConstInitDsymbol(Dsymbol* dsym); | |
63 void DtoConstInitGlobal(VarDeclaration* vd); | |
89 | 64 |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
65 // llvm wrappers |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
66 void DtoMemCpy(llvm::Value* dst, llvm::Value* src, llvm::Value* nbytes); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
67 bool DtoCanLoad(llvm::Value* ptr); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
68 llvm::Value* DtoLoad(llvm::Value* src); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
69 void DtoStore(llvm::Value* src, llvm::Value* dst); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
70 llvm::Value* DtoBitCast(llvm::Value* v, const llvm::Type* t); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
71 |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
72 // llvm::dyn_cast wrappers |
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
73 const llvm::PointerType* isaPointer(llvm::Value* v); |
96 | 74 const llvm::PointerType* isaPointer(const llvm::Type* t); |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
75 const llvm::ArrayType* isaArray(llvm::Value* v); |
96 | 76 const llvm::ArrayType* isaArray(const llvm::Type* t); |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
77 const llvm::StructType* isaStruct(llvm::Value* v); |
96 | 78 const llvm::StructType* isaStruct(const llvm::Type* t); |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
79 llvm::Constant* isaConstant(llvm::Value* v); |
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
80 llvm::ConstantInt* isaConstantInt(llvm::Value* v); |
96 | 81 llvm::Argument* isaArgument(llvm::Value* v); |
94
61615fa85940
[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents:
92
diff
changeset
|
82 |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
83 // basic operations |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
84 void DtoAssign(DValue* lhs, DValue* rhs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
85 |
97
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
86 // casts |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
87 DValue* DtoCastInt(DValue* val, Type* to); |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
88 DValue* DtoCastPtr(DValue* val, Type* to); |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
89 DValue* DtoCastFloat(DValue* val, Type* to); |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
90 DValue* DtoCastArray(DValue* val, Type* to); |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
91 DValue* DtoCastClass(DValue* val, Type* to); |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
92 DValue* DtoCast(DValue* val, Type* to); |
c4e161556a21
[svn r101] Split up CastExp into several smaller utility functions.
lindquist
parents:
96
diff
changeset
|
93 |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
94 // binary operations |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
95 DValue* DtoBinAdd(DValue* lhs, DValue* rhs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
96 DValue* DtoBinSub(DValue* lhs, DValue* rhs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
97 DValue* DtoBinMul(DValue* lhs, DValue* rhs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
98 DValue* DtoBinDiv(DValue* lhs, DValue* rhs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
99 DValue* DtoBinRem(DValue* lhs, DValue* rhs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
100 |
1 | 101 #include "enums.h" |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
102 |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
85
diff
changeset
|
103 #endif // LLVMDC_GEN_TOLLVM_H |