Skip to content

Commit 8b71056

Browse files
committed
Remove hasLDAttributes() and hasERAttributes()
Just inline and simplify the expressions.
1 parent 9fd32ac commit 8b71056

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

llvm/include/llvm/MC/MCSymbolGOFF.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class MCSymbolGOFF : public MCSymbol {
3838
MCSymbolGOFF(const MCSymbolTableEntry *Name, bool IsTemporary)
3939
: MCSymbol(Name, IsTemporary) {}
4040

41-
bool hasLDAttributes() const;
42-
bool hasERAttributes() const;
43-
4441
void setADA(MCSectionGOFF *AssociatedDataArea) {
4542
ADA = AssociatedDataArea;
4643
AssociatedDataArea->RequiresNonZeroLength = true;

llvm/lib/MC/GOFFObjectWriter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,12 @@ void GOFFWriter::defineSymbols() {
372372
if (Sym.isTemporary())
373373
continue;
374374
auto &Symbol = static_cast<const MCSymbolGOFF &>(Sym);
375-
if (Symbol.hasLDAttributes()) {
375+
bool IsDefined = Symbol.isDefined();
376+
if (IsDefined &&
377+
static_cast<MCSectionGOFF &>(Symbol.getSection()).isED()) {
376378
Symbol.setIndex(++Ordinal);
377379
defineLabel(Symbol);
378-
} else if (Symbol.hasERAttributes()) {
380+
} else if (!IsDefined) {
379381
Symbol.setIndex(++Ordinal);
380382
defineExtern(Symbol);
381383
}

llvm/lib/MC/MCSymbolGOFF.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212

1313
using namespace llvm;
1414

15-
bool MCSymbolGOFF::hasLDAttributes() const {
16-
return !isTemporary() && isDefined() &&
17-
static_cast<MCSectionGOFF &>(getSection()).isED();
18-
}
19-
20-
bool MCSymbolGOFF::hasERAttributes() const {
21-
return !isTemporary() && !isDefined() && isExternal();
22-
}
23-
2415
bool MCSymbolGOFF::setSymbolAttribute(MCSymbolAttr Attribute) {
2516
switch (Attribute) {
2617
case MCSA_Invalid:

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ static void emitXATTR(raw_ostream &OS, StringRef Name,
226226
}
227227

228228
static bool sameNameAsCSECT(MCSymbolGOFF *Sym) {
229-
if (Sym->hasLDAttributes() && Sym->isInSection()) {
229+
if (!Sym->isTemporary() && Sym->isDefined() && Sym->isInSection()) {
230230
MCSectionGOFF &ED = static_cast<MCSectionGOFF &>(Sym->getSection());
231-
return Sym->getName() == ED.getParent()->getName();
231+
return ED.isED() && Sym->getName() == ED.getParent()->getName();
232232
}
233233
return false;
234234
}
@@ -241,7 +241,8 @@ void SystemZHLASMAsmStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
241241
// Emit ENTRY statement only if not implied by CSECT.
242242
bool EmitEntry = !sameNameAsCSECT(Sym);
243243

244-
if (!Sym->isTemporary() && Sym->hasLDAttributes()) {
244+
if (!Sym->isTemporary() && Sym->isDefined() &&
245+
static_cast<MCSectionGOFF &>(Sym->getSection()).isED()) {
245246
if (EmitEntry) {
246247
OS << " ENTRY " << Sym->getName();
247248
EmitEOL();
@@ -358,14 +359,14 @@ void SystemZHLASMAsmStreamer::finishImpl() {
358359
if (Symbol.isTemporary())
359360
continue;
360361
if (Symbol.isRegistered()) {
362+
if (Symbol.isDefined())
363+
continue;
361364
auto &Sym = static_cast<MCSymbolGOFF &>(const_cast<MCSymbol &>(Symbol));
362-
if (Sym.hasERAttributes()) {
363-
OS << " " << (Sym.isWeak() ? "WXTRN" : "EXTRN") << " " << Sym.getName();
364-
EmitEOL();
365-
emitXATTR(OS, Sym.getName(), Sym.getLinkage(), Sym.getCodeData(),
366-
Sym.getBindingScope());
367-
EmitEOL();
368-
}
365+
OS << " " << (Sym.isWeak() ? "WXTRN" : "EXTRN") << " " << Sym.getName();
366+
EmitEOL();
367+
emitXATTR(OS, Sym.getName(), Sym.getLinkage(), Sym.getCodeData(),
368+
Sym.getBindingScope());
369+
EmitEOL();
369370
}
370371
}
371372

0 commit comments

Comments
 (0)