[llvm] r307363 - [TableGen] Cleanup capturing of instruction namespace for the fast isel emitter to remove a std::string and duplicated code. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 23:22:36 PDT 2017
Author: ctopper
Date: Thu Jul 6 23:22:36 2017
New Revision: 307363
URL: http://llvm.org/viewvc/llvm-project?rev=307363&view=rev
Log:
[TableGen] Cleanup capturing of instruction namespace for the fast isel emitter to remove a std::string and duplicated code. NFC
Modified:
llvm/trunk/utils/TableGen/FastISelEmitter.cpp
Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=307363&r1=307362&r2=307363&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Thu Jul 6 23:22:36 2017
@@ -390,10 +390,10 @@ class FastISelMap {
std::map<OperandsSignature, std::vector<OperandsSignature> >
SignaturesWithConstantForms;
- std::string InstNS;
+ StringRef InstNS;
ImmPredicateSet ImmediatePredicates;
public:
- explicit FastISelMap(std::string InstNS);
+ explicit FastISelMap(StringRef InstNS);
void collectPatterns(CodeGenDAGPatterns &CGP);
void printImmediatePredicates(raw_ostream &OS);
@@ -417,7 +417,7 @@ static std::string getLegalCName(std::st
return OpName;
}
-FastISelMap::FastISelMap(std::string instns) : InstNS(std::move(instns)) {}
+FastISelMap::FastISelMap(StringRef instns) : InstNS(instns) {}
static std::string PhyRegForNode(TreePatternNode *Op,
const CodeGenTarget &Target) {
@@ -440,10 +440,6 @@ static std::string PhyRegForNode(TreePat
void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) {
const CodeGenTarget &Target = CGP.getTargetInfo();
- // Determine the target's namespace name.
- InstNS = Target.getInstNamespace().str() + "::";
- assert(InstNS.size() > 2 && "Can't determine target-specific namespace!");
-
// Scan through all the patterns and record the simple ones.
for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(),
E = CGP.ptm_end(); I != E; ++I) {
@@ -659,8 +655,8 @@ void FastISelMap::emitInstructionCode(ra
if (Memo.SubRegNo.empty()) {
Operands.PrintManglingSuffix(OS, *Memo.PhysRegs,
ImmediatePredicates, true);
- OS << "(" << InstNS << Memo.Name << ", ";
- OS << "&" << InstNS << Memo.RC->getName() << "RegClass";
+ OS << "(" << InstNS << "::" << Memo.Name << ", ";
+ OS << "&" << InstNS << "::" << Memo.RC->getName() << "RegClass";
if (!Operands.empty())
OS << ", ";
Operands.PrintArguments(OS, *Memo.PhysRegs);
@@ -873,8 +869,8 @@ void EmitFastISel(RecordKeeper &RK, raw_
Target.getName().str() + " target", OS);
// Determine the target's namespace name.
- std::string InstNS = Target.getInstNamespace().str() + "::";
- assert(InstNS.size() > 2 && "Can't determine target-specific namespace!");
+ StringRef InstNS = Target.getInstNamespace();
+ assert(!InstNS.empty() && "Can't determine target-specific namespace!");
FastISelMap F(InstNS);
F.collectPatterns(CGP);
More information about the llvm-commits
mailing list