mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
1. Remove ranges from itinerary data.
2. Tidy up the subtarget emittined code. llvm-svn: 24172
This commit is contained in:
parent
99bd05542a
commit
42681c1d58
@ -16,7 +16,6 @@
|
||||
#ifndef LLVM_TARGET_TARGETINSTRITINERARIES_H
|
||||
#define LLVM_TARGET_TARGETINSTRITINERARIES_H
|
||||
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
@ -49,36 +48,26 @@ struct InstrItinerary {
|
||||
// Instruction itinerary Data - Itinerary data supplied by a subtarget to be
|
||||
// used by a target.
|
||||
//
|
||||
class InstrItineraryData {
|
||||
struct InstrItineraryData {
|
||||
InstrStage *Stages; // Array of stages selected
|
||||
unsigned NStages; // Number of stages
|
||||
InstrItinerary *Itineratries; // Array of itineraries selected
|
||||
unsigned NItineraries; // Number of itineraries (actually classes)
|
||||
|
||||
public:
|
||||
|
||||
//
|
||||
// Ctors.
|
||||
//
|
||||
InstrItineraryData()
|
||||
: Stages(NULL), NStages(0), Itineratries(NULL), NItineraries(0)
|
||||
{}
|
||||
InstrItineraryData(InstrStage *S, unsigned NS, InstrItinerary *I, unsigned NI)
|
||||
: Stages(S), NStages(NS), Itineratries(I), NItineraries(NI)
|
||||
{}
|
||||
//
|
||||
// Ctors.
|
||||
//
|
||||
InstrItineraryData() : Stages(NULL), Itineratries(NULL) {}
|
||||
InstrItineraryData(InstrStage *S, InstrItinerary *I) : Stages(S), Itineratries(I) {}
|
||||
|
||||
//
|
||||
// isEmpty - Returns true if there are no itineraries.
|
||||
//
|
||||
inline bool isEmpty() const { return NItineraries == 0; }
|
||||
inline bool isEmpty() const { return Itineratries == NULL; }
|
||||
|
||||
//
|
||||
// begin - Return the first stage of the itinerary.
|
||||
//
|
||||
inline InstrStage *begin(unsigned ItinClassIndx) const {
|
||||
assert(ItinClassIndx < NItineraries && "Itinerary index out of range");
|
||||
unsigned StageIdx = Itineratries[ItinClassIndx].First;
|
||||
assert(StageIdx < NStages && "Stage index out of range");
|
||||
return Stages + StageIdx;
|
||||
}
|
||||
|
||||
@ -86,9 +75,7 @@ public:
|
||||
// end - Return the last+1 stage of the itinerary.
|
||||
//
|
||||
inline InstrStage *end(unsigned ItinClassIndx) const {
|
||||
assert(ItinClassIndx < NItineraries && "Itinerary index out of range");
|
||||
unsigned StageIdx = Itineratries[ItinClassIndx].Last;
|
||||
assert(StageIdx < NStages && "Stage index out of range");
|
||||
return Stages + StageIdx;
|
||||
}
|
||||
};
|
||||
|
@ -223,7 +223,7 @@ void SubtargetEmitter::FormItineraryString(Record *ItinData,
|
||||
|
||||
// Form string as ,{ cycles, u1 | u2 | ... | un }
|
||||
int Cycles = Stage->getValueAsInt("Cycles");
|
||||
ItinString += " ,{ " + itostr(Cycles) + ", ";
|
||||
ItinString += " { " + itostr(Cycles) + ", ";
|
||||
|
||||
// Get unit list
|
||||
std::vector<Record*> UnitList = Stage->getValueAsListOfDefs("Units");
|
||||
@ -260,7 +260,7 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS,
|
||||
|
||||
// Begin stages table
|
||||
OS << "static llvm::InstrStage Stages[] = {\n"
|
||||
" { 0, 0 } // No itinerary\n";
|
||||
" { 0, 0 }, // No itinerary\n";
|
||||
|
||||
unsigned ItinEnum = 1;
|
||||
std::map<std::string, unsigned> ItinMap;
|
||||
@ -296,8 +296,9 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS,
|
||||
|
||||
// If new itinerary
|
||||
if (Find == 0) {
|
||||
// Emit as ,{ cycles, u1 | u2 | ... | un } // index
|
||||
OS << ItinString << " // " << ItinEnum << "\n";
|
||||
// Emit as { cycles, u1 | u2 | ... | un }, // index
|
||||
OS << ItinString << ", // " << ItinEnum << "\n";
|
||||
// Record Itin class number
|
||||
ItinMap[ItinString] = Find = ItinEnum++;
|
||||
}
|
||||
|
||||
@ -316,6 +317,8 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS,
|
||||
ProcList.push_back(ItinList);
|
||||
}
|
||||
|
||||
// Closing stage
|
||||
OS << " { 0, 0 } // End itinerary\n";
|
||||
// End stages table
|
||||
OS << "};\n";
|
||||
|
||||
@ -390,7 +393,7 @@ void SubtargetEmitter::EmitProcessorLookup(std::ostream &OS) {
|
||||
// Begin processor table
|
||||
OS << "\n";
|
||||
OS << "// Sorted (by key) array of itineraries for CPU subtype.\n"
|
||||
<< "static const llvm::SubtargetInfoKV SubTypeInfoKV[] = {\n";
|
||||
<< "static const llvm::SubtargetInfoKV ProcItinKV[] = {\n";
|
||||
|
||||
// For each processor
|
||||
for (unsigned i = 0, N = ProcessorList.size(); i < N;) {
|
||||
@ -418,7 +421,7 @@ void SubtargetEmitter::EmitProcessorLookup(std::ostream &OS) {
|
||||
|
||||
// Emit size of table
|
||||
OS<<"\nenum {\n";
|
||||
OS<<" SubTypeInfoKVSize = sizeof(SubTypeInfoKV)/"
|
||||
OS<<" ProcItinKVSize = sizeof(ProcItinKV)/"
|
||||
"sizeof(llvm::SubtargetInfoKV)\n";
|
||||
OS<<"};\n";
|
||||
}
|
||||
@ -479,9 +482,8 @@ void SubtargetEmitter::ParseFeaturesFunction(std::ostream &OS) {
|
||||
if (HasItineraries) {
|
||||
OS << "\n"
|
||||
<< " InstrItinerary *Itinerary = (InstrItinerary *)"
|
||||
"Features.getInfo(SubTypeInfoKV, SubTypeInfoKVSize);\n"
|
||||
" InstrItins = InstrItineraryData(Stages, StagesSize, "
|
||||
"Itinerary, ItinClassesSize);\n";
|
||||
"Features.getInfo(ProcItinKV, ProcItinKVSize);\n"
|
||||
" InstrItins = InstrItineraryData(Stages, Itinerary);\n";
|
||||
}
|
||||
|
||||
OS << "}\n";
|
||||
|
Loading…
Reference in New Issue
Block a user