[llvm] 452d0b2 - [mips] Make MipsAsmParser::isEvaluated static function. NFC
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 05:08:00 PST 2019
Author: Simon Atanasyan
Date: 2019-11-20T16:07:16+03:00
New Revision: 452d0b21e00d6f80e3b12f9ffc4fb5bc4986f081
URL: https://github.com/llvm/llvm-project/commit/452d0b21e00d6f80e3b12f9ffc4fb5bc4986f081
DIFF: https://github.com/llvm/llvm-project/commit/452d0b21e00d6f80e3b12f9ffc4fb5bc4986f081.diff
LOG: [mips] Make MipsAsmParser::isEvaluated static function. NFC
Added:
Modified:
llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index 0ff9586f2585..cd64fcf2f4e3 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -339,7 +339,6 @@ class MipsAsmParser : public MCTargetAsmParser {
bool parseMemOffset(const MCExpr *&Res, bool isParenExpr);
- bool isEvaluated(const MCExpr *Expr);
bool parseSetMips0Directive();
bool parseSetArchDirective();
bool parseSetFeature(uint64_t Feature);
@@ -1796,6 +1795,26 @@ static unsigned countMCSymbolRefExpr(const MCExpr *Expr) {
return 0;
}
+static bool isEvaluated(const MCExpr *Expr) {
+ switch (Expr->getKind()) {
+ case MCExpr::Constant:
+ return true;
+ case MCExpr::SymbolRef:
+ return (cast<MCSymbolRefExpr>(Expr)->getKind() != MCSymbolRefExpr::VK_None);
+ case MCExpr::Binary: {
+ const MCBinaryExpr *BE = cast<MCBinaryExpr>(Expr);
+ if (!isEvaluated(BE->getLHS()))
+ return false;
+ return isEvaluated(BE->getRHS());
+ }
+ case MCExpr::Unary:
+ return isEvaluated(cast<MCUnaryExpr>(Expr)->getSubExpr());
+ case MCExpr::Target:
+ return true;
+ }
+ return false;
+}
+
bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
MCStreamer &Out,
const MCSubtargetInfo *STI) {
@@ -6094,26 +6113,6 @@ bool MipsAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
return true;
}
-bool MipsAsmParser::isEvaluated(const MCExpr *Expr) {
- switch (Expr->getKind()) {
- case MCExpr::Constant:
- return true;
- case MCExpr::SymbolRef:
- return (cast<MCSymbolRefExpr>(Expr)->getKind() != MCSymbolRefExpr::VK_None);
- case MCExpr::Binary: {
- const MCBinaryExpr *BE = cast<MCBinaryExpr>(Expr);
- if (!isEvaluated(BE->getLHS()))
- return false;
- return isEvaluated(BE->getRHS());
- }
- case MCExpr::Unary:
- return isEvaluated(cast<MCUnaryExpr>(Expr)->getSubExpr());
- case MCExpr::Target:
- return true;
- }
- return false;
-}
-
bool MipsAsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
SMLoc &EndLoc) {
SmallVector<std::unique_ptr<MCParsedAsmOperand>, 1> Operands;
More information about the llvm-commits
mailing list