Mercurial > projects > ldc
comparison gen/passes/GarbageCollect2Stack.cpp @ 1350:15e9762bb620
Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 .
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Thu, 14 May 2009 13:26:40 +0200 |
parents | 3297edb697eb |
children | 67ac63740c7f |
comparison
equal
deleted
inserted
replaced
1349:a376776e2301 | 1350:15e9762bb620 |
---|---|
96 // It will always be inserted before the call. | 96 // It will always be inserted before the call. |
97 virtual AllocaInst* promote(CallSite CS, IRBuilder<>& B, const Analysis& A) { | 97 virtual AllocaInst* promote(CallSite CS, IRBuilder<>& B, const Analysis& A) { |
98 NumGcToStack++; | 98 NumGcToStack++; |
99 | 99 |
100 Instruction* Begin = CS.getCaller()->getEntryBlock().begin(); | 100 Instruction* Begin = CS.getCaller()->getEntryBlock().begin(); |
101 return new AllocaInst(Ty, ".nongc_mem", Begin); | 101 return new AllocaInst(Ty, ".nongc_mem", Begin); // FIXME: align? |
102 } | 102 } |
103 | 103 |
104 FunctionInfo(unsigned typeInfoArgNr, bool safeToDelete) | 104 FunctionInfo(unsigned typeInfoArgNr, bool safeToDelete) |
105 : TypeInfoArgNr(typeInfoArgNr), SafeToDelete(safeToDelete) {} | 105 : TypeInfoArgNr(typeInfoArgNr), SafeToDelete(safeToDelete) {} |
106 }; | 106 }; |
163 NumToDynSize++; | 163 NumToDynSize++; |
164 } | 164 } |
165 | 165 |
166 // Convert array size to 32 bits if necessary | 166 // Convert array size to 32 bits if necessary |
167 Value* count = Builder.CreateIntCast(arrSize, Type::Int32Ty, false); | 167 Value* count = Builder.CreateIntCast(arrSize, Type::Int32Ty, false); |
168 AllocaInst* alloca = Builder.CreateAlloca(Ty, count, ".nongc_mem"); | 168 AllocaInst* alloca = Builder.CreateAlloca(Ty, count, ".nongc_mem"); // FIXME: align? |
169 | 169 |
170 if (Initialized) { | 170 if (Initialized) { |
171 // For now, only zero-init is supported. | 171 // For now, only zero-init is supported. |
172 uint64_t size = A.TD.getTypeStoreSize(Ty); | 172 uint64_t size = A.TD.getTypeStoreSize(Ty); |
173 Value* TypeSize = ConstantInt::get(arrSize->getType(), size); | 173 Value* TypeSize = ConstantInt::get(arrSize->getType(), size); |