Skip to content

Commit 0894094

Browse files
committed
X86: Replace deprecated MCExpr::print with MCAsmInfo::printExpr
1 parent 95acd61 commit 0894094

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "X86ATTInstPrinter.h"
1515
#include "X86BaseInfo.h"
1616
#include "X86InstComments.h"
17+
#include "llvm/MC/MCAsmInfo.h"
1718
#include "llvm/MC/MCExpr.h"
1819
#include "llvm/MC/MCInst.h"
1920
#include "llvm/MC/MCInstrAnalysis.h"
@@ -414,7 +415,7 @@ void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
414415
assert(Op.isExpr() && "unknown operand kind in printOperand");
415416
WithMarkup M = markup(O, Markup::Immediate);
416417
O << '$';
417-
Op.getExpr()->print(O, &MAI);
418+
MAI.printExpr(O, *Op.getExpr());
418419
}
419420
}
420421

@@ -445,7 +446,7 @@ void X86ATTInstPrinter::printMemReference(const MCInst *MI, unsigned Op,
445446
O << formatImm(DispVal);
446447
} else {
447448
assert(DispSpec.isExpr() && "non-immediate displacement for LEA?");
448-
DispSpec.getExpr()->print(O, &MAI);
449+
MAI.printExpr(O, *DispSpec.getExpr());
449450
}
450451

451452
if (IndexReg.getReg() || BaseReg.getReg()) {
@@ -500,7 +501,7 @@ void X86ATTInstPrinter::printMemOffset(const MCInst *MI, unsigned Op,
500501
O << formatImm(DispSpec.getImm());
501502
} else {
502503
assert(DispSpec.isExpr() && "non-immediate displacement?");
503-
DispSpec.getExpr()->print(O, &MAI);
504+
MAI.printExpr(O, *DispSpec.getExpr());
504505
}
505506
}
506507

llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ void X86InstPrinterCommon::printPCRelImm(const MCInst *MI, uint64_t Address,
374374
markup(O, Markup::Immediate) << formatHex((uint64_t)Address);
375375
} else {
376376
// Otherwise, just print the expression.
377-
Op.getExpr()->print(O, &MAI);
377+
MAI.printExpr(O, *Op.getExpr());
378378
}
379379
}
380380
}

llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "X86IntelInstPrinter.h"
1515
#include "X86BaseInfo.h"
1616
#include "X86InstComments.h"
17+
#include "llvm/MC/MCAsmInfo.h"
1718
#include "llvm/MC/MCExpr.h"
1819
#include "llvm/MC/MCInst.h"
1920
#include "llvm/MC/MCInstrAnalysis.h"
@@ -372,7 +373,7 @@ void X86IntelInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
372373
} else {
373374
assert(Op.isExpr() && "unknown operand kind in printOperand");
374375
O << "offset ";
375-
Op.getExpr()->print(O, &MAI);
376+
MAI.printExpr(O, *Op.getExpr());
376377
}
377378
}
378379

@@ -415,7 +416,7 @@ void X86IntelInstPrinter::printMemReference(const MCInst *MI, unsigned Op,
415416
if (!DispSpec.isImm()) {
416417
if (NeedPlus) O << " + ";
417418
assert(DispSpec.isExpr() && "non-immediate displacement for LEA?");
418-
DispSpec.getExpr()->print(O, &MAI);
419+
MAI.printExpr(O, *DispSpec.getExpr());
419420
} else {
420421
int64_t DispVal = DispSpec.getImm();
421422
if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg())) {
@@ -470,7 +471,7 @@ void X86IntelInstPrinter::printMemOffset(const MCInst *MI, unsigned Op,
470471
markup(O, Markup::Immediate) << formatImm(DispSpec.getImm());
471472
} else {
472473
assert(DispSpec.isExpr() && "non-immediate displacement?");
473-
DispSpec.getExpr()->print(O, &MAI);
474+
MAI.printExpr(O, *DispSpec.getExpr());
474475
}
475476

476477
O << ']';
@@ -479,7 +480,7 @@ void X86IntelInstPrinter::printMemOffset(const MCInst *MI, unsigned Op,
479480
void X86IntelInstPrinter::printU8Imm(const MCInst *MI, unsigned Op,
480481
raw_ostream &O) {
481482
if (MI->getOperand(Op).isExpr())
482-
return MI->getOperand(Op).getExpr()->print(O, &MAI);
483+
return MAI.printExpr(O, *MI->getOperand(Op).getExpr());
483484

484485
markup(O, Markup::Immediate) << formatImm(MI->getOperand(Op).getImm() & 0xff);
485486
}

0 commit comments

Comments
 (0)