9
9
#include " MCTargetDesc/MipsABIFlagsSection.h"
10
10
#include " MCTargetDesc/MipsABIInfo.h"
11
11
#include " MCTargetDesc/MipsBaseInfo.h"
12
- #include " MCTargetDesc/MipsMCExpr .h"
12
+ #include " MCTargetDesc/MipsMCAsmInfo .h"
13
13
#include " MCTargetDesc/MipsMCTargetDesc.h"
14
14
#include " MCTargetDesc/MipsTargetStreamer.h"
15
15
#include " TargetInfo/MipsTargetInfo.h"
@@ -2964,10 +2964,10 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
2964
2964
if ((DstReg == Mips::T9 || DstReg == Mips::T9_64) && !UseSrcReg &&
2965
2965
Res.getConstant () == 0 && !IsLocalSym) {
2966
2966
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 ());
2971
2971
TOut.emitRX (Mips::LUi, DstReg, MCOperand::createExpr (CallHiExpr), IDLoc,
2972
2972
STI);
2973
2973
TOut.emitRRR (IsPtr64 ? Mips::DADDu : Mips::ADDu, DstReg, DstReg, GPReg,
@@ -2976,7 +2976,7 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
2976
2976
MCOperand::createExpr (CallLoExpr), IDLoc, STI);
2977
2977
} else {
2978
2978
const MCExpr *CallExpr =
2979
- MipsMCExpr::create (MipsMCExpr::MEK_GOT_CALL , SymExpr, getContext ());
2979
+ MipsMCExpr::create (Mips::S_GOT_CALL , SymExpr, getContext ());
2980
2980
TOut.emitRRX (IsPtr64 ? Mips::LD : Mips::LW, DstReg, GPReg,
2981
2981
MCOperand::createExpr (CallExpr), IDLoc, STI);
2982
2982
}
@@ -3009,9 +3009,9 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
3009
3009
// this happens then the last instruction must use $rd as the result
3010
3010
// register.
3011
3011
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 ());
3015
3015
3016
3016
TOut.emitRX (Mips::LUi, TmpReg, MCOperand::createExpr (CallHiExpr), IDLoc,
3017
3017
STI);
@@ -3042,8 +3042,8 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
3042
3042
// The daddiu's marked with a '>' may be omitted if they are redundant. If
3043
3043
// this happens then the last instruction must use $rd as the result
3044
3044
// 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 ());
3047
3047
if (Res.getConstant () != 0 ) {
3048
3048
// Symbols fully resolve with just the %got_disp(symbol) but we
3049
3049
// must still account for any offset to the symbol for
@@ -3070,15 +3070,14 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
3070
3070
// this happens then the last instruction must use $rd as the result
3071
3071
// register.
3072
3072
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 ());
3076
3075
} else {
3077
3076
// External symbols fully resolve the symbol with just the %got(symbol)
3078
3077
// but we must still account for any offset to the symbol for
3079
3078
// 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 ());
3082
3081
if (Res.getConstant () != 0 )
3083
3082
LoExpr = MCConstantExpr::create (Res.getConstant (), getContext ());
3084
3083
}
@@ -3099,9 +3098,9 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
3099
3098
}
3100
3099
3101
3100
const MipsMCExpr *HiExpr =
3102
- MipsMCExpr::create (MipsMCExpr::MEK_HI , SymExpr, getContext ());
3101
+ MipsMCExpr::create (Mips::S_HI , SymExpr, getContext ());
3103
3102
const MipsMCExpr *LoExpr =
3104
- MipsMCExpr::create (MipsMCExpr::MEK_LO , SymExpr, getContext ());
3103
+ MipsMCExpr::create (Mips::S_LO , SymExpr, getContext ());
3105
3104
3106
3105
// This is the 64-bit symbol address expansion.
3107
3106
if (ABI.ArePtrs64bit () && isGP64bit ()) {
@@ -3113,9 +3112,9 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
3113
3112
// source register.
3114
3113
3115
3114
const MipsMCExpr *HighestExpr =
3116
- MipsMCExpr::create (MipsMCExpr::MEK_HIGHEST , SymExpr, getContext ());
3115
+ MipsMCExpr::create (Mips::S_HIGHEST , SymExpr, getContext ());
3117
3116
const MipsMCExpr *HigherExpr =
3118
- MipsMCExpr::create (MipsMCExpr::MEK_HIGHER , SymExpr, getContext ());
3117
+ MipsMCExpr::create (Mips::S_HIGHER , SymExpr, getContext ());
3119
3118
3120
3119
bool RdRegIsRsReg =
3121
3120
UseSrcReg &&
@@ -3314,7 +3313,7 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
3314
3313
if (IsPicEnabled) {
3315
3314
const MCExpr *GotSym = MCSymbolRefExpr::create (Sym, getContext ());
3316
3315
const MipsMCExpr *GotExpr =
3317
- MipsMCExpr::create (MipsMCExpr::MEK_GOT , GotSym, getContext ());
3316
+ MipsMCExpr::create (Mips::S_GOT , GotSym, getContext ());
3318
3317
3319
3318
if (isABI_O32 () || isABI_N32 ()) {
3320
3319
TOut.emitRRX (Mips::LW, ATReg, GPReg, MCOperand::createExpr (GotExpr),
@@ -3326,7 +3325,7 @@ bool MipsAsmParser::emitPartialAddress(MipsTargetStreamer &TOut, SMLoc IDLoc,
3326
3325
} else { // !IsPicEnabled
3327
3326
const MCExpr *HiSym = MCSymbolRefExpr::create (Sym, getContext ());
3328
3327
const MipsMCExpr *HiExpr =
3329
- MipsMCExpr::create (MipsMCExpr::MEK_HI , HiSym, getContext ());
3328
+ MipsMCExpr::create (Mips::S_HI , HiSym, getContext ());
3330
3329
3331
3330
// FIXME: This is technically correct but gives a different result to gas,
3332
3331
// 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,
3339
3338
} else { // isABI_N64()
3340
3339
const MCExpr *HighestSym = MCSymbolRefExpr::create (Sym, getContext ());
3341
3340
const MipsMCExpr *HighestExpr =
3342
- MipsMCExpr::create (MipsMCExpr::MEK_HIGHEST , HighestSym, getContext ());
3341
+ MipsMCExpr::create (Mips::S_HIGHEST , HighestSym, getContext ());
3343
3342
const MCExpr *HigherSym = MCSymbolRefExpr::create (Sym, getContext ());
3344
3343
const MipsMCExpr *HigherExpr =
3345
- MipsMCExpr::create (MipsMCExpr::MEK_HIGHER , HigherSym, getContext ());
3344
+ MipsMCExpr::create (Mips::S_HIGHER , HigherSym, getContext ());
3346
3345
3347
3346
TOut.emitRX (Mips::LUi, ATReg, MCOperand::createExpr (HighestExpr), IDLoc,
3348
3347
STI);
@@ -3430,7 +3429,7 @@ bool MipsAsmParser::expandLoadSingleImmToFPR(MCInst &Inst, SMLoc IDLoc,
3430
3429
MCSymbol *Sym = getContext ().createTempSymbol ();
3431
3430
const MCExpr *LoSym = MCSymbolRefExpr::create (Sym, getContext ());
3432
3431
const MipsMCExpr *LoExpr =
3433
- MipsMCExpr::create (MipsMCExpr::MEK_LO , LoSym, getContext ());
3432
+ MipsMCExpr::create (Mips::S_LO , LoSym, getContext ());
3434
3433
3435
3434
getStreamer ().switchSection (ReadOnlySection);
3436
3435
getStreamer ().emitLabel (Sym, IDLoc);
@@ -3481,7 +3480,7 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
3481
3480
MCSymbol *Sym = getContext ().createTempSymbol ();
3482
3481
const MCExpr *LoSym = MCSymbolRefExpr::create (Sym, getContext ());
3483
3482
const MipsMCExpr *LoExpr =
3484
- MipsMCExpr::create (MipsMCExpr::MEK_LO , LoSym, getContext ());
3483
+ MipsMCExpr::create (Mips::S_LO , LoSym, getContext ());
3485
3484
3486
3485
getStreamer ().switchSection (ReadOnlySection);
3487
3486
getStreamer ().emitLabel (Sym, IDLoc);
@@ -3562,7 +3561,7 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
3562
3561
MCSymbol *Sym = getContext ().createTempSymbol ();
3563
3562
const MCExpr *LoSym = MCSymbolRefExpr::create (Sym, getContext ());
3564
3563
const MipsMCExpr *LoExpr =
3565
- MipsMCExpr::create (MipsMCExpr::MEK_LO , LoSym, getContext ());
3564
+ MipsMCExpr::create (Mips::S_LO , LoSym, getContext ());
3566
3565
3567
3566
getStreamer ().switchSection (ReadOnlySection);
3568
3567
getStreamer ().emitLabel (Sym, IDLoc);
@@ -3785,15 +3784,15 @@ void MipsAsmParser::expandMem16Inst(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
3785
3784
// sw $8, %lo(sym)($at)
3786
3785
const MCExpr *OffExpr = OffsetOp.getExpr ();
3787
3786
MCOperand LoOperand = MCOperand::createExpr (
3788
- MipsMCExpr::create (MipsMCExpr::MEK_LO , OffExpr, getContext ()));
3787
+ MipsMCExpr::create (Mips::S_LO , OffExpr, getContext ()));
3789
3788
MCOperand HiOperand = MCOperand::createExpr (
3790
- MipsMCExpr::create (MipsMCExpr::MEK_HI , OffExpr, getContext ()));
3789
+ MipsMCExpr::create (Mips::S_HI , OffExpr, getContext ()));
3791
3790
3792
3791
if (ABI.IsN64 ()) {
3793
3792
MCOperand HighestOperand = MCOperand::createExpr (
3794
- MipsMCExpr::create (MipsMCExpr::MEK_HIGHEST , OffExpr, getContext ()));
3793
+ MipsMCExpr::create (Mips::S_HIGHEST , OffExpr, getContext ()));
3795
3794
MCOperand HigherOperand = MCOperand::createExpr (
3796
- MipsMCExpr::create (MipsMCExpr::MEK_HIGHER , OffExpr, getContext ()));
3795
+ MipsMCExpr::create (Mips::S_HIGHER , OffExpr, getContext ()));
3797
3796
3798
3797
TOut.emitRX (Mips::LUi, TmpReg, HighestOperand, IDLoc, STI);
3799
3798
TOut.emitRRX (Mips::DADDiu, TmpReg, TmpReg, HigherOperand, IDLoc, STI);
@@ -6355,31 +6354,31 @@ MCRegister MipsAsmParser::getReg(int RC, int RegNo) {
6355
6354
const MCExpr *MipsAsmParser::parseRelocExpr () {
6356
6355
auto getOp = [](StringRef Op) {
6357
6356
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 );
6383
6382
};
6384
6383
6385
6384
MCAsmParser &Parser = getParser ();
@@ -6391,7 +6390,7 @@ const MCExpr *MipsAsmParser::parseRelocExpr() {
6391
6390
Parser.parseToken (AsmToken::LParen, " expected '('" ))
6392
6391
return nullptr ;
6393
6392
auto Op = getOp (Name);
6394
- if (Op == MipsMCExpr::MEK_None ) {
6393
+ if (Op == Mips::S_None ) {
6395
6394
Error (Parser.getTok ().getLoc (), " invalid relocation operator" );
6396
6395
return nullptr ;
6397
6396
}
0 commit comments