comparison dmd/template.c @ 1147:dbe4af57b240

Changed use of toObjFile to a new codegen method. More versioning of DMD specific codegen code.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 27 Mar 2009 17:54:27 +0100
parents 1860414bf3b7
children 0b26cfb2d445
comparison
equal deleted inserted replaced
1146:1860414bf3b7 1147:dbe4af57b240
335 if (constraint) 335 if (constraint)
336 e = constraint->syntaxCopy(); 336 e = constraint->syntaxCopy();
337 #endif 337 #endif
338 d = Dsymbol::arraySyntaxCopy(members); 338 d = Dsymbol::arraySyntaxCopy(members);
339 td = new TemplateDeclaration(loc, ident, p, d); 339 td = new TemplateDeclaration(loc, ident, p, d);
340 340
341 #if IN_LLVM
341 // LDC 342 // LDC
342 td->intrinsicName = intrinsicName; 343 td->intrinsicName = intrinsicName;
343 344 #endif
345
344 return td; 346 return td;
345 } 347 }
346 348
347 void TemplateDeclaration::semantic(Scope *sc) 349 void TemplateDeclaration::semantic(Scope *sc)
348 { 350 {
2948 this->nest = 0; 2950 this->nest = 0;
2949 this->havetempdecl = 0; 2951 this->havetempdecl = 0;
2950 this->isnested = NULL; 2952 this->isnested = NULL;
2951 this->errors = 0; 2953 this->errors = 0;
2952 2954
2955 #if IN_LLVM
2953 // LDC 2956 // LDC
2954 this->emittedInModule = NULL; 2957 this->emittedInModule = NULL;
2955 this->tinst = NULL; 2958 this->tinst = NULL;
2956 this->tmodule = NULL; 2959 this->tmodule = NULL;
2960 #endif
2957 } 2961 }
2958 2962
2959 /***************** 2963 /*****************
2960 * This constructor is only called when we figured out which function 2964 * This constructor is only called when we figured out which function
2961 * template to instantiate. 2965 * template to instantiate.
2980 this->nest = 0; 2984 this->nest = 0;
2981 this->havetempdecl = 1; 2985 this->havetempdecl = 1;
2982 this->isnested = NULL; 2986 this->isnested = NULL;
2983 this->errors = 0; 2987 this->errors = 0;
2984 2988
2989 #if IN_LLVM
2985 // LDC 2990 // LDC
2986 this->tinst = NULL; 2991 this->tinst = NULL;
2987 this->tmodule = NULL; 2992 this->tmodule = NULL;
2993 #endif
2988 2994
2989 assert((size_t)tempdecl->scope > 0x10000); 2995 assert((size_t)tempdecl->scope > 0x10000);
2990 } 2996 }
2991 2997
2992 2998
3268 if (s->ident && s->ident->equals(tempdecl->ident)) 3274 if (s->ident && s->ident->equals(tempdecl->ident))
3269 { 3275 {
3270 //printf("setting aliasdecl\n"); 3276 //printf("setting aliasdecl\n");
3271 aliasdecl = new AliasDeclaration(loc, s->ident, s); 3277 aliasdecl = new AliasDeclaration(loc, s->ident, s);
3272 3278
3279 #if IN_LLVM
3273 // LDC propagate internal information 3280 // LDC propagate internal information
3274 if (tempdecl->llvmInternal) { 3281 if (tempdecl->llvmInternal) {
3275 s->llvmInternal = tempdecl->llvmInternal; 3282 s->llvmInternal = tempdecl->llvmInternal;
3276 if (FuncDeclaration* fd = s->isFuncDeclaration()) { 3283 if (FuncDeclaration* fd = s->isFuncDeclaration()) {
3277 fd->intrinsicName = tempdecl->intrinsicName; 3284 fd->intrinsicName = tempdecl->intrinsicName;
3278 } 3285 }
3279 } 3286 }
3287 #endif
3280 } 3288 }
3281 } 3289 }
3282 } 3290 }
3283 3291
3284 // Do semantic() analysis on template instance members 3292 // Do semantic() analysis on template instance members
3955 sc = sc->pop(); 3963 sc = sc->pop();
3956 sc->pop(); 3964 sc->pop();
3957 } 3965 }
3958 } 3966 }
3959 3967
3968 #if IN_DMD
3969
3960 void TemplateInstance::toObjFile(int multiobj) 3970 void TemplateInstance::toObjFile(int multiobj)
3961 { 3971 {
3962 #if LOG 3972 #if LOG
3963 printf("TemplateInstance::toObjFile('%s', this = %p)\n", toChars(), this); 3973 printf("TemplateInstance::toObjFile('%s', this = %p)\n", toChars(), this);
3964 #endif 3974 #endif
3976 s->toObjFile(multiobj); 3986 s->toObjFile(multiobj);
3977 } 3987 }
3978 } 3988 }
3979 } 3989 }
3980 } 3990 }
3991
3992 #endif
3981 3993
3982 void TemplateInstance::inlineScan() 3994 void TemplateInstance::inlineScan()
3983 { 3995 {
3984 #if LOG 3996 #if LOG
3985 printf("TemplateInstance::inlineScan('%s')\n", toChars()); 3997 printf("TemplateInstance::inlineScan('%s')\n", toChars());
4557 buf->writebyte(';'); 4569 buf->writebyte(';');
4558 buf->writenl(); 4570 buf->writenl();
4559 } 4571 }
4560 4572
4561 4573
4574 #if IN_DMD
4562 void TemplateMixin::toObjFile(int multiobj) 4575 void TemplateMixin::toObjFile(int multiobj)
4563 { 4576 {
4564 //printf("TemplateMixin::toObjFile('%s')\n", toChars()); 4577 //printf("TemplateMixin::toObjFile('%s')\n", toChars());
4565 TemplateInstance::toObjFile(multiobj); 4578 TemplateInstance::toObjFile(multiobj);
4566 } 4579 }
4567 4580 #endif