diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-12-06 00:47:03 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-12-06 00:47:03 +0000 |
commit | 370b78d795154899a22ca2b4674e890661ff1d59 (patch) | |
tree | 212eb851e899aec47082208576f32338dbc3cd08 /lib/Target/MBlaze/MCTargetDesc | |
parent | 7c0674100443b4115d2fd6472e59cd8dcb9cc6d4 (diff) | |
download | llvm-370b78d795154899a22ca2b4674e890661ff1d59.tar.gz llvm-370b78d795154899a22ca2b4674e890661ff1d59.tar.bz2 llvm-370b78d795154899a22ca2b4674e890661ff1d59.tar.xz |
Move target-specific logic out of generic MCAssembler.
Whether a fixup needs relaxation for the associated instruction is a
target-specific function, as the FIXME indicated. Create a hook for that
and use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MBlaze/MCTargetDesc')
-rw-r--r-- | lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp b/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp index 08f7d46a58..d5acbe9749 100644 --- a/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp +++ b/lib/Target/MBlaze/MCTargetDesc/MBlazeAsmBackend.cpp @@ -58,6 +58,11 @@ public: bool MayNeedRelaxation(const MCInst &Inst) const; + bool fixupNeedsRelaxation(const MCFixup &Fixup, + uint64_t Value, + const MCInstFragment *DF, + const MCAsmLayout &Layout) const; + void RelaxInstruction(const MCInst &Inst, MCInst &Res) const; bool WriteNopData(uint64_t Count, MCObjectWriter *OW) const; @@ -87,6 +92,18 @@ bool MBlazeAsmBackend::MayNeedRelaxation(const MCInst &Inst) const { return hasExprOrImm; } +bool MBlazeAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup, + uint64_t Value, + const MCInstFragment *DF, + const MCAsmLayout &Layout) const { + // FIXME: Is this right? It's what the "generic" code was doing before, + // but is X86 specific. Is it actually true for MBlaze also, or was it + // just close enough to not be a big deal? + // + // Relax if the value is too big for a (signed) i8. + return int64_t(Value) != int64_t(int8_t(Value)); +} + void MBlazeAsmBackend::RelaxInstruction(const MCInst &Inst, MCInst &Res) const { Res = Inst; Res.setOpcode(getRelaxedOpcode(Inst.getOpcode())); |