summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-11-30 00:50:53 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-11-30 00:50:53 +0000
commit873cf93b6eac3ba5c693b9d06e29d2a1ece52d3a (patch)
tree560a4d6ff251fde3e6c2ea1351f5fcee3e9529fc /llvm
parent58efc9e0fe3907fe67fecfc9b50ca82ab93dcc52 (diff)
downloadbcm5719-llvm-873cf93b6eac3ba5c693b9d06e29d2a1ece52d3a.tar.gz
bcm5719-llvm-873cf93b6eac3ba5c693b9d06e29d2a1ece52d3a.zip
Go back to allocating memory for each constant separately. Since SPARCs do not
allow unaligned loads, that is probably the problem I've been seeing in numerous SPARC test cases failing. X86, on the other hand, just slows down unaligned accesses, since it must make 2 aligned accesses for each unaligned one. llvm-svn: 10266
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/Emitter.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/Emitter.cpp b/llvm/lib/ExecutionEngine/JIT/Emitter.cpp
index be60b239a3e..32d0651f226 100644
--- a/llvm/lib/ExecutionEngine/JIT/Emitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/Emitter.cpp
@@ -187,28 +187,13 @@ void Emitter::finishFunction(MachineFunction &F) {
void Emitter::emitConstantPool(MachineConstantPool *MCP) {
const std::vector<Constant*> &Constants = MCP->getConstants();
- if (Constants.size() == 0) return;
-
- std::vector<unsigned> ConstantSizes;
- unsigned TotalSize = 0;
- // Calculate how much space we will need for all the constants
for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
+ // For now we just allocate some memory on the heap, this can be
+ // dramatically improved.
const Type *Ty = ((Value*)Constants[i])->getType();
- unsigned TySize = TheVM->getTargetData().getTypeSize(Ty);
- ConstantSizes.push_back(TySize);
- TotalSize += TySize;
- }
- // Allocate a 'pool' of memory just once
- void *ConstPool = malloc(TotalSize);
- if (!ConstPool) {
- perror("malloc");
- abort();
- }
- // Initialize each slot in the 'pool' appropriately
- for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
- TheVM->InitializeMemory(Constants[i], ConstPool);
- ConstantPoolAddresses.push_back(ConstPool);
- ConstPool = (void*) ((intptr_t)ConstPool + ConstantSizes[i]);
+ void *Addr = malloc(TheVM->getTargetData().getTypeSize(Ty));
+ TheVM->InitializeMemory(Constants[i], Addr);
+ ConstantPoolAddresses.push_back(Addr);
}
}
OpenPOWER on IntegriCloud