Simplify the code a bit: MCRelaxableFragment doesn't need a separate getInstSize

method because getContents().size() already covers it. So computeFragmentSize
can use the generic MCEncodedFragment interface when querying both Data and
Relaxable fragments for contents sizes.

No change in functionality


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171903 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Bendersky 2013-01-08 22:05:10 +00:00
parent 02fa38344c
commit 0fdcef6030
2 changed files with 2 additions and 4 deletions

View File

@ -235,7 +235,6 @@ public:
virtual SmallVectorImpl<char> &getContents() { return Contents; }
virtual const SmallVectorImpl<char> &getContents() const { return Contents; }
unsigned getInstSize() const { return Contents.size(); }
const MCInst &getInst() const { return Inst; }
void setInst(const MCInst& Value) { Inst = Value; }

View File

@ -387,11 +387,10 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
const MCFragment &F) const {
switch (F.getKind()) {
case MCFragment::FT_Data:
return cast<MCDataFragment>(F).getContents().size();
case MCFragment::FT_Relaxable:
return cast<MCEncodedFragment>(F).getContents().size();
case MCFragment::FT_Fill:
return cast<MCFillFragment>(F).getSize();
case MCFragment::FT_Relaxable:
return cast<MCRelaxableFragment>(F).getInstSize();
case MCFragment::FT_LEB:
return cast<MCLEBFragment>(F).getContents().size();