Skip to content

[TableGen] Replace all lingering uses of getName with getEnumName #113731

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

Merged
Show file tree
Hide file tree
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
13 changes: 0 additions & 13 deletions llvm/utils/TableGen/Common/CodeGenTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ MVT::SimpleValueType llvm::getValueType(const Record *Rec) {
return (MVT::SimpleValueType)Rec->getValueAsInt("Value");
}

StringRef llvm::getName(MVT::SimpleValueType T) {
switch (T) {
case MVT::Other:
return "UNKNOWN";
case MVT::iPTR:
return "TLI.getPointerTy()";
case MVT::iPTRAny:
return "TLI.getPointerTy()";
default:
return getEnumName(T);
}
}

StringRef llvm::getEnumName(MVT::SimpleValueType T) {
// clang-format off
switch (T) {
Expand Down
1 change: 0 additions & 1 deletion llvm/utils/TableGen/Common/CodeGenTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class CodeGenSubRegIndex;
/// record corresponds to.
MVT::SimpleValueType getValueType(const Record *Rec);

StringRef getName(MVT::SimpleValueType T);
StringRef getEnumName(MVT::SimpleValueType T);

/// getQualifiedName - Return the name of the specified record, with a
Expand Down
21 changes: 11 additions & 10 deletions llvm/utils/TableGen/FastISelEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,19 +718,20 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
const PredMap &PM = RI.second;

OS << "unsigned fastEmit_" << getLegalCName(Opcode) << "_"
<< getLegalCName(std::string(getName(VT))) << "_"
<< getLegalCName(std::string(getName(RetVT))) << "_";
<< getLegalCName(std::string(getEnumName(VT))) << "_"
<< getLegalCName(std::string(getEnumName(RetVT))) << "_";
Operands.PrintManglingSuffix(OS, ImmediatePredicates);
OS << "(";
Operands.PrintParameters(OS);
OS << ") {\n";

emitInstructionCode(OS, Operands, PM, std::string(getName(RetVT)));
emitInstructionCode(OS, Operands, PM,
std::string(getEnumName(RetVT)));
}

// Emit one function for the type that demultiplexes on return type.
OS << "unsigned fastEmit_" << getLegalCName(Opcode) << "_"
<< getLegalCName(std::string(getName(VT))) << "_";
<< getLegalCName(std::string(getEnumName(VT))) << "_";
Operands.PrintManglingSuffix(OS, ImmediatePredicates);
OS << "(MVT RetVT";
if (!Operands.empty())
Expand All @@ -739,10 +740,10 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
OS << ") {\nswitch (RetVT.SimpleTy) {\n";
for (const auto &RI : RM) {
MVT::SimpleValueType RetVT = RI.first;
OS << " case " << getName(RetVT) << ": return fastEmit_"
OS << " case " << getEnumName(RetVT) << ": return fastEmit_"
<< getLegalCName(Opcode) << "_"
<< getLegalCName(std::string(getName(VT))) << "_"
<< getLegalCName(std::string(getName(RetVT))) << "_";
<< getLegalCName(std::string(getEnumName(VT))) << "_"
<< getLegalCName(std::string(getEnumName(RetVT))) << "_";
Operands.PrintManglingSuffix(OS, ImmediatePredicates);
OS << "(";
Operands.PrintArguments(OS);
Expand All @@ -753,15 +754,15 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
} else {
// Non-variadic return type.
OS << "unsigned fastEmit_" << getLegalCName(Opcode) << "_"
<< getLegalCName(std::string(getName(VT))) << "_";
<< getLegalCName(std::string(getEnumName(VT))) << "_";
Operands.PrintManglingSuffix(OS, ImmediatePredicates);
OS << "(MVT RetVT";
if (!Operands.empty())
OS << ", ";
Operands.PrintParameters(OS);
OS << ") {\n";

OS << " if (RetVT.SimpleTy != " << getName(RM.begin()->first)
OS << " if (RetVT.SimpleTy != " << getEnumName(RM.begin()->first)
<< ")\n return 0;\n";

const PredMap &PM = RM.begin()->second;
Expand All @@ -781,7 +782,7 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
OS << " switch (VT.SimpleTy) {\n";
for (const auto &TI : TM) {
MVT::SimpleValueType VT = TI.first;
std::string TypeName = std::string(getName(VT));
std::string TypeName = std::string(getEnumName(VT));
OS << " case " << TypeName << ": return fastEmit_"
<< getLegalCName(Opcode) << "_" << getLegalCName(TypeName) << "_";
Operands.PrintManglingSuffix(OS, ImmediatePredicates);
Expand Down
Loading