From 4b70fab658114dbab81725f2a42db381bf6f031f Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Wed, 15 Jul 2009 20:49:10 +0000 Subject: use std::vector instead of std::list for both Section and Symbol lists because we care more about random access than insertion/deletion of elements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75828 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/ELFCodeEmitter.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'lib/CodeGen/ELFCodeEmitter.cpp') diff --git a/lib/CodeGen/ELFCodeEmitter.cpp b/lib/CodeGen/ELFCodeEmitter.cpp index 5133e74..1d15003 100644 --- a/lib/CodeGen/ELFCodeEmitter.cpp +++ b/lib/CodeGen/ELFCodeEmitter.cpp @@ -60,23 +60,18 @@ void ELFCodeEmitter::startFunction(MachineFunction &MF) { bool ELFCodeEmitter::finishFunction(MachineFunction &MF) { // Add a symbol to represent the function. const Function *F = MF.getFunction(); - ELFSym FnSym(F); - FnSym.setType(ELFSym::STT_FUNC); - FnSym.setBind(EW.getGlobalELFBinding(F)); - FnSym.setVisibility(EW.getGlobalELFVisibility(F)); - FnSym.SectionIdx = ES->SectionIdx; - FnSym.Size = ES->getCurrentPCOffset()-FnStartOff; + ELFSym *FnSym = new ELFSym(F); + FnSym->setType(ELFSym::STT_FUNC); + FnSym->setBind(EW.getGlobalELFBinding(F)); + FnSym->setVisibility(EW.getGlobalELFVisibility(F)); + FnSym->SectionIdx = ES->SectionIdx; + FnSym->Size = ES->getCurrentPCOffset()-FnStartOff; // Offset from start of Section - FnSym.Value = FnStartOff; - - // Locals should go on the symbol list front - if (!F->hasPrivateLinkage()) { - if (FnSym.getBind() == ELFSym::STB_LOCAL) - EW.SymbolList.push_front(FnSym); - else - EW.SymbolList.push_back(FnSym); - } + FnSym->Value = FnStartOff; + + if (!F->hasPrivateLinkage()) + EW.SymbolList.push_back(FnSym); // Emit constant pool to appropriate section(s) emitConstantPool(MF.getConstantPool()); -- cgit v1.1