Skip to content

Commit

Permalink
[RISCV] Silence an unused variable warning in release builds [NFC]
Browse files Browse the repository at this point in the history
Summary:
Also minor cleanups:
1. Avoided multiple calls to Fixup.getKind()
2. Avoided multiple calls to getFixupKindInfo()
3. Removed a redundant return.

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: rbar, johnrusso, llvm-commits

Differential Revision: https://reviews.llvm.org/D39881

llvm-svn: 317908
  • Loading branch information
Mandeep Singh Grang committed Nov 10, 2017
1 parent 36e5678 commit 5f043ae
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
Original file line number Diff line number Diff line change
@@ -161,26 +161,27 @@ void RISCVAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
MutableArrayRef<char> Data, uint64_t Value,
bool IsResolved) const {
MCContext &Ctx = Asm.getContext();
MCFixupKind Kind = Fixup.getKind();
unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8;
MCFixupKindInfo Info = getFixupKindInfo(Fixup.getKind());
if (!Value)
return; // Doesn't change encoding.
MCFixupKindInfo Info = getFixupKindInfo(Fixup.getKind());
// Apply any target-specific value adjustments.
Value = adjustFixupValue(Fixup, Value, Ctx);

// Shift the value into position.
Value <<= Info.TargetOffset;

unsigned Offset = Fixup.getOffset();

#ifndef NDEBUG
unsigned NumBytes = (Info.TargetSize + 7) / 8;
assert(Offset + NumBytes <= Data.size() && "Invalid fixup offset!");
#endif

// For each byte of the fragment that the fixup touches, mask in the
// bits from the fixup value.
for (unsigned i = 0; i != 4; ++i) {
Data[Offset + i] |= uint8_t((Value >> (i * 8)) & 0xff);
}
return;
}

std::unique_ptr<MCObjectWriter>
1 change: 0 additions & 1 deletion llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
Original file line number Diff line number Diff line change
@@ -82,7 +82,6 @@ void RISCVRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,

MI.getOperand(FIOperandNum).ChangeToRegister(FrameReg, false);
MI.getOperand(FIOperandNum + 1).ChangeToImmediate(Offset);
return;
}

unsigned RISCVRegisterInfo::getFrameRegister(const MachineFunction &MF) const {

0 comments on commit 5f043ae

Please sign in to comment.