99#include " MCTargetDesc/MipsABIFlagsSection.h"
1010#include " MCTargetDesc/MipsABIInfo.h"
1111#include " MCTargetDesc/MipsBaseInfo.h"
12- #include " MCTargetDesc/MipsMCExpr .h"
12+ #include " MCTargetDesc/MipsMCAsmInfo .h"
1313#include " MCTargetDesc/MipsMCTargetDesc.h"
1414#include " MCTargetDesc/MipsTargetStreamer.h"
1515#include " TargetInfo/MipsTargetInfo.h"
@@ -2964,10 +2964,10 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
29642964 if ((DstReg == Mips::T9 || DstReg == Mips::T9_64) && !UseSrcReg &&
29652965 Res.getConstant () == 0 && !IsLocalSym) {
29662966 if (UseXGOT) {
2967- const MCExpr *CallHiExpr = MipsMCExpr::create (MipsMCExpr::MEK_CALL_HI16,
2968- SymExpr, getContext ());
2969- const MCExpr *CallLoExpr = MipsMCExpr::create (MipsMCExpr::MEK_CALL_LO16,
2970- SymExpr, getContext ());
2967+ const MCExpr *CallHiExpr =
2968+ MipsMCExpr::create (Mips::S_CALL_HI16, SymExpr, getContext ());
2969+ const MCExpr *CallLoExpr =
2970+ MipsMCExpr::create (Mips::S_CALL_LO16, SymExpr, getContext ());
29712971 TOut.emitRX (Mips::LUi, DstReg, MCOperand::createExpr (CallHiExpr), IDLoc,
29722972 STI);
29732973 TOut.emitRRR (IsPtr64 ? Mips::DADDu : Mips::ADDu, DstReg, DstReg, GPReg,
@@ -2976,7 +2976,7 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
29762976 MCOperand::createExpr (CallLoExpr), IDLoc, STI);
29772977 } else {
29782978 const MCExpr *CallExpr =
2979- MipsMCExpr::create (MipsMCExpr::MEK_GOT_CALL , SymExpr, getContext ());
2979+ MipsMCExpr::create (Mips::S_GOT_CALL , SymExpr, getContext ());
29802980 TOut.emitRRX (IsPtr64 ? Mips::LD : Mips::LW, DstReg, GPReg,
29812981 MCOperand::createExpr (CallExpr), IDLoc, STI);
29822982 }
@@ -3009,9 +3009,9 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
30093009 // this happens then the last instruction must use $rd as the result
30103010 // register.
30113011 const MCExpr *CallHiExpr =
3012- MipsMCExpr::create (MipsMCExpr::MEK_GOT_HI16 , SymExpr, getContext ());
3013- const MCExpr *CallLoExpr = MipsMCExpr::create (
3014- Res.getAddSym (), MipsMCExpr::MEK_GOT_LO16 , getContext ());
3012+ MipsMCExpr::create (Mips::S_GOT_HI16 , SymExpr, getContext ());
3013+ const MCExpr *CallLoExpr =
3014+ MipsMCExpr::create ( Res.getAddSym (), Mips::S_GOT_LO16 , getContext ());
30153015
30163016 TOut.emitRX (Mips::LUi, TmpReg, MCOperand::createExpr (CallHiExpr), IDLoc,
30173017 STI);
@@ -3042,8 +3042,8 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
30423042 // The daddiu's marked with a '>' may be omitted if they are redundant. If
30433043 // this happens then the last instruction must use $rd as the result
30443044 // register.
3045- GotExpr = MipsMCExpr::create (Res. getAddSym (), MipsMCExpr::MEK_GOT_DISP,
3046- getContext ());
3045+ GotExpr =
3046+ MipsMCExpr::create (Res. getAddSym (), Mips::S_GOT_DISP, getContext ());
30473047 if (Res.getConstant () != 0 ) {
30483048 // Symbols fully resolve with just the %got_disp(symbol) but we
30493049 // must still account for any offset to the symbol for
@@ -3070,15 +3070,14 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
30703070 // this happens then the last instruction must use $rd as the result
30713071 // register.
30723072 if (IsLocalSym) {
3073- GotExpr =
3074- MipsMCExpr::create (MipsMCExpr::MEK_GOT, SymExpr, getContext ());
3075- LoExpr = MipsMCExpr::create (MipsMCExpr::MEK_LO, SymExpr, getContext ());
3073+ GotExpr = MipsMCExpr::create (Mips::S_GOT, SymExpr, getContext ());
3074+ LoExpr = MipsMCExpr::create (Mips::S_LO, SymExpr, getContext ());
30763075 } else {
30773076 // External symbols fully resolve the symbol with just the %got(symbol)
30783077 // but we must still account for any offset to the symbol for
30793078 // expressions like symbol+8.
3080- GotExpr = MipsMCExpr::create (Res. getAddSym (), MipsMCExpr::MEK_GOT,
3081- getContext ());
3079+ GotExpr =
3080+ MipsMCExpr::create (Res. getAddSym (), Mips::S_GOT, getContext ());
30823081 if (Res.getConstant () != 0 )
30833082 LoExpr = MCConstantExpr::create (Res.getConstant (), getContext ());
30843083 }
@@ -3099,9 +3098,9 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
30993098 }
31003099
31013100 const MipsMCExpr *HiExpr =
3102- MipsMCExpr::create (MipsMCExpr::MEK_HI , SymExpr, getContext ());
3101+ MipsMCExpr::create (Mips::S_HI , SymExpr, getContext ());
31033102 const MipsMCExpr *LoExpr =
3104- MipsMCExpr::create (MipsMCExpr::MEK_LO , SymExpr, getContext ());
3103+ MipsMCExpr::create (Mips::S_LO , SymExpr, getContext ());
31053104
31063105 // This is the 64-bit symbol address expansion.
31073106 if (ABI.ArePtrs64bit () && isGP64bit ()) {
@@ -3113,9 +3112,9 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
31133112 // source register.
31143113
31153114 const MipsMCExpr *HighestExpr =
3116- MipsMCExpr::create (MipsMCExpr::MEK_HIGHEST , SymExpr, getContext ());
3115+ MipsMCExpr::create (Mips::S_HIGHEST , SymExpr, getContext ());
31173116 const MipsMCExpr *HigherExpr =
3118- MipsMCExpr::create (MipsMCExpr::MEK_HIGHER , SymExpr, getContext ());
3117+ MipsMCExpr::create (Mips::S_HIGHER , SymExpr, getContext ());
31193118
31203119 bool RdRegIsRsReg =
31213120 UseSrcReg &&
@@ -3314,7 +3313,7 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
33143313 if (IsPicEnabled) {
33153314 const MCExpr *GotSym = MCSymbolRefExpr::create (Sym, getContext ());
33163315 const MipsMCExpr *GotExpr =
3317- MipsMCExpr::create (MipsMCExpr::MEK_GOT , GotSym, getContext ());
3316+ MipsMCExpr::create (Mips::S_GOT , GotSym, getContext ());
33183317
33193318 if (isABI_O32 () || isABI_N32 ()) {
33203319 TOut.emitRRX (Mips::LW, ATReg, GPReg, MCOperand::createExpr (GotExpr),
@@ -3326,7 +3325,7 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
33263325 } else { // !IsPicEnabled
33273326 const MCExpr *HiSym = MCSymbolRefExpr::create (Sym, getContext ());
33283327 const MipsMCExpr *HiExpr =
3329- MipsMCExpr::create (MipsMCExpr::MEK_HI , HiSym, getContext ());
3328+ MipsMCExpr::create (Mips::S_HI , HiSym, getContext ());
33303329
33313330 // FIXME: This is technically correct but gives a different result to gas,
33323331 // but gas is incomplete there (it has a fixme noting it doesn't work with
@@ -3339,10 +3338,10 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
33393338 } else { // isABI_N64()
33403339 const MCExpr *HighestSym = MCSymbolRefExpr::create (Sym, getContext ());
33413340 const MipsMCExpr *HighestExpr =
3342- MipsMCExpr::create (MipsMCExpr::MEK_HIGHEST , HighestSym, getContext ());
3341+ MipsMCExpr::create (Mips::S_HIGHEST , HighestSym, getContext ());
33433342 const MCExpr *HigherSym = MCSymbolRefExpr::create (Sym, getContext ());
33443343 const MipsMCExpr *HigherExpr =
3345- MipsMCExpr::create (MipsMCExpr::MEK_HIGHER , HigherSym, getContext ());
3344+ MipsMCExpr::create (Mips::S_HIGHER , HigherSym, getContext ());
33463345
33473346 TOut.emitRX (Mips::LUi, ATReg, MCOperand::createExpr (HighestExpr), IDLoc,
33483347 STI);
@@ -3430,7 +3429,7 @@ bool MipsAsmParser::expandLoadSingleImmToFPR(MCInst &Inst, SMLoc IDLoc,
34303429 MCSymbol *Sym = getContext ().createTempSymbol ();
34313430 const MCExpr *LoSym = MCSymbolRefExpr::create (Sym, getContext ());
34323431 const MipsMCExpr *LoExpr =
3433- MipsMCExpr::create (MipsMCExpr::MEK_LO , LoSym, getContext ());
3432+ MipsMCExpr::create (Mips::S_LO , LoSym, getContext ());
34343433
34353434 getStreamer ().switchSection (ReadOnlySection);
34363435 getStreamer ().emitLabel (Sym, IDLoc);
@@ -3481,7 +3480,7 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
34813480 MCSymbol *Sym = getContext ().createTempSymbol ();
34823481 const MCExpr *LoSym = MCSymbolRefExpr::create (Sym, getContext ());
34833482 const MipsMCExpr *LoExpr =
3484- MipsMCExpr::create (MipsMCExpr::MEK_LO , LoSym, getContext ());
3483+ MipsMCExpr::create (Mips::S_LO , LoSym, getContext ());
34853484
34863485 getStreamer ().switchSection (ReadOnlySection);
34873486 getStreamer ().emitLabel (Sym, IDLoc);
@@ -3562,7 +3561,7 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
35623561 MCSymbol *Sym = getContext ().createTempSymbol ();
35633562 const MCExpr *LoSym = MCSymbolRefExpr::create (Sym, getContext ());
35643563 const MipsMCExpr *LoExpr =
3565- MipsMCExpr::create (MipsMCExpr::MEK_LO , LoSym, getContext ());
3564+ MipsMCExpr::create (Mips::S_LO , LoSym, getContext ());
35663565
35673566 getStreamer ().switchSection (ReadOnlySection);
35683567 getStreamer ().emitLabel (Sym, IDLoc);
@@ -3785,15 +3784,15 @@ void MipsAsmParser::expandMem16Inst(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
37853784 // sw $8, %lo(sym)($at)
37863785 const MCExpr *OffExpr = OffsetOp.getExpr ();
37873786 MCOperand LoOperand = MCOperand::createExpr (
3788- MipsMCExpr::create (MipsMCExpr::MEK_LO , OffExpr, getContext ()));
3787+ MipsMCExpr::create (Mips::S_LO , OffExpr, getContext ()));
37893788 MCOperand HiOperand = MCOperand::createExpr (
3790- MipsMCExpr::create (MipsMCExpr::MEK_HI , OffExpr, getContext ()));
3789+ MipsMCExpr::create (Mips::S_HI , OffExpr, getContext ()));
37913790
37923791 if (ABI.IsN64 ()) {
37933792 MCOperand HighestOperand = MCOperand::createExpr (
3794- MipsMCExpr::create (MipsMCExpr::MEK_HIGHEST , OffExpr, getContext ()));
3793+ MipsMCExpr::create (Mips::S_HIGHEST , OffExpr, getContext ()));
37953794 MCOperand HigherOperand = MCOperand::createExpr (
3796- MipsMCExpr::create (MipsMCExpr::MEK_HIGHER , OffExpr, getContext ()));
3795+ MipsMCExpr::create (Mips::S_HIGHER , OffExpr, getContext ()));
37973796
37983797 TOut.emitRX (Mips::LUi, TmpReg, HighestOperand, IDLoc, STI);
37993798 TOut.emitRRX (Mips::DADDiu, TmpReg, TmpReg, HigherOperand, IDLoc, STI);
@@ -6355,31 +6354,31 @@ MCRegister MipsAsmParser::getReg(int RC, int RegNo) {
63556354const MCExpr *MipsAsmParser::parseRelocExpr () {
63566355 auto getOp = [](StringRef Op) {
63576356 return StringSwitch<MipsMCExpr::Specifier>(Op)
6358- .Case (" call16" , MipsMCExpr::MEK_GOT_CALL )
6359- .Case (" call_hi" , MipsMCExpr::MEK_CALL_HI16 )
6360- .Case (" call_lo" , MipsMCExpr::MEK_CALL_LO16 )
6361- .Case (" dtprel_hi" , MipsMCExpr::MEK_DTPREL_HI )
6362- .Case (" dtprel_lo" , MipsMCExpr::MEK_DTPREL_LO )
6363- .Case (" got" , MipsMCExpr::MEK_GOT )
6364- .Case (" got_disp" , MipsMCExpr::MEK_GOT_DISP )
6365- .Case (" got_hi" , MipsMCExpr::MEK_GOT_HI16 )
6366- .Case (" got_lo" , MipsMCExpr::MEK_GOT_LO16 )
6367- .Case (" got_ofst" , MipsMCExpr::MEK_GOT_OFST )
6368- .Case (" got_page" , MipsMCExpr::MEK_GOT_PAGE )
6369- .Case (" gottprel" , MipsMCExpr::MEK_GOTTPREL )
6370- .Case (" gp_rel" , MipsMCExpr::MEK_GPREL )
6371- .Case (" hi" , MipsMCExpr::MEK_HI )
6372- .Case (" higher" , MipsMCExpr::MEK_HIGHER )
6373- .Case (" highest" , MipsMCExpr::MEK_HIGHEST )
6374- .Case (" lo" , MipsMCExpr::MEK_LO )
6375- .Case (" neg" , MipsMCExpr::MEK_NEG )
6376- .Case (" pcrel_hi" , MipsMCExpr::MEK_PCREL_HI16 )
6377- .Case (" pcrel_lo" , MipsMCExpr::MEK_PCREL_LO16 )
6378- .Case (" tlsgd" , MipsMCExpr::MEK_TLSGD )
6379- .Case (" tlsldm" , MipsMCExpr::MEK_TLSLDM )
6380- .Case (" tprel_hi" , MipsMCExpr::MEK_TPREL_HI )
6381- .Case (" tprel_lo" , MipsMCExpr::MEK_TPREL_LO )
6382- .Default (MipsMCExpr::MEK_None );
6357+ .Case (" call16" , Mips::S_GOT_CALL )
6358+ .Case (" call_hi" , Mips::S_CALL_HI16 )
6359+ .Case (" call_lo" , Mips::S_CALL_LO16 )
6360+ .Case (" dtprel_hi" , Mips::S_DTPREL_HI )
6361+ .Case (" dtprel_lo" , Mips::S_DTPREL_LO )
6362+ .Case (" got" , Mips::S_GOT )
6363+ .Case (" got_disp" , Mips::S_GOT_DISP )
6364+ .Case (" got_hi" , Mips::S_GOT_HI16 )
6365+ .Case (" got_lo" , Mips::S_GOT_LO16 )
6366+ .Case (" got_ofst" , Mips::S_GOT_OFST )
6367+ .Case (" got_page" , Mips::S_GOT_PAGE )
6368+ .Case (" gottprel" , Mips::S_GOTTPREL )
6369+ .Case (" gp_rel" , Mips::S_GPREL )
6370+ .Case (" hi" , Mips::S_HI )
6371+ .Case (" higher" , Mips::S_HIGHER )
6372+ .Case (" highest" , Mips::S_HIGHEST )
6373+ .Case (" lo" , Mips::S_LO )
6374+ .Case (" neg" , Mips::S_NEG )
6375+ .Case (" pcrel_hi" , Mips::S_PCREL_HI16 )
6376+ .Case (" pcrel_lo" , Mips::S_PCREL_LO16 )
6377+ .Case (" tlsgd" , Mips::S_TLSGD )
6378+ .Case (" tlsldm" , Mips::S_TLSLDM )
6379+ .Case (" tprel_hi" , Mips::S_TPREL_HI )
6380+ .Case (" tprel_lo" , Mips::S_TPREL_LO )
6381+ .Default (Mips::S_None );
63836382 };
63846383
63856384 MCAsmParser &Parser = getParser ();
@@ -6391,7 +6390,7 @@ const MCExpr *MipsAsmParser::parseRelocExpr() {
63916390 Parser.parseToken (AsmToken::LParen, " expected '('" ))
63926391 return nullptr ;
63936392 auto Op = getOp (Name);
6394- if (Op == MipsMCExpr::MEK_None ) {
6393+ if (Op == Mips::S_None ) {
63956394 Error (Parser.getTok ().getLoc (), " invalid relocation operator" );
63966395 return nullptr ;
63976396 }
0 commit comments