diff options
| -rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 14 | ||||
| -rw-r--r-- | llvm/utils/TableGen/CodeGenTarget.h | 4 | ||||
| -rw-r--r-- | llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | 20 |
3 files changed, 19 insertions, 19 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index c839e5c0153..4ec7634efe8 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -36,7 +36,7 @@ namespace { class AsmWriterEmitter { RecordKeeper &Records; CodeGenTarget Target; - const std::vector<const CodeGenInstruction*> *NumberedInstructions; + ArrayRef<const CodeGenInstruction *> NumberedInstructions; std::vector<AsmWriterInst> Instructions; std::vector<std::string> PrintMethods; public: @@ -280,7 +280,7 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) { /// OpcodeInfo - This encodes the index of the string to use for the first /// chunk of the output as well as indices used for operand printing. - std::vector<uint64_t> OpcodeInfo(NumberedInstructions->size()); + std::vector<uint64_t> OpcodeInfo(NumberedInstructions.size()); const unsigned OpcodeInfoBits = 64; // Add all strings to the string table upfront so it can generate an optimized @@ -392,9 +392,9 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) { uint64_t Mask = (1ULL << TableSize) - 1; O << " static const uint" << TableSize << "_t OpInfo" << Table << "[] = {\n"; - for (unsigned i = 0, e = NumberedInstructions->size(); i != e; ++i) { + for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { O << " " << ((OpcodeInfo[i] >> Shift) & Mask) << "U,\t// " - << NumberedInstructions->at(i)->TheDef->getName() << "\n"; + << NumberedInstructions[i]->TheDef->getName() << "\n"; } O << " };\n\n"; // Emit string to combine the individual table lookups. @@ -1072,10 +1072,10 @@ AsmWriterEmitter::AsmWriterEmitter(RecordKeeper &R) : Records(R), Target(R) { unsigned Variant = AsmWriter->getValueAsInt("Variant"); // Get the instruction numbering. - NumberedInstructions = &Target.getInstructionsByEnumValue(); + NumberedInstructions = Target.getInstructionsByEnumValue(); - for (unsigned i = 0, e = NumberedInstructions->size(); i != e; ++i) { - const CodeGenInstruction *I = NumberedInstructions->at(i); + for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { + const CodeGenInstruction *I = NumberedInstructions[i]; if (!I->AsmString.empty() && I->TheDef->getName() != "PHI") Instructions.emplace_back(*I, i, Variant); } diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h index 604fe7351e8..da420c4f1a9 100644 --- a/llvm/utils/TableGen/CodeGenTarget.h +++ b/llvm/utils/TableGen/CodeGenTarget.h @@ -161,13 +161,13 @@ public: /// getInstructionsByEnumValue - Return all of the instructions defined by the /// target, ordered by their enum value. - const std::vector<const CodeGenInstruction*> & + ArrayRef<const CodeGenInstruction *> getInstructionsByEnumValue() const { if (InstrsByEnum.empty()) ComputeInstrsByEnum(); return InstrsByEnum; } - typedef std::vector<const CodeGenInstruction*>::const_iterator inst_iterator; + typedef ArrayRef<const CodeGenInstruction *>::const_iterator inst_iterator; inst_iterator inst_begin() const{return getInstructionsByEnumValue().begin();} inst_iterator inst_end() const { return getInstructionsByEnumValue().end(); } iterator_range<inst_iterator> instructions() const { diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 8ca4a1bf540..9efc09e1822 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -78,7 +78,7 @@ struct DecoderTableInfo { namespace { class FixedLenDecoderEmitter { - const std::vector<const CodeGenInstruction*> *NumberedInstructions; + ArrayRef<const CodeGenInstruction *> NumberedInstructions; public: // Defaults preserved here for documentation, even though they aren't @@ -306,7 +306,7 @@ protected: friend class Filter; // Vector of codegen instructions to choose our filter. - const std::vector<const CodeGenInstruction*> &AllInstructions; + ArrayRef<const CodeGenInstruction *> AllInstructions; // Vector of uid's for this filter chooser to work on. const std::vector<unsigned> &Opcodes; @@ -337,7 +337,7 @@ protected: void operator=(const FilterChooser &) = delete; public: - FilterChooser(const std::vector<const CodeGenInstruction*> &Insts, + FilterChooser(ArrayRef<const CodeGenInstruction *> Insts, const std::vector<unsigned> &IDs, const std::map<unsigned, std::vector<OperandInfo> > &Ops, unsigned BW, @@ -348,7 +348,7 @@ public: doFilter(); } - FilterChooser(const std::vector<const CodeGenInstruction*> &Insts, + FilterChooser(ArrayRef<const CodeGenInstruction *> Insts, const std::vector<unsigned> &IDs, const std::map<unsigned, std::vector<OperandInfo> > &Ops, const std::vector<bit_value_t> &ParentFilterBitValues, @@ -806,7 +806,7 @@ void FixedLenDecoderEmitter::emitTable(formatted_raw_ostream &OS, if (!IsTry) { OS << "// Opcode: " - << NumberedInstructions->at(Opc)->TheDef->getName() << "\n"; + << NumberedInstructions[Opc]->TheDef->getName() << "\n"; break; } @@ -821,7 +821,7 @@ void FixedLenDecoderEmitter::emitTable(formatted_raw_ostream &OS, NumToSkip |= Byte << 8; OS << "// Opcode: " - << NumberedInstructions->at(Opc)->TheDef->getName() + << NumberedInstructions[Opc]->TheDef->getName() << ", skip to: " << ((I - Table.begin()) + NumToSkip) << "\n"; break; } @@ -2250,13 +2250,13 @@ void FixedLenDecoderEmitter::run(raw_ostream &o) { Target.reverseBitsForLittleEndianEncoding(); // Parameterize the decoders based on namespace and instruction width. - NumberedInstructions = &Target.getInstructionsByEnumValue(); + NumberedInstructions = Target.getInstructionsByEnumValue(); std::map<std::pair<std::string, unsigned>, std::vector<unsigned> > OpcMap; std::map<unsigned, std::vector<OperandInfo> > Operands; - for (unsigned i = 0; i < NumberedInstructions->size(); ++i) { - const CodeGenInstruction *Inst = NumberedInstructions->at(i); + for (unsigned i = 0; i < NumberedInstructions.size(); ++i) { + const CodeGenInstruction *Inst = NumberedInstructions[i]; const Record *Def = Inst->TheDef; unsigned Size = Def->getValueAsInt("Size"); if (Def->getValueAsString("Namespace") == "TargetOpcode" || @@ -2277,7 +2277,7 @@ void FixedLenDecoderEmitter::run(raw_ostream &o) { DecoderTableInfo TableInfo; for (const auto &Opc : OpcMap) { // Emit the decoder for this namespace+width combination. - FilterChooser FC(*NumberedInstructions, Opc.second, Operands, + FilterChooser FC(NumberedInstructions, Opc.second, Operands, 8*Opc.first.second, this); // The decode table is cleared for each top level decoder function. The |

