[llvm-branch-commits] [llvm-branch] r104763 - in /llvm/branches/Apple/whitney: include/llvm/MC/MCAssembler.h lib/MC/MCAssembler.cpp
Daniel Dunbar
daniel at zuster.org
Wed May 26 15:28:46 PDT 2010
Author: ddunbar
Date: Wed May 26 17:28:46 2010
New Revision: 104763
URL: http://llvm.org/viewvc/llvm-project?rev=104763&view=rev
Log:
MC: Eliminate MCFragment vtable, which was unnecessary.
Modified:
llvm/branches/Apple/whitney/include/llvm/MC/MCAssembler.h
llvm/branches/Apple/whitney/lib/MC/MCAssembler.cpp
Modified: llvm/branches/Apple/whitney/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/include/llvm/MC/MCAssembler.h?rev=104763&r1=104762&r2=104763&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/include/llvm/MC/MCAssembler.h (original)
+++ llvm/branches/Apple/whitney/include/llvm/MC/MCAssembler.h Wed May 26 17:28:46 2010
@@ -108,7 +108,6 @@
public:
// Only for sentinel.
MCFragment();
- virtual ~MCFragment();
FragmentType getKind() const { return Kind; }
@@ -123,7 +122,7 @@
static bool classof(const MCFragment *O) { return true; }
- virtual void dump();
+ void dump();
};
class MCDataFragment : public MCFragment {
@@ -173,8 +172,6 @@
return F->getKind() == MCFragment::FT_Data;
}
static bool classof(const MCDataFragment *) { return true; }
-
- virtual void dump();
};
// FIXME: This current incarnation of MCInstFragment doesn't make much sense, as
@@ -235,8 +232,6 @@
return F->getKind() == MCFragment::FT_Inst;
}
static bool classof(const MCInstFragment *) { return true; }
-
- virtual void dump();
};
class MCAlignFragment : public MCFragment {
@@ -295,8 +290,6 @@
return F->getKind() == MCFragment::FT_Align;
}
static bool classof(const MCAlignFragment *) { return true; }
-
- virtual void dump();
};
class MCFillFragment : public MCFragment {
@@ -334,8 +327,6 @@
return F->getKind() == MCFragment::FT_Fill;
}
static bool classof(const MCFillFragment *) { return true; }
-
- virtual void dump();
};
class MCOrgFragment : public MCFragment {
@@ -363,8 +354,6 @@
return F->getKind() == MCFragment::FT_Org;
}
static bool classof(const MCOrgFragment *) { return true; }
-
- virtual void dump();
};
// FIXME: Should this be a separate class, or just merged into MCSection? Since
Modified: llvm/branches/Apple/whitney/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/MC/MCAssembler.cpp?rev=104763&r1=104762&r2=104763&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/MC/MCAssembler.cpp (original)
+++ llvm/branches/Apple/whitney/lib/MC/MCAssembler.cpp Wed May 26 17:28:46 2010
@@ -185,9 +185,6 @@
Parent->getFragmentList().push_back(this);
}
-MCFragment::~MCFragment() {
-}
-
/* *** */
MCSectionData::MCSectionData() : Section(0) {}
@@ -918,81 +915,77 @@
void MCFragment::dump() {
raw_ostream &OS = llvm::errs();
+ OS << "<";
+ switch (getKind()) {
+ case MCFragment::FT_Align: OS << "MCAlignFragment"; break;
+ case MCFragment::FT_Data: OS << "MCDataFragment"; break;
+ case MCFragment::FT_Fill: OS << "MCFillFragment"; break;
+ case MCFragment::FT_Inst: OS << "MCInstFragment"; break;
+ case MCFragment::FT_Org: OS << "MCOrgFragment"; break;
+ }
+
OS << "<MCFragment " << (void*) this << " LayoutOrder:" << LayoutOrder
<< " Offset:" << Offset << " EffectiveSize:" << EffectiveSize << ">";
-}
-void MCAlignFragment::dump() {
- raw_ostream &OS = llvm::errs();
-
- OS << "<MCAlignFragment ";
- this->MCFragment::dump();
- if (hasEmitNops())
- OS << " (emit nops)";
- if (hasOnlyAlignAddress())
- OS << " (only align section)";
- OS << "\n ";
- OS << " Alignment:" << getAlignment()
- << " Value:" << getValue() << " ValueSize:" << getValueSize()
- << " MaxBytesToEmit:" << getMaxBytesToEmit() << ">";
-}
-
-void MCDataFragment::dump() {
- raw_ostream &OS = llvm::errs();
+ switch (getKind()) {
+ case MCFragment::FT_Align: {
+ const MCAlignFragment *AF = cast<MCAlignFragment>(this);
+ if (AF->hasEmitNops())
+ OS << " (emit nops)";
+ if (AF->hasOnlyAlignAddress())
+ OS << " (only align section)";
+ OS << "\n ";
+ OS << " Alignment:" << AF->getAlignment()
+ << " Value:" << AF->getValue() << " ValueSize:" << AF->getValueSize()
+ << " MaxBytesToEmit:" << AF->getMaxBytesToEmit() << ">";
+ break;
+ }
+ case MCFragment::FT_Data: {
+ const MCDataFragment *DF = cast<MCDataFragment>(this);
+ OS << "\n ";
+ OS << " Contents:[";
+ const SmallVectorImpl<char> &Contents = DF->getContents();
+ for (unsigned i = 0, e = Contents.size(); i != e; ++i) {
+ if (i) OS << ",";
+ OS << hexdigit((Contents[i] >> 4) & 0xF) << hexdigit(Contents[i] & 0xF);
+ }
+ OS << "] (" << Contents.size() << " bytes)";
- OS << "<MCDataFragment ";
- this->MCFragment::dump();
- OS << "\n ";
- OS << " Contents:[";
- for (unsigned i = 0, e = getContents().size(); i != e; ++i) {
- if (i) OS << ",";
- OS << hexdigit((Contents[i] >> 4) & 0xF) << hexdigit(Contents[i] & 0xF);
- }
- OS << "] (" << getContents().size() << " bytes)";
-
- if (!getFixups().empty()) {
- OS << ",\n ";
- OS << " Fixups:[";
- for (fixup_iterator it = fixup_begin(), ie = fixup_end(); it != ie; ++it) {
- if (it != fixup_begin()) OS << ",\n ";
- OS << *it;
+ if (!DF->getFixups().empty()) {
+ OS << ",\n ";
+ OS << " Fixups:[";
+ for (MCDataFragment::const_fixup_iterator it = DF->fixup_begin(),
+ ie = DF->fixup_end(); it != ie; ++it) {
+ if (it != DF->fixup_begin()) OS << ",\n ";
+ OS << *it;
+ }
+ OS << "]";
}
- OS << "]";
+ break;
+ }
+ case MCFragment::FT_Fill: {
+ const MCFillFragment *FF = cast<MCFillFragment>(this);
+ OS << " Value:" << FF->getValue() << " ValueSize:" << FF->getValueSize()
+ << " Size:" << FF->getSize();
+ break;
+ }
+ case MCFragment::FT_Inst: {
+ const MCInstFragment *IF = cast<MCInstFragment>(this);
+ OS << "\n ";
+ OS << " Inst:";
+ IF->getInst().dump_pretty(OS);
+ break;
+ }
+ case MCFragment::FT_Org: {
+ const MCOrgFragment *OF = cast<MCOrgFragment>(this);
+ OS << "\n ";
+ OS << " Offset:" << OF->getOffset() << " Value:" << OF->getValue();
+ break;
+ }
}
-
- OS << ">";
-}
-
-void MCFillFragment::dump() {
- raw_ostream &OS = llvm::errs();
-
- OS << "<MCFillFragment ";
- this->MCFragment::dump();
- OS << "\n ";
- OS << " Value:" << getValue() << " ValueSize:" << getValueSize()
- << " Size:" << getSize() << ">";
-}
-
-void MCInstFragment::dump() {
- raw_ostream &OS = llvm::errs();
-
- OS << "<MCInstFragment ";
- this->MCFragment::dump();
- OS << "\n ";
- OS << " Inst:";
- getInst().dump_pretty(OS);
OS << ">";
}
-void MCOrgFragment::dump() {
- raw_ostream &OS = llvm::errs();
-
- OS << "<MCOrgFragment ";
- this->MCFragment::dump();
- OS << "\n ";
- OS << " Offset:" << getOffset() << " Value:" << getValue() << ">";
-}
-
void MCSectionData::dump() {
raw_ostream &OS = llvm::errs();
More information about the llvm-branch-commits
mailing list