mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
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
This commit is contained in:
@ -19,14 +19,12 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// FIXME: Should be using #include <cmath>
|
// FIXME: Should be using #include <cmath>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
//#include <swig.h>
|
//#include <swig.h>
|
||||||
|
|
||||||
#define UNIDELAY 1
|
#define UNIDELAY 1
|
||||||
|
|
||||||
|
|
||||||
//*********************** Internal Data Structures *************************/
|
//*********************** Internal Data Structures *************************/
|
||||||
|
|
||||||
// The following two types need to be classes, not typedefs, so we can use
|
// The following two types need to be classes, not typedefs, so we can use
|
||||||
@ -52,7 +50,6 @@ struct ValueToDefVecMap:public hash_map<const Instruction*,RefVec> {
|
|||||||
|
|
||||||
// class Modulo SchedGraphNode
|
// class Modulo SchedGraphNode
|
||||||
|
|
||||||
/*ctor*/
|
|
||||||
ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned int _nodeId,
|
ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned int _nodeId,
|
||||||
const BasicBlock * _bb,
|
const BasicBlock * _bb,
|
||||||
const Instruction * _inst,
|
const Instruction * _inst,
|
||||||
@ -113,8 +110,8 @@ void ModuloSchedGraph::addDefUseEdges(const BasicBlock *bb)
|
|||||||
for (unsigned int i = 0; i < defVec.size(); i++) {
|
for (unsigned int i = 0; i < defVec.size(); i++) {
|
||||||
for (Value::use_const_iterator I = defVec[i]->getInst()->use_begin();
|
for (Value::use_const_iterator I = defVec[i]->getInst()->use_begin();
|
||||||
I != defVec[i]->getInst()->use_end(); I++) {
|
I != defVec[i]->getInst()->use_end(); I++) {
|
||||||
//for each use of a def, add a flow edge from the def instruction to the ref instruction
|
//for each use of a def, add a flow edge from the def instruction to the
|
||||||
|
//ref instruction
|
||||||
|
|
||||||
const Instruction *value = defVec[i]->getInst();
|
const Instruction *value = defVec[i]->getInst();
|
||||||
Instruction *inst = (Instruction *) (*I);
|
Instruction *inst = (Instruction *) (*I);
|
||||||
@ -969,7 +966,6 @@ ModuloSchedGraphNode *ModuloSchedGraph::getNode(const unsigned nodeId) const
|
|||||||
|
|
||||||
int ModuloSchedGraph::computeRecII(const BasicBlock *bb)
|
int ModuloSchedGraph::computeRecII(const BasicBlock *bb)
|
||||||
{
|
{
|
||||||
|
|
||||||
int RecII = 0;
|
int RecII = 0;
|
||||||
|
|
||||||
//os<<"begining computerRecII()"<<"\n";
|
//os<<"begining computerRecII()"<<"\n";
|
||||||
@ -1269,7 +1265,6 @@ void ModuloSchedGraph::dump(const BasicBlock * bb)
|
|||||||
DEBUG(std::cerr << "dumping basic block:");
|
DEBUG(std::cerr << "dumping basic block:");
|
||||||
DEBUG(std::cerr << (bb->hasName()? bb->getName() : "block")
|
DEBUG(std::cerr << (bb->hasName()? bb->getName() : "block")
|
||||||
<< " (" << bb << ")" << "\n");
|
<< " (" << bb << ")" << "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os)
|
void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os)
|
||||||
@ -1320,8 +1315,7 @@ void ModuloSchedGraph::dumpNodeProperty() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F,
|
void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F,
|
||||||
const TargetMachine &
|
const TargetMachine &target)
|
||||||
target)
|
|
||||||
{
|
{
|
||||||
for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
|
for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
|
||||||
addGraph(new ModuloSchedGraph(BI, target));
|
addGraph(new ModuloSchedGraph(BI, target));
|
||||||
@ -1348,6 +1342,5 @@ std::ostream & operator<<(std::ostream & os,
|
|||||||
os << std::string(16, ' ') << *node.outEdges[i];
|
os << std::string(16, ' ') << *node.outEdges[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -235,6 +235,7 @@ public:
|
|||||||
const unsigned int getNumNodes() const {
|
const unsigned int getNumNodes() const {
|
||||||
return size() + 2;
|
return size() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return wether the BasicBlock 'bb' contains a loop
|
//return wether the BasicBlock 'bb' contains a loop
|
||||||
bool isLoop(const BasicBlock *bb);
|
bool isLoop(const BasicBlock *bb);
|
||||||
|
|
||||||
@ -288,10 +289,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Graph builder
|
// Graph builder
|
||||||
|
|
||||||
ModuloSchedGraphNode *getNode(const unsigned nodeId) const;
|
ModuloSchedGraphNode *getNode(const unsigned nodeId) const;
|
||||||
|
|
||||||
//build the graph from the basicBlock
|
// Build the graph from the basicBlock
|
||||||
void buildGraph(const TargetMachine &target);
|
void buildGraph(const TargetMachine &target);
|
||||||
|
|
||||||
// Build nodes for BasicBlock
|
// Build nodes for BasicBlock
|
||||||
|
@ -19,14 +19,12 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// FIXME: Should be using #include <cmath>
|
// FIXME: Should be using #include <cmath>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
//#include <swig.h>
|
//#include <swig.h>
|
||||||
|
|
||||||
#define UNIDELAY 1
|
#define UNIDELAY 1
|
||||||
|
|
||||||
|
|
||||||
//*********************** Internal Data Structures *************************/
|
//*********************** Internal Data Structures *************************/
|
||||||
|
|
||||||
// The following two types need to be classes, not typedefs, so we can use
|
// The following two types need to be classes, not typedefs, so we can use
|
||||||
@ -52,7 +50,6 @@ struct ValueToDefVecMap:public hash_map<const Instruction*,RefVec> {
|
|||||||
|
|
||||||
// class Modulo SchedGraphNode
|
// class Modulo SchedGraphNode
|
||||||
|
|
||||||
/*ctor*/
|
|
||||||
ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned int _nodeId,
|
ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned int _nodeId,
|
||||||
const BasicBlock * _bb,
|
const BasicBlock * _bb,
|
||||||
const Instruction * _inst,
|
const Instruction * _inst,
|
||||||
@ -113,8 +110,8 @@ void ModuloSchedGraph::addDefUseEdges(const BasicBlock *bb)
|
|||||||
for (unsigned int i = 0; i < defVec.size(); i++) {
|
for (unsigned int i = 0; i < defVec.size(); i++) {
|
||||||
for (Value::use_const_iterator I = defVec[i]->getInst()->use_begin();
|
for (Value::use_const_iterator I = defVec[i]->getInst()->use_begin();
|
||||||
I != defVec[i]->getInst()->use_end(); I++) {
|
I != defVec[i]->getInst()->use_end(); I++) {
|
||||||
//for each use of a def, add a flow edge from the def instruction to the ref instruction
|
//for each use of a def, add a flow edge from the def instruction to the
|
||||||
|
//ref instruction
|
||||||
|
|
||||||
const Instruction *value = defVec[i]->getInst();
|
const Instruction *value = defVec[i]->getInst();
|
||||||
Instruction *inst = (Instruction *) (*I);
|
Instruction *inst = (Instruction *) (*I);
|
||||||
@ -969,7 +966,6 @@ ModuloSchedGraphNode *ModuloSchedGraph::getNode(const unsigned nodeId) const
|
|||||||
|
|
||||||
int ModuloSchedGraph::computeRecII(const BasicBlock *bb)
|
int ModuloSchedGraph::computeRecII(const BasicBlock *bb)
|
||||||
{
|
{
|
||||||
|
|
||||||
int RecII = 0;
|
int RecII = 0;
|
||||||
|
|
||||||
//os<<"begining computerRecII()"<<"\n";
|
//os<<"begining computerRecII()"<<"\n";
|
||||||
@ -1269,7 +1265,6 @@ void ModuloSchedGraph::dump(const BasicBlock * bb)
|
|||||||
DEBUG(std::cerr << "dumping basic block:");
|
DEBUG(std::cerr << "dumping basic block:");
|
||||||
DEBUG(std::cerr << (bb->hasName()? bb->getName() : "block")
|
DEBUG(std::cerr << (bb->hasName()? bb->getName() : "block")
|
||||||
<< " (" << bb << ")" << "\n");
|
<< " (" << bb << ")" << "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os)
|
void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os)
|
||||||
@ -1320,8 +1315,7 @@ void ModuloSchedGraph::dumpNodeProperty() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F,
|
void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F,
|
||||||
const TargetMachine &
|
const TargetMachine &target)
|
||||||
target)
|
|
||||||
{
|
{
|
||||||
for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
|
for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
|
||||||
addGraph(new ModuloSchedGraph(BI, target));
|
addGraph(new ModuloSchedGraph(BI, target));
|
||||||
@ -1348,6 +1342,5 @@ std::ostream & operator<<(std::ostream & os,
|
|||||||
os << std::string(16, ' ') << *node.outEdges[i];
|
os << std::string(16, ' ') << *node.outEdges[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -235,6 +235,7 @@ public:
|
|||||||
const unsigned int getNumNodes() const {
|
const unsigned int getNumNodes() const {
|
||||||
return size() + 2;
|
return size() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return wether the BasicBlock 'bb' contains a loop
|
//return wether the BasicBlock 'bb' contains a loop
|
||||||
bool isLoop(const BasicBlock *bb);
|
bool isLoop(const BasicBlock *bb);
|
||||||
|
|
||||||
@ -288,10 +289,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Graph builder
|
// Graph builder
|
||||||
|
|
||||||
ModuloSchedGraphNode *getNode(const unsigned nodeId) const;
|
ModuloSchedGraphNode *getNode(const unsigned nodeId) const;
|
||||||
|
|
||||||
//build the graph from the basicBlock
|
// Build the graph from the basicBlock
|
||||||
void buildGraph(const TargetMachine &target);
|
void buildGraph(const TargetMachine &target);
|
||||||
|
|
||||||
// Build nodes for BasicBlock
|
// Build nodes for BasicBlock
|
||||||
|
Reference in New Issue
Block a user