mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-22 05:51:42 +00:00
[TableGen] Use StringRef instead of std::string for CodeGenInstruction namespace. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307362 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2986f4761d
commit
77eddb74c0
@ -137,12 +137,12 @@ static void EmitInstructions(std::vector<AsmWriterInst> &Insts,
|
||||
O << " switch (MI->getOpcode()) {\n";
|
||||
O << " default: llvm_unreachable(\"Unexpected opcode.\");\n";
|
||||
std::vector<std::pair<std::string, AsmWriterOperand>> OpsToPrint;
|
||||
OpsToPrint.push_back(std::make_pair(FirstInst.CGI->Namespace + "::" +
|
||||
OpsToPrint.push_back(std::make_pair(FirstInst.CGI->Namespace.str() + "::" +
|
||||
FirstInst.CGI->TheDef->getName().str(),
|
||||
FirstInst.Operands[i]));
|
||||
|
||||
for (const AsmWriterInst &AWI : SimilarInsts) {
|
||||
OpsToPrint.push_back(std::make_pair(AWI.CGI->Namespace+"::" +
|
||||
OpsToPrint.push_back(std::make_pair(AWI.CGI->Namespace.str()+"::" +
|
||||
AWI.CGI->TheDef->getName().str(),
|
||||
AWI.Operands[i]));
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ template <typename T> class ArrayRef;
|
||||
class CodeGenInstruction {
|
||||
public:
|
||||
Record *TheDef; // The actual record defining this instruction.
|
||||
std::string Namespace; // The namespace the instruction is in.
|
||||
StringRef Namespace; // The namespace the instruction is in.
|
||||
|
||||
/// AsmString - The format string used to emit a .s file for the
|
||||
/// instruction.
|
||||
|
@ -367,7 +367,7 @@ unsigned MapTableEmitter::emitBinSearchTable(raw_ostream &OS) {
|
||||
|
||||
ArrayRef<const CodeGenInstruction*> NumberedInstructions =
|
||||
Target.getInstructionsByEnumValue();
|
||||
std::string Namespace = Target.getInstNamespace();
|
||||
StringRef Namespace = Target.getInstNamespace();
|
||||
const std::vector<ListInit*> &ValueCols = InstrMapDesc.getValueCols();
|
||||
unsigned NumCol = ValueCols.size();
|
||||
unsigned TotalNumInstr = NumberedInstructions.size();
|
||||
@ -567,7 +567,7 @@ namespace llvm {
|
||||
//===----------------------------------------------------------------------===//
|
||||
void EmitMapTable(RecordKeeper &Records, raw_ostream &OS) {
|
||||
CodeGenTarget Target(Records);
|
||||
std::string NameSpace = Target.getInstNamespace();
|
||||
StringRef NameSpace = Target.getInstNamespace();
|
||||
std::vector<Record*> InstrMapVec;
|
||||
InstrMapVec = Records.getAllDerivedDefinitions("InstrMapping");
|
||||
|
||||
|
@ -207,7 +207,7 @@ const StringRef CodeGenTarget::getName() const {
|
||||
return TargetRec->getName();
|
||||
}
|
||||
|
||||
std::string CodeGenTarget::getInstNamespace() const {
|
||||
StringRef CodeGenTarget::getInstNamespace() const {
|
||||
for (const CodeGenInstruction *Inst : getInstructionsByEnumValue()) {
|
||||
// Make sure not to pick up "TargetOpcode" by accidentally getting
|
||||
// the namespace off the PHI instruction or something.
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
|
||||
/// getInstNamespace - Return the target-specific instruction namespace.
|
||||
///
|
||||
std::string getInstNamespace() const;
|
||||
StringRef getInstNamespace() const;
|
||||
|
||||
/// getInstructionSet - Return the InstructionSet object.
|
||||
///
|
||||
|
@ -886,7 +886,7 @@ EmitResultInstructionAsOperand(const TreePatternNode *N,
|
||||
assert((!ResultVTs.empty() || TreeHasOutGlue || NodeHasChain) &&
|
||||
"Node has no result");
|
||||
|
||||
AddMatcher(new EmitNodeMatcher(II.Namespace+"::"+II.TheDef->getName().str(),
|
||||
AddMatcher(new EmitNodeMatcher(II.Namespace.str()+"::"+II.TheDef->getName().str(),
|
||||
ResultVTs, InstOps,
|
||||
NodeHasChain, TreeHasInGlue, TreeHasOutGlue,
|
||||
NodeHasMemRefs, NumFixedArityOperands,
|
||||
|
@ -441,7 +441,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) {
|
||||
const CodeGenTarget &Target = CGP.getTargetInfo();
|
||||
|
||||
// Determine the target's namespace name.
|
||||
InstNS = Target.getInstNamespace() + "::";
|
||||
InstNS = Target.getInstNamespace().str() + "::";
|
||||
assert(InstNS.size() > 2 && "Can't determine target-specific namespace!");
|
||||
|
||||
// Scan through all the patterns and record the simple ones.
|
||||
@ -873,7 +873,7 @@ void EmitFastISel(RecordKeeper &RK, raw_ostream &OS) {
|
||||
Target.getName().str() + " target", OS);
|
||||
|
||||
// Determine the target's namespace name.
|
||||
std::string InstNS = Target.getInstNamespace() + "::";
|
||||
std::string InstNS = Target.getInstNamespace().str() + "::";
|
||||
assert(InstNS.size() > 2 && "Can't determine target-specific namespace!");
|
||||
|
||||
FastISelMap F(InstNS);
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
void emitOperandTypesEnum(raw_ostream &OS, const CodeGenTarget &Target);
|
||||
void initOperandMapData(
|
||||
ArrayRef<const CodeGenInstruction *> NumberedInstructions,
|
||||
const std::string &Namespace,
|
||||
StringRef Namespace,
|
||||
std::map<std::string, unsigned> &Operands,
|
||||
OpNameMapTy &OperandMap);
|
||||
void emitOperandNameMappings(raw_ostream &OS, const CodeGenTarget &Target,
|
||||
@ -207,7 +207,7 @@ void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS,
|
||||
/// well as the getNamedOperandIdx() function.
|
||||
void InstrInfoEmitter::initOperandMapData(
|
||||
ArrayRef<const CodeGenInstruction *> NumberedInstructions,
|
||||
const std::string &Namespace,
|
||||
StringRef Namespace,
|
||||
std::map<std::string, unsigned> &Operands,
|
||||
OpNameMapTy &OperandMap) {
|
||||
unsigned NumOperands = 0;
|
||||
@ -224,7 +224,7 @@ void InstrInfoEmitter::initOperandMapData(
|
||||
}
|
||||
OpList[I->second] = Info.MIOperandNo;
|
||||
}
|
||||
OperandMap[OpList].push_back(Namespace + "::" +
|
||||
OperandMap[OpList].push_back(Namespace.str() + "::" +
|
||||
Inst->TheDef->getName().str());
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ void InstrInfoEmitter::initOperandMapData(
|
||||
void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS,
|
||||
const CodeGenTarget &Target,
|
||||
ArrayRef<const CodeGenInstruction*> NumberedInstructions) {
|
||||
const std::string &Namespace = Target.getInstNamespace();
|
||||
StringRef Namespace = Target.getInstNamespace();
|
||||
std::string OpNameNS = "OpName";
|
||||
// Map of operand names to their enumeration value. This will be used to
|
||||
// generate the OpName enum.
|
||||
@ -315,7 +315,7 @@ void InstrInfoEmitter::emitOperandNameMappings(raw_ostream &OS,
|
||||
void InstrInfoEmitter::emitOperandTypesEnum(raw_ostream &OS,
|
||||
const CodeGenTarget &Target) {
|
||||
|
||||
const std::string &Namespace = Target.getInstNamespace();
|
||||
StringRef Namespace = Target.getInstNamespace();
|
||||
std::vector<Record *> Operands = Records.getAllDerivedDefinitions("Operand");
|
||||
|
||||
OS << "#ifdef GET_INSTRINFO_OPERAND_TYPES_ENUM\n";
|
||||
@ -576,7 +576,7 @@ void InstrInfoEmitter::emitEnums(raw_ostream &OS) {
|
||||
CodeGenTarget Target(Records);
|
||||
|
||||
// We must emit the PHI opcode first...
|
||||
std::string Namespace = Target.getInstNamespace();
|
||||
StringRef Namespace = Target.getInstNamespace();
|
||||
|
||||
if (Namespace.empty())
|
||||
PrintFatalError("No instructions defined!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user