@@ -109,7 +109,7 @@ class SparcAsmParser : public MCTargetAsmParser {
109109 ParseStatus parseExpression (int64_t &Val);
110110
111111 // Helper function for dealing with %lo / %hi in PIC mode.
112- const SparcMCExpr *adjustPICRelocation (SparcMCExpr::VariantKind VK,
112+ const SparcMCExpr *adjustPICRelocation (SparcMCExpr::Specifier VK,
113113 const MCExpr *subExpr);
114114
115115 // Helper function to see if current token can start an expression.
@@ -701,7 +701,7 @@ bool SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
701701 // In either case, start with the 'sethi'.
702702 if (!IsEffectivelyImm13) {
703703 MCInst TmpInst;
704- const MCExpr *Expr = adjustPICRelocation (SparcMCExpr::VK_Sparc_HI , ValExpr);
704+ const MCExpr *Expr = adjustPICRelocation (SparcMCExpr::VK_HI , ValExpr);
705705 TmpInst.setLoc (IDLoc);
706706 TmpInst.setOpcode (SP::SETHIi);
707707 TmpInst.addOperand (MCRegOp);
@@ -726,7 +726,7 @@ bool SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
726726 if (IsEffectivelyImm13)
727727 Expr = ValExpr;
728728 else
729- Expr = adjustPICRelocation (SparcMCExpr::VK_Sparc_LO , ValExpr);
729+ Expr = adjustPICRelocation (SparcMCExpr::VK_LO , ValExpr);
730730 TmpInst.setLoc (IDLoc);
731731 TmpInst.setOpcode (SP::ORri);
732732 TmpInst.addOperand (MCRegOp);
@@ -766,16 +766,15 @@ bool SparcAsmParser::expandSETSW(MCInst &Inst, SMLoc IDLoc,
766766 Instructions.push_back (
767767 MCInstBuilder (SP::SETHIi)
768768 .addReg (MCRegOp.getReg ())
769- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HI , ValExpr)));
769+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HI , ValExpr)));
770770
771771 PrevReg = MCRegOp;
772772 }
773773
774774 // If the immediate has the lower bits set or is small, we need to emit an or.
775775 if (!NoLowBitsImm || IsSmallImm) {
776776 const MCExpr *Expr =
777- IsSmallImm ? ValExpr
778- : adjustPICRelocation (SparcMCExpr::VK_Sparc_LO, ValExpr);
777+ IsSmallImm ? ValExpr : adjustPICRelocation (SparcMCExpr::VK_LO, ValExpr);
779778
780779 // or rd, %lo(val), rd
781780 Instructions.push_back (MCInstBuilder (SP::ORri)
@@ -831,13 +830,13 @@ bool SparcAsmParser::expandSETX(MCInst &Inst, SMLoc IDLoc,
831830 Instructions.push_back (
832831 MCInstBuilder (SP::SETHIi)
833832 .addReg (MCRegOp.getReg ())
834- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HI , ValExpr)));
833+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HI , ValExpr)));
835834 // or rd, %lo(val), rd
836835 Instructions.push_back (
837836 MCInstBuilder (SP::ORri)
838837 .addReg (MCRegOp.getReg ())
839838 .addReg (MCRegOp.getReg ())
840- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_LO , ValExpr)));
839+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_LO , ValExpr)));
841840
842841 // Small positive immediates can be expressed as a single `sethi`+`or`
843842 // combination, so we can just return here.
@@ -851,13 +850,13 @@ bool SparcAsmParser::expandSETX(MCInst &Inst, SMLoc IDLoc,
851850 Instructions.push_back (
852851 MCInstBuilder (SP::SETHIi)
853852 .addReg (MCTmpOp.getReg ())
854- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HH , ValExpr)));
853+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HH , ValExpr)));
855854 // or tmp, %hm(val), tmp
856855 Instructions.push_back (
857856 MCInstBuilder (SP::ORri)
858857 .addReg (MCTmpOp.getReg ())
859858 .addReg (MCTmpOp.getReg ())
860- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HM , ValExpr)));
859+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HM , ValExpr)));
861860 // sllx tmp, 32, tmp
862861 Instructions.push_back (MCInstBuilder (SP::SLLXri)
863862 .addReg (MCTmpOp.getReg ())
@@ -1115,20 +1114,20 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
11151114 SMLoc S = getLoc ();
11161115 SMLoc E = SMLoc::getFromPointer (S.getPointer () - 1 );
11171116
1118- auto MatchesKind = [](SparcMCExpr::VariantKind VK) -> bool {
1117+ auto MatchesKind = [](SparcMCExpr::Specifier VK) -> bool {
11191118 switch (Kind) {
11201119 case TailRelocKind::Load_GOT:
11211120 // Non-TLS relocations on ld (or ldx).
11221121 // ld [%rr + %rr], %rr, %rel(sym)
1123- return VK == SparcMCExpr::VK_Sparc_GOTDATA_OP ;
1122+ return VK == SparcMCExpr::VK_GOTDATA_OP ;
11241123 case TailRelocKind::Add_TLS:
11251124 // TLS relocations on add.
11261125 // add %rr, %rr, %rr, %rel(sym)
11271126 switch (VK) {
1128- case SparcMCExpr::VK_Sparc_TLS_GD_ADD :
1129- case SparcMCExpr::VK_Sparc_TLS_IE_ADD :
1130- case SparcMCExpr::VK_Sparc_TLS_LDM_ADD :
1131- case SparcMCExpr::VK_Sparc_TLS_LDO_ADD :
1127+ case SparcMCExpr::VK_TLS_GD_ADD :
1128+ case SparcMCExpr::VK_TLS_IE_ADD :
1129+ case SparcMCExpr::VK_TLS_LDM_ADD :
1130+ case SparcMCExpr::VK_TLS_LDO_ADD :
11321131 return true ;
11331132 default :
11341133 return false ;
@@ -1137,8 +1136,8 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
11371136 // TLS relocations on ld (or ldx).
11381137 // ld[x] %addr, %rr, %rel(sym)
11391138 switch (VK) {
1140- case SparcMCExpr::VK_Sparc_TLS_IE_LD :
1141- case SparcMCExpr::VK_Sparc_TLS_IE_LDX :
1139+ case SparcMCExpr::VK_TLS_IE_LD :
1140+ case SparcMCExpr::VK_TLS_IE_LDX :
11421141 return true ;
11431142 default :
11441143 return false ;
@@ -1147,8 +1146,8 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
11471146 // TLS relocations on call.
11481147 // call sym, %rel(sym)
11491148 switch (VK) {
1150- case SparcMCExpr::VK_Sparc_TLS_GD_CALL :
1151- case SparcMCExpr::VK_Sparc_TLS_LDM_CALL :
1149+ case SparcMCExpr::VK_TLS_GD_CALL :
1150+ case SparcMCExpr::VK_TLS_LDM_CALL :
11521151 return true ;
11531152 default :
11541153 return false ;
@@ -1167,9 +1166,9 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
11671166 return Error (getLoc (), " expected valid identifier for operand modifier" );
11681167
11691168 StringRef Name = getParser ().getTok ().getIdentifier ();
1170- SparcMCExpr::VariantKind VK = SparcMCExpr::parseVariantKind (Name);
1171- if (VK == SparcMCExpr::VK_Sparc_None )
1172- return Error (getLoc (), " invalid operand modifier " );
1169+ SparcMCExpr::Specifier VK = SparcMCExpr::parseSpecifier (Name);
1170+ if (VK == SparcMCExpr::VK_None )
1171+ return Error (getLoc (), " invalid relocation specifier " );
11731172
11741173 if (!MatchesKind (VK)) {
11751174 // Did not match the specified set of relocation types, put '%' back.
@@ -1325,8 +1324,8 @@ ParseStatus SparcAsmParser::parseCallTarget(OperandVector &Operands) {
13251324 return ParseStatus::NoMatch;
13261325
13271326 bool IsPic = getContext ().getObjectFileInfo ()->isPositionIndependent ();
1328- SparcMCExpr::VariantKind Kind =
1329- IsPic ? SparcMCExpr::VK_Sparc_WPLT30 : SparcMCExpr::VK_Sparc_WDISP30 ;
1327+ SparcMCExpr::Specifier Kind =
1328+ IsPic ? SparcMCExpr::VK_WPLT30 : SparcMCExpr::VK_WDISP30 ;
13301329
13311330 const MCExpr *DestExpr = SparcMCExpr::create (Kind, DestValue, getContext ());
13321331 Operands.push_back (SparcOperand::CreateImm (DestExpr, S, E));
@@ -1483,13 +1482,13 @@ SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Op,
14831482
14841483 int64_t Res;
14851484 if (!EVal->evaluateAsAbsolute (Res)) {
1486- SparcMCExpr::VariantKind Kind = SparcMCExpr::VK_Sparc_13 ;
1485+ SparcMCExpr::Specifier Kind = SparcMCExpr::VK_13 ;
14871486
14881487 if (getContext ().getObjectFileInfo ()->isPositionIndependent ()) {
14891488 if (isCall)
1490- Kind = SparcMCExpr::VK_Sparc_WPLT30 ;
1489+ Kind = SparcMCExpr::VK_WPLT30 ;
14911490 else
1492- Kind = SparcMCExpr::VK_Sparc_GOT13 ;
1491+ Kind = SparcMCExpr::VK_GOT13 ;
14931492 }
14941493 EVal = SparcMCExpr::create (Kind, EVal, getContext ());
14951494 }
@@ -1686,7 +1685,7 @@ static bool hasGOTReference(const MCExpr *Expr) {
16861685}
16871686
16881687const SparcMCExpr *
1689- SparcAsmParser::adjustPICRelocation (SparcMCExpr::VariantKind VK,
1688+ SparcAsmParser::adjustPICRelocation (SparcMCExpr::Specifier VK,
16901689 const MCExpr *subExpr) {
16911690 // When in PIC mode, "%lo(...)" and "%hi(...)" behave differently.
16921691 // If the expression refers contains _GLOBAL_OFFSET_TABLE, it is
@@ -1696,13 +1695,13 @@ SparcAsmParser::adjustPICRelocation(SparcMCExpr::VariantKind VK,
16961695 if (getContext ().getObjectFileInfo ()->isPositionIndependent ()) {
16971696 switch (VK) {
16981697 default : break ;
1699- case SparcMCExpr::VK_Sparc_LO :
1700- VK = (hasGOTReference (subExpr) ? SparcMCExpr::VK_Sparc_PC10
1701- : SparcMCExpr::VK_Sparc_GOT10 );
1698+ case SparcMCExpr::VK_LO :
1699+ VK = (hasGOTReference (subExpr) ? SparcMCExpr::VK_PC10
1700+ : SparcMCExpr::VK_GOT10 );
17021701 break ;
1703- case SparcMCExpr::VK_Sparc_HI :
1704- VK = (hasGOTReference (subExpr) ? SparcMCExpr::VK_Sparc_PC22
1705- : SparcMCExpr::VK_Sparc_GOT22 );
1702+ case SparcMCExpr::VK_HI :
1703+ VK = (hasGOTReference (subExpr) ? SparcMCExpr::VK_PC22
1704+ : SparcMCExpr::VK_GOT22 );
17061705 break ;
17071706 }
17081707 }
@@ -1718,21 +1717,21 @@ bool SparcAsmParser::matchSparcAsmModifiers(const MCExpr *&EVal,
17181717
17191718 StringRef name = Tok.getString ();
17201719
1721- SparcMCExpr::VariantKind VK = SparcMCExpr::parseVariantKind (name);
1720+ SparcMCExpr::Specifier VK = SparcMCExpr::parseSpecifier (name);
17221721 switch (VK) {
1723- case SparcMCExpr::VK_Sparc_None :
1724- Error (getLoc (), " invalid operand modifier " );
1722+ case SparcMCExpr::VK_None :
1723+ Error (getLoc (), " invalid relocation specifier " );
17251724 return false ;
17261725
1727- case SparcMCExpr::VK_Sparc_GOTDATA_OP :
1728- case SparcMCExpr::VK_Sparc_TLS_GD_ADD :
1729- case SparcMCExpr::VK_Sparc_TLS_GD_CALL :
1730- case SparcMCExpr::VK_Sparc_TLS_IE_ADD :
1731- case SparcMCExpr::VK_Sparc_TLS_IE_LD :
1732- case SparcMCExpr::VK_Sparc_TLS_IE_LDX :
1733- case SparcMCExpr::VK_Sparc_TLS_LDM_ADD :
1734- case SparcMCExpr::VK_Sparc_TLS_LDM_CALL :
1735- case SparcMCExpr::VK_Sparc_TLS_LDO_ADD :
1726+ case SparcMCExpr::VK_GOTDATA_OP :
1727+ case SparcMCExpr::VK_TLS_GD_ADD :
1728+ case SparcMCExpr::VK_TLS_GD_CALL :
1729+ case SparcMCExpr::VK_TLS_IE_ADD :
1730+ case SparcMCExpr::VK_TLS_IE_LD :
1731+ case SparcMCExpr::VK_TLS_IE_LDX :
1732+ case SparcMCExpr::VK_TLS_LDM_ADD :
1733+ case SparcMCExpr::VK_TLS_LDM_CALL :
1734+ case SparcMCExpr::VK_TLS_LDO_ADD :
17361735 // These are special-cased at tablegen level.
17371736 return false ;
17381737
0 commit comments