Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[M68k][NFC] Rename M68kOperand::Kind to KindTy #112

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ struct M68kMemOp {
class M68kOperand : public MCParsedAsmOperand {
typedef MCParsedAsmOperand Base;

enum class Kind {
enum class KindTy {
Invalid,
Token,
Imm,
MemOp,
};

Kind Kind;
KindTy Kind;
SMLoc Start, End;
union {
StringRef Token;
Expand All @@ -134,7 +134,7 @@ class M68kOperand : public MCParsedAsmOperand {
};

public:
M68kOperand(enum Kind Kind, SMLoc Start, SMLoc End)
M68kOperand(KindTy Kind, SMLoc Start, SMLoc End)
: Base(), Kind(Kind), Start(Start), End(End) {}

SMLoc getStartLoc() const override { return Start; }
Expand All @@ -143,7 +143,7 @@ class M68kOperand : public MCParsedAsmOperand {
void print(raw_ostream &OS) const override;

bool isMem() const override { return false; }
bool isMemOp() const { return Kind == Kind::MemOp; }
bool isMemOp() const { return Kind == KindTy::MemOp; }

static void addExpr(MCInst &Inst, const MCExpr *Expr);

Expand Down Expand Up @@ -248,7 +248,7 @@ void M68kOperand::addExpr(MCInst &Inst, const MCExpr *Expr) {

// Reg
bool M68kOperand::isReg() const {
return Kind == Kind::MemOp && MemOp.Op == M68kMemOp::Kind::Reg;
return Kind == KindTy::MemOp && MemOp.Op == M68kMemOp::Kind::Reg;
}

unsigned M68kOperand::getReg() const {
Expand All @@ -265,27 +265,27 @@ void M68kOperand::addRegOperands(MCInst &Inst, unsigned N) const {

std::unique_ptr<M68kOperand> M68kOperand::createMemOp(M68kMemOp MemOp,
SMLoc Start, SMLoc End) {
auto Op = std::make_unique<M68kOperand>(Kind::MemOp, Start, End);
auto Op = std::make_unique<M68kOperand>(KindTy::MemOp, Start, End);
Op->MemOp = MemOp;
return Op;
}

// Token
bool M68kOperand::isToken() const { return Kind == Kind::Token; }
bool M68kOperand::isToken() const { return Kind == KindTy::Token; }
StringRef M68kOperand::getToken() const {
assert(isToken());
return Token;
}

std::unique_ptr<M68kOperand> M68kOperand::createToken(StringRef Token,
SMLoc Start, SMLoc End) {
auto Op = std::make_unique<M68kOperand>(Kind::Token, Start, End);
auto Op = std::make_unique<M68kOperand>(KindTy::Token, Start, End);
Op->Token = Token;
return Op;
}

// Imm
bool M68kOperand::isImm() const { return Kind == Kind::Imm; }
bool M68kOperand::isImm() const { return Kind == KindTy::Imm; }
void M68kOperand::addImmOperands(MCInst &Inst, unsigned N) const {
assert(isImm() && "wrong oeprand kind");
assert((N == 1) && "can only handle one register operand");
Expand All @@ -295,7 +295,7 @@ void M68kOperand::addImmOperands(MCInst &Inst, unsigned N) const {

std::unique_ptr<M68kOperand> M68kOperand::createImm(const MCExpr *Expr,
SMLoc Start, SMLoc End) {
auto Op = std::make_unique<M68kOperand>(Kind::Imm, Start, End);
auto Op = std::make_unique<M68kOperand>(KindTy::Imm, Start, End);
Op->Expr = Expr;
return Op;
}
Expand Down Expand Up @@ -842,19 +842,19 @@ bool M68kAsmParser::MatchAndEmitInstruction(SMLoc Loc, unsigned &Opcode,

void M68kOperand::print(raw_ostream &OS) const {
switch (Kind) {
case Kind::Invalid:
case KindTy::Invalid:
OS << "invalid";
break;

case Kind::Token:
case KindTy::Token:
OS << "token '" << Token << "'";
break;

case Kind::Imm:
case KindTy::Imm:
OS << "immediate " << Imm;
break;

case Kind::MemOp:
case KindTy::MemOp:
MemOp.print(OS);
break;
}
Expand Down