MC: Use accessors for access to MCAsmFixup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104697 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp
index e072392..eec310b 100644
--- a/lib/Target/X86/X86AsmBackend.cpp
+++ b/lib/Target/X86/X86AsmBackend.cpp
@@ -46,12 +46,12 @@
void ApplyFixup(const MCAsmFixup &Fixup, MCDataFragment &DF,
uint64_t Value) const {
- unsigned Size = 1 << getFixupKindLog2Size(Fixup.Kind);
+ unsigned Size = 1 << getFixupKindLog2Size(Fixup.getKind());
- assert(Fixup.Offset + Size <= DF.getContents().size() &&
+ assert(Fixup.getOffset() + Size <= DF.getContents().size() &&
"Invalid fixup offset!");
for (unsigned i = 0; i != Size; ++i)
- DF.getContents()[Fixup.Offset + i] = uint8_t(Value >> (i * 8));
+ DF.getContents()[Fixup.getOffset() + i] = uint8_t(Value >> (i * 8));
}
bool MayNeedRelaxation(const MCInst &Inst,
@@ -91,6 +91,8 @@
bool X86AsmBackend::MayNeedRelaxation(const MCInst &Inst,
const SmallVectorImpl<MCAsmFixup> &Fixups) const {
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
+ const MCAsmFixup &F = Fixups[i];
+
// We don't support relaxing anything else currently. Make sure we error out
// if we see a non-constant 1 or 2 byte fixup.
//
@@ -98,13 +100,13 @@
// object writer which should be verifying that any final relocations match
// the expected fixup. However, that code is more complicated and hasn't
// been written yet. See the FIXMEs in MachObjectWriter.cpp.
- if ((Fixups[i].Kind == FK_Data_1 || Fixups[i].Kind == FK_Data_2) &&
- !isa<MCConstantExpr>(Fixups[i].Value))
+ if ((F.getKind() == FK_Data_1 || F.getKind() == FK_Data_2) &&
+ !isa<MCConstantExpr>(F.getValue()))
report_fatal_error("unexpected small fixup with a non-constant operand!");
// Check for a 1byte pcrel fixup, and enforce that we would know how to
// relax this instruction.
- if (unsigned(Fixups[i].Kind) == X86::reloc_pcrel_1byte) {
+ if (unsigned(F.getKind()) == X86::reloc_pcrel_1byte) {
assert(getRelaxedOpcode(Inst.getOpcode()) != Inst.getOpcode());
return true;
}