Skip to content

Commit

Permalink
Simplify the code a bit: MCRelaxableFragment doesn't need a separate …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
eliben committed Jan 8, 2013
1 parent 02fa383 commit 0fdcef6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion include/llvm/MC/MCAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ class MCRelaxableFragment : public MCEncodedFragment {
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; }

Expand Down
5 changes: 2 additions & 3 deletions lib/MC/MCAssembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0fdcef6

Please sign in to comment.