Browse Source

Improve allocas order and namings

cl-refactor
Paweł Bylica 10 years ago
parent
commit
019aa6dd63
  1. 10
      evmjit/libevmjit/Ext.cpp

10
evmjit/libevmjit/Ext.cpp

@ -60,14 +60,16 @@ llvm::Function* createFunc(EnvFunc _id, llvm::Module* _module)
llvm::Value* Ext::getArgAlloca() llvm::Value* Ext::getArgAlloca()
{ {
auto& a = m_argAllocas[m_argCounter++]; auto& a = m_argAllocas[m_argCounter];
if (!a) if (!a)
{ {
// FIXME: Improve order and names
InsertPointGuard g{getBuilder()}; InsertPointGuard g{getBuilder()};
getBuilder().SetInsertPoint(getMainFunction()->front().getFirstNonPHI()); auto allocaIt = getMainFunction()->front().begin();
a = getBuilder().CreateAlloca(Type::Word, nullptr, "arg"); std::advance(allocaIt, m_argCounter); // Skip already created allocas
getBuilder().SetInsertPoint(allocaIt);
a = getBuilder().CreateAlloca(Type::Word, nullptr, {"a.", std::to_string(m_argCounter)});
} }
++m_argCounter;
return a; return a;
} }

Loading…
Cancel
Save