diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-07-15 20:49:10 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-07-15 20:49:10 +0000 |
commit | 4b70fab658114dbab81725f2a42db381bf6f031f (patch) | |
tree | 6f179081c49b8b191cbe079d0239c955bb0d6ffa /lib/CodeGen/ELFCodeEmitter.cpp | |
parent | cf20031f60f3a242f0cf4e0a42e115762e2948e4 (diff) |
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
Diffstat (limited to 'lib/CodeGen/ELFCodeEmitter.cpp')
-rw-r--r-- | lib/CodeGen/ELFCodeEmitter.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/CodeGen/ELFCodeEmitter.cpp b/lib/CodeGen/ELFCodeEmitter.cpp index 5133e74298..1d150032c3 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()); |