Skip to content

Commit 7962820

Browse files
committed
MC: Simplify code with isRelocation
1 parent b9e11ea commit 7962820

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

llvm/lib/MC/MCAssembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bool MCAssembler::evaluateFixup(const MCFixup &Fixup, const MCFragment *DF,
203203
if (IsResolved) {
204204
auto TargetVal = Target;
205205
TargetVal.Cst = Value;
206-
if (Fixup.getKind() >= FirstRelocationKind ||
206+
if (mc::isRelocation(Fixup.getKind()) ||
207207
getBackend().shouldForceRelocation(*this, Fixup, TargetVal, STI))
208208
IsResolved = false;
209209
}

llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,11 @@ CSKYAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
7171
assert(Infos.size() == CSKY::NumTargetFixupKinds &&
7272
"Not all fixup kinds added to Infos array");
7373

74-
if (FirstTargetFixupKind <= Kind && Kind < FirstLiteralRelocationKind) {
75-
assert(unsigned(Kind - FirstTargetFixupKind) < CSKY::NumTargetFixupKinds &&
76-
"Invalid kind!");
77-
78-
return Infos[Kind];
79-
} else if (Kind < FirstTargetFixupKind) {
80-
return MCAsmBackend::getFixupKindInfo(Kind);
81-
} else {
74+
if (mc::isRelocation(Kind))
8275
return MCAsmBackend::getFixupKindInfo(FK_NONE);
83-
}
76+
if (Kind < FirstTargetFixupKind)
77+
return MCAsmBackend::getFixupKindInfo(Kind);
78+
return Infos[Kind];
8479
}
8580

8681
static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value,

0 commit comments

Comments
 (0)