mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-12 16:29:31 +00:00
use space star instead of star space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145944 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f6f77e90a1
commit
464f3a332f
@ -49,8 +49,8 @@ private:
|
|||||||
void ReadTable(unsigned int state);
|
void ReadTable(unsigned int state);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DFAPacketizer(const InstrItineraryData* I, const int (*SIT)[2],
|
DFAPacketizer(const InstrItineraryData *I, const int (*SIT)[2],
|
||||||
const unsigned* SET);
|
const unsigned *SET);
|
||||||
|
|
||||||
// Reset the current state to make all resources available.
|
// Reset the current state to make all resources available.
|
||||||
void clearResources() {
|
void clearResources() {
|
||||||
@ -59,19 +59,19 @@ public:
|
|||||||
|
|
||||||
// canReserveResources - Check if the resources occupied by a MCInstrDesc
|
// canReserveResources - Check if the resources occupied by a MCInstrDesc
|
||||||
// are available in the current state.
|
// are available in the current state.
|
||||||
bool canReserveResources(const llvm::MCInstrDesc* MID);
|
bool canReserveResources(const llvm::MCInstrDesc *MID);
|
||||||
|
|
||||||
// reserveResources - Reserve the resources occupied by a MCInstrDesc and
|
// reserveResources - Reserve the resources occupied by a MCInstrDesc and
|
||||||
// change the current state to reflect that change.
|
// change the current state to reflect that change.
|
||||||
void reserveResources(const llvm::MCInstrDesc* MID);
|
void reserveResources(const llvm::MCInstrDesc *MID);
|
||||||
|
|
||||||
// canReserveResources - Check if the resources occupied by a machine
|
// canReserveResources - Check if the resources occupied by a machine
|
||||||
// instruction are available in the current state.
|
// instruction are available in the current state.
|
||||||
bool canReserveResources(llvm::MachineInstr* MI);
|
bool canReserveResources(llvm::MachineInstr *MI);
|
||||||
|
|
||||||
// reserveResources - Reserve the resources occupied by a machine
|
// reserveResources - Reserve the resources occupied by a machine
|
||||||
// instruction and change the current state to reflect that change.
|
// instruction and change the current state to reflect that change.
|
||||||
void reserveResources(llvm::MachineInstr* MI);
|
void reserveResources(llvm::MachineInstr *MI);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
DFAPacketizer::DFAPacketizer(const InstrItineraryData *I, const int (*SIT)[2],
|
DFAPacketizer::DFAPacketizer(const InstrItineraryData *I, const int (*SIT)[2],
|
||||||
const unsigned* SET):
|
const unsigned *SET):
|
||||||
InstrItins(I), CurrentState(0), DFAStateInputTable(SIT),
|
InstrItins(I), CurrentState(0), DFAStateInputTable(SIT),
|
||||||
DFAStateEntryTable(SET) {}
|
DFAStateEntryTable(SET) {}
|
||||||
|
|
||||||
@ -60,9 +60,9 @@ void DFAPacketizer::ReadTable(unsigned int state) {
|
|||||||
|
|
||||||
// canReserveResources - Check if the resources occupied by a MCInstrDesc
|
// canReserveResources - Check if the resources occupied by a MCInstrDesc
|
||||||
// are available in the current state.
|
// are available in the current state.
|
||||||
bool DFAPacketizer::canReserveResources(const llvm::MCInstrDesc* MID) {
|
bool DFAPacketizer::canReserveResources(const llvm::MCInstrDesc *MID) {
|
||||||
unsigned InsnClass = MID->getSchedClass();
|
unsigned InsnClass = MID->getSchedClass();
|
||||||
const llvm::InstrStage* IS = InstrItins->beginStage(InsnClass);
|
const llvm::InstrStage *IS = InstrItins->beginStage(InsnClass);
|
||||||
unsigned FuncUnits = IS->getUnits();
|
unsigned FuncUnits = IS->getUnits();
|
||||||
UnsignPair StateTrans = UnsignPair(CurrentState, FuncUnits);
|
UnsignPair StateTrans = UnsignPair(CurrentState, FuncUnits);
|
||||||
ReadTable(CurrentState);
|
ReadTable(CurrentState);
|
||||||
@ -72,9 +72,9 @@ bool DFAPacketizer::canReserveResources(const llvm::MCInstrDesc* MID) {
|
|||||||
|
|
||||||
// reserveResources - Reserve the resources occupied by a MCInstrDesc and
|
// reserveResources - Reserve the resources occupied by a MCInstrDesc and
|
||||||
// change the current state to reflect that change.
|
// change the current state to reflect that change.
|
||||||
void DFAPacketizer::reserveResources(const llvm::MCInstrDesc* MID) {
|
void DFAPacketizer::reserveResources(const llvm::MCInstrDesc *MID) {
|
||||||
unsigned InsnClass = MID->getSchedClass();
|
unsigned InsnClass = MID->getSchedClass();
|
||||||
const llvm::InstrStage* IS = InstrItins->beginStage(InsnClass);
|
const llvm::InstrStage *IS = InstrItins->beginStage(InsnClass);
|
||||||
unsigned FuncUnits = IS->getUnits();
|
unsigned FuncUnits = IS->getUnits();
|
||||||
UnsignPair StateTrans = UnsignPair(CurrentState, FuncUnits);
|
UnsignPair StateTrans = UnsignPair(CurrentState, FuncUnits);
|
||||||
ReadTable(CurrentState);
|
ReadTable(CurrentState);
|
||||||
@ -85,14 +85,14 @@ void DFAPacketizer::reserveResources(const llvm::MCInstrDesc* MID) {
|
|||||||
|
|
||||||
// canReserveResources - Check if the resources occupied by a machine
|
// canReserveResources - Check if the resources occupied by a machine
|
||||||
// instruction are available in the current state.
|
// instruction are available in the current state.
|
||||||
bool DFAPacketizer::canReserveResources(llvm::MachineInstr* MI) {
|
bool DFAPacketizer::canReserveResources(llvm::MachineInstr *MI) {
|
||||||
const llvm::MCInstrDesc& MID = MI->getDesc();
|
const llvm::MCInstrDesc &MID = MI->getDesc();
|
||||||
return canReserveResources(&MID);
|
return canReserveResources(&MID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reserveResources - Reserve the resources occupied by a machine
|
// reserveResources - Reserve the resources occupied by a machine
|
||||||
// instruction and change the current state to reflect that change.
|
// instruction and change the current state to reflect that change.
|
||||||
void DFAPacketizer::reserveResources(llvm::MachineInstr* MI) {
|
void DFAPacketizer::reserveResources(llvm::MachineInstr *MI) {
|
||||||
const llvm::MCInstrDesc& MID = MI->getDesc();
|
const llvm::MCInstrDesc &MID = MI->getDesc();
|
||||||
reserveResources(&MID);
|
reserveResources(&MID);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class State {
|
|||||||
std::set<unsigned> stateInfo;
|
std::set<unsigned> stateInfo;
|
||||||
|
|
||||||
State();
|
State();
|
||||||
State(const State& S);
|
State(const State &S);
|
||||||
|
|
||||||
//
|
//
|
||||||
// canAddInsnClass - Returns true if an instruction of type InsnClass is a
|
// canAddInsnClass - Returns true if an instruction of type InsnClass is a
|
||||||
@ -63,7 +63,7 @@ class State {
|
|||||||
// PossibleStates is the set of valid resource states that ensue from valid
|
// PossibleStates is the set of valid resource states that ensue from valid
|
||||||
// transitions.
|
// transitions.
|
||||||
//
|
//
|
||||||
bool canAddInsnClass(unsigned InsnClass, std::set<unsigned>& PossibleStates);
|
bool canAddInsnClass(unsigned InsnClass, std::set<unsigned> &PossibleStates);
|
||||||
};
|
};
|
||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
@ -73,11 +73,11 @@ struct Transition {
|
|||||||
public:
|
public:
|
||||||
static int currentTransitionNum;
|
static int currentTransitionNum;
|
||||||
int transitionNum;
|
int transitionNum;
|
||||||
State* from;
|
State *from;
|
||||||
unsigned input;
|
unsigned input;
|
||||||
State* to;
|
State *to;
|
||||||
|
|
||||||
Transition(State* from_, unsigned input_, State* to_);
|
Transition(State *from_, unsigned input_, State *to_);
|
||||||
};
|
};
|
||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ struct Transition {
|
|||||||
//
|
//
|
||||||
namespace {
|
namespace {
|
||||||
struct ltState {
|
struct ltState {
|
||||||
bool operator()(const State* s1, const State* s2) const;
|
bool operator()(const State *s1, const State *s2) const;
|
||||||
};
|
};
|
||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
|
|
||||||
// Map from a state to the list of transitions with that state as source.
|
// Map from a state to the list of transitions with that state as source.
|
||||||
std::map<State*, SmallVector<Transition*, 16>, ltState> stateTransitions;
|
std::map<State*, SmallVector<Transition*, 16>, ltState> stateTransitions;
|
||||||
State* currentState;
|
State *currentState;
|
||||||
|
|
||||||
// Highest valued Input seen.
|
// Highest valued Input seen.
|
||||||
unsigned LargestInput;
|
unsigned LargestInput;
|
||||||
@ -114,25 +114,25 @@ public:
|
|||||||
// Modify the DFA.
|
// Modify the DFA.
|
||||||
//
|
//
|
||||||
void initialize();
|
void initialize();
|
||||||
void addState(State*);
|
void addState(State *);
|
||||||
void addTransition(Transition*);
|
void addTransition(Transition *);
|
||||||
|
|
||||||
//
|
//
|
||||||
// getTransition - Return the state when a transition is made from
|
// getTransition - Return the state when a transition is made from
|
||||||
// State From with Input I. If a transition is not found, return NULL.
|
// State From with Input I. If a transition is not found, return NULL.
|
||||||
//
|
//
|
||||||
State* getTransition(State*, unsigned);
|
State *getTransition(State *, unsigned);
|
||||||
|
|
||||||
//
|
//
|
||||||
// isValidTransition: Predicate that checks if there is a valid transition
|
// isValidTransition: Predicate that checks if there is a valid transition
|
||||||
// from state From on input InsnClass.
|
// from state From on input InsnClass.
|
||||||
//
|
//
|
||||||
bool isValidTransition(State* From, unsigned InsnClass);
|
bool isValidTransition(State *From, unsigned InsnClass);
|
||||||
|
|
||||||
//
|
//
|
||||||
// writeTable: Print out a table representing the DFA.
|
// writeTable: Print out a table representing the DFA.
|
||||||
//
|
//
|
||||||
void writeTableAndAPI(raw_ostream &OS, const std::string& ClassName);
|
void writeTableAndAPI(raw_ostream &OS, const std::string &ClassName);
|
||||||
};
|
};
|
||||||
} // End anonymous namespace.
|
} // End anonymous namespace.
|
||||||
|
|
||||||
@ -144,12 +144,12 @@ State::State() :
|
|||||||
stateNum(currentStateNum++), isInitial(false) {}
|
stateNum(currentStateNum++), isInitial(false) {}
|
||||||
|
|
||||||
|
|
||||||
State::State(const State& S) :
|
State::State(const State &S) :
|
||||||
stateNum(currentStateNum++), isInitial(S.isInitial),
|
stateNum(currentStateNum++), isInitial(S.isInitial),
|
||||||
stateInfo(S.stateInfo) {}
|
stateInfo(S.stateInfo) {}
|
||||||
|
|
||||||
|
|
||||||
Transition::Transition(State* from_, unsigned input_, State* to_) :
|
Transition::Transition(State *from_, unsigned input_, State *to_) :
|
||||||
transitionNum(currentTransitionNum++), from(from_), input(input_),
|
transitionNum(currentTransitionNum++), from(from_), input(input_),
|
||||||
to(to_) {}
|
to(to_) {}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ DFA::DFA() :
|
|||||||
LargestInput(0) {}
|
LargestInput(0) {}
|
||||||
|
|
||||||
|
|
||||||
bool ltState::operator()(const State* s1, const State* s2) const {
|
bool ltState::operator()(const State *s1, const State *s2) const {
|
||||||
return (s1->stateNum < s2->stateNum);
|
return (s1->stateNum < s2->stateNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ bool ltState::operator()(const State* s1, const State* s2) const {
|
|||||||
// transitions.
|
// transitions.
|
||||||
//
|
//
|
||||||
bool State::canAddInsnClass(unsigned InsnClass,
|
bool State::canAddInsnClass(unsigned InsnClass,
|
||||||
std::set<unsigned>& PossibleStates) {
|
std::set<unsigned> &PossibleStates) {
|
||||||
//
|
//
|
||||||
// Iterate over all resource states in currentState.
|
// Iterate over all resource states in currentState.
|
||||||
//
|
//
|
||||||
@ -224,13 +224,13 @@ void DFA::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DFA::addState(State* S) {
|
void DFA::addState(State *S) {
|
||||||
assert(!states.count(S) && "State already exists");
|
assert(!states.count(S) && "State already exists");
|
||||||
states.insert(S);
|
states.insert(S);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DFA::addTransition(Transition* T) {
|
void DFA::addTransition(Transition *T) {
|
||||||
// Update LargestInput.
|
// Update LargestInput.
|
||||||
if (T->input > LargestInput)
|
if (T->input > LargestInput)
|
||||||
LargestInput = T->input;
|
LargestInput = T->input;
|
||||||
@ -244,7 +244,7 @@ void DFA::addTransition(Transition* T) {
|
|||||||
// getTransition - Return the state when a transition is made from
|
// getTransition - Return the state when a transition is made from
|
||||||
// State From with Input I. If a transition is not found, return NULL.
|
// State From with Input I. If a transition is not found, return NULL.
|
||||||
//
|
//
|
||||||
State* DFA::getTransition(State* From, unsigned I) {
|
State *DFA::getTransition(State *From, unsigned I) {
|
||||||
// Do we have a transition from state From?
|
// Do we have a transition from state From?
|
||||||
if (!stateTransitions.count(From))
|
if (!stateTransitions.count(From))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -260,7 +260,7 @@ State* DFA::getTransition(State* From, unsigned I) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DFA::isValidTransition(State* From, unsigned InsnClass) {
|
bool DFA::isValidTransition(State *From, unsigned InsnClass) {
|
||||||
return (getTransition(From, InsnClass) != NULL);
|
return (getTransition(From, InsnClass) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ bool DFA::isValidTransition(State* From, unsigned InsnClass) {
|
|||||||
int State::currentStateNum = 0;
|
int State::currentStateNum = 0;
|
||||||
int Transition::currentTransitionNum = 0;
|
int Transition::currentTransitionNum = 0;
|
||||||
|
|
||||||
DFAGen::DFAGen(RecordKeeper& R):
|
DFAGen::DFAGen(RecordKeeper &R):
|
||||||
TargetName(CodeGenTarget(R).getName()),
|
TargetName(CodeGenTarget(R).getName()),
|
||||||
allInsnClasses(), Records(R) {}
|
allInsnClasses(), Records(R) {}
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ DFAGen::DFAGen(RecordKeeper& R):
|
|||||||
// the ith state.
|
// the ith state.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
void DFA::writeTableAndAPI(raw_ostream &OS, const std::string& TargetName) {
|
void DFA::writeTableAndAPI(raw_ostream &OS, const std::string &TargetName) {
|
||||||
std::set<State*, ltState>::iterator SI = states.begin();
|
std::set<State*, ltState>::iterator SI = states.begin();
|
||||||
// This table provides a map to the beginning of the transitions for State s
|
// This table provides a map to the beginning of the transitions for State s
|
||||||
// in DFAStateInputTable.
|
// in DFAStateInputTable.
|
||||||
@ -334,7 +334,7 @@ void DFA::writeTableAndAPI(raw_ostream &OS, const std::string& TargetName) {
|
|||||||
std::string SubTargetClassName = TargetName + "GenSubtargetInfo";
|
std::string SubTargetClassName = TargetName + "GenSubtargetInfo";
|
||||||
OS << "\n" << "#include \"llvm/CodeGen/DFAPacketizer.h\"\n";
|
OS << "\n" << "#include \"llvm/CodeGen/DFAPacketizer.h\"\n";
|
||||||
OS << "namespace llvm {\n";
|
OS << "namespace llvm {\n";
|
||||||
OS << "DFAPacketizer* " << SubTargetClassName << "::"
|
OS << "DFAPacketizer *" << SubTargetClassName << "::"
|
||||||
<< "createDFAPacketizer(const InstrItineraryData *IID) const {\n"
|
<< "createDFAPacketizer(const InstrItineraryData *IID) const {\n"
|
||||||
<< " return new DFAPacketizer(IID, " << TargetName
|
<< " return new DFAPacketizer(IID, " << TargetName
|
||||||
<< "DFAStateInputTable, " << TargetName << "DFAStateEntryTable);\n}\n\n";
|
<< "DFAStateInputTable, " << TargetName << "DFAStateEntryTable);\n}\n\n";
|
||||||
@ -444,7 +444,7 @@ void DFAGen::run(raw_ostream &OS) {
|
|||||||
// Run a worklist algorithm to generate the DFA.
|
// Run a worklist algorithm to generate the DFA.
|
||||||
//
|
//
|
||||||
DFA D;
|
DFA D;
|
||||||
State* Initial = new State;
|
State *Initial = new State;
|
||||||
Initial->isInitial = true;
|
Initial->isInitial = true;
|
||||||
Initial->stateInfo.insert(0x0);
|
Initial->stateInfo.insert(0x0);
|
||||||
D.addState(Initial);
|
D.addState(Initial);
|
||||||
@ -471,7 +471,7 @@ void DFAGen::run(raw_ostream &OS) {
|
|||||||
// Add S' to Visited
|
// Add S' to Visited
|
||||||
//
|
//
|
||||||
while (!WorkList.empty()) {
|
while (!WorkList.empty()) {
|
||||||
State* current = WorkList.pop_back_val();
|
State *current = WorkList.pop_back_val();
|
||||||
for (DenseSet<unsigned>::iterator CI = allInsnClasses.begin(),
|
for (DenseSet<unsigned>::iterator CI = allInsnClasses.begin(),
|
||||||
CE = allInsnClasses.end(); CI != CE; ++CI) {
|
CE = allInsnClasses.end(); CI != CE; ++CI) {
|
||||||
unsigned InsnClass = *CI;
|
unsigned InsnClass = *CI;
|
||||||
@ -483,7 +483,7 @@ void DFAGen::run(raw_ostream &OS) {
|
|||||||
//
|
//
|
||||||
if (!D.getTransition(current, InsnClass) &&
|
if (!D.getTransition(current, InsnClass) &&
|
||||||
current->canAddInsnClass(InsnClass, NewStateResources)) {
|
current->canAddInsnClass(InsnClass, NewStateResources)) {
|
||||||
State* NewState = NULL;
|
State *NewState = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we have seen this state before, then do not create a new state.
|
// If we have seen this state before, then do not create a new state.
|
||||||
@ -500,7 +500,7 @@ void DFAGen::run(raw_ostream &OS) {
|
|||||||
WorkList.push_back(NewState);
|
WorkList.push_back(NewState);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transition* NewTransition = new Transition(current, InsnClass,
|
Transition *NewTransition = new Transition(current, InsnClass,
|
||||||
NewState);
|
NewState);
|
||||||
D.addTransition(NewTransition);
|
D.addTransition(NewTransition);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ private:
|
|||||||
RecordKeeper &Records;
|
RecordKeeper &Records;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DFAGen(RecordKeeper& R);
|
DFAGen(RecordKeeper &R);
|
||||||
|
|
||||||
//
|
//
|
||||||
// collectAllInsnClasses: Populate allInsnClasses which is a set of units
|
// collectAllInsnClasses: Populate allInsnClasses which is a set of units
|
||||||
|
@ -716,7 +716,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
|
|||||||
<< " explicit " << ClassName << "(StringRef TT, StringRef CPU, "
|
<< " explicit " << ClassName << "(StringRef TT, StringRef CPU, "
|
||||||
<< "StringRef FS);\n"
|
<< "StringRef FS);\n"
|
||||||
<< "public:\n"
|
<< "public:\n"
|
||||||
<< " DFAPacketizer* createDFAPacketizer(const InstrItineraryData* IID)"
|
<< " DFAPacketizer *createDFAPacketizer(const InstrItineraryData *IID)"
|
||||||
<< " const;\n"
|
<< " const;\n"
|
||||||
<< "};\n";
|
<< "};\n";
|
||||||
OS << "} // End llvm namespace \n";
|
OS << "} // End llvm namespace \n";
|
||||||
|
Loading…
Reference in New Issue
Block a user