SystemZMCExpr: Migrate to MCSpecifierExpr
This commit is contained in:
@@ -185,7 +185,7 @@ void SystemZInstPrinterCommon::printPCRelTLSOperand(const MCInst *MI,
|
||||
if ((unsigned)OpNum + 1 < MI->getNumOperands()) {
|
||||
const MCOperand &MO = MI->getOperand(OpNum + 1);
|
||||
const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*MO.getExpr());
|
||||
switch (getSpecifier(&refExp)) {
|
||||
switch (refExp.getSpecifier()) {
|
||||
case SystemZMCExpr::VK_TLSGD:
|
||||
O << ":tls_gdcall:";
|
||||
break;
|
||||
|
||||
@@ -12,9 +12,9 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "systemzmcexpr"
|
||||
|
||||
const SystemZMCExpr *SystemZMCExpr::create(SystemZMCExpr::Specifier Kind,
|
||||
const SystemZMCExpr *SystemZMCExpr::create(MCSpecifierExpr::Spec S,
|
||||
const MCExpr *Expr, MCContext &Ctx) {
|
||||
return new (Ctx) SystemZMCExpr(Kind, Expr);
|
||||
return new (Ctx) SystemZMCExpr(Expr, S);
|
||||
}
|
||||
|
||||
StringRef SystemZMCExpr::getVariantKindName() const {
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class SystemZMCExpr : public MCTargetExpr {
|
||||
class SystemZMCExpr : public MCSpecifierExpr {
|
||||
public:
|
||||
enum Specifier : uint8_t {
|
||||
using Specifier = Spec;
|
||||
enum {
|
||||
VK_None,
|
||||
|
||||
VK_DTPOFF = MCSymbolRefExpr::FirstTargetSpecifier,
|
||||
@@ -37,40 +38,19 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
const Specifier specifier;
|
||||
const MCExpr *Expr;
|
||||
|
||||
explicit SystemZMCExpr(Specifier S, const MCExpr *Expr)
|
||||
: specifier(S), Expr(Expr) {}
|
||||
explicit SystemZMCExpr(const MCExpr *Expr, Spec S)
|
||||
: MCSpecifierExpr(Expr, S) {}
|
||||
|
||||
public:
|
||||
static const SystemZMCExpr *create(Specifier Kind, const MCExpr *Expr,
|
||||
static const SystemZMCExpr *create(Spec Kind, const MCExpr *Expr,
|
||||
MCContext &Ctx);
|
||||
|
||||
Specifier getSpecifier() const { return specifier; }
|
||||
const MCExpr *getSubExpr() const { return Expr; }
|
||||
|
||||
StringRef getVariantKindName() const;
|
||||
|
||||
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAssembler *Asm) const override;
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override {
|
||||
Streamer.visitUsedExpr(*getSubExpr());
|
||||
}
|
||||
MCFragment *findAssociatedFragment() const override {
|
||||
return getSubExpr()->findAssociatedFragment();
|
||||
}
|
||||
|
||||
static bool classof(const MCExpr *E) {
|
||||
return E->getKind() == MCExpr::Target;
|
||||
}
|
||||
};
|
||||
|
||||
static inline SystemZMCExpr::Specifier
|
||||
getSpecifier(const MCSymbolRefExpr *SRE) {
|
||||
return SystemZMCExpr::Specifier(SRE->getKind());
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user