1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[TableGen] Cleanup capturing of instruction namespace for the fast isel emitter to remove a std::string and duplicated code. NFC

llvm-svn: 307363
This commit is contained in:
Craig Topper 2017-07-07 06:22:36 +00:00
parent c19a7dc04a
commit 638d01fc9f

View File

@ -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::string OpName) {
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(TreePatternNode *Op,
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(raw_ostream &OS,
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_ostream &OS) {
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);