1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Rename all of the "Process" methods to be "read" methods, start the Instantiate method

llvm-svn: 7685
This commit is contained in:
Chris Lattner 2003-08-07 20:42:23 +00:00
parent 096a2cc522
commit 578cd4425b
2 changed files with 48 additions and 41 deletions

View File

@ -261,11 +261,10 @@ std::ostream &operator<<(std::ostream &OS, const Pattern &P) {
// InstrSelectorEmitter implementation
//
/// ProcessNodeTypes - Process all of the node types in the current
/// RecordKeeper, turning them into the more accessible NodeTypes data
/// structure.
/// ReadNodeTypes - Read in all of the node types in the current RecordKeeper,
/// turning them into the more accessible NodeTypes data structure.
///
void InstrSelectorEmitter::ProcessNodeTypes() {
void InstrSelectorEmitter::ReadNodeTypes() {
std::vector<Record*> Nodes = Records.getAllDerivedDefinitions("DagNode");
DEBUG(std::cerr << "Getting node types: ");
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
@ -301,61 +300,66 @@ void InstrSelectorEmitter::ProcessNodeTypes() {
DEBUG(std::cerr << "DONE!\n");
}
// ProcessNonTerminals - Read in all nonterminals and incorporate them into
// our pattern database.
void InstrSelectorEmitter::ProcessNonterminals() {
// ReadNonTerminals - Read in all nonterminals and incorporate them into our
// pattern database.
void InstrSelectorEmitter::ReadNonterminals() {
std::vector<Record*> NTs = Records.getAllDerivedDefinitions("Nonterminal");
for (unsigned i = 0, e = NTs.size(); i != e; ++i) {
DagInit *DI = NTs[i]->getValueAsDag("Pattern");
Pattern *P = new Pattern(Pattern::Nonterminal, DI, NTs[i], *this);
DEBUG(std::cerr << "Parsed " << *P << "\n");
Patterns[NTs[i]] = new Pattern(Pattern::Nonterminal, DI, NTs[i], *this);
DEBUG(std::cerr << "Parsed " << *Patterns[NTs[i]] << "\n");
}
}
/// ProcessInstructionPatterns - Read in all subclasses of Instruction, and
/// process those with a useful Pattern field.
/// ReadInstructionPatterns - Read in all subclasses of Instruction, and process
/// those with a useful Pattern field.
///
void InstrSelectorEmitter::ProcessInstructionPatterns() {
void InstrSelectorEmitter::ReadInstructionPatterns() {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
for (unsigned i = 0, e = Insts.size(); i != e; ++i) {
Record *Inst = Insts[i];
if (DagInit *DI = dynamic_cast<DagInit*>(Inst->getValueInit("Pattern"))) {
Pattern *P = new Pattern(Pattern::Instruction, DI, Inst, *this);
DEBUG(std::cerr << "Parsed " << *P << "\n");
Patterns[Inst] = new Pattern(Pattern::Instruction, DI, Inst, *this);
DEBUG(std::cerr << "Parsed " << *Patterns[Inst] << "\n");
}
}
}
/// ProcessExpanderPatterns - Read in all expander patterns...
/// ReadExpanderPatterns - Read in all expander patterns...
///
void InstrSelectorEmitter::ProcessExpanderPatterns() {
void InstrSelectorEmitter::ReadExpanderPatterns() {
std::vector<Record*> Expanders = Records.getAllDerivedDefinitions("Expander");
for (unsigned i = 0, e = Expanders.size(); i != e; ++i) {
Record *Expander = Expanders[i];
DagInit *DI = Expanders[i]->getValueAsDag("Pattern");
DagInit *DI = Expander->getValueAsDag("Pattern");
Patterns[Expander] = new Pattern(Pattern::Expander, DI, Expander, *this);
DEBUG(std::cerr << "Parsed " << *Patterns[Expander] << "\n");
}
}
Pattern *P = new Pattern(Pattern::Expander, DI, Expanders[i], *this);
DEBUG(std::cerr << "Parsed " << *P << "\n");
// InstantiateNonterminals - Instantiate any unresolved nonterminals with
// information from the context that they are used in.
void InstrSelectorEmitter::InstantiateNonterminals() {
for (std::map<Record*, Pattern*>::iterator I = Patterns.begin(),
E = Patterns.end(); I != E; ++I) {
}
}
void InstrSelectorEmitter::run(std::ostream &OS) {
// Type-check all of the node types to ensure we "understand" them.
ProcessNodeTypes();
ReadNodeTypes();
// Read in all of the nonterminals...
ProcessNonterminals();
// Read in all of the nonterminals, instructions, and expanders...
ReadNonterminals();
ReadInstructionPatterns();
ReadExpanderPatterns();
// Read all of the instruction patterns in...
ProcessInstructionPatterns();
// Read all of the Expander patterns in...
ProcessExpanderPatterns();
// Instantiate any unresolved nonterminals with information from the context
// that they are used in.
InstantiateNonterminals();
}

View File

@ -194,21 +194,24 @@ public:
std::map<Record*, NodeType> &getNodeTypes() { return NodeTypes; }
private:
// ProcessNodeTypes - Process all of the node types in the current
// RecordKeeper, turning them into the more accessible NodeTypes data
// structure.
void ProcessNodeTypes();
// ReadNodeTypes - Read in all of the node types in the current RecordKeeper,
// turning them into the more accessible NodeTypes data structure.
void ReadNodeTypes();
// ProcessNonTerminals - Read in all nonterminals and incorporate them into
// our pattern database.
void ProcessNonterminals();
// ReadNonTerminals - Read in all nonterminals and incorporate them into our
// pattern database.
void ReadNonterminals();
// ProcessInstructionPatterns - Read in all subclasses of Instruction, and
// ReadInstructionPatterns - Read in all subclasses of Instruction, and
// process those with a useful Pattern field.
void ProcessInstructionPatterns();
void ReadInstructionPatterns();
// ProcessExpanderPatterns - Read in all of the expanded patterns.
void ProcessExpanderPatterns();
// ReadExpanderPatterns - Read in all of the expanded patterns.
void ReadExpanderPatterns();
// InstantiateNonterminals - Instantiate any unresolved nonterminals with
// information from the context that they are used in.
void InstantiateNonterminals();
};
#endif