From 7b68fe1bd8963e2ac3d1211bcfdad5acfa05a6b2 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 5 Dec 2012 22:11:02 +0000 Subject: [PATCH] Change std::vector to SmallVector<4> and remove some unused methods. This is more consistent with other vectors in this code. In addition, I ran some tests compiling a large program and >96% of fragments have 4 or less fixups, so SmallVector<4> is a good optimization. llvm-svn: 169433 --- include/llvm/MC/MCAssembler.h | 9 +++------ lib/MC/MCAssembler.cpp | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index 057faac91a2..266e0c7f484 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -107,11 +107,11 @@ class MCDataFragment : public MCFragment { SmallString<32> Contents; /// Fixups - The list of fixups in this fragment. - std::vector Fixups; + SmallVector Fixups; public: - typedef std::vector::const_iterator const_fixup_iterator; - typedef std::vector::iterator fixup_iterator; + typedef SmallVectorImpl::const_iterator const_fixup_iterator; + typedef SmallVectorImpl::iterator fixup_iterator; public: MCDataFragment(MCSectionData *SD = 0) : MCFragment(FT_Data, SD) {} @@ -133,9 +133,6 @@ public: Fixups.push_back(Fixup); } - std::vector &getFixups() { return Fixups; } - const std::vector &getFixups() const { return Fixups; } - fixup_iterator fixup_begin() { return Fixups.begin(); } const_fixup_iterator fixup_begin() const { return Fixups.begin(); } diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index 48aec668bf8..457abd2a0aa 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -870,7 +870,7 @@ void MCFragment::dump() { } OS << "] (" << Contents.size() << " bytes)"; - if (!DF->getFixups().empty()) { + if (DF->fixup_begin() != DF->fixup_end()) { OS << ",\n "; OS << " Fixups:["; for (MCDataFragment::const_fixup_iterator it = DF->fixup_begin(),