comparison gen/llvmhelpers.h @ 1151:3cf0066e6faf

- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM. - Eliminated the DLRValue DValue. - Implemented proactive handling of l-value CastExpS. - Minor tweak in runtime memory.d .
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Sat, 28 Mar 2009 05:00:43 +0100
parents 3d1b16dabd25
children 521dd1626d76
comparison
equal deleted inserted replaced
1150:2a687353c84d 1151:3cf0066e6faf
50 50
51 // Generates IR for enclosing handlers between the current state and 51 // Generates IR for enclosing handlers between the current state and
52 // the scope created by the 'target' statement. 52 // the scope created by the 'target' statement.
53 void DtoEnclosingHandlers(Loc loc, Statement* target); 53 void DtoEnclosingHandlers(Loc loc, Statement* target);
54 54
55 // enters a critical section 55 /// Enters a critical section.
56 void DtoEnterCritical(LLValue* g); 56 void DtoEnterCritical(LLValue* g);
57 // leaves a critical section 57 /// leaves a critical section.
58 void DtoLeaveCritical(LLValue* g); 58 void DtoLeaveCritical(LLValue* g);
59 59
60 // enters a monitor lock 60 /// Enters a monitor lock.
61 void DtoEnterMonitor(LLValue* v); 61 void DtoEnterMonitor(LLValue* v);
62 // leaves a monitor lock 62 /// Leaves a monitor lock.
63 void DtoLeaveMonitor(LLValue* v); 63 void DtoLeaveMonitor(LLValue* v);
64 64
65 // nested variable and context helpers 65 // nested variable and context helpers
66 66
67 // gets the context value for a call to a nested function or newing a class, with arbitrary nesting 67 /// Gets the context value for a call to a nested function or newing a nested
68 /// class with arbitrary nesting.
68 LLValue* DtoNestedContext(Loc loc, Dsymbol* sym); 69 LLValue* DtoNestedContext(Loc loc, Dsymbol* sym);
69 // gets the dvalue of a nested variable with arbitrary nesting 70
71 /// Gets the DValue of a nested variable with arbitrary nesting.
70 DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd); 72 DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd);
71 73
72 // basic operations 74 // basic operations
73 void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs); 75 void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs);
74 76
75 // create a null dvalue 77 /// Create a null DValue.
76 DValue* DtoNullValue(Type* t); 78 DValue* DtoNullValue(Type* t);
77 79
78 // casts 80 // casts
79 DValue* DtoCastInt(Loc& loc, DValue* val, Type* to); 81 DValue* DtoCastInt(Loc& loc, DValue* val, Type* to);
80 DValue* DtoCastPtr(Loc& loc, DValue* val, Type* to); 82 DValue* DtoCastPtr(Loc& loc, DValue* val, Type* to);
86 DValue* DtoPaintType(Loc& loc, DValue* val, Type* to); 88 DValue* DtoPaintType(Loc& loc, DValue* val, Type* to);
87 89
88 // is template instance check, returns module where instantiated 90 // is template instance check, returns module where instantiated
89 TemplateInstance* DtoIsTemplateInstance(Dsymbol* s); 91 TemplateInstance* DtoIsTemplateInstance(Dsymbol* s);
90 92
91 // these are all basically drivers for the codegeneration called by the main loop 93 /// Generate code for the symbol.
94 /// Dispatches as appropriate.
92 void DtoResolveDsymbol(Dsymbol* dsym); 95 void DtoResolveDsymbol(Dsymbol* dsym);
93 void DtoDeclareDsymbol(Dsymbol* dsym); 96
94 void DtoDefineDsymbol(Dsymbol* dsym); 97 /// Generates the constant initializer for a global variable.
95 void DtoConstInitDsymbol(Dsymbol* dsym);
96 void DtoConstInitGlobal(VarDeclaration* vd); 98 void DtoConstInitGlobal(VarDeclaration* vd);
97 99
98 // declaration inside a declarationexp 100 // declaration inside a declarationexp
99 DValue* DtoDeclarationExp(Dsymbol* declaration); 101 DValue* DtoDeclarationExp(Dsymbol* declaration);
100 LLValue* DtoRawVarDeclaration(VarDeclaration* var); 102 LLValue* DtoRawVarDeclaration(VarDeclaration* var);
120 DValue* DtoBinRem(Type* resulttype, DValue* lhs, DValue* rhs); 122 DValue* DtoBinRem(Type* resulttype, DValue* lhs, DValue* rhs);
121 123
122 // target stuff 124 // target stuff
123 void findDefaultTarget(); 125 void findDefaultTarget();
124 126
125 // fixup an overloaded intrinsic name string 127 /// Fixup an overloaded intrinsic name string.
126 void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, std::string& name); 128 void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, std::string& name);
127 129
128 // return true if the symbol should be defined in the current module, not just declared 130 /// Returns true if the symbol should be defined in the current module, not just declared.
129 bool mustDefineSymbol(Dsymbol* s); 131 bool mustDefineSymbol(Dsymbol* s);
130 132
131 // returns true if the symbol needs template linkage, or just external 133 /// Returns true if the symbol needs template linkage, or just external.
132 bool needsTemplateLinkage(Dsymbol* s); 134 bool needsTemplateLinkage(Dsymbol* s);
133 135
134 // returns true if there is any unaligned type inside the aggregate 136 /// Returns true if there is any unaligned type inside the aggregate.
135 bool hasUnalignedFields(Type* t); 137 bool hasUnalignedFields(Type* t);
136 138
137 //////////////////////////////////////////// 139 ////////////////////////////////////////////
138 // gen/tocall.cpp stuff below 140 // gen/tocall.cpp stuff below
139 //////////////////////////////////////////// 141 ////////////////////////////////////////////