comparison gen/llvmhelpers.cpp @ 339:385a18242485 trunk

[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too! Fixed issues with slice initialization (!!!) of multidimensional static arrays. Attempt to fix issue with referencing nested 'this' pointers introduced in DMD 1.033 merge.
author lindquist
date Sun, 13 Jul 2008 01:29:49 +0200
parents 7086a84ab3d6
children a7a26f538d6e
comparison
equal deleted inserted replaced
338:0c90d816394f 339:385a18242485
1 #include "gen/llvm.h" 1 #include "gen/llvm.h"
2 #include "llvm/Target/TargetMachineRegistry.h" 2 #include "llvm/Target/TargetMachineRegistry.h"
3 3
4 #include "mars.h" 4 #include "mars.h"
5 #include "init.h" 5 #include "init.h"
6 #include "id.h"
6 7
7 #include "gen/tollvm.h" 8 #include "gen/tollvm.h"
8 #include "gen/llvmhelpers.h" 9 #include "gen/llvmhelpers.h"
9 #include "gen/irstate.h" 10 #include "gen/irstate.h"
10 #include "gen/runtime.h" 11 #include "gen/runtime.h"
462 // resolve frame ptr 463 // resolve frame ptr
463 FuncDeclaration* func = vd->toParent2()->isFuncDeclaration(); 464 FuncDeclaration* func = vd->toParent2()->isFuncDeclaration();
464 assert(func); 465 assert(func);
465 LLValue* ptr = DtoNestedContext(func); 466 LLValue* ptr = DtoNestedContext(func);
466 assert(ptr && "nested var, but no context"); 467 assert(ptr && "nested var, but no context");
468
469 // if the nested var is a this pointer it's a class member and not a magic struct
470 // so we're done here!
471 // this happens since 1.033 for some reason... always correct ?
472 if (vd->ident == Id::This)
473 {
474 return ptr;
475 }
476
477 // handle a "normal" nested variable
467 478
468 // we must cast here to be sure. nested classes just have a void* 479 // we must cast here to be sure. nested classes just have a void*
469 ptr = DtoBitCast(ptr, func->ir.irFunc->nestedVar->getType()); 480 ptr = DtoBitCast(ptr, func->ir.irFunc->nestedVar->getType());
470 481
471 // index nested var and load (if necessary) 482 // index nested var and load (if necessary)