Skip to content

Commit 452d0b2

Browse files
committed
[mips] Make MipsAsmParser::isEvaluated static function. NFC
1 parent 525f9c0 commit 452d0b2

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ class MipsAsmParser : public MCTargetAsmParser {
339339

340340
bool parseMemOffset(const MCExpr *&Res, bool isParenExpr);
341341

342-
bool isEvaluated(const MCExpr *Expr);
343342
bool parseSetMips0Directive();
344343
bool parseSetArchDirective();
345344
bool parseSetFeature(uint64_t Feature);
@@ -1796,6 +1795,26 @@ static unsigned countMCSymbolRefExpr(const MCExpr *Expr) {
17961795
return 0;
17971796
}
17981797

1798+
static bool isEvaluated(const MCExpr *Expr) {
1799+
switch (Expr->getKind()) {
1800+
case MCExpr::Constant:
1801+
return true;
1802+
case MCExpr::SymbolRef:
1803+
return (cast<MCSymbolRefExpr>(Expr)->getKind() != MCSymbolRefExpr::VK_None);
1804+
case MCExpr::Binary: {
1805+
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Expr);
1806+
if (!isEvaluated(BE->getLHS()))
1807+
return false;
1808+
return isEvaluated(BE->getRHS());
1809+
}
1810+
case MCExpr::Unary:
1811+
return isEvaluated(cast<MCUnaryExpr>(Expr)->getSubExpr());
1812+
case MCExpr::Target:
1813+
return true;
1814+
}
1815+
return false;
1816+
}
1817+
17991818
bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
18001819
MCStreamer &Out,
18011820
const MCSubtargetInfo *STI) {
@@ -6094,26 +6113,6 @@ bool MipsAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
60946113
return true;
60956114
}
60966115

6097-
bool MipsAsmParser::isEvaluated(const MCExpr *Expr) {
6098-
switch (Expr->getKind()) {
6099-
case MCExpr::Constant:
6100-
return true;
6101-
case MCExpr::SymbolRef:
6102-
return (cast<MCSymbolRefExpr>(Expr)->getKind() != MCSymbolRefExpr::VK_None);
6103-
case MCExpr::Binary: {
6104-
const MCBinaryExpr *BE = cast<MCBinaryExpr>(Expr);
6105-
if (!isEvaluated(BE->getLHS()))
6106-
return false;
6107-
return isEvaluated(BE->getRHS());
6108-
}
6109-
case MCExpr::Unary:
6110-
return isEvaluated(cast<MCUnaryExpr>(Expr)->getSubExpr());
6111-
case MCExpr::Target:
6112-
return true;
6113-
}
6114-
return false;
6115-
}
6116-
61176116
bool MipsAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
61186117
SMLoc &EndLoc) {
61196118
SmallVector<std::unique_ptr<MCParsedAsmOperand>, 1> Operands;

0 commit comments

Comments
 (0)