forked from OSchip/llvm-project
[mips] Make MipsAsmParser::isEvaluated static function. NFC
This commit is contained in:
parent
525f9c0be5
commit
452d0b21e0
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue