Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 648:8d850fa25713
Fix VarDecls for tuples. Closes #99.
I've implemented it this way since it doesn't require any changes in the
frontend. However, I think having TypeTuple expressed as LLVM struct types
would make much more sense and open the door to tuple lvalues.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 05 Oct 2008 11:47:47 +0200 |
parents | 29dc68c949b0 |
children | aa6a0b7968f7 |
comparison
equal
deleted
inserted
replaced
646:51c4d1a64da6 | 648:8d850fa25713 |
---|---|
167 TypeAArray* taa = (TypeAArray*)t; | 167 TypeAArray* taa = (TypeAArray*)t; |
168 // aa key/val can't be void | 168 // aa key/val can't be void |
169 return getPtrToType(LLStructType::get(DtoType(taa->key), DtoType(taa->next), 0)); | 169 return getPtrToType(LLStructType::get(DtoType(taa->key), DtoType(taa->next), 0)); |
170 } | 170 } |
171 | 171 |
172 /* | |
173 Not needed atm as VarDecls for tuples are rewritten as a string of | |
174 VarDecls for the fields (u -> _u_field_0, ...) | |
175 | |
176 case Ttuple: | |
177 { | |
178 TypeTuple* ttupl = (TypeTuple*)t; | |
179 return DtoStructTypeFromArguments(ttupl->arguments); | |
180 } | |
181 */ | |
172 // opaque type | 182 // opaque type |
173 case Topaque: | 183 case Topaque: |
174 return llvm::OpaqueType::get(); | 184 return llvm::OpaqueType::get(); |
175 | 185 |
176 default: | 186 default: |
177 printf("trying to convert unknown type with value %d\n", t->ty); | 187 printf("trying to convert unknown type with value %d\n", t->ty); |
178 assert(0); | 188 assert(0); |
179 } | 189 } |
180 return 0; | 190 return 0; |
181 } | 191 } |
192 | |
193 ////////////////////////////////////////////////////////////////////////////////////////// | |
194 | |
195 /* | |
196 const LLType* DtoStructTypeFromArguments(Arguments* arguments) | |
197 { | |
198 if (!arguments) | |
199 return LLType::VoidTy; | |
200 | |
201 std::vector<const LLType*> types; | |
202 for (size_t i = 0; i < arguments->dim; i++) | |
203 { | |
204 Argument *arg = (Argument *)arguments->data[i]; | |
205 assert(arg && arg->type); | |
206 | |
207 types.push_back(DtoType(arg->type)); | |
208 } | |
209 return LLStructType::get(types); | |
210 } | |
211 */ | |
182 | 212 |
183 ////////////////////////////////////////////////////////////////////////////////////////// | 213 ////////////////////////////////////////////////////////////////////////////////////////// |
184 | 214 |
185 const LLType* DtoTypeNotVoid(Type* t) | 215 const LLType* DtoTypeNotVoid(Type* t) |
186 { | 216 { |