@@ -109,7 +109,7 @@ class SparcAsmParser : public MCTargetAsmParser {
109
109
ParseStatus parseExpression (int64_t &Val);
110
110
111
111
// Helper function for dealing with %lo / %hi in PIC mode.
112
- const SparcMCExpr *adjustPICRelocation (SparcMCExpr::VariantKind VK,
112
+ const SparcMCExpr *adjustPICRelocation (SparcMCExpr::Specifier VK,
113
113
const MCExpr *subExpr);
114
114
115
115
// Helper function to see if current token can start an expression.
@@ -701,7 +701,7 @@ bool SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
701
701
// In either case, start with the 'sethi'.
702
702
if (!IsEffectivelyImm13) {
703
703
MCInst TmpInst;
704
- const MCExpr *Expr = adjustPICRelocation (SparcMCExpr::VK_Sparc_HI , ValExpr);
704
+ const MCExpr *Expr = adjustPICRelocation (SparcMCExpr::VK_HI , ValExpr);
705
705
TmpInst.setLoc (IDLoc);
706
706
TmpInst.setOpcode (SP::SETHIi);
707
707
TmpInst.addOperand (MCRegOp);
@@ -726,7 +726,7 @@ bool SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
726
726
if (IsEffectivelyImm13)
727
727
Expr = ValExpr;
728
728
else
729
- Expr = adjustPICRelocation (SparcMCExpr::VK_Sparc_LO , ValExpr);
729
+ Expr = adjustPICRelocation (SparcMCExpr::VK_LO , ValExpr);
730
730
TmpInst.setLoc (IDLoc);
731
731
TmpInst.setOpcode (SP::ORri);
732
732
TmpInst.addOperand (MCRegOp);
@@ -766,16 +766,15 @@ bool SparcAsmParser::expandSETSW(MCInst &Inst, SMLoc IDLoc,
766
766
Instructions.push_back (
767
767
MCInstBuilder (SP::SETHIi)
768
768
.addReg (MCRegOp.getReg ())
769
- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HI , ValExpr)));
769
+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HI , ValExpr)));
770
770
771
771
PrevReg = MCRegOp;
772
772
}
773
773
774
774
// If the immediate has the lower bits set or is small, we need to emit an or.
775
775
if (!NoLowBitsImm || IsSmallImm) {
776
776
const MCExpr *Expr =
777
- IsSmallImm ? ValExpr
778
- : adjustPICRelocation (SparcMCExpr::VK_Sparc_LO, ValExpr);
777
+ IsSmallImm ? ValExpr : adjustPICRelocation (SparcMCExpr::VK_LO, ValExpr);
779
778
780
779
// or rd, %lo(val), rd
781
780
Instructions.push_back (MCInstBuilder (SP::ORri)
@@ -831,13 +830,13 @@ bool SparcAsmParser::expandSETX(MCInst &Inst, SMLoc IDLoc,
831
830
Instructions.push_back (
832
831
MCInstBuilder (SP::SETHIi)
833
832
.addReg (MCRegOp.getReg ())
834
- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HI , ValExpr)));
833
+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HI , ValExpr)));
835
834
// or rd, %lo(val), rd
836
835
Instructions.push_back (
837
836
MCInstBuilder (SP::ORri)
838
837
.addReg (MCRegOp.getReg ())
839
838
.addReg (MCRegOp.getReg ())
840
- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_LO , ValExpr)));
839
+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_LO , ValExpr)));
841
840
842
841
// Small positive immediates can be expressed as a single `sethi`+`or`
843
842
// combination, so we can just return here.
@@ -851,13 +850,13 @@ bool SparcAsmParser::expandSETX(MCInst &Inst, SMLoc IDLoc,
851
850
Instructions.push_back (
852
851
MCInstBuilder (SP::SETHIi)
853
852
.addReg (MCTmpOp.getReg ())
854
- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HH , ValExpr)));
853
+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HH , ValExpr)));
855
854
// or tmp, %hm(val), tmp
856
855
Instructions.push_back (
857
856
MCInstBuilder (SP::ORri)
858
857
.addReg (MCTmpOp.getReg ())
859
858
.addReg (MCTmpOp.getReg ())
860
- .addExpr (adjustPICRelocation (SparcMCExpr::VK_Sparc_HM , ValExpr)));
859
+ .addExpr (adjustPICRelocation (SparcMCExpr::VK_HM , ValExpr)));
861
860
// sllx tmp, 32, tmp
862
861
Instructions.push_back (MCInstBuilder (SP::SLLXri)
863
862
.addReg (MCTmpOp.getReg ())
@@ -1115,20 +1114,20 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
1115
1114
SMLoc S = getLoc ();
1116
1115
SMLoc E = SMLoc::getFromPointer (S.getPointer () - 1 );
1117
1116
1118
- auto MatchesKind = [](SparcMCExpr::VariantKind VK) -> bool {
1117
+ auto MatchesKind = [](SparcMCExpr::Specifier VK) -> bool {
1119
1118
switch (Kind) {
1120
1119
case TailRelocKind::Load_GOT:
1121
1120
// Non-TLS relocations on ld (or ldx).
1122
1121
// ld [%rr + %rr], %rr, %rel(sym)
1123
- return VK == SparcMCExpr::VK_Sparc_GOTDATA_OP ;
1122
+ return VK == SparcMCExpr::VK_GOTDATA_OP ;
1124
1123
case TailRelocKind::Add_TLS:
1125
1124
// TLS relocations on add.
1126
1125
// add %rr, %rr, %rr, %rel(sym)
1127
1126
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 :
1132
1131
return true ;
1133
1132
default :
1134
1133
return false ;
@@ -1137,8 +1136,8 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
1137
1136
// TLS relocations on ld (or ldx).
1138
1137
// ld[x] %addr, %rr, %rel(sym)
1139
1138
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 :
1142
1141
return true ;
1143
1142
default :
1144
1143
return false ;
@@ -1147,8 +1146,8 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
1147
1146
// TLS relocations on call.
1148
1147
// call sym, %rel(sym)
1149
1148
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 :
1152
1151
return true ;
1153
1152
default :
1154
1153
return false ;
@@ -1167,9 +1166,9 @@ ParseStatus SparcAsmParser::parseTailRelocSym(OperandVector &Operands) {
1167
1166
return Error (getLoc (), " expected valid identifier for operand modifier" );
1168
1167
1169
1168
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 " );
1173
1172
1174
1173
if (!MatchesKind (VK)) {
1175
1174
// Did not match the specified set of relocation types, put '%' back.
@@ -1325,8 +1324,8 @@ ParseStatus SparcAsmParser::parseCallTarget(OperandVector &Operands) {
1325
1324
return ParseStatus::NoMatch;
1326
1325
1327
1326
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 ;
1330
1329
1331
1330
const MCExpr *DestExpr = SparcMCExpr::create (Kind, DestValue, getContext ());
1332
1331
Operands.push_back (SparcOperand::CreateImm (DestExpr, S, E));
@@ -1483,13 +1482,13 @@ SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Op,
1483
1482
1484
1483
int64_t Res;
1485
1484
if (!EVal->evaluateAsAbsolute (Res)) {
1486
- SparcMCExpr::VariantKind Kind = SparcMCExpr::VK_Sparc_13 ;
1485
+ SparcMCExpr::Specifier Kind = SparcMCExpr::VK_13 ;
1487
1486
1488
1487
if (getContext ().getObjectFileInfo ()->isPositionIndependent ()) {
1489
1488
if (isCall)
1490
- Kind = SparcMCExpr::VK_Sparc_WPLT30 ;
1489
+ Kind = SparcMCExpr::VK_WPLT30 ;
1491
1490
else
1492
- Kind = SparcMCExpr::VK_Sparc_GOT13 ;
1491
+ Kind = SparcMCExpr::VK_GOT13 ;
1493
1492
}
1494
1493
EVal = SparcMCExpr::create (Kind, EVal, getContext ());
1495
1494
}
@@ -1686,7 +1685,7 @@ static bool hasGOTReference(const MCExpr *Expr) {
1686
1685
}
1687
1686
1688
1687
const SparcMCExpr *
1689
- SparcAsmParser::adjustPICRelocation (SparcMCExpr::VariantKind VK,
1688
+ SparcAsmParser::adjustPICRelocation (SparcMCExpr::Specifier VK,
1690
1689
const MCExpr *subExpr) {
1691
1690
// When in PIC mode, "%lo(...)" and "%hi(...)" behave differently.
1692
1691
// If the expression refers contains _GLOBAL_OFFSET_TABLE, it is
@@ -1696,13 +1695,13 @@ SparcAsmParser::adjustPICRelocation(SparcMCExpr::VariantKind VK,
1696
1695
if (getContext ().getObjectFileInfo ()->isPositionIndependent ()) {
1697
1696
switch (VK) {
1698
1697
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 );
1702
1701
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 );
1706
1705
break ;
1707
1706
}
1708
1707
}
@@ -1718,21 +1717,21 @@ bool SparcAsmParser::matchSparcAsmModifiers(const MCExpr *&EVal,
1718
1717
1719
1718
StringRef name = Tok.getString ();
1720
1719
1721
- SparcMCExpr::VariantKind VK = SparcMCExpr::parseVariantKind (name);
1720
+ SparcMCExpr::Specifier VK = SparcMCExpr::parseSpecifier (name);
1722
1721
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 " );
1725
1724
return false ;
1726
1725
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 :
1736
1735
// These are special-cased at tablegen level.
1737
1736
return false ;
1738
1737
0 commit comments