Skip to content

Commit 6aa4468

Browse files
committed
Address comments
1 parent b8e3233 commit 6aa4468

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ class PPCAsmParser : public MCTargetAsmParser {
131131

132132
void processInstruction(MCInst &Inst, const OperandVector &Ops);
133133

134-
bool hasMemOp(const OperandVector &Ops);
135-
136134
/// @name Auto-generated Match Functions
137135
/// {
138136

@@ -187,7 +185,7 @@ struct PPCOperand : public MCParsedAsmOperand {
187185

188186
struct ImmOp {
189187
int64_t Val;
190-
bool IsMemOp;
188+
bool IsMemOpBase;
191189
};
192190

193191
struct ExprOp {
@@ -248,10 +246,8 @@ struct PPCOperand : public MCParsedAsmOperand {
248246
/// isPPC64 - True if this operand is for an instruction in 64-bit mode.
249247
bool isPPC64() const { return IsPPC64; }
250248

251-
/// isMemOp - True if this operand is a memory operand.
252-
bool isMemOp() const {
253-
return Kind == Immediate && Imm.IsMemOp;
254-
}
249+
/// isMemOpBase - True if this operand is the base of a memory operand.
250+
bool isMemOpBase() const { return Kind == Immediate && Imm.IsMemOpBase; }
255251

256252
int64_t getImm() const {
257253
assert(Kind == Immediate && "Invalid access!");
@@ -703,12 +699,11 @@ struct PPCOperand : public MCParsedAsmOperand {
703699
Op->IsPPC64 = IsPPC64;
704700
return Op;
705701
}
706-
707-
static std::unique_ptr<PPCOperand> CreateImm(int64_t Val, SMLoc S, SMLoc E,
708-
bool IsPPC64, bool IsMemOp = false) {
702+
static std::unique_ptr<PPCOperand>
703+
CreateImm(int64_t Val, SMLoc S, SMLoc E, bool IsPPC64, bool IsMemOpBase = false) {
709704
auto Op = std::make_unique<PPCOperand>(Immediate);
710705
Op->Imm.Val = Val;
711-
Op->Imm.IsMemOp = IsMemOp;
706+
Op->Imm.IsMemOpBase = IsMemOpBase;
712707
Op->StartLoc = S;
713708
Op->EndLoc = E;
714709
Op->IsPPC64 = IsPPC64;
@@ -1262,6 +1257,15 @@ void PPCAsmParser::processInstruction(MCInst &Inst,
12621257
static std::string PPCMnemonicSpellCheck(StringRef S, const FeatureBitset &FBS,
12631258
unsigned VariantID = 0);
12641259

1260+
static bool hasMemOp(const OperandVector &Operands) {
1261+
for (const auto &Operand : Operands) {
1262+
const PPCOperand &Op = static_cast<const PPCOperand &>(*Operand);
1263+
if (Op.isMemOpBase())
1264+
return true;
1265+
}
1266+
return false;
1267+
}
1268+
12651269
bool PPCAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
12661270
OperandVector &Operands,
12671271
MCStreamer &Out, uint64_t &ErrorInfo,
@@ -1630,7 +1634,8 @@ bool PPCAsmParser::parseOperand(OperandVector &Operands) {
16301634
E = Parser.getTok().getLoc();
16311635
if (parseToken(AsmToken::RParen, "missing ')'"))
16321636
return true;
1633-
Operands.push_back(PPCOperand::CreateImm(IntVal, S, E, isPPC64(), /*IsMemOp=*/true));
1637+
Operands.push_back(
1638+
PPCOperand::CreateImm(IntVal, S, E, isPPC64(), /*IsMemOpBase=*/true));
16341639
}
16351640

16361641
return false;
@@ -1918,12 +1923,3 @@ PPCAsmParser::applyModifierToExpr(const MCExpr *E,
19181923
return nullptr;
19191924
}
19201925
}
1921-
1922-
bool PPCAsmParser::hasMemOp(const OperandVector &Operands) {
1923-
for (const auto &Operand : Operands) {
1924-
const PPCOperand &Op = static_cast<const PPCOperand &>(*Operand);
1925-
if (Op.isMemOp())
1926-
return true;
1927-
}
1928-
return false;
1929-
}

0 commit comments

Comments
 (0)