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
This commit is contained in:
Eli Bendersky 2012-12-05 22:11:02 +00:00
parent d3746e6895
commit 02631c4e31
2 changed files with 4 additions and 7 deletions

View File

@ -107,11 +107,11 @@ class MCDataFragment : public MCFragment {
SmallString<32> Contents;
/// Fixups - The list of fixups in this fragment.
std::vector<MCFixup> Fixups;
SmallVector<MCFixup, 4> Fixups;
public:
typedef std::vector<MCFixup>::const_iterator const_fixup_iterator;
typedef std::vector<MCFixup>::iterator fixup_iterator;
typedef SmallVectorImpl<MCFixup>::const_iterator const_fixup_iterator;
typedef SmallVectorImpl<MCFixup>::iterator fixup_iterator;
public:
MCDataFragment(MCSectionData *SD = 0) : MCFragment(FT_Data, SD) {}
@ -133,9 +133,6 @@ public:
Fixups.push_back(Fixup);
}
std::vector<MCFixup> &getFixups() { return Fixups; }
const std::vector<MCFixup> &getFixups() const { return Fixups; }
fixup_iterator fixup_begin() { return Fixups.begin(); }
const_fixup_iterator fixup_begin() const { return Fixups.begin(); }

View File

@ -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(),