llvm.org GIT mirror llvm / 63e04f3
Just some code beautification changes I had sitting around in my tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5859 91177308-0d34-0410-b5e6-96231b3b80d8 Misha Brukman 17 years ago
4 changed file(s) with 32 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
1818 #include
1919 #include
2020 #include
21
2221 // FIXME: Should be using #include
2322 #include
2423 //#include
2524
2625 #define UNIDELAY 1
27
2826
2927 //*********************** Internal Data Structures *************************/
3028
5149
5250 // class Modulo SchedGraphNode
5351
54 /*ctor*/
5552 ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned int _nodeId,
5653 const BasicBlock * _bb,
5754 const Instruction * _inst,
112109 for (unsigned int i = 0; i < defVec.size(); i++) {
113110 for (Value::use_const_iterator I = defVec[i]->getInst()->use_begin();
114111 I != defVec[i]->getInst()->use_end(); I++) {
115 //for each use of a def, add a flow edge from the def instruction to the ref instruction
116
112 //for each use of a def, add a flow edge from the def instruction to the
113 //ref instruction
117114
118115 const Instruction *value = defVec[i]->getInst();
119116 Instruction *inst = (Instruction *) (*I);
968965
969966 int ModuloSchedGraph::computeRecII(const BasicBlock *bb)
970967 {
971
972968 int RecII = 0;
973969
974970 //os<<"begining computerRecII()"<<"\n";
12681264 DEBUG(std::cerr << "dumping basic block:");
12691265 DEBUG(std::cerr << (bb->hasName()? bb->getName() : "block")
12701266 << " (" << bb << ")" << "\n");
1271
12721267 }
12731268
12741269 void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os)
13181313 }
13191314 }
13201315
1321 void ModuloSchedGraphSet::buildGraphsForMethod(const Function * F,
1322 const TargetMachine &
1323 target)
1316 void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F,
1317 const TargetMachine &target)
13241318 {
13251319 for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
13261320 addGraph(new ModuloSchedGraph(BI, target));
13271321 }
13281322
1329 std::ostream & operator<<(std::ostream & os,
1330 const ModuloSchedGraphNode & node)
1323 std::ostream& operator<<(std::ostream &os,
1324 const ModuloSchedGraphNode &node)
13311325 {
13321326 os << std::string(8, ' ')
13331327 << "Node " << node.nodeId << " : "
13471341 os << std::string(16, ' ') << *node.outEdges[i];
13481342 }
13491343
1350
13511344 return os;
13521345 }
234234 const unsigned int getNumNodes() const {
235235 return size() + 2;
236236 }
237
237238 //return wether the BasicBlock 'bb' contains a loop
238 bool isLoop(const BasicBlock * bb);
239 bool isLoop(const BasicBlock *bb);
239240
240241 //return this basibBlock contains a loop
241242 bool isLoop();
242243
243244 //return the node for the input instruction
244 ModuloSchedGraphNode *getGraphNodeForInst(const Instruction * inst) const {
245 ModuloSchedGraphNode *getGraphNodeForInst(const Instruction *inst) const {
245246 const_iterator onePair = this->find(inst);
246247 return (onePair != this->end()) ? (*onePair).second : NULL;
247248 }
251252 void dump() const;
252253
253254 // dump the basicBlock
254 void dump(const BasicBlock * bb);
255 void dump(const BasicBlock *bb);
255256
256257 //dump the basicBlock into 'os' stream
257 void dump(const BasicBlock * bb, std::ostream & os);
258 void dump(const BasicBlock *bb, std::ostream &os);
258259
259260 //dump the node property
260261 void dumpNodeProperty() const;
286287 (*this)[inst] = node;
287288 }
288289
289 //Graph builder
290
290 // Graph builder
291291 ModuloSchedGraphNode *getNode(const unsigned nodeId) const;
292292
293 //build the graph from the basicBlock
294 void buildGraph(const TargetMachine & target);
295
296 //Build nodes for BasicBlock
293 // Build the graph from the basicBlock
294 void buildGraph(const TargetMachine &target);
295
296 // Build nodes for BasicBlock
297297 void buildNodesforBB(const TargetMachine &target,
298298 const BasicBlock *bb,
299299 NodeVec &memNode,
1818 #include
1919 #include
2020 #include
21
2221 // FIXME: Should be using #include
2322 #include
2423 //#include
2524
2625 #define UNIDELAY 1
27
2826
2927 //*********************** Internal Data Structures *************************/
3028
5149
5250 // class Modulo SchedGraphNode
5351
54 /*ctor*/
5552 ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned int _nodeId,
5653 const BasicBlock * _bb,
5754 const Instruction * _inst,
112109 for (unsigned int i = 0; i < defVec.size(); i++) {
113110 for (Value::use_const_iterator I = defVec[i]->getInst()->use_begin();
114111 I != defVec[i]->getInst()->use_end(); I++) {
115 //for each use of a def, add a flow edge from the def instruction to the ref instruction
116
112 //for each use of a def, add a flow edge from the def instruction to the
113 //ref instruction
117114
118115 const Instruction *value = defVec[i]->getInst();
119116 Instruction *inst = (Instruction *) (*I);
968965
969966 int ModuloSchedGraph::computeRecII(const BasicBlock *bb)
970967 {
971
972968 int RecII = 0;
973969
974970 //os<<"begining computerRecII()"<<"\n";
12681264 DEBUG(std::cerr << "dumping basic block:");
12691265 DEBUG(std::cerr << (bb->hasName()? bb->getName() : "block")
12701266 << " (" << bb << ")" << "\n");
1271
12721267 }
12731268
12741269 void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os)
13181313 }
13191314 }
13201315
1321 void ModuloSchedGraphSet::buildGraphsForMethod(const Function * F,
1322 const TargetMachine &
1323 target)
1316 void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F,
1317 const TargetMachine &target)
13241318 {
13251319 for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
13261320 addGraph(new ModuloSchedGraph(BI, target));
13271321 }
13281322
1329 std::ostream & operator<<(std::ostream & os,
1330 const ModuloSchedGraphNode & node)
1323 std::ostream& operator<<(std::ostream &os,
1324 const ModuloSchedGraphNode &node)
13311325 {
13321326 os << std::string(8, ' ')
13331327 << "Node " << node.nodeId << " : "
13471341 os << std::string(16, ' ') << *node.outEdges[i];
13481342 }
13491343
1350
13511344 return os;
13521345 }
234234 const unsigned int getNumNodes() const {
235235 return size() + 2;
236236 }
237
237238 //return wether the BasicBlock 'bb' contains a loop
238 bool isLoop(const BasicBlock * bb);
239 bool isLoop(const BasicBlock *bb);
239240
240241 //return this basibBlock contains a loop
241242 bool isLoop();
242243
243244 //return the node for the input instruction
244 ModuloSchedGraphNode *getGraphNodeForInst(const Instruction * inst) const {
245 ModuloSchedGraphNode *getGraphNodeForInst(const Instruction *inst) const {
245246 const_iterator onePair = this->find(inst);
246247 return (onePair != this->end()) ? (*onePair).second : NULL;
247248 }
251252 void dump() const;
252253
253254 // dump the basicBlock
254 void dump(const BasicBlock * bb);
255 void dump(const BasicBlock *bb);
255256
256257 //dump the basicBlock into 'os' stream
257 void dump(const BasicBlock * bb, std::ostream & os);
258 void dump(const BasicBlock *bb, std::ostream &os);
258259
259260 //dump the node property
260261 void dumpNodeProperty() const;
286287 (*this)[inst] = node;
287288 }
288289
289 //Graph builder
290
290 // Graph builder
291291 ModuloSchedGraphNode *getNode(const unsigned nodeId) const;
292292
293 //build the graph from the basicBlock
294 void buildGraph(const TargetMachine & target);
295
296 //Build nodes for BasicBlock
293 // Build the graph from the basicBlock
294 void buildGraph(const TargetMachine &target);
295
296 // Build nodes for BasicBlock
297297 void buildNodesforBB(const TargetMachine &target,
298298 const BasicBlock *bb,
299299 NodeVec &memNode,