Skip to content

Commit c403cf1

Browse files
committed
VE: Replace VEMCExpr::printImpl with printSpecifierExpr
Prepare for removing the VEMCExpr subclass. VEMCExpr overrides evaluateAsRelocatableImpl, so it cannot be removed yet.
1 parent b184672 commit c403cf1

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "VEInstPrinter.h"
1414
#include "VE.h"
15+
#include "llvm/MC/MCAsmInfo.h"
1516
#include "llvm/MC/MCExpr.h"
1617
#include "llvm/MC/MCInst.h"
1718
#include "llvm/MC/MCRegisterInfo.h"
@@ -61,7 +62,7 @@ void VEInstPrinter::printOperand(const MCInst *MI, int OpNum,
6162
}
6263

6364
assert(MO.isExpr() && "Unknown operand kind in printOperand");
64-
MO.getExpr()->print(O, &MAI);
65+
MAI.printExpr(O, *MO.getExpr());
6566
}
6667

6768
void VEInstPrinter::printMemASXOperand(const MCInst *MI, int OpNum,

llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ VEELFMCAsmInfo::VEELFMCAsmInfo(const Triple &TheTriple) {
5656

5757
initializeVariantKinds(variantKindDescs);
5858
}
59+
60+
void VEELFMCAsmInfo::printSpecifierExpr(raw_ostream &OS,
61+
const MCSpecifierExpr &Expr) const {
62+
printExpr(OS, *Expr.getSubExpr());
63+
auto specifier = Expr.getSpecifier();
64+
if (specifier && specifier != VEMCExpr::VK_REFLONG)
65+
OS << '@' << getSpecifierName(specifier);
66+
}

llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class VEELFMCAsmInfo : public MCAsmInfoELF {
2424

2525
public:
2626
explicit VEELFMCAsmInfo(const Triple &TheTriple);
27+
void printSpecifierExpr(raw_ostream &OS,
28+
const MCSpecifierExpr &Expr) const override;
2729
};
2830

2931
} // namespace llvm

llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ const VEMCExpr *VEMCExpr::create(Specifier S, const MCExpr *Expr,
2727
return new (Ctx) VEMCExpr(Expr, S);
2828
}
2929

30-
void VEMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
31-
32-
const MCExpr *Expr = getSubExpr();
33-
Expr->print(OS, MAI);
34-
if (specifier != VK_None && specifier != VK_REFLONG)
35-
OS << '@' << MAI->getSpecifierName(specifier);
36-
}
37-
3830
VE::Fixups VEMCExpr::getFixupKind(MCSpecifierExpr::Spec S) {
3931
switch (S) {
4032
default:

llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class VEMCExpr : public MCSpecifierExpr {
5050
static const VEMCExpr *create(Specifier Kind, const MCExpr *Expr,
5151
MCContext &Ctx);
5252

53-
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
5453
bool evaluateAsRelocatableImpl(MCValue &Res,
5554
const MCAssembler *Asm) const override;
5655

0 commit comments

Comments
 (0)