From gshi1 at cs.uiuc.edu Tue Jun 10 14:10:02 2003 From: gshi1 at cs.uiuc.edu (Guochun Shi) Date: Tue Jun 10 14:10:02 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp ModuloSchedGraph.h ModuloScheduling.cpp Message-ID: <200306101909.OAA16681@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/ModuloScheduling: ModuloSchedGraph.cpp updated: 1.8 -> 1.9 ModuloSchedGraph.h updated: 1.7 -> 1.8 ModuloScheduling.cpp updated: 1.7 -> 1.8 --- Log message: cleaned code add some comments --- Diffs of the changes: Index: llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp diff -u llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp:1.8 llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp:1.9 --- llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp:1.8 Sun Jun 8 18:16:07 2003 +++ llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp Tue Jun 10 14:09:00 2003 @@ -130,7 +130,7 @@ // find the last instruction in the basic block // see if it is an branch instruction. // If yes, then add an edge from each node expcept the last node - //to the last node + // to the last node const Instruction *inst = &(bb->back()); ModuloSchedGraphNode *lastNode = (*this)[inst]; @@ -228,7 +228,10 @@ } } - +/* + this function build graph nodes for each instruction + in the basicblock +*/ void ModuloSchedGraph::buildNodesforBB(const TargetMachine &target, @@ -250,6 +253,10 @@ } +/* + determine if this basicblock includes a loop or not +*/ + bool ModuloSchedGraph::isLoop(const BasicBlock *bb) { @@ -257,6 +264,7 @@ //there is at least an option to branch itself const Instruction *inst = &(bb->back()); + if (BranchInst::classof(inst)) { for (unsigned i = 0; i < ((BranchInst *) inst)->getNumSuccessors(); i++) { @@ -270,11 +278,18 @@ } -void ModuloSchedGraph::computeNodeASAP(const BasicBlock *bb) { +/* + compute every node's ASAP - //FIXME: now assume the only backward edges come from the edges from other - //nodes to the phi Node so i will ignore all edges to the phi node; after - //this, there shall be no recurrence. +*/ + +//FIXME: now assume the only backward edges come from the edges from other +//nodes to the phi Node so i will ignore all edges to the phi node; after +//this, there shall be no recurrence. + +void +ModuloSchedGraph::computeNodeASAP(const BasicBlock *bb) { + unsigned numNodes = bb->size(); for (unsigned i = 2; i < numNodes + 2; i++) { @@ -305,67 +320,96 @@ } } -void ModuloSchedGraph::computeNodeALAP(const BasicBlock *bb) { + +/* + compute every node's ALAP in the basic block +*/ + +void +ModuloSchedGraph::computeNodeALAP(const BasicBlock *bb) { + unsigned numNodes = bb->size(); int maxASAP = 0; for (unsigned i = numNodes + 1; i >= 2; i--) { + ModuloSchedGraphNode *node = getNode(i); node->setPropertyComputed(false); - //cerr<< " maxASAP= " <ASAP= "<< node->ASAP<<"\n"; maxASAP = std::max(maxASAP, node->ASAP); - } - //cerr<<"maxASAP is "<= 2; i--) { ModuloSchedGraphNode *node = getNode(i); + node->ALAP = maxASAP; + for (ModuloSchedGraphNode::const_iterator I = node->beginOutEdges(), E = node->endOutEdges(); I != E; I++) { + SchedGraphEdge *edge = *I; ModuloSchedGraphNode *succ = - (ModuloSchedGraphNode *) (edge->getSink()); + (ModuloSchedGraphNode *) (edge->getSink()); if (PHINode::classof(succ->getInst())) continue; + assert(succ->getPropertyComputed() && "succ node property is not computed!"); + int temp = succ->ALAP - edge->getMinDelay() + edge->getIteDiff() * this->MII; + node->ALAP = std::min(node->ALAP, temp); + } node->setPropertyComputed(true); } } -void ModuloSchedGraph::computeNodeMov(const BasicBlock *bb) -{ +/* + compute every node's mov in this basicblock +*/ + +void +ModuloSchedGraph::computeNodeMov(const BasicBlock *bb){ + unsigned numNodes = bb->size(); for (unsigned i = 2; i < numNodes + 2; i++) { + ModuloSchedGraphNode *node = getNode(i); node->mov = node->ALAP - node->ASAP; assert(node->mov >= 0 && "move freedom for this node is less than zero? "); + } -} +} -void ModuloSchedGraph::computeNodeDepth(const BasicBlock * bb) -{ +/* + compute every node's depth in this basicblock +*/ +void +ModuloSchedGraph::computeNodeDepth(const BasicBlock * bb){ + unsigned numNodes = bb->size(); + for (unsigned i = 2; i < numNodes + 2; i++) { + ModuloSchedGraphNode *node = getNode(i); node->setPropertyComputed(false); + } for (unsigned i = 2; i < numNodes + 2; i++) { + ModuloSchedGraphNode *node = getNode(i); node->depth = 0; if (i == 2 || node->getNumInEdges() == 0) { node->setPropertyComputed(true); continue; } + for (ModuloSchedGraphNode::const_iterator I = node->beginInEdges(), E = node->endInEdges(); I != E; I++) { SchedGraphEdge *edge = *I; @@ -377,40 +421,49 @@ node->depth = std::max(node->depth, temp); } node->setPropertyComputed(true); - } + } + } -void ModuloSchedGraph::computeNodeHeight(const BasicBlock *bb) -{ +/* + compute every node's height in this basic block +*/ + +void +ModuloSchedGraph::computeNodeHeight(const BasicBlock *bb){ + unsigned numNodes = bb->size(); for (unsigned i = numNodes + 1; i >= 2; i--) { ModuloSchedGraphNode *node = getNode(i); node->setPropertyComputed(false); } - + for (unsigned i = numNodes + 1; i >= 2; i--) { ModuloSchedGraphNode *node = getNode(i); node->height = 0; for (ModuloSchedGraphNode::const_iterator I = - node->beginOutEdges(), E = node->endOutEdges(); I != E; ++I) { + node->beginOutEdges(), E = node->endOutEdges(); I != E; ++I) { SchedGraphEdge *edge = *I; ModuloSchedGraphNode *succ = - (ModuloSchedGraphNode *) (edge->getSink()); + (ModuloSchedGraphNode *) (edge->getSink()); if (PHINode::classof(succ->getInst())) continue; assert(succ->getPropertyComputed() && "succ node property is not computed!"); node->height = std::max(node->height, succ->height + edge->getMinDelay()); - + } node->setPropertyComputed(true); - } - + } +/* + compute every node's property in a basicblock +*/ + void ModuloSchedGraph::computeNodeProperty(const BasicBlock * bb) { //FIXME: now assume the only backward edges come from the edges from other @@ -425,26 +478,33 @@ } -//do not consider the backedge in these two functions: -// i.e. don't consider the edge with destination in phi node +/* + compute the preset of this set without considering the edges + between backEdgeSrc and backEdgeSink +*/ std::vector ModuloSchedGraph::predSet(std::vector set, unsigned backEdgeSrc, unsigned - backEdgeSink) -{ + backEdgeSink){ + std::vector predS; + for (unsigned i = 0; i < set.size(); i++) { + ModuloSchedGraphNode *node = set[i]; for (ModuloSchedGraphNode::const_iterator I = node->beginInEdges(), E = node->endInEdges(); I != E; I++) { SchedGraphEdge *edge = *I; + + //if edges between backEdgeSrc and backEdgeSink, omitted if (edge->getSrc()->getNodeId() == backEdgeSrc && edge->getSink()->getNodeId() == backEdgeSink) continue; ModuloSchedGraphNode *pred = (ModuloSchedGraphNode *) (edge->getSrc()); - //if pred is not in the predSet, push it in vector + + //if pred is not in the predSet .... bool alreadyInset = false; for (unsigned j = 0; j < predS.size(); ++j) if (predS[j]->getNodeId() == pred->getNodeId()) { @@ -452,12 +512,14 @@ break; } + // and pred is not in the set .... for (unsigned j = 0; j < set.size(); ++j) if (set[j]->getNodeId() == pred->getNodeId()) { alreadyInset = true; break; } + //push it into the predS if (!alreadyInset) predS.push_back(pred); } @@ -465,43 +527,68 @@ return predS; } -ModuloSchedGraph::NodeVec ModuloSchedGraph::predSet(NodeVec set) -{ - //node number increases from 2 + +/* + return pred set to this set +*/ + +ModuloSchedGraph::NodeVec +ModuloSchedGraph::predSet(NodeVec set){ + + //node number increases from 2, return predSet(set, 0, 0); } +/* + return pred set to _node, ignoring + any edge between backEdgeSrc and backEdgeSink +*/ std::vector ModuloSchedGraph::predSet(ModuloSchedGraphNode *_node, - unsigned backEdgeSrc, unsigned backEdgeSink) -{ + unsigned backEdgeSrc, unsigned backEdgeSink){ + std::vector set; set.push_back(_node); return predSet(set, backEdgeSrc, backEdgeSink); } + +/* + return pred set to _node, ignoring +*/ + std::vector -ModuloSchedGraph::predSet(ModuloSchedGraphNode * _node) -{ +ModuloSchedGraph::predSet(ModuloSchedGraphNode * _node){ + return predSet(_node, 0, 0); + } +/* + return successor set to the input set + ignoring any edge between src and sink +*/ + std::vector ModuloSchedGraph::succSet(std::vector set, - unsigned src, unsigned sink) -{ + unsigned src, unsigned sink){ + std::vector succS; + for (unsigned i = 0; i < set.size(); i++) { ModuloSchedGraphNode *node = set[i]; for (ModuloSchedGraphNode::const_iterator I = node->beginOutEdges(), E = node->endOutEdges(); I != E; I++) { SchedGraphEdge *edge = *I; + + //if the edge is between src and sink, skip if (edge->getSrc()->getNodeId() == src && edge->getSink()->getNodeId() == sink) continue; ModuloSchedGraphNode *succ = (ModuloSchedGraphNode *) (edge->getSink()); - //if pred is not in the predSet, push it in vector + + //if pred is not in the successor set .... bool alreadyInset = false; for (unsigned j = 0; j < succS.size(); j++) if (succS[j]->getNodeId() == succ->getNodeId()) { @@ -509,11 +596,14 @@ break; } + //and not in this set .... for (unsigned j = 0; j < set.size(); j++) if (set[j]->getNodeId() == succ->getNodeId()) { alreadyInset = true; break; } + + //push it into the successor set if (!alreadyInset) succS.push_back(succ); } @@ -521,30 +611,53 @@ return succS; } -ModuloSchedGraph::NodeVec ModuloSchedGraph::succSet(NodeVec set) -{ +/* + return successor set to the input set +*/ + +ModuloSchedGraph::NodeVec ModuloSchedGraph::succSet(NodeVec set){ + return succSet(set, 0, 0); + } +/* + return successor set to the input node + ignoring any edge between src and sink +*/ std::vector ModuloSchedGraph::succSet(ModuloSchedGraphNode *_node, - unsigned src, unsigned sink) -{ + unsigned src, unsigned sink){ + std::vectorset; + set.push_back(_node); + return succSet(set, src, sink); + } +/* + return successor set to the input node +*/ + std::vector -ModuloSchedGraph::succSet(ModuloSchedGraphNode * _node) -{ +ModuloSchedGraph::succSet(ModuloSchedGraphNode * _node){ + return succSet(_node, 0, 0); + } -SchedGraphEdge *ModuloSchedGraph::getMaxDelayEdge(unsigned srcId, - unsigned sinkId) -{ + +/* + find maximum delay between srcId and sinkId +*/ + +SchedGraphEdge* +ModuloSchedGraph::getMaxDelayEdge(unsigned srcId, + unsigned sinkId){ + ModuloSchedGraphNode *node = getNode(srcId); SchedGraphEdge *maxDelayEdge = NULL; int maxDelay = -1; @@ -559,10 +672,16 @@ } assert(maxDelayEdge != NULL && "no edge between the srcId and sinkId?"); return maxDelayEdge; + } -void ModuloSchedGraph::dumpCircuits() -{ +/* + dump all circuits found +*/ + +void +ModuloSchedGraph::dumpCircuits(){ + DEBUG_PRINT(std::cerr << "dumping circuits for graph:\n"); int j = -1; while (circuits[++j][0] != 0) { @@ -573,17 +692,27 @@ } } -void ModuloSchedGraph::dumpSet(std::vector < ModuloSchedGraphNode * >set) -{ +/* + dump all sets found +*/ + +void +ModuloSchedGraph::dumpSet(std::vector < ModuloSchedGraphNode * >set){ + for (unsigned i = 0; i < set.size(); i++) DEBUG_PRINT(std::cerr << set[i]->getNodeId() << "\t"); DEBUG_PRINT(std::cerr << "\n"); + } +/* + return union of set1 and set2 +*/ + std::vector ModuloSchedGraph::vectorUnion(std::vector set1, - std::vector set2) -{ + std::vector set2){ + std::vector unionVec; for (unsigned i = 0; i < set1.size(); i++) unionVec.push_back(set1[i]); @@ -598,35 +727,56 @@ return unionVec; } +/* + return conjuction of set1 and set2 +*/ std::vector ModuloSchedGraph::vectorConj(std::vector set1, - std::vector set2) -{ + std::vector set2){ + std::vector conjVec; for (unsigned i = 0; i < set1.size(); i++) for (unsigned j = 0; j < set2.size(); j++) if (set1[i] == set2[j]) conjVec.push_back(set1[i]); return conjVec; + } -ModuloSchedGraph::NodeVec ModuloSchedGraph::vectorSub(NodeVec set1, - NodeVec set2) -{ +/* + return the result of subtracting set2 from set1 + (set1 -set2) +*/ +ModuloSchedGraph::NodeVec +ModuloSchedGraph::vectorSub(NodeVec set1, + NodeVec set2){ + NodeVec newVec; for (NodeVec::iterator I = set1.begin(); I != set1.end(); I++) { + bool inset = false; for (NodeVec::iterator II = set2.begin(); II != set2.end(); II++) if ((*I)->getNodeId() == (*II)->getNodeId()) { inset = true; break; } + if (!inset) newVec.push_back(*I); + } + return newVec; + } +/* + order all nodes in the basicblock + based on the sets information and node property + + output: ordered nodes are stored in oNodes +*/ + void ModuloSchedGraph::orderNodes() { oNodes.clear(); @@ -662,6 +812,7 @@ } } + // build the first set int backEdgeSrc; int backEdgeSink; @@ -680,6 +831,7 @@ DEBUG_PRINT(std::cerr << "the first set is:"); dumpSet(set); } + // implement the ordering algorithm enum OrderSeq { bottom_up, top_down }; OrderSeq order; @@ -726,6 +878,7 @@ chosenI = I; continue; } + //possible case: instruction A and B has the same height and mov, //but A has dependence to B e.g B is the branch instruction in the //end, or A is the phi instruction at the beginning @@ -741,6 +894,7 @@ } } } + ModuloSchedGraphNode *mu = *chosenI; oNodes.push_back(mu); R.erase(chosenI); @@ -787,6 +941,7 @@ dumpSet(oNodes); dumpCircuits(); } + //create a new set //FIXME: the nodes between onodes and this circuit should also be include in //this set @@ -801,6 +956,7 @@ backEdgeSrc = circuits[setSeq][k - 1]; backEdgeSink = circuits[setSeq][0]; } + if (set.empty()) { //no circuits any more //collect all other nodes @@ -821,40 +977,31 @@ DEBUG_PRINT(std::cerr << "next set is:\n"); dumpSet(set); } - } //while(!set.empty()) + } } +/* + + build graph for instructions in this basic block + +*/ void ModuloSchedGraph::buildGraph(const TargetMachine & target) { - + assert(this->bb && "The basicBlock is NULL?"); - - + // Make a dummy root node. We'll add edges to the real roots later. graphRoot = new ModuloSchedGraphNode(0, NULL, NULL, -1, target); graphLeaf = new ModuloSchedGraphNode(1, NULL, NULL, -1, target); - //---------------------------------------------------------------- - // First add nodes for all the LLVM instructions in the basic block because - // this greatly simplifies identifying which edges to add. Do this one VM - // instruction at a time since the ModuloSchedGraphNode needs that. - // Also, remember the load/store instructions to add memory deps later. - //---------------------------------------------------------------- - - //FIXME:if there is call instruction, then we shall quit somewhere - // currently we leave call instruction and continue construct graph - - //dump only the blocks which are from loops - - if (ModuloScheduling::printScheduleProcess()) this->dump(bb); if (isLoop(bb)) { - + DEBUG_PRINT(cerr << "building nodes for this BasicBlock\n"); buildNodesforBB(target, bb); @@ -868,12 +1015,14 @@ this->addMemEdges(bb); int ResII = this->computeResII(bb); + if (ModuloScheduling::printScheduleProcess()) DEBUG_PRINT(std::cerr << "ResII is " << ResII << "\n"); + int RecII = this->computeRecII(bb); if (ModuloScheduling::printScheduleProcess()) DEBUG_PRINT(std::cerr << "RecII is " << RecII << "\n"); - + this->MII = std::max(ResII, RecII); this->computeNodeProperty(bb); @@ -885,25 +1034,32 @@ if (ModuloScheduling::printScheduleProcess()) this->dump(); - //this->instrScheduling(); - - //this->dumpScheduling(); } } -ModuloSchedGraphNode *ModuloSchedGraph::getNode(const unsigned nodeId) const -{ +/* + get node with nodeId +*/ + +ModuloSchedGraphNode * +ModuloSchedGraph::getNode(const unsigned nodeId) const{ + for (const_iterator I = begin(), E = end(); I != E; I++) if ((*I).second->getNodeId() == nodeId) return (ModuloSchedGraphNode *) (*I).second; return NULL; + } -int ModuloSchedGraph::computeRecII(const BasicBlock *bb) -{ +/* + compute RecurrenceII +*/ + +int +ModuloSchedGraph::computeRecII(const BasicBlock *bb){ + int RecII = 0; - //os<<"begining computerRecII()"<<"\n"; //FIXME: only deal with circuits starting at the first node: the phi node //nodeId=2; @@ -913,15 +1069,14 @@ unsigned path[MAXNODE]; unsigned stack[MAXNODE][MAXNODE]; - + for (int j = 0; j < MAXNODE; j++) { path[j] = 0; for (int k = 0; k < MAXNODE; k++) stack[j][k] = 0; } - //in our graph, the node number starts at 2 - //number of nodes, because each instruction will result in one node + //in our graph, the node number starts at 2 const unsigned numNodes = bb->size(); int i = 0; @@ -1027,18 +1182,8 @@ circuits[j][k + 1] != 0 ? circuits[j][k + 1] : circuits[j][0]; - /* - for(ModuloSchedGraphNode::const_iterator I=node->beginOutEdges(), - E=node->endOutEdges();I !=E; I++) - { - SchedGraphEdge* edge= *I; - if(edge->getSink()->getNodeId() == nextNodeId) - {sumDelay += edge->getMinDelay();break;} - } - */ - sumDelay += - getMaxDelayEdge(circuits[j][k], nextNodeId)->getMinDelay(); + getMaxDelayEdge(circuits[j][k], nextNodeId)->getMinDelay(); } // assume we have distance 1, in this case the sumDelay is RecII @@ -1059,11 +1204,13 @@ return -1; } -void ModuloSchedGraph::addResourceUsage(std::vector > &ruVec, - int rid) -{ - //DEBUG_PRINT(std::cerr<<"\nadding a resouce , current resouceUsage vector size is - //"< > &ruVec, + int rid){ + bool alreadyExists = false; for (unsigned i = 0; i < ruVec.size(); i++) { if (rid == ruVec[i].first) { @@ -1074,13 +1221,18 @@ } if (!alreadyExists) ruVec.push_back(std::make_pair(rid, 1)); - //DEBUG_PRINT(std::cerr<<"current resouceUsage vector size is "< > &ru) -{ - TargetSchedInfo & msi = (TargetSchedInfo &) target.getSchedInfo(); +/* + dump the resource usage vector +*/ + +void +ModuloSchedGraph::dumpResourceUsage(std::vector > &ru){ + + TargetSchedInfo & msi = (TargetSchedInfo &) target.getSchedInfo(); + std::vector > resourceNumVector = msi.resourceNumVector; DEBUG_PRINT(std::cerr << "resourceID\t" << "resourceNum\n"); for (unsigned i = 0; i < resourceNumVector.size(); i++) @@ -1094,21 +1246,22 @@ DEBUG_PRINT(std::cerr << ru[i].first << "\t" << ru[i].second); const unsigned resNum = msi.getCPUResourceNum(ru[i].first); DEBUG_PRINT(std::cerr << "\t" << resNum << "\n"); - } + + } } -int ModuloSchedGraph::computeResII(const BasicBlock * bb) -{ +/* + compute thre resource restriction II +*/ +int +ModuloSchedGraph::computeResII(const BasicBlock * bb){ + const TargetInstrInfo & mii = target.getInstrInfo(); const TargetSchedInfo & msi = target.getSchedInfo(); - + int ResII; std::vector > resourceUsage; - //pair - - //FIXME: number of functional units the target machine can provide should be - //get from Target here I temporary hardcode it for (BasicBlock::const_iterator I = bb->begin(), E = bb->end(); I != E; I++) { @@ -1171,21 +1324,35 @@ +/* + dump the basicblock +*/ -void ModuloSchedGraph::dump(const BasicBlock * bb) -{ +void +ModuloSchedGraph::dump(const BasicBlock * bb){ + DEBUG_PRINT(std::cerr << "dumping basic block:"); DEBUG_PRINT(std::cerr << (bb->hasName()? bb->getName() : "block") - << " (" << bb << ")" << "\n"); + << " (" << bb << ")" << "\n"); + } -void ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os) -{ +/* + dump the basicblock to ostream os +*/ + +void +ModuloSchedGraph::dump(const BasicBlock * bb, std::ostream & os){ + os << "dumping basic block:"; os << (bb->hasName()? bb->getName() : "block") << " (" << bb << ")" << "\n"; } +/* + dump the graph +*/ + void ModuloSchedGraph::dump() const { DEBUG_PRINT(std::cerr << " ModuloSchedGraph for basic Blocks:"); @@ -1199,8 +1366,7 @@ << ((i == N - 1) ? "" : ", ")); DEBUG_PRINT(std::cerr << "\n Graph Nodes:\n"); - //for (const_iterator I=begin(); I != end(); ++I) - //DEBUG_PRINT(std::cerr << "\n" << *I->second; + unsigned numNodes = bb->size(); for (unsigned i = 2; i < numNodes + 2; i++) { ModuloSchedGraphNode *node = getNode(i); @@ -1210,6 +1376,11 @@ DEBUG_PRINT(std::cerr << "\n"); } + +/* + dump all node property +*/ + void ModuloSchedGraph::dumpNodeProperty() const { @@ -1230,6 +1401,10 @@ /************member functions for ModuloSchedGraphSet**************/ +/* + constructor +*/ + ModuloSchedGraphSet::ModuloSchedGraphSet(const Function *function, const TargetMachine &target) : method(function){ @@ -1238,6 +1413,10 @@ } +/* + destructor +*/ + ModuloSchedGraphSet::~ModuloSchedGraphSet(){ @@ -1248,6 +1427,10 @@ +/* + build graph for each basicblock in this method +*/ + void ModuloSchedGraphSet::buildGraphsForMethod(const Function *F, const TargetMachine &target){ @@ -1261,6 +1444,10 @@ } +/* + dump the graph set +*/ + void ModuloSchedGraphSet::dump() const{ @@ -1279,6 +1466,10 @@ /********************misc functions***************************/ +/* + dump the input basic block +*/ + static void dumpBasicBlock(const BasicBlock * bb){ @@ -1287,6 +1478,9 @@ << " (" << bb << ")" << "\n"); } +/* + dump the input node +*/ std::ostream& operator<<(std::ostream &os, const ModuloSchedGraphNode &node) Index: llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h diff -u llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h:1.7 llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h:1.8 --- llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h:1.7 Sun Jun 8 18:16:07 2003 +++ llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h Tue Jun 10 14:09:00 2003 @@ -120,7 +120,7 @@ const Instruction * _inst, int indexInBB, const TargetMachine &target); - + friend std::ostream & operator<<(std::ostream & os, const ModuloSchedGraphNode & edge); Index: llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp diff -u llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.7 llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.8 --- llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.7 Sun Jun 8 18:16:07 2003 +++ llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp Tue Jun 10 14:09:00 2003 @@ -920,7 +920,7 @@ ModuloSchedGraphSet *graphSet = new ModuloSchedGraphSet(&F, target); - //ModuloSchedulingSet ModuloSchedulingSet(*graphSet); + ModuloSchedulingSet ModuloSchedulingSet(*graphSet); printf("runOnFunction in ModuloSchedulingPass returns\n"); return false; From gshi1 at cs.uiuc.edu Tue Jun 10 15:03:00 2003 From: gshi1 at cs.uiuc.edu (Guochun Shi) Date: Tue Jun 10 15:03:00 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ModuloScheduling/README Message-ID: <200306102002.PAA16795@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/ModuloScheduling: README added (r1.1) --- Log message: a simple introduction to this pass --- Diffs of the changes: Index: llvm/lib/CodeGen/ModuloScheduling/README diff -c /dev/null llvm/lib/CodeGen/ModuloScheduling/README:1.1 *** /dev/null Tue Jun 10 15:02:26 2003 --- llvm/lib/CodeGen/ModuloScheduling/README Tue Jun 10 15:02:16 2003 *************** *** 0 **** --- 1,33 ---- + The moduloScheduling pass includes two passes + + + 1. building graph + The pass will build an instance of class ModuloSchedGraph for each loop-including basicblock in a function. The steps to build a graph: + a)build one node for each instruction in the basicblock + ---ModuloScheduGraph::buildNodesforBB() + b)add def-use edges + ---ModuloScheduGraph::addDefUseEdges() + c)add cd edges + ---ModuloScheduGraph::addCDEdges() + d)add mem dependency edges + ---ModuloScheduGraph::addMemEdges() + e)compute resource restriction II and recurrenct II + ---ModuloScheduGraph::computeResII() + ---ModuloScheduGraph::computeRecII() + f)compute each node's property, including ASAP,ALAP, Mov, Depth and Height. + ---ModuloScheduGraph::computeNodeProperty + g)sort all nodes + ---ModuloScheduGraph::orderNodes() + + + 2. compute schedule + The second step is to compute a schule and replace the orginal basic block with three basicblocks: prelogue, kernelblock and epilog. + + a)compute the schedule according the algorithm described in the paper + ---ModuloScheduling::computeSchedule() + + b)replace the original basicblock.(to be done) + ---ModuloScheduling::constructPrologue(); + ---ModuloScheduling::constructKernel(); + ---ModuloScheduling::constructEpilogue(); + These three functions are not working yet. From gshi1 at cs.uiuc.edu Tue Jun 10 15:04:02 2003 From: gshi1 at cs.uiuc.edu (Guochun Shi) Date: Tue Jun 10 15:04:02 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ModuloScheduling/README Message-ID: <200306102003.PAA16870@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/ModuloScheduling: README updated: 1.1 -> 1.2 --- Log message: add an brief instruction what this pass is --- Diffs of the changes: Index: llvm/lib/CodeGen/ModuloScheduling/README diff -u llvm/lib/CodeGen/ModuloScheduling/README:1.1 llvm/lib/CodeGen/ModuloScheduling/README:1.2 --- llvm/lib/CodeGen/ModuloScheduling/README:1.1 Tue Jun 10 15:02:16 2003 +++ llvm/lib/CodeGen/ModuloScheduling/README Tue Jun 10 15:03:39 2003 @@ -1,4 +1,4 @@ -The moduloScheduling pass includes two passes +The modulo scheduling pass impliment modulo scheduling for llvm instruction. It includes two passes 1. building graph From gshi1 at cs.uiuc.edu Tue Jun 10 15:05:00 2003 From: gshi1 at cs.uiuc.edu (Guochun Shi) Date: Tue Jun 10 15:05:00 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp ModuloScheduling.h Message-ID: <200306102004.PAA16902@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/ModuloScheduling: ModuloScheduling.cpp updated: 1.8 -> 1.9 ModuloScheduling.h updated: 1.8 -> 1.9 --- Log message: add some comments add a function ModuloScheduling::dumpFinalSchedule() to print out final schedule --- Diffs of the changes: Index: llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp diff -u llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.8 llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.9 --- llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp:1.8 Tue Jun 10 14:09:00 2003 +++ llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp Tue Jun 10 15:04:30 2003 @@ -27,6 +27,7 @@ #include using std::endl; +using std::cerr; //************************************************************ // printing Debug information @@ -52,10 +53,9 @@ // Computes the schedule and inserts epilogue and prologue // -void ModuloScheduling::instrScheduling() -{ +void +ModuloScheduling::instrScheduling(){ - printf(" instrScheduling \n"); if (ModuloScheduling::printScheduleProcess()) DEBUG_PRINT(std::cerr << "************ computing modulo schedule ***********\n"); @@ -81,10 +81,9 @@ } } - //print the final schedule if necessary - if (ModuloScheduling::printSchedule()) - dumpScheduling(); - + //print the final schedule + dumpFinalSchedule(); + //the schedule has been computed //create epilogue, prologue and kernel BasicBlock @@ -127,10 +126,13 @@ } + // Clear memory from the last round and initialize if necessary // -void ModuloScheduling::clearInitMem(const TargetSchedInfo & msi) -{ + +void +ModuloScheduling::clearInitMem(const TargetSchedInfo & msi){ + unsigned numIssueSlots = msi.maxNumIssueTotal; // clear nodeScheduled from the last round if (ModuloScheduling::printScheduleProcess()) { @@ -162,8 +164,9 @@ // Compute schedule and coreSchedule with the current II // -bool ModuloScheduling::computeSchedule() -{ +bool +ModuloScheduling::computeSchedule(){ + if (ModuloScheduling::printScheduleProcess()) DEBUG_PRINT(std::cerr << "start to compute schedule\n"); @@ -276,8 +279,9 @@ // Get the successor of the BasicBlock // -BasicBlock *ModuloScheduling::getSuccBB(BasicBlock *bb) -{ +BasicBlock * +ModuloScheduling::getSuccBB(BasicBlock *bb){ + BasicBlock *succ_bb; for (unsigned i = 0; i < II; ++i) for (unsigned j = 0; j < coreSchedule[i].size(); ++j) @@ -310,8 +314,9 @@ // Get the predecessor of the BasicBlock // -BasicBlock *ModuloScheduling::getPredBB(BasicBlock *bb) -{ +BasicBlock * +ModuloScheduling::getPredBB(BasicBlock *bb){ + BasicBlock *pred_bb; for (unsigned i = 0; i < II; ++i) for (unsigned j = 0; j < coreSchedule[i].size(); ++j) @@ -342,8 +347,9 @@ // Construct the prologue // -void ModuloScheduling::constructPrologue(BasicBlock *prologue) -{ +void +ModuloScheduling::constructPrologue(BasicBlock *prologue){ + InstListType & prologue_ist = prologue->getInstList(); vvNodeType & tempSchedule_prologue = *(new std::vector >(schedule)); @@ -397,10 +403,11 @@ // Construct the kernel BasicBlock // -void ModuloScheduling::constructKernel(BasicBlock *prologue, +void +ModuloScheduling::constructKernel(BasicBlock *prologue, BasicBlock *kernel, - BasicBlock *epilogue) -{ + BasicBlock *epilogue){ + //*************fill instructions in the kernel**************** InstListType & kernel_ist = kernel->getInstList(); BranchInst *brchInst; @@ -472,9 +479,9 @@ // Construct the epilogue // -void ModuloScheduling::constructEpilogue(BasicBlock *epilogue, - BasicBlock *succ_bb) -{ +void +ModuloScheduling::constructEpilogue(BasicBlock *epilogue, + BasicBlock *succ_bb){ //compute the schedule for epilogue vvNodeType &tempSchedule_epilogue = @@ -546,8 +553,9 @@ //its latest clone i.e. after this function is called, the ist is not used //anywhere and it can be erased. //------------------------------------------------------------------------------ -void ModuloScheduling::updateUseWithClone(Instruction * ist) -{ +void +ModuloScheduling::updateUseWithClone(Instruction * ist){ + while (ist->use_size() > 0) { bool destroyed = false; @@ -587,8 +595,9 @@ //this function clear all clone mememoy //i.e. set all instruction's clone memory to NULL //***************************************************** -void ModuloScheduling::clearCloneMemory() -{ +void +ModuloScheduling::clearCloneMemory(){ + for (unsigned i = 0; i < coreSchedule.size(); i++) for (unsigned j = 0; j < coreSchedule[i].size(); j++) if (coreSchedule[i][j]) @@ -603,8 +612,9 @@ // because LLVM is in SSA form and we should use the correct value //this fuction also update the instruction orn's latest clone memory //****************************************************************************** -Instruction *ModuloScheduling::cloneInstSetMemory(Instruction * orn) -{ +Instruction * +ModuloScheduling::cloneInstSetMemory(Instruction * orn){ + // make a clone instruction Instruction *cln = orn->clone(); @@ -624,10 +634,11 @@ -bool ModuloScheduling::ScheduleNode(ModuloSchedGraphNode * node, +bool +ModuloScheduling::ScheduleNode(ModuloSchedGraphNode * node, unsigned start, unsigned end, - NodeVec & nodeScheduled) -{ + NodeVec & nodeScheduled){ + const TargetSchedInfo & msi = target.getSchedInfo(); unsigned int numIssueSlots = msi.maxNumIssueTotal; @@ -734,9 +745,10 @@ } -void ModuloScheduling::updateResourceTable(Resources useResources, - int startCycle) -{ +void +ModuloScheduling::updateResourceTable(Resources useResources, + int startCycle){ + for (unsigned i = 0; i < useResources.size(); i++) { int absCycle = startCycle + i; int coreCycle = absCycle % II; @@ -752,9 +764,10 @@ } } -void ModuloScheduling::undoUpdateResourceTable(Resources useResources, - int startCycle) -{ +void +ModuloScheduling::undoUpdateResourceTable(Resources useResources, + int startCycle){ + for (unsigned i = 0; i < useResources.size(); i++) { int absCycle = startCycle + i; int coreCycle = absCycle % II; @@ -783,8 +796,9 @@ //----------------------------------------------------------------------- -bool ModuloScheduling::resourceTableNegative() -{ +bool +ModuloScheduling::resourceTableNegative(){ + assert(resourceTable.size() == (unsigned) II && "resouceTable size must be equal to II"); bool isNegative = false; @@ -806,8 +820,9 @@ // //------------------------------------------------------------------------ -void ModuloScheduling::dumpResourceUsageTable() -{ +void +ModuloScheduling::dumpResourceUsageTable(){ + DEBUG_PRINT(std::cerr << "dumping resource usage table\n"); for (unsigned i = 0; i < resourceTable.size(); i++) { for (unsigned j = 0; j < resourceTable[i].size(); j++) @@ -824,8 +839,9 @@ // print out thisSchedule for debug // //----------------------------------------------------------------------- -void ModuloScheduling::dumpSchedule(vvNodeType thisSchedule) -{ +void +ModuloScheduling::dumpSchedule(vvNodeType thisSchedule){ + const TargetSchedInfo & msi = target.getSchedInfo(); unsigned numIssueSlots = msi.maxNumIssueTotal; for (unsigned i = 0; i < numIssueSlots; i++) @@ -850,8 +866,9 @@ // //------------------------------------------------------- -void ModuloScheduling::dumpScheduling() -{ +void +ModuloScheduling::dumpScheduling(){ + DEBUG_PRINT(std::cerr << "dump schedule:" << "\n"); const TargetSchedInfo & msi = target.getSchedInfo(); unsigned numIssueSlots = msi.maxNumIssueTotal; @@ -883,7 +900,47 @@ } } +/* + print out final schedule +*/ +void +ModuloScheduling::dumpFinalSchedule(){ + + cerr << "dump schedule:" << endl; + const TargetSchedInfo & msi = target.getSchedInfo(); + unsigned numIssueSlots = msi.maxNumIssueTotal; + + for (unsigned i = 0; i < numIssueSlots; i++) + cerr << "\t#"; + cerr << endl; + + for (unsigned i = 0; i < schedule.size(); i++) { + cerr << "cycle" << i << ": "; + + for (unsigned j = 0; j < schedule[i].size(); j++) + if (schedule[i][j] != NULL) + cerr << schedule[i][j]->getNodeId() << "\t"; + else + cerr << "\t"; + cerr << endl; + } + + cerr << "dump coreSchedule:" << endl; + for (unsigned i = 0; i < numIssueSlots; i++) + cerr << "\t#"; + cerr << endl; + + for (unsigned i = 0; i < coreSchedule.size(); i++) { + cerr << "cycle" << i << ": "; + for (unsigned j = 0; j < coreSchedule[i].size(); j++) + if (coreSchedule[i][j] != NULL) + cerr << coreSchedule[i][j]->getNodeId() << "\t"; + else + cerr << "\t"; + cerr << endl; + } +} //--------------------------------------------------------------------------- // Function: ModuloSchedulingPass @@ -915,20 +972,20 @@ } // end anonymous namespace -bool ModuloSchedulingPass::runOnFunction(Function &F) -{ - +bool +ModuloSchedulingPass::runOnFunction(Function &F){ + ModuloSchedGraphSet *graphSet = new ModuloSchedGraphSet(&F, target); ModuloSchedulingSet ModuloSchedulingSet(*graphSet); - printf("runOnFunction in ModuloSchedulingPass returns\n"); + DEBUG_PRINT(cerr<<"runOnFunction in ModuloSchedulingPass returns\n"< #include -#define DEBUG_PRINT(x) x +//#define DEBUG_PRINT(x) x + +#define DEBUG_PRINT(x) // for debug information selecton enum ModuloSchedDebugLevel_t { @@ -98,6 +100,7 @@ // Debug functions: // Dump the schedule and core schedule void dumpScheduling(); + void dumpFinalSchedule(); // Dump the input vector of nodes // sch: the input vector of nodes From dhurjati at cs.uiuc.edu Tue Jun 10 19:30:04 2003 From: dhurjati at cs.uiuc.edu (Dinakar Dhurjati) Date: Tue Jun 10 19:30:04 2003 Subject: [llvm-commits] CVS: llvm/www/safecode/index.html Message-ID: <200306110025.TAA10200@tank.cs.uiuc.edu> Changes in directory llvm/www/safecode: index.html updated: 1.6 -> 1.7 --- Log message: Added image --- Diffs of the changes: Index: llvm/www/safecode/index.html diff -u llvm/www/safecode/index.html:1.6 llvm/www/safecode/index.html:1.7 --- llvm/www/safecode/index.html:1.6 Fri Jun 6 16:39:30 2003 +++ llvm/www/safecode/index.html Tue Jun 10 19:25:21 2003 @@ -38,6 +38,12 @@ +

Implementation :

+ + + IMPLEmentation 
+picture +

Download :

Not in public domain for now. Check this page later. From dhurjati at cs.uiuc.edu Tue Jun 10 19:30:06 2003 From: dhurjati at cs.uiuc.edu (Dinakar Dhurjati) Date: Tue Jun 10 19:30:06 2003 Subject: [llvm-commits] CVS: llvm/www/safecode/impl.jpg Message-ID: <200306110026.TAA10229@tank.cs.uiuc.edu> Changes in directory llvm/www/safecode: impl.jpg added (r1.1) --- Log message: Image file --- Diffs of the changes: Index: llvm/www/safecode/impl.jpg From criswell at cs.uiuc.edu Wed Jun 11 08:50:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 08:50:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Makefile Message-ID: <200306111349.IAA11323@choi.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Makefile added (r1.23) --- Log message: Updated for the new projects Makefile. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/Makefile diff -c /dev/null llvm/lib/Target/Sparc/Makefile:1.1 *** /dev/null Wed Jun 11 08:49:21 2003 --- llvm/lib/Target/Sparc/Makefile Thu Sep 13 22:47:56 2001 *************** *** 0 **** --- 1,14 ---- + LEVEL = ../../../.. + + DIRS = + + LIBRARYNAME = sparc + + ## List source files in link order + Source = \ + Sparc.o \ + Sparc.burm.o \ + SparcInstrSelection.o + + include $(LEVEL)/Makefile.common + From criswell at cs.uiuc.edu Wed Jun 11 08:56:00 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 08:56:00 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Burg/Makefile Message-ID: <200306111355.IAA11346@choi.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Burg: Makefile updated: 1.3 -> 1.4 --- Log message: Modified Makefile.common to handle compilation of projects inside and outside of the llvm source directory. The main modification was to add new environment variables: one set for llvm entities and another set for source entities current being compiled. This should make the Makefile more flexible and easier to understand as each environment variable only does one thing. --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Burg/Makefile diff -u llvm/test/Programs/MultiSource/Burg/Makefile:1.3 llvm/test/Programs/MultiSource/Burg/Makefile:1.4 --- llvm/test/Programs/MultiSource/Burg/Makefile:1.3 Sun Jun 1 21:02:01 2003 +++ llvm/test/Programs/MultiSource/Burg/Makefile Wed Jun 11 08:55:44 2003 @@ -11,7 +11,7 @@ Source := $(ExtraSource) $(wildcard *.c) -## $(BUILD_ROOT)/Depend/y.tab.d:: y.tab.c $(BUILD_ROOT)/Depend/.dir +## $(BUILD_OBJ_ROOT)/Depend/y.tab.d:: y.tab.c $(BUILD_OBJ_ROOT)/Depend/.dir %.cpp %.h : %.y yacc -d $< @@ -28,7 +28,7 @@ Source := $(patsubst gram.%,,$(Source)) -## $(BUILD_ROOT)/Depend/gram.d: gram.y +## $(BUILD_OBJ_ROOT)/Depend/gram.d: gram.y src: echo Sources = $(Source) From criswell at cs.uiuc.edu Wed Jun 11 08:57:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 08:57:02 2003 Subject: [llvm-commits] CVS: llvm/Makefile Makefile.config Makefile.common Message-ID: <200306111356.IAA11357@choi.cs.uiuc.edu> Changes in directory llvm: Makefile updated: 1.3 -> 1.4 Makefile.config updated: 1.14 -> 1.15 Makefile.common updated: 1.87 -> 1.88 --- Log message: Modified Makefile.common to handle compilation of projects inside and outside of the llvm source directory. The main modification was to add new environment variables: one set for llvm entities and another set for source entities current being compiled. This should make the Makefile more flexible and easier to understand as each environment variable only does one thing. --- Diffs of the changes: Index: llvm/Makefile diff -u llvm/Makefile:1.3 llvm/Makefile:1.4 --- llvm/Makefile:1.3 Sun Dec 1 19:23:26 2002 +++ llvm/Makefile Wed Jun 11 08:55:26 2003 @@ -1,5 +1,6 @@ LEVEL = . DIRS = lib/Support utils lib tools +OPTIONAL_DIRS = projects include $(LEVEL)/Makefile.common Index: llvm/Makefile.config diff -u llvm/Makefile.config:1.14 llvm/Makefile.config:1.15 --- llvm/Makefile.config:1.14 Fri May 30 10:49:28 2003 +++ llvm/Makefile.config Wed Jun 11 08:55:26 2003 @@ -34,12 +34,13 @@ BISON = bison FLEX = flex -# Path to directory where object files should be stored during a build. -# Set LLVM_OBJ_DIR to "." if you do not want to use a separate place for -# object files. +# +# Path OBJ_ROOT to the directory where object files should be stored during a +# build. Set to "." if you do not want to use a separate place for object +# files. # -#LLVM_OBJ_DIR = . -LLVM_OBJ_DIR := /localhome/$(USER) +#OBJ_ROOT = . +OBJ_ROOT := /localhome/$(USER) # Path to location for LLVM front-end this should only be specified here if you # want to override the value set in Makefile.$(uname) Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.87 llvm/Makefile.common:1.88 --- llvm/Makefile.common:1.87 Fri May 30 10:50:31 2003 +++ llvm/Makefile.common Wed Jun 11 08:55:26 2003 @@ -45,60 +45,94 @@ # include $(LEVEL)/Makefile.config -# Figure out how to do platform specific stuff on this platform. This is really -# gross and should be autoconfiscated (automake actually), but should hopefully -# work on Linux and solaris (SunOS). +########################################################################### +# Directory Configuration +# This section of the Makefile determines what is where. To be +# specific, there are several locations that need to be defined: # -UNAME := $(shell uname) -include $(LEVEL)/Makefile.$(UNAME) +# o LLVM_SRC_ROOT : The root directory of the LLVM source code. +# o LLVM_OBJ_ROOT : The root directory containing the built LLVM code. +# +# o BUILD_SRC_DIR : The directory containing the code to build. +# o BUILD_SRC_ROOT : The root directory of the code to build. +# +# o BUILD_OBJ_DIR : The directory in which compiled code will be placed. +# o BUILD_OBJ_ROOT : The root directory in which compiled code is placed. +# +########################################################################### -ifdef SHARED_LIBRARY -# if SHARED_LIBRARY is specified, the default is to build the dynamic lib -dynamic :: +# +# Set the source build directory. That is almost always the current directory. +# +ifndef BUILD_SRC_DIR +BUILD_SRC_DIR = $(shell pwd) endif -# Default Rule: Make sure it's also a :: rule -all :: - -# Default for install is to at least build everything... -install :: - - -# Figure out which directory to build stuff into. We want to build into the -# /shared directory by default because it is guaranteed to be local to the -# current machine. # +# Set the source root directory. +# +ifndef BUILD_SRC_ROOT +BUILD_SRC_ROOT = $(BUILD_SRC_DIR)/$(LEVEL) +endif -ifeq ($(LLVM_OBJ_DIR),.) -BUILD_ROOT = $(LLVM_OBJ_DIR) - -ifdef PROJ_COMPILE -BUILD_ROOT_TOP = $(PROJLEVEL) +# +# Set the object build directory. Its location depends upon the source path +# and where object files should go. +# +ifndef BUILD_OBJ_DIR +ifeq ($(OBJ_ROOT),.) +BUILD_OBJ_DIR = $(shell pwd) else -BUILD_ROOT_TOP = $(LEVEL) -endif +BUILD_OBJ_DIR := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(shell cd $(BUILD_SRC_DIR); pwd)) +endif +endif +# +# Set the root of the object directory. +# +ifndef BUILD_OBJ_ROOT +ifeq ($(OBJ_ROOT),.) +BUILD_OBJ_ROOT = $(shell cd $(LEVEL); pwd) else +BUILD_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(shell cd $(LEVEL); pwd)) +endif +endif -BUILD_ROOT := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(shell pwd)) +# +# Set the LLVM source directory. +# It is typically the root directory of what we're compiling now. +# +ifndef LLVM_SRC_ROOT +LLVM_SRC_ROOT = $(BUILD_SRC_ROOT) +endif -# Calculate the BUILD_ROOT_TOP variable, which is the top of the llvm/ tree. -# Note that although this is just equal to $(BUILD_ROOT)/$(LEVEL), we cannot use -# this expression because some of the directories on the source tree may not -# exist in the build tree (for example the test/ heirarchy). Thus we evaluate -# the directory to eliminate the ../'s # -ifdef PROJ_COMPILE -TOP_DIRECTORY := $(shell cd $(PROJLEVEL); pwd) -else -TOP_DIRECTORY := $(shell cd $(LEVEL); pwd) +# Set the LLVM object directory. +# +ifndef LLVM_OBJ_ROOT +LLVM_OBJ_ROOT = $(BUILD_OBJ_ROOT) endif -BUILD_ROOT_TOP := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(TOP_DIRECTORY)) +# Figure out how to do platform specific stuff on this platform. This is really +# gross and should be autoconfiscated (automake actually), but should hopefully +# work on Linux and solaris (SunOS). +# +UNAME := $(shell uname) +include $(LLVM_SRC_ROOT)/Makefile.$(UNAME) + +ifdef SHARED_LIBRARY +# if SHARED_LIBRARY is specified, the default is to build the dynamic lib +dynamic :: endif +# Default Rule: Make sure it's also a :: rule +all :: +# Default for install is to at least build everything... +install :: +# Default rule for test. It ensures everything has a test rule +test:: #-------------------------------------------------------------------- # Variables derived from configuration options... @@ -110,7 +144,7 @@ BURG_OPTS = -I -PURIFY := $(PURIFY) -cache-dir="$(BUILD_ROOT_TOP)/../purifycache" -chain-length="30" -messages=all +PURIFY := $(PURIFY) -cache-dir="$(BUILD_OBJ_ROOT)/../purifycache" -chain-length="30" -messages=all ifdef ENABLE_PROFILING ENABLE_OPTIMIZED = 1 @@ -123,38 +157,56 @@ endif endif -# Shorthand for commonly accessed directories -# DESTLIBXYZ indicates destination for the libraries built -DESTLIBDEBUG := $(BUILD_ROOT_TOP)/lib/Debug -DESTLIBRELEASE := $(BUILD_ROOT_TOP)/lib/Release -DESTLIBPROFILE := $(BUILD_ROOT_TOP)/lib/Profile -DESTLIBCURRENT := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION) - -ifdef PROJ_COMPILE -#get the llvm libraries from LLVM_LIB_DIR -LLVMLIBDEBUGSOURCE := $(LLVM_LIB_DIR)/lib/Debug -LLVMLIBRELEASESOURCE := $(LLVM_LIB_DIR)/lib/Release -LLVMLIBPROFILESOURCE := $(LLVM_LIB_DIR)/lib/Profile -LLVMLIBCURRENTSOURCE := $(LLVM_LIB_DIR)/lib/$(CONFIGURATION) - -PROJLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug -PROJLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release -PROJLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile -PROJLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION) - -else -#when we are building llvm, destination is same as source -LLVMLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug -LLVMLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release -LLVMLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile -LLVMLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION) -endif - - -TOOLDEBUG := $(BUILD_ROOT_TOP)/tools/Debug -TOOLRELEASE := $(BUILD_ROOT_TOP)/tools/Release -TOOLPROFILE := $(BUILD_ROOT_TOP)/tools/Profile -TOOLCURRENT := $(BUILD_ROOT_TOP)/tools/$(CONFIGURATION) +########################################################################### +# Library Locations +# These variables describe various library locations: +# +# DEST* = Location of where libraries that are built will be placed. +# LLVM* = Location of LLVM libraries used for linking. +# PROJ* = Location of previously built libraries used for linking. +########################################################################### + +# Libraries that are being built +DESTLIBDEBUG := $(BUILD_OBJ_ROOT)/lib/Debug +DESTLIBRELEASE := $(BUILD_OBJ_ROOT)/lib/Release +DESTLIBPROFILE := $(BUILD_OBJ_ROOT)/lib/Profile +DESTLIBCURRENT := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) + +# LLVM libraries used for linking +LLVMLIBDEBUGSOURCE := $(LLVM_OBJ_ROOT)/lib/Debug +LLVMLIBRELEASESOURCE := $(LLVM_OBJ_ROOT)/lib/Release +LLVMLIBPROFILESOURCE := $(LLVM_OBJ_ROOT)/lib/Profile +LLVMLIBCURRENTSOURCE := $(LLVM_OBJ_ROOT)/lib/$(CONFIGURATION) + +# Libraries that were built that will now be used for linking +PROJLIBDEBUGSOURCE := $(BUILD_OBJ_ROOT)/lib/Debug +PROJLIBRELEASESOURCE := $(BUILD_OBJ_ROOT)/lib/Release +PROJLIBPROFILESOURCE := $(BUILD_OBJ_ROOT)/lib/Profile +PROJLIBCURRENTSOURCE := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) + +########################################################################### +# Tool Locations +# These variables describe various tool locations: +# +# DEST* = Location of where tools that are built will be placed. +# LLVM* = Location of LLVM tools used for building. +# PROJ* = Location of previously built tools used for linking. +########################################################################### + +DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug +DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release +DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile +DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) + +LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/tools/Debug +LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/tools/Release +LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/tools/Profile +LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/tools/$(CONFIGURATION) + +PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug +PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release +PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile +PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION) # Verbosity levels ifndef VERBOSE @@ -165,13 +217,14 @@ # Compilation options... #--------------------------------------------------------- +########################################################################### # Special tools used while building the LLVM tree. Burg is built as part of the # utils directory. -# -BURG := $(TOOLCURRENT)/burg +########################################################################### +BURG := $(LLVMTOOLCURRENT)/burg RunBurg := $(BURG) $(BURG_OPTS) -TBLGEN := $(TOOLCURRENT)/tblgen +TBLGEN := $(LLVMTOOLCURRENT)/tblgen # Enable this for profiling support with 'gprof' # This automatically enables optimized builds. @@ -179,12 +232,14 @@ PROFILE = -pg endif -#if PROJDIR is defined then we include project include directory -ifndef PROJ_COMPILE -PROJ_INCLUDE = . -else -PROJ_INCLUDE = $(TOP_DIRECTORY)/include -endif +########################################################################### +# Compile Time Flags +########################################################################### + +# +# Include both the project headers and the LLVM headers for compilation +# +CPPFLAGS += -I$(BUILD_SRC_ROOT)/include -I$(LLVM_SRC_ROOT)/include # By default, strip symbol information from executable ifndef KEEP_SYMBOLS @@ -196,7 +251,7 @@ CPPFLAGS += -D_GNU_SOURCE # -Wno-unused-parameter -CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include -I$(PROJ_INCLUDE) +CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions -fshort-enums # Compile a cpp file, don't link... @@ -242,8 +297,8 @@ MakeSOP := $(MakeSOO) $(PROFILE) # Create dependancy file from CPP file, send to stdout. -Depend := $(CXX) -MM -I$(LEVEL)/include -I$(PROJ_INCLUDE) $(CPPFLAGS) -DependC := $(CC) -MM -I$(LEVEL)/include -I$(PROJ_INCLUDE) $(CPPFLAGS) +Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS) +DependC := $(CC) -MM -I$(LEVEL)/include $(CPPFLAGS) # Archive a bunch of .o files into a .a file... AR = ${AR_PATH} cq @@ -259,9 +314,9 @@ endif Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source)))))) -ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs)) -ObjectsP := $(addprefix $(BUILD_ROOT)/Profile/,$(Objs)) -ObjectsG := $(addprefix $(BUILD_ROOT)/Debug/,$(Objs)) +ObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(Objs)) +ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs)) +ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs)) #--------------------------------------------------------- @@ -394,14 +449,12 @@ ifdef TOOLNAME # TOOLEXENAME* - These compute the output filenames to generate... -TOOLEXENAME_G := $(BUILD_ROOT_TOP)/tools/Debug/$(TOOLNAME) -TOOLEXENAME_O := $(BUILD_ROOT_TOP)/tools/Release/$(TOOLNAME) -TOOLEXENAME_P := $(BUILD_ROOT_TOP)/tools/Profile/$(TOOLNAME) -TOOLEXENAMES := $(BUILD_ROOT_TOP)/tools/$(CONFIGURATION)/$(TOOLNAME) +TOOLEXENAME_G := $(DESTTOOLDEBUG)/$(TOOLNAME) +TOOLEXENAME_O := $(DESTTOOLRELEASE)/$(TOOLNAME) +TOOLEXENAME_P := $(DESTTOOLPROFILE)/$(TOOLNAME) +TOOLEXENAMES := $(DESTTOOLCURRENT)/$(TOOLNAME) # USED_LIBS_OPTIONS - Compute the options line that add -llib1 -llib2, etc. -ifdef PROJ_COMPILE - PROJ_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) PROJ_LIBS_OPTIONS_G := $(patsubst %.o, $(PROJLIBDEBUGSOURCE)/%.o, $(PROJ_LIBS_OPTIONS)) PROJ_LIBS_OPTIONS_O := $(patsubst %.o, $(PROJLIBRELEASESOURCE)/%.o,$(PROJ_LIBS_OPTIONS)) @@ -416,23 +469,6 @@ LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_P) LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P) -else - -LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) -LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS)) -LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS)) -LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS)) - -LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G) -LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O) -LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P) -endif - - - - - - # USED_LIB_PATHS - Compute the path of the libraries used so that tools are # rebuilt if libraries change. This has to make sure to handle .a/.so and .o # files seperately. @@ -457,15 +493,15 @@ clean:: $(VERB) rm -f $(TOOLEXENAMES) -$(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(TOOLDEBUG)/.dir +$(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)======= $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) -$(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(TOOLRELEASE)/.dir +$(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir @echo ======= Linking $(TOOLNAME) release executable ======= $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS) -$(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(TOOLPROFILE)/.dir +$(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir @echo ======= Linking $(TOOLNAME) profile executable ======= $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS) @@ -474,30 +510,30 @@ #--------------------------------------------------------- -.PRECIOUS: $(BUILD_ROOT)/Depend/.dir -.PRECIOUS: $(BUILD_ROOT)/Debug/.dir $(BUILD_ROOT)/Release/.dir +.PRECIOUS: $(BUILD_OBJ_DIR)/Depend/.dir +.PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir # Create .o files in the ObjectFiles directory from the .cpp and .c files... -$(BUILD_ROOT)/Release/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Release/.dir +$(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir @echo "Compiling $<" $(VERB) $(CompileO) $< -o $@ -$(BUILD_ROOT)/Release/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Release/.dir +$(BUILD_OBJ_DIR)/Release/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir $(VERB) $(CompileCO) $< -o $@ -$(BUILD_ROOT)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Profile/.dir +$(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir @echo "Compiling $<" $(VERB) $(CompileP) $< -o $@ -$(BUILD_ROOT)/Profile/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Profile/.dir +$(BUILD_OBJ_DIR)/Profile/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir @echo "Compiling $<" $(VERB) $(CompileCP) $< -o $@ -$(BUILD_ROOT)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Debug/.dir +$(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir @echo "Compiling $<" $(VERB) $(CompileG) $< -o $@ -$(BUILD_ROOT)/Debug/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Debug/.dir +$(BUILD_OBJ_DIR)/Debug/%.o: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir $(VERB) $(CompileCG) $< -o $@ # @@ -543,7 +579,7 @@ # 'make clean' nukes the tree clean:: - $(VERB) rm -rf $(BUILD_ROOT)/Debug $(BUILD_ROOT)/Release $(BUILD_ROOT)/Profile $(BUILD_ROOT)/Depend + $(VERB) rm -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend $(VERB) rm -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc $(VERB) rm -f $(LEX_OUTPUT) $(YACC_OUTPUT) @@ -551,16 +587,16 @@ # include the dependancies now... # SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source)))) -SourceDepend := $(SourceBaseNames:%=$(BUILD_ROOT)/Depend/%.d) +SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d) # Create dependencies for the *.cpp files... #$(SourceDepend): \x -$(BUILD_ROOT)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_ROOT)/Depend/.dir - $(VERB) $(Depend) $< | sed 's|$*\.o *|$(BUILD_ROOT)/Release/& $(BUILD_ROOT)/Profile/& $(BUILD_ROOT)/Debug/& $(BUILD_ROOT)/Depend/$(@F)|g' > $@ +$(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Depend/.dir + $(VERB) $(Depend) $< | sed 's|$*\.o *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@ # Create dependencies for the *.c files... #$(SourceDepend): \x -$(BUILD_ROOT)/Depend/%.d: $(SourceDir)%.c $(BUILD_ROOT)/Depend/.dir +$(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Depend/.dir $(VERB) $(DependC) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@ ifneq ($(SourceDepend),) From criswell at cs.uiuc.edu Wed Jun 11 08:58:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 08:58:01 2003 Subject: [llvm-commits] CVS: llvm/test/Makefile.tests Message-ID: <200306111357.IAA11371@choi.cs.uiuc.edu> Changes in directory llvm/test: Makefile.tests updated: 1.61 -> 1.62 --- Log message: Updated to use the new Makefile.common. Replaced the hard-coded compiler variable with the one defined by Makefile.config. --- Diffs of the changes: Index: llvm/test/Makefile.tests diff -u llvm/test/Makefile.tests:1.61 llvm/test/Makefile.tests:1.62 --- llvm/test/Makefile.tests:1.61 Wed Jun 4 09:24:50 2003 +++ llvm/test/Makefile.tests Wed Jun 11 08:56:55 2003 @@ -31,9 +31,9 @@ .PRECIOUS: Output/%.llvm ifdef ENABLE_OPTIMIZED -TOOLS = $(BUILD_ROOT_TOP)/tools/Release +TOOLS = $(BUILD_OBJ_ROOT)/tools/Release else -TOOLS = $(BUILD_ROOT_TOP)/tools/Debug +TOOLS = $(BUILD_OBJ_ROOT)/tools/Debug endif # LLVM Tool Definitions... @@ -60,7 +60,7 @@ TESTRUNR = $(LEVEL)/test/TestRunner.sh # Native Tool Definitions -NATGCC = /usr/dcs/software/supported/bin/gcc +NATGCC = $(CC) CP = /bin/cp -f ## If TRACE or TRACEM is "yes", set the appropriate llc flag (-trace or -tracem) From criswell at cs.uiuc.edu Wed Jun 11 08:58:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 08:58:02 2003 Subject: [llvm-commits] CVS: llvm/utils/Burg/Makefile Message-ID: <200306111357.IAA11387@choi.cs.uiuc.edu> Changes in directory llvm/utils/Burg: Makefile updated: 1.12 -> 1.13 --- Log message: Updated to the new Makefile.common. Modified the test rule so that it can be added to the regular test rule (I believe the term is double dependency?). --- Diffs of the changes: Index: llvm/utils/Burg/Makefile diff -u llvm/utils/Burg/Makefile:1.12 llvm/utils/Burg/Makefile:1.13 --- llvm/utils/Burg/Makefile:1.12 Thu Oct 31 21:16:45 2002 +++ llvm/utils/Burg/Makefile Wed Jun 11 08:57:48 2003 @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.12 2002/11/01 03:16:45 lattner Exp $ +# $Id: Makefile,v 1.13 2003/06/11 13:57:48 criswell Exp $ LEVEL = ../.. TOOLNAME = burg EXTRASOURCES = gram.tab.c @@ -13,13 +13,13 @@ clean:: rm -ff gram.tab.h gram.tab.c core* *.aux *.log *.dvi sample sample.c tmp -$(BUILD_ROOT)/Release/lex.o $(BUILD_ROOT)/Profile/lex.o $(BUILD_ROOT)/Debug/lex.o: gram.tab.h +$(BUILD_OBJ_DIR)/Release/lex.o $(BUILD_OBJ_DIR)/Profile/lex.o $(BUILD_OBJ_DIR)/Debug/lex.o: gram.tab.h doc.dvi: doc.tex latex doc; latex doc -test: $(TOOLEXENAME_G) sample.gr +test:: $(TOOLEXENAME_G) sample.gr $(TOOLEXENAME_G) -I sample.c && $(CC) $(CFLAGS) -o sample sample.c && ./sample $(TOOLEXENAME_G) -I sample.gr >tmp && cmp tmp sample.c $(TOOLEXENAME_G) -I Changes in directory llvm/include/llvm: Constant.h updated: 1.6 -> 1.7 ConstantHandling.h updated: 1.25 -> 1.26 Constants.h updated: 1.25 -> 1.26 DerivedTypes.h updated: 1.28 -> 1.29 GlobalVariable.h updated: 1.19 -> 1.20 Instruction.h updated: 1.39 -> 1.40 Pass.h updated: 1.32 -> 1.33 PassAnalysisSupport.h updated: 1.11 -> 1.12 PassSupport.h updated: 1.11 -> 1.12 SymbolTable.h updated: 1.20 -> 1.21 User.h updated: 1.17 -> 1.18 iOther.h updated: 1.34 -> 1.35 iPHINode.h updated: 1.8 -> 1.9 iTerminators.h updated: 1.26 -> 1.27 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.6 llvm/include/llvm/Constant.h:1.7 --- llvm/include/llvm/Constant.h:1.6 Sun Oct 13 22:30:13 2002 +++ llvm/include/llvm/Constant.h Wed Jun 11 09:01:26 2003 @@ -7,6 +7,7 @@ #ifndef LLVM_CONSTANT_H #define LLVM_CONSTANT_H +#include #include "llvm/User.h" class Constant : public User { Index: llvm/include/llvm/ConstantHandling.h diff -u llvm/include/llvm/ConstantHandling.h:1.25 llvm/include/llvm/ConstantHandling.h:1.26 --- llvm/include/llvm/ConstantHandling.h:1.25 Thu Apr 24 21:51:46 2003 +++ llvm/include/llvm/ConstantHandling.h Wed Jun 11 09:01:26 2003 @@ -33,6 +33,8 @@ #ifndef LLVM_CONSTANTHANDLING_H #define LLVM_CONSTANTHANDLING_H +#include + #include "llvm/Constants.h" #include "llvm/Type.h" class PointerType; Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.25 llvm/include/llvm/Constants.h:1.26 --- llvm/include/llvm/Constants.h:1.25 Fri May 23 15:02:05 2003 +++ llvm/include/llvm/Constants.h Wed Jun 11 09:01:26 2003 @@ -8,6 +8,8 @@ #ifndef LLVM_CONSTANTS_H #define LLVM_CONSTANTS_H +#include + #include "llvm/Constant.h" #include "Support/DataTypes.h" Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.28 llvm/include/llvm/DerivedTypes.h:1.29 --- llvm/include/llvm/DerivedTypes.h:1.28 Tue Sep 10 20:16:19 2002 +++ llvm/include/llvm/DerivedTypes.h Wed Jun 11 09:01:26 2003 @@ -11,6 +11,8 @@ #ifndef LLVM_DERIVED_TYPES_H #define LLVM_DERIVED_TYPES_H +#include + #include "llvm/Type.h" class DerivedType : public Type { Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.19 llvm/include/llvm/GlobalVariable.h:1.20 --- llvm/include/llvm/GlobalVariable.h:1.19 Wed Apr 16 15:28:30 2003 +++ llvm/include/llvm/GlobalVariable.h Wed Jun 11 09:01:26 2003 @@ -13,6 +13,8 @@ #ifndef LLVM_GLOBAL_VARIABLE_H #define LLVM_GLOBAL_VARIABLE_H +#include + #include "llvm/GlobalValue.h" class Module; class Constant; Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.39 llvm/include/llvm/Instruction.h:1.40 --- llvm/include/llvm/Instruction.h:1.39 Wed Apr 16 15:30:02 2003 +++ llvm/include/llvm/Instruction.h Wed Jun 11 09:01:26 2003 @@ -8,6 +8,8 @@ #ifndef LLVM_INSTRUCTION_H #define LLVM_INSTRUCTION_H +#include + #include "llvm/User.h" template struct ilist_traits; template + #include #include #include Index: llvm/include/llvm/PassAnalysisSupport.h diff -u llvm/include/llvm/PassAnalysisSupport.h:1.11 llvm/include/llvm/PassAnalysisSupport.h:1.12 --- llvm/include/llvm/PassAnalysisSupport.h:1.11 Mon Oct 21 15:00:19 2002 +++ llvm/include/llvm/PassAnalysisSupport.h Wed Jun 11 09:01:26 2003 @@ -14,7 +14,7 @@ // No need to include Pass.h, we are being included by it! - +#include //===----------------------------------------------------------------------===// // AnalysisUsage - Represent the analysis usage information of a pass. This Index: llvm/include/llvm/PassSupport.h diff -u llvm/include/llvm/PassSupport.h:1.11 llvm/include/llvm/PassSupport.h:1.12 --- llvm/include/llvm/PassSupport.h:1.11 Thu Apr 24 13:41:30 2003 +++ llvm/include/llvm/PassSupport.h Wed Jun 11 09:01:26 2003 @@ -14,6 +14,8 @@ #ifndef LLVM_PASS_SUPPORT_H #define LLVM_PASS_SUPPORT_H +#include + // No need to include Pass.h, we are being included by it! class TargetMachine; Index: llvm/include/llvm/SymbolTable.h diff -u llvm/include/llvm/SymbolTable.h:1.20 llvm/include/llvm/SymbolTable.h:1.21 --- llvm/include/llvm/SymbolTable.h:1.20 Thu Jan 30 14:54:03 2003 +++ llvm/include/llvm/SymbolTable.h Wed Jun 11 09:01:26 2003 @@ -16,6 +16,8 @@ #ifndef LLVM_SYMBOL_TABLE_H #define LLVM_SYMBOL_TABLE_H +#include + #include "llvm/Value.h" #include Index: llvm/include/llvm/User.h diff -u llvm/include/llvm/User.h:1.17 llvm/include/llvm/User.h:1.18 --- llvm/include/llvm/User.h:1.17 Thu May 29 10:08:33 2003 +++ llvm/include/llvm/User.h Wed Jun 11 09:01:26 2003 @@ -12,6 +12,8 @@ #ifndef LLVM_USER_H #define LLVM_USER_H +#include + #include "llvm/Value.h" class User : public Value { Index: llvm/include/llvm/iOther.h diff -u llvm/include/llvm/iOther.h:1.34 llvm/include/llvm/iOther.h:1.35 --- llvm/include/llvm/iOther.h:1.34 Fri May 9 20:56:42 2003 +++ llvm/include/llvm/iOther.h Wed Jun 11 09:01:26 2003 @@ -8,6 +8,8 @@ #ifndef LLVM_IOTHER_H #define LLVM_IOTHER_H +#include + #include "llvm/InstrTypes.h" //===----------------------------------------------------------------------===// Index: llvm/include/llvm/iPHINode.h diff -u llvm/include/llvm/iPHINode.h:1.8 llvm/include/llvm/iPHINode.h:1.9 --- llvm/include/llvm/iPHINode.h:1.8 Thu Mar 6 10:36:28 2003 +++ llvm/include/llvm/iPHINode.h Wed Jun 11 09:01:26 2003 @@ -7,6 +7,8 @@ #ifndef LLVM_IPHINODE_H #define LLVM_IPHINODE_H +#include + #include "llvm/Instruction.h" class BasicBlock; Index: llvm/include/llvm/iTerminators.h diff -u llvm/include/llvm/iTerminators.h:1.26 llvm/include/llvm/iTerminators.h:1.27 --- llvm/include/llvm/iTerminators.h:1.26 Wed Jun 4 00:08:31 2003 +++ llvm/include/llvm/iTerminators.h Wed Jun 11 09:01:26 2003 @@ -9,6 +9,8 @@ #ifndef LLVM_ITERMINATORS_H #define LLVM_ITERMINATORS_H +#include + #include "llvm/InstrTypes.h" //===--------------------------------------------------------------------------- From criswell at cs.uiuc.edu Wed Jun 11 09:02:04 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:02:04 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/AliasSetTracker.h CallGraph.h ConstantsScanner.h DSGraph.h DSGraphTraits.h DSNode.h DSSupport.h DataStructure.h DependenceGraph.h Dominators.h IPModRef.h InstForest.h IntervalIterator.h MemoryDepAnalysis.h PgmDependenceGraph.h Message-ID: <200306111401.JAA11514@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: AliasSetTracker.h updated: 1.4 -> 1.5 CallGraph.h updated: 1.26 -> 1.27 ConstantsScanner.h updated: 1.9 -> 1.10 DSGraph.h updated: 1.47 -> 1.48 DSGraphTraits.h updated: 1.13 -> 1.14 DSNode.h updated: 1.23 -> 1.24 DSSupport.h updated: 1.15 -> 1.16 DataStructure.h updated: 1.62 -> 1.63 DependenceGraph.h updated: 1.3 -> 1.4 Dominators.h updated: 1.32 -> 1.33 IPModRef.h updated: 1.9 -> 1.10 InstForest.h updated: 1.16 -> 1.17 IntervalIterator.h updated: 1.10 -> 1.11 MemoryDepAnalysis.h updated: 1.1 -> 1.2 PgmDependenceGraph.h updated: 1.1 -> 1.2 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/AliasSetTracker.h diff -u llvm/include/llvm/Analysis/AliasSetTracker.h:1.4 llvm/include/llvm/Analysis/AliasSetTracker.h:1.5 --- llvm/include/llvm/Analysis/AliasSetTracker.h:1.4 Mon Mar 3 17:27:52 2003 +++ llvm/include/llvm/Analysis/AliasSetTracker.h Wed Jun 11 09:01:29 2003 @@ -10,6 +10,8 @@ #ifndef LLVM_ANALYSIS_ALIASSETTRACKER_H #define LLVM_ANALYSIS_ALIASSETTRACKER_H +#include + #include "llvm/Support/CallSite.h" #include "Support/iterator" #include "Support/hash_map" Index: llvm/include/llvm/Analysis/CallGraph.h diff -u llvm/include/llvm/Analysis/CallGraph.h:1.26 llvm/include/llvm/Analysis/CallGraph.h:1.27 --- llvm/include/llvm/Analysis/CallGraph.h:1.26 Fri Dec 6 00:40:00 2002 +++ llvm/include/llvm/Analysis/CallGraph.h Wed Jun 11 09:01:29 2003 @@ -41,6 +41,8 @@ #ifndef LLVM_ANALYSIS_CALLGRAPH_H #define LLVM_ANALYSIS_CALLGRAPH_H +#include + #include "Support/GraphTraits.h" #include "Support/STLExtras.h" #include "llvm/Pass.h" Index: llvm/include/llvm/Analysis/ConstantsScanner.h diff -u llvm/include/llvm/Analysis/ConstantsScanner.h:1.9 llvm/include/llvm/Analysis/ConstantsScanner.h:1.10 --- llvm/include/llvm/Analysis/ConstantsScanner.h:1.9 Sun Oct 27 20:11:13 2002 +++ llvm/include/llvm/Analysis/ConstantsScanner.h Wed Jun 11 09:01:29 2003 @@ -9,6 +9,8 @@ #ifndef LLVM_ANALYSIS_CONSTANTSSCANNER_H #define LLVM_ANALYSIS_CONSTANTSSCANNER_H +#include + #include "llvm/Support/InstIterator.h" #include "llvm/Instruction.h" #include "Support/iterator" Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.47 llvm/include/llvm/Analysis/DSGraph.h:1.48 --- llvm/include/llvm/Analysis/DSGraph.h:1.47 Tue Feb 11 00:36:00 2003 +++ llvm/include/llvm/Analysis/DSGraph.h Wed Jun 11 09:01:29 2003 @@ -7,6 +7,8 @@ #ifndef LLVM_ANALYSIS_DSGRAPH_H #define LLVM_ANALYSIS_DSGRAPH_H +#include + #include "llvm/Analysis/DSNode.h" //===----------------------------------------------------------------------===// Index: llvm/include/llvm/Analysis/DSGraphTraits.h diff -u llvm/include/llvm/Analysis/DSGraphTraits.h:1.13 llvm/include/llvm/Analysis/DSGraphTraits.h:1.14 --- llvm/include/llvm/Analysis/DSGraphTraits.h:1.13 Tue Feb 11 17:11:51 2003 +++ llvm/include/llvm/Analysis/DSGraphTraits.h Wed Jun 11 09:01:29 2003 @@ -9,6 +9,8 @@ #ifndef LLVM_ANALYSIS_DSGRAPHTRAITS_H #define LLVM_ANALYSIS_DSGRAPHTRAITS_H +#include + #include "llvm/Analysis/DSGraph.h" #include "Support/GraphTraits.h" #include "Support/iterator" Index: llvm/include/llvm/Analysis/DSNode.h diff -u llvm/include/llvm/Analysis/DSNode.h:1.23 llvm/include/llvm/Analysis/DSNode.h:1.24 --- llvm/include/llvm/Analysis/DSNode.h:1.23 Mon Mar 3 11:13:22 2003 +++ llvm/include/llvm/Analysis/DSNode.h Wed Jun 11 09:01:29 2003 @@ -7,6 +7,8 @@ #ifndef LLVM_ANALYSIS_DSNODE_H #define LLVM_ANALYSIS_DSNODE_H +#include + #include "llvm/Analysis/DSSupport.h" template class DSNodeIterator; // Data structure graph traversal iterator Index: llvm/include/llvm/Analysis/DSSupport.h diff -u llvm/include/llvm/Analysis/DSSupport.h:1.15 llvm/include/llvm/Analysis/DSSupport.h:1.16 --- llvm/include/llvm/Analysis/DSSupport.h:1.15 Thu Feb 13 13:08:58 2003 +++ llvm/include/llvm/Analysis/DSSupport.h Wed Jun 11 09:01:29 2003 @@ -7,6 +7,8 @@ #ifndef LLVM_ANALYSIS_DSSUPPORT_H #define LLVM_ANALYSIS_DSSUPPORT_H +#include + #include #include #include Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.62 llvm/include/llvm/Analysis/DataStructure.h:1.63 --- llvm/include/llvm/Analysis/DataStructure.h:1.62 Mon Feb 3 16:51:26 2003 +++ llvm/include/llvm/Analysis/DataStructure.h Wed Jun 11 09:01:29 2003 @@ -7,6 +7,8 @@ #ifndef LLVM_ANALYSIS_DATA_STRUCTURE_H #define LLVM_ANALYSIS_DATA_STRUCTURE_H +#include + #include "llvm/Pass.h" #include "Support/HashExtras.h" #include "Support/hash_set" Index: llvm/include/llvm/Analysis/DependenceGraph.h diff -u llvm/include/llvm/Analysis/DependenceGraph.h:1.3 llvm/include/llvm/Analysis/DependenceGraph.h:1.4 --- llvm/include/llvm/Analysis/DependenceGraph.h:1.3 Tue Jun 3 10:30:01 2003 +++ llvm/include/llvm/Analysis/DependenceGraph.h Wed Jun 11 09:01:29 2003 @@ -23,6 +23,8 @@ #include #include +#include + class Instruction; class Function; class Dependence; Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.32 llvm/include/llvm/Analysis/Dominators.h:1.33 --- llvm/include/llvm/Analysis/Dominators.h:1.32 Thu Mar 20 15:21:05 2003 +++ llvm/include/llvm/Analysis/Dominators.h Wed Jun 11 09:01:29 2003 @@ -20,6 +20,7 @@ #include "llvm/Pass.h" #include +#include class Instruction; template struct GraphTraits; Index: llvm/include/llvm/Analysis/IPModRef.h diff -u llvm/include/llvm/Analysis/IPModRef.h:1.9 llvm/include/llvm/Analysis/IPModRef.h:1.10 --- llvm/include/llvm/Analysis/IPModRef.h:1.9 Fri Jan 31 22:51:53 2003 +++ llvm/include/llvm/Analysis/IPModRef.h Wed Jun 11 09:01:29 2003 @@ -39,6 +39,8 @@ #ifndef LLVM_ANALYSIS_IPMODREF_H #define LLVM_ANALYSIS_IPMODREF_H +#include + #include "llvm/Pass.h" #include "Support/BitSetVector.h" #include "Support/hash_map" Index: llvm/include/llvm/Analysis/InstForest.h diff -u llvm/include/llvm/Analysis/InstForest.h:1.16 llvm/include/llvm/Analysis/InstForest.h:1.17 --- llvm/include/llvm/Analysis/InstForest.h:1.16 Wed Jul 31 14:31:59 2002 +++ llvm/include/llvm/Analysis/InstForest.h Wed Jun 11 09:01:29 2003 @@ -19,6 +19,7 @@ #include "llvm/Function.h" #include "Support/Tree.h" #include +#include template class InstTreeNode; template class InstForest; Index: llvm/include/llvm/Analysis/IntervalIterator.h diff -u llvm/include/llvm/Analysis/IntervalIterator.h:1.10 llvm/include/llvm/Analysis/IntervalIterator.h:1.11 --- llvm/include/llvm/Analysis/IntervalIterator.h:1.10 Tue Jun 25 11:10:54 2002 +++ llvm/include/llvm/Analysis/IntervalIterator.h Wed Jun 11 09:01:29 2003 @@ -33,6 +33,7 @@ #include #include #include +#include // getNodeHeader - Given a source graph node and the source graph, return the // BasicBlock that is the header node. This is the opposite of Index: llvm/include/llvm/Analysis/MemoryDepAnalysis.h diff -u llvm/include/llvm/Analysis/MemoryDepAnalysis.h:1.1 llvm/include/llvm/Analysis/MemoryDepAnalysis.h:1.2 --- llvm/include/llvm/Analysis/MemoryDepAnalysis.h:1.1 Sun Dec 8 07:26:04 2002 +++ llvm/include/llvm/Analysis/MemoryDepAnalysis.h Wed Jun 11 09:01:29 2003 @@ -20,6 +20,7 @@ #include "Support/NonCopyable.h" #include "Support/hash_map" +#include class Instruction; class Function; Index: llvm/include/llvm/Analysis/PgmDependenceGraph.h diff -u llvm/include/llvm/Analysis/PgmDependenceGraph.h:1.1 llvm/include/llvm/Analysis/PgmDependenceGraph.h:1.2 --- llvm/include/llvm/Analysis/PgmDependenceGraph.h:1.1 Sun Dec 8 08:13:06 2002 +++ llvm/include/llvm/Analysis/PgmDependenceGraph.h Wed Jun 11 09:01:29 2003 @@ -40,6 +40,7 @@ #include "Support/NonCopyable.h" #include +#include class Instruction; class Function; From criswell at cs.uiuc.edu Wed Jun 11 09:02:06 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:02:06 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/IGNode.h InstrForest.h InstrSelection.h LiveRange.h LiveVariables.h MachineCodeForInstruction.h MachineFrameInfo.h MachineInstr.h MachineInstrAnnot.h SSARegMap.h Message-ID: <200306111401.JAA11539@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: IGNode.h updated: 1.11 -> 1.12 InstrForest.h updated: 1.25 -> 1.26 InstrSelection.h updated: 1.22 -> 1.23 LiveRange.h updated: 1.18 -> 1.19 LiveVariables.h updated: 1.4 -> 1.5 MachineCodeForInstruction.h updated: 1.8 -> 1.9 MachineFrameInfo.h updated: 1.4 -> 1.5 MachineInstr.h updated: 1.102 -> 1.103 MachineInstrAnnot.h updated: 1.8 -> 1.9 SSARegMap.h updated: 1.3 -> 1.4 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/IGNode.h diff -u llvm/include/llvm/CodeGen/IGNode.h:1.11 llvm/include/llvm/CodeGen/IGNode.h:1.12 --- llvm/include/llvm/CodeGen/IGNode.h:1.11 Tue Oct 29 10:49:44 2002 +++ llvm/include/llvm/CodeGen/IGNode.h Wed Jun 11 09:01:30 2003 @@ -26,6 +26,7 @@ #define IG_NODE_H #include "llvm/CodeGen/LiveRange.h" +#include class RegClass; //---------------------------------------------------------------------------- Index: llvm/include/llvm/CodeGen/InstrForest.h diff -u llvm/include/llvm/CodeGen/InstrForest.h:1.25 llvm/include/llvm/CodeGen/InstrForest.h:1.26 --- llvm/include/llvm/CodeGen/InstrForest.h:1.25 Tue Jun 3 10:29:12 2003 +++ llvm/include/llvm/CodeGen/InstrForest.h Wed Jun 11 09:01:30 2003 @@ -21,6 +21,7 @@ #include "llvm/Instruction.h" #include "Support/HashExtras.h" +#include class Constant; class BasicBlock; Index: llvm/include/llvm/CodeGen/InstrSelection.h diff -u llvm/include/llvm/CodeGen/InstrSelection.h:1.22 llvm/include/llvm/CodeGen/InstrSelection.h:1.23 --- llvm/include/llvm/CodeGen/InstrSelection.h:1.22 Sat May 31 02:41:24 2003 +++ llvm/include/llvm/CodeGen/InstrSelection.h Wed Jun 11 09:01:30 2003 @@ -8,6 +8,7 @@ #define LLVM_CODEGEN_INSTR_SELECTION_H #include "llvm/Instruction.h" +#include class Function; class InstrForest; class MachineInstr; Index: llvm/include/llvm/CodeGen/LiveRange.h diff -u llvm/include/llvm/CodeGen/LiveRange.h:1.18 llvm/include/llvm/CodeGen/LiveRange.h:1.19 --- llvm/include/llvm/CodeGen/LiveRange.h:1.18 Wed Jan 15 14:28:36 2003 +++ llvm/include/llvm/CodeGen/LiveRange.h Wed Jun 11 09:01:30 2003 @@ -14,6 +14,8 @@ #include "llvm/CodeGen/ValueSet.h" #include "llvm/Value.h" +#include + class RegClass; class IGNode; class Type; Index: llvm/include/llvm/CodeGen/LiveVariables.h diff -u llvm/include/llvm/CodeGen/LiveVariables.h:1.4 llvm/include/llvm/CodeGen/LiveVariables.h:1.5 --- llvm/include/llvm/CodeGen/LiveVariables.h:1.4 Mon May 12 09:23:04 2003 +++ llvm/include/llvm/CodeGen/LiveVariables.h Wed Jun 11 09:01:30 2003 @@ -24,6 +24,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include +#include class MRegisterInfo; Index: llvm/include/llvm/CodeGen/MachineCodeForInstruction.h diff -u llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.8 llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.9 --- llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.8 Tue Jan 14 15:29:39 2003 +++ llvm/include/llvm/CodeGen/MachineCodeForInstruction.h Wed Jun 11 09:01:30 2003 @@ -20,6 +20,8 @@ #include "Support/Annotation.h" #include +#include + class MachineInstr; class Instruction; class Value; Index: llvm/include/llvm/CodeGen/MachineFrameInfo.h diff -u llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.4 llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.5 --- llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.4 Thu Jan 16 12:35:57 2003 +++ llvm/include/llvm/CodeGen/MachineFrameInfo.h Wed Jun 11 09:01:30 2003 @@ -35,6 +35,7 @@ class TargetRegisterClass; class MachineFunction; #include +#include class MachineFrameInfo { Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.102 llvm/include/llvm/CodeGen/MachineInstr.h:1.103 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.102 Tue Jun 3 10:42:53 2003 +++ llvm/include/llvm/CodeGen/MachineInstr.h Wed Jun 11 09:01:30 2003 @@ -13,6 +13,8 @@ #include "Support/Annotation.h" #include "Support/iterator" #include +#include + class Value; class Function; class MachineBasicBlock; Index: llvm/include/llvm/CodeGen/MachineInstrAnnot.h diff -u llvm/include/llvm/CodeGen/MachineInstrAnnot.h:1.8 llvm/include/llvm/CodeGen/MachineInstrAnnot.h:1.9 --- llvm/include/llvm/CodeGen/MachineInstrAnnot.h:1.8 Sat May 31 02:43:41 2003 +++ llvm/include/llvm/CodeGen/MachineInstrAnnot.h Wed Jun 11 09:01:31 2003 @@ -10,6 +10,8 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetRegInfo.h" +#include + class Value; class TmpInstruction; class CallInst; Index: llvm/include/llvm/CodeGen/SSARegMap.h diff -u llvm/include/llvm/CodeGen/SSARegMap.h:1.3 llvm/include/llvm/CodeGen/SSARegMap.h:1.4 --- llvm/include/llvm/CodeGen/SSARegMap.h:1.3 Sun Jan 12 18:19:18 2003 +++ llvm/include/llvm/CodeGen/SSARegMap.h Wed Jun 11 09:01:31 2003 @@ -12,6 +12,8 @@ #include "llvm/Target/MRegisterInfo.h" +#include + class TargetRegisterClass; class SSARegMap { From criswell at cs.uiuc.edu Wed Jun 11 09:02:08 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:02:08 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/TraceCache.h Message-ID: <200306111401.JAA11546@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Reoptimizer: TraceCache.h updated: 1.9 -> 1.10 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/Reoptimizer/TraceCache.h diff -u llvm/include/llvm/Reoptimizer/TraceCache.h:1.9 llvm/include/llvm/Reoptimizer/TraceCache.h:1.10 --- llvm/include/llvm/Reoptimizer/TraceCache.h:1.9 Sat May 31 21:31:15 2003 +++ llvm/include/llvm/Reoptimizer/TraceCache.h Wed Jun 11 09:01:32 2003 @@ -11,6 +11,7 @@ #include #include #include +#include class VirtualMem; class MemoryManager; From criswell at cs.uiuc.edu Wed Jun 11 09:02:10 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:02:10 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/BinInterface/regmask.h sparcbin.h Message-ID: <200306111401.JAA11555@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Reoptimizer/BinInterface: regmask.h updated: 1.1 -> 1.2 sparcbin.h updated: 1.2 -> 1.3 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/Reoptimizer/BinInterface/regmask.h diff -u llvm/include/llvm/Reoptimizer/BinInterface/regmask.h:1.1 llvm/include/llvm/Reoptimizer/BinInterface/regmask.h:1.2 --- llvm/include/llvm/Reoptimizer/BinInterface/regmask.h:1.1 Sat May 31 17:16:47 2003 +++ llvm/include/llvm/Reoptimizer/BinInterface/regmask.h Wed Jun 11 09:01:34 2003 @@ -11,6 +11,7 @@ #include "bitmath.h" #include #include +#include #define VREG_ISMEM(x) (x >= 32) #define VREG_ISREG(x) (x < 32) Index: llvm/include/llvm/Reoptimizer/BinInterface/sparcbin.h diff -u llvm/include/llvm/Reoptimizer/BinInterface/sparcbin.h:1.2 llvm/include/llvm/Reoptimizer/BinInterface/sparcbin.h:1.3 --- llvm/include/llvm/Reoptimizer/BinInterface/sparcbin.h:1.2 Wed Jun 4 04:42:22 2003 +++ llvm/include/llvm/Reoptimizer/BinInterface/sparcbin.h Wed Jun 11 09:01:34 2003 @@ -18,6 +18,7 @@ #include "sparcpriv.h" #include #include +#include using std::vector; From criswell at cs.uiuc.edu Wed Jun 11 09:02:11 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:02:11 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CFG.h InstVisitor.h PassNameParser.h Message-ID: <200306111401.JAA11566@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CFG.h updated: 1.10 -> 1.11 InstVisitor.h updated: 1.16 -> 1.17 PassNameParser.h updated: 1.5 -> 1.6 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/Support/CFG.h diff -u llvm/include/llvm/Support/CFG.h:1.10 llvm/include/llvm/Support/CFG.h:1.11 --- llvm/include/llvm/Support/CFG.h:1.10 Sat Apr 26 12:38:26 2003 +++ llvm/include/llvm/Support/CFG.h Wed Jun 11 09:01:35 2003 @@ -13,6 +13,8 @@ #include "llvm/InstrTypes.h" #include "Support/iterator" +#include + //===--------------------------------------------------------------------===// // BasicBlock pred_iterator definition //===--------------------------------------------------------------------===// Index: llvm/include/llvm/Support/InstVisitor.h diff -u llvm/include/llvm/Support/InstVisitor.h:1.16 llvm/include/llvm/Support/InstVisitor.h:1.17 --- llvm/include/llvm/Support/InstVisitor.h:1.16 Tue May 20 16:01:04 2003 +++ llvm/include/llvm/Support/InstVisitor.h Wed Jun 11 09:01:35 2003 @@ -44,6 +44,8 @@ #define LLVM_SUPPORT_INSTVISITOR_H #include "llvm/Instruction.h" +#include + class Module; // We operate on opaque instruction classes, so forward declare all instruction Index: llvm/include/llvm/Support/PassNameParser.h diff -u llvm/include/llvm/Support/PassNameParser.h:1.5 llvm/include/llvm/Support/PassNameParser.h:1.6 --- llvm/include/llvm/Support/PassNameParser.h:1.5 Thu Apr 24 13:41:13 2003 +++ llvm/include/llvm/Support/PassNameParser.h Wed Jun 11 09:01:35 2003 @@ -20,6 +20,7 @@ #include "llvm/Pass.h" #include #include +#include //===----------------------------------------------------------------------===// // PassNameParser class - Make use of the pass registration mechanism to From criswell at cs.uiuc.edu Wed Jun 11 09:02:13 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:02:13 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetCacheInfo.h TargetInstrInfo.h TargetRegInfo.h TargetSchedInfo.h Message-ID: <200306111401.JAA11579@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetCacheInfo.h updated: 1.8 -> 1.9 TargetInstrInfo.h updated: 1.44 -> 1.45 TargetRegInfo.h updated: 1.37 -> 1.38 TargetSchedInfo.h updated: 1.16 -> 1.17 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/llvm/Target/TargetCacheInfo.h diff -u llvm/include/llvm/Target/TargetCacheInfo.h:1.8 llvm/include/llvm/Target/TargetCacheInfo.h:1.9 --- llvm/include/llvm/Target/TargetCacheInfo.h:1.8 Tue Jun 3 10:28:40 2003 +++ llvm/include/llvm/Target/TargetCacheInfo.h Wed Jun 11 09:01:36 2003 @@ -8,6 +8,8 @@ #define LLVM_TARGET_TARGETCACHEINFO_H #include "Support/DataTypes.h" +#include + class TargetMachine; struct TargetCacheInfo { Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.44 llvm/include/llvm/Target/TargetInstrInfo.h:1.45 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.44 Fri May 23 20:08:40 2003 +++ llvm/include/llvm/Target/TargetInstrInfo.h Wed Jun 11 09:01:36 2003 @@ -9,6 +9,7 @@ #include "Support/DataTypes.h" #include +#include class MachineInstr; class TargetMachine; Index: llvm/include/llvm/Target/TargetRegInfo.h diff -u llvm/include/llvm/Target/TargetRegInfo.h:1.37 llvm/include/llvm/Target/TargetRegInfo.h:1.38 --- llvm/include/llvm/Target/TargetRegInfo.h:1.37 Tue Jun 3 10:28:40 2003 +++ llvm/include/llvm/Target/TargetRegInfo.h Wed Jun 11 09:01:36 2003 @@ -10,6 +10,7 @@ #include "Support/hash_map" #include +#include class TargetMachine; class IGNode; Index: llvm/include/llvm/Target/TargetSchedInfo.h diff -u llvm/include/llvm/Target/TargetSchedInfo.h:1.16 llvm/include/llvm/Target/TargetSchedInfo.h:1.17 --- llvm/include/llvm/Target/TargetSchedInfo.h:1.16 Sun Apr 6 19:25:09 2003 +++ llvm/include/llvm/Target/TargetSchedInfo.h Wed Jun 11 09:01:36 2003 @@ -10,6 +10,7 @@ #include "llvm/Target/TargetInstrInfo.h" #include "Support/hash_map" #include +#include typedef long long cycles_t; static const cycles_t HUGE_LATENCY = ~((long long) 1 << (sizeof(cycles_t)-2)); From criswell at cs.uiuc.edu Wed Jun 11 09:03:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:03:01 2003 Subject: [llvm-commits] CVS: llvm/include/Support/Annotation.h BitSetVector.h CommandLine.h TarjanSCCIterator.h Timer.h Tree.h Message-ID: <200306111402.JAA11594@choi.cs.uiuc.edu> Changes in directory llvm/include/Support: Annotation.h updated: 1.7 -> 1.8 BitSetVector.h updated: 1.4 -> 1.5 CommandLine.h updated: 1.11 -> 1.12 TarjanSCCIterator.h updated: 1.4 -> 1.5 Timer.h updated: 1.5 -> 1.6 Tree.h updated: 1.2 -> 1.3 --- Log message: Included assert.h so that the code compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/include/Support/Annotation.h diff -u llvm/include/Support/Annotation.h:1.7 llvm/include/Support/Annotation.h:1.8 --- llvm/include/Support/Annotation.h:1.7 Tue Jan 14 15:29:07 2003 +++ llvm/include/Support/Annotation.h Wed Jun 11 09:01:21 2003 @@ -16,6 +16,7 @@ #define SUPPORT_ANNOTATION_H #include +#include class AnnotationID; class Annotation; class Annotable; Index: llvm/include/Support/BitSetVector.h diff -u llvm/include/Support/BitSetVector.h:1.4 llvm/include/Support/BitSetVector.h:1.5 --- llvm/include/Support/BitSetVector.h:1.4 Mon Mar 17 12:11:27 2003 +++ llvm/include/Support/BitSetVector.h Wed Jun 11 09:01:21 2003 @@ -31,6 +31,7 @@ #include #include +#include #define WORDSIZE (32U) Index: llvm/include/Support/CommandLine.h diff -u llvm/include/Support/CommandLine.h:1.11 llvm/include/Support/CommandLine.h:1.12 --- llvm/include/Support/CommandLine.h:1.11 Tue Jun 3 10:30:37 2003 +++ llvm/include/Support/CommandLine.h Wed Jun 11 09:01:21 2003 @@ -19,6 +19,8 @@ #include #include "boost/type_traits/object_traits.hpp" +#include + /// cl Namespace - This namespace contains all of the command line option /// processing machinery. It is intentionally a short name to make qualified /// usage concise. Index: llvm/include/Support/TarjanSCCIterator.h diff -u llvm/include/Support/TarjanSCCIterator.h:1.4 llvm/include/Support/TarjanSCCIterator.h:1.5 --- llvm/include/Support/TarjanSCCIterator.h:1.4 Fri Dec 6 09:02:22 2002 +++ llvm/include/Support/TarjanSCCIterator.h Wed Jun 11 09:01:21 2003 @@ -21,6 +21,7 @@ #include #include +#include //-------------------------------------------------------------------------- // class SCC : A simple representation of an SCC in a generic Graph. Index: llvm/include/Support/Timer.h diff -u llvm/include/Support/Timer.h:1.5 llvm/include/Support/Timer.h:1.6 --- llvm/include/Support/Timer.h:1.5 Fri May 9 15:44:22 2003 +++ llvm/include/Support/Timer.h Wed Jun 11 09:01:21 2003 @@ -29,6 +29,8 @@ #include #include +#include + class TimerGroup; class Timer { Index: llvm/include/Support/Tree.h diff -u llvm/include/Support/Tree.h:1.2 llvm/include/Support/Tree.h:1.3 --- llvm/include/Support/Tree.h:1.2 Sun Jan 20 16:54:19 2002 +++ llvm/include/Support/Tree.h Wed Jun 11 09:01:21 2003 @@ -10,6 +10,8 @@ #include +#include + template class Tree { std::vector Children; // This nodes children, if any From criswell at cs.uiuc.edu Wed Jun 11 09:18:02 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 09:18:02 2003 Subject: [llvm-commits] CVS: llvm/utils/TableGen/Record.h Message-ID: <200306111417.JAA11630@choi.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: Record.h updated: 1.8 -> 1.9 --- Log message: Added assert.h so that it compiles under newer versions of GCC. --- Diffs of the changes: Index: llvm/utils/TableGen/Record.h diff -u llvm/utils/TableGen/Record.h:1.8 llvm/utils/TableGen/Record.h:1.9 --- llvm/utils/TableGen/Record.h:1.8 Thu Dec 5 21:55:39 2002 +++ llvm/utils/TableGen/Record.h Wed Jun 11 09:17:21 2003 @@ -10,6 +10,8 @@ #include #include #include +#include + class Init; class UnsetInit; class BitInit; From criswell at choi.cs.uiuc.edu Wed Jun 11 14:57:02 2003 From: criswell at choi.cs.uiuc.edu (John Criswell) Date: Wed Jun 11 14:57:02 2003 Subject: [llvm-commits] CVS: llvm/include/Support/DataTypes.h Message-ID: <200306111944.h5BJiwO01782@choi.cs.uiuc.edu> Changes in directory llvm/include/Support: DataTypes.h updated: 1.7 -> 1.8 --- Log message: Changed the LITTLE_ENDIAN and BIG_ENDIAN macros to ENDIAN_LITTLE and ENDIAN_BIG. This will prevent them from conflicting with macros defined by the system header files. When autoconf comes, this will look a lot nicer. --- Diffs of the changes: Index: llvm/include/Support/DataTypes.h diff -u llvm/include/Support/DataTypes.h:1.7 llvm/include/Support/DataTypes.h:1.8 --- llvm/include/Support/DataTypes.h:1.7 Sat Sep 14 14:52:49 2002 +++ llvm/include/Support/DataTypes.h Wed Jun 11 14:44:48 2003 @@ -4,10 +4,10 @@ // This file is important because different host OS's define different macros, // which makes portability tough. This file exports the following definitions: // -// LITTLE_ENDIAN: is #define'd if the host is little endian -// int64_t : is a typedef for the signed 64 bit system type -// uint64_t : is a typedef for the unsigned 64 bit system type -// INT64_MAX : is a #define specifying the max value for int64_t's +// ENDIAN_LITTLE : is #define'd if the host is little endian +// int64_t : is a typedef for the signed 64 bit system type +// uint64_t : is a typedef for the unsigned 64 bit system type +// INT64_MAX : is a #define specifying the max value for int64_t's // // No library is required when using these functinons. // @@ -44,11 +44,26 @@ # endif #endif -#if (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)) -#error "Cannot define both LITTLE_ENDIAN and BIG_ENDIAN!" +// +// Convert the information from the header files into our own local +// endian macros. We do this because various strange systems define both +// BIG_ENDIAN and LITTLE_ENDIAN, and we don't want to conflict with them. +// +// Don't worry; once we introduce autoconf, this will look a lot nicer. +// +#ifdef LITTLE_ENDIAN +#define ENDIAN_LITTLE +#endif + +#ifdef BIG_ENDIAN +#define ENDIAN_BIG +#endif + +#if (defined(ENDIAN_LITTLE) && defined(ENDIAN_BIG)) +#error "Cannot define both ENDIAN_LITTLE and ENDIAN_BIG!" #endif -#if (!defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)) || !defined(INT64_MAX) +#if (!defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)) || !defined(INT64_MAX) #error "include/Support/DataTypes.h could not determine endianness!" #endif From criswell at choi.cs.uiuc.edu Wed Jun 11 14:57:04 2003 From: criswell at choi.cs.uiuc.edu (John Criswell) Date: Wed Jun 11 14:57:04 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Primitives.h Message-ID: <200306111945.h5BJj1a01791@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Primitives.h updated: 1.8 -> 1.9 --- Log message: Changed the LITTLE_ENDIAN and BIG_ENDIAN macros to ENDIAN_LITTLE and ENDIAN_BIG. This will prevent them from conflicting with macros defined by the system header files. When autoconf comes, this will look a lot nicer. --- Diffs of the changes: Index: llvm/include/llvm/Bytecode/Primitives.h diff -u llvm/include/llvm/Bytecode/Primitives.h:1.8 llvm/include/llvm/Bytecode/Primitives.h:1.9 --- llvm/include/llvm/Bytecode/Primitives.h:1.8 Tue May 6 13:45:02 2003 +++ llvm/include/llvm/Bytecode/Primitives.h Wed Jun 11 14:44:51 2003 @@ -23,7 +23,7 @@ static inline bool read(const unsigned char *&Buf, const unsigned char *EndBuf, unsigned &Result) { if (Buf+4 > EndBuf) return true; -#ifdef LITTLE_ENDIAN +#ifdef ENDIAN_LITTLE Result = *(unsigned*)Buf; #else Result = Buf[0] | (Buf[1] << 8) | (Buf[2] << 16) | (Buf[3] << 24); @@ -36,7 +36,7 @@ uint64_t &Result) { if (Buf+8 > EndBuf) return true; -#ifdef LITTLE_ENDIAN +#ifdef ENDIAN_LITTLE Result = *(uint64_t*)Buf; #else Result = Buf[0] | (Buf[1] << 8) | (Buf[2] << 16) | (Buf[3] << 24) | @@ -136,7 +136,7 @@ unsigned char *Start = (unsigned char *)Ptr; unsigned Amount = (unsigned char *)End - Start; if (Buf+Amount > EndBuf) return true; -#ifdef LITTLE_ENDIAN +#ifdef ENDIAN_LITTLE std::copy(Buf, Buf+Amount, Start); Buf += Amount; #else @@ -159,7 +159,7 @@ // static inline void output(unsigned i, std::deque &Out, int pos = -1) { -#ifdef LITTLE_ENDIAN +#ifdef ENDIAN_LITTLE if (pos == -1) Out.insert(Out.end(), (unsigned char*)&i, (unsigned char*)&i+4); else @@ -257,7 +257,7 @@ static inline void output_data(void *Ptr, void *End, std::deque &Out, bool Align = false) { -#ifdef LITTLE_ENDIAN +#ifdef ENDIAN_LITTLE Out.insert(Out.end(), (unsigned char*)Ptr, (unsigned char*)End); #else unsigned char *E = (unsigned char *)End; From criswell at cs.uiuc.edu Wed Jun 11 15:47:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed Jun 11 15:47:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/GettingStarted.html Message-ID: <200306112046.PAA15276@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: GettingStarted.html updated: 1.12 -> 1.13 --- Log message: Updated the documentation to reflect changes in the Makefiles for building projects. Fixed some small grammatical errors. Using Netscape Composer seems to have added stuff that makes the page look exactly the same. Bah! Curse my laziness! --- Diffs of the changes: Index: llvm/www/docs/GettingStarted.html diff -u llvm/www/docs/GettingStarted.html:1.12 llvm/www/docs/GettingStarted.html:1.13 --- llvm/www/docs/GettingStarted.html:1.12 Sun Jun 8 10:33:25 2003 +++ llvm/www/docs/GettingStarted.html Wed Jun 11 15:46:40 2003 @@ -1,477 +1,468 @@ - - Getting Started with LLVM System - - - -

Getting Started with the LLVM System
By: Guochun Shi, - Chris Lattner and - Vikram Adve -

- - -

Contents

- - - - - - -
-

Overview

-
- - -

The next section of this guide is meant to get - you up and running with LLVM, and to give you some basic information about - the LLVM environment. The first subsection gives - a short summary for those who are already familiar with the system and - want to get started as quickly as possible. - -

The later sections of this guide describe the general layout of the the LLVM source-tree, a simple example using the LLVM tool chain, and links to find more information about LLVM or to get - help via e-mail. - - -

-

Getting Started

-
- - - - -

Getting Started Quickly (A Summary)

- - - Here's the short story for getting up and running quickly with LLVM: + + Getting Started with LLVM System + + + +
+

Getting Started with the LLVM System
+By: Guochun Shi, Chris Lattner and Vikram Adve

+
+ + +

Contents

+ + + + + +
+

Overview

+
+ + +

The next section of this guide is meant to +get you up and running with LLVM, and to give you some basic information +about the LLVM environment. The first subsection +gives a short summary for those who are already familiar with the system +and want to get started as quickly as possible.

+

The later sections of this guide describe the general +layout of the LLVM source-tree, a simple example +using the LLVM tool chain, and links to find more information +about LLVM or to get help via e-mail. +

+
+

Getting Started

+
+ + + +

Getting Started Quickly (A Summary)

+ + Here's the short story for getting up and running quickly with LLVM: + +
    +
  1. Find the path to the CVS repository containing LLVM (we'll call +this CVSROOTDIR).
  2. +
  3. cd where-you-want-llvm-to-live
  4. +
  5. cvs -d CVSROOTDIR checkout llvm
  6. +
  7. cd llvm
  8. +
  9. Edit Makefile.config to set local paths. This includes + setting the install location of the C frontend and the various paths + to the C and C++ compilers used to build LLVM itself.
  10. +
  11. Set your LLVM_LIB_SEARCH_PATH environment variable.
  12. +
  13. gmake -k |& tee gnumake.out    # this is +csh or tcsh syntax
  14. +
+ +

See Setting up your environment on tips to + simplify working with the LLVM front-end and compiled tools. See the + other sub-sections below for other useful details in working with LLVM, + or go straight to Program Layout to learn about +the layout of the source code tree. +

+

Terminology and Notation

+ + +

Through this manual, the following names are used to denote paths +specific to the local system and working environment. These are not + environment variables you need to set, but just strings used in the rest + of this document below. In any of the examples below, simply replace + each of these names with the appropriate pathname on your local system. All these paths are absolute:

-
    -
- - -

Checkout LLVM from CVS

- - -

Before checking out the source code, you will need to know the path to - CVS repository containing LLVM source code (we'll call this - CVSROOTDIR below). Ask the person responsible for your local LLVM - installation to give you this path. - -

To get a fresh copy of the entire source code, all you - need to do is check it out from CVS as follows: -

    -
  • cd where-you-want-llvm-to-live -
  • cvs -d CVSROOTDIR checkout llvm

    -
- -

This will create an 'llvm' directory in the current - directory and fully populate it with the LLVM source code, Makefiles, - test directories, and local copies of documentation files.

- - -

Local Configuration Options

- - -

The file llvm/Makefile.config - defines the following path variables, - which are specific to a particular installation of LLVM. - These should need to be modified only once after checking out a copy - of LLVM (if the default values do not already match your system): - -

    -

  • CXX = Path to C++ compiler to use. -

  • LLVM_OBJ_DIR = Path to the llvm directory where - object files should be placed. - (See the Section on - The location for LLVM object files - for more information.) -

  • LLVMGCCDIR = Path to the location of the LLVM front-end - binaries and associated libraries. -

  • PURIFY = Path to the purify program. -
- - In addition to settings in this file, you must set a - LLVM_LIB_SEARCH_PATH environment variable in your startup scripts. - This environment variable is used to locate "system" libraries like - "-lc" and "-lm" when linking. This variable should be set - to the absolute path for the bytecode-libs subdirectory of the C front-end - install. For example, - /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86 - version of the C front-end, on our research machines.

- - -

The location for LLVM object files

- - -

The LLVM make system sends most output files generated during the build - into the directory defined by the variable LLVM_OBJ_DIR in - llvm/Makefile.config. This can be either just your normal LLVM - source tree or some other directory writable by you. You may wish to put - object files on a different filesystem either to keep them from being backed - up or to speed up local builds. - -

If you do not wish to use a different location for object files (building - into the source tree directly), just set this variable to ".".

- - -

Setting up your environment

- - - NOTE: This step is optional but will set up your environment so you - can use the compiled LLVM tools with as little hassle as - possible.) - -

Add the following lines to your .cshrc (or the corresponding - lines to your .profile if you use a bourne shell derivative). - -

-       # Make the C front end easy to use...
-       alias llvmgcc LLVMGCCDIR/bin/llvm-gcc
+     
+
    + +
+ + +

Checkout LLVM from CVS

+ + +

Before checking out the source code, you will need to know the path to + the CVS repository containing LLVM source code (we'll call this CVSROOTDIR +below). Ask the person responsible for your local LLVM installation +to give you this path.

+

To get a fresh copy of the entire source code, all you need to do +is check it out from CVS as follows:

+
    +
  • cd where-you-want-llvm-to-live
  • +
  • cvs -d CVSROOTDIR checkout llvm +

    +
  • +
+ +

This will create an 'llvm' directory in the current directory +and fully populate it with the LLVM source code, Makefiles, test directories, +and local copies of documentation files.

+ + +

Local Configuration Options

+ + +

The file llvm/Makefile.config defines the following path +variables which are specific to a particular installation of LLVM. + These should need to be modified only once after checking out a copy + of LLVM (if the default values do not already match your system): +

+
    + +

    +
  • CXX = Path to C++ compiler to use. +

    +
  • +
  • OBJ_ROOT = Path to the llvm directory where object files +should be placed. (See the Section on The +location for LLVM object files for more information.) +

    +
  • +
  • LLVMGCCDIR = Path to the location of the LLVM front-end +binaries and associated libraries. +

    +
  • +
  • PURIFY = Path to the purify program.
  • +
+ In addition to settings in this file, you must set a LLVM_LIB_SEARCH_PATH +environment variable in your startup scripts. This environment variable +is used to locate "system" libraries like "-lc" and "-lm" +when linking. This variable should be set to the absolute path for the +bytecode-libs subdirectory of the C front-end install. For example, + /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs is used +for the X86 version of the C front-end on our research machines. +

+

+

The location for LLVM object files

+ + +

The LLVM make system sends most output files generated during the build + into the directory defined by the variable OBJ_ROOT in llvm/Makefile.config. + This can be either just your normal LLVM source tree or some other directory +writable by you. You may wish to put object files on a different filesystem +either to keep them from being backed up or to speed up local builds. +

+

If you do not wish to use a different location for object files (i.e. +building into the source tree directly), just set this variable to ".".

+

+

+

Setting up your environment

+ + NOTE: This step is optional but will set up your environment so you + can use the compiled LLVM tools with as little hassle as possible.) + +

Add the following lines to your .cshrc (or the corresponding + lines to your .profile if you use a bourne shell derivative). +

+
       # Make the C front end easy to use...
alias llvmgcc LLVMGCCDIR/bin/llvm-gcc # Make the LLVM tools easy to use... - setenv PATH LLVM_OBJ_DIR/llvm/tools/Debug:${PATH} -
- The llvmgcc alias is useful because the C compiler is not - included in the CVS tree you just checked out. - -

The other LLVM tools are part of the LLVM - source base, and built when compiling LLVM. They will be built into the - LLVM_OBJ_DIR/tools/Debug directory.

- - -

Compiling the source code

- - -

Every directory in the LLVM source tree includes a Makefile to - build it, and any subdirectories that it contains. These makefiles require - that you use gmake, instead of make to build them, but can - otherwise be used freely. To build the entire LLVM system, just enter the - top level llvm directory and type gmake. A few minutes - later you will hopefully have a freshly compiled toolchain waiting for you - in llvm/tools/Debug. If you want to look at the libraries that - were compiled, look in llvm/lib/Debug.

- - If you get an error talking about a /localhome directory, follow - the instructions in the section about Setting Up Your - Environment. - - - - -
-

Program Layout

-
- - -

One useful source of infomation about the LLVM sourcebase is the LLVM doxygen documentation, available at http://llvm.cs.uiuc.edu/doxygen/. The - following is a brief introduction to code layout:

- - - -

CVS directories

- - - Every directory checked out of CVS will contain a CVS directory, - for the most part these can just be ignored. - - - -

Depend, Debug, & Release + setenv PATH OBJ_ROOT/llvm/tools/Debug:${PATH}

+ The llvmgcc alias is useful because the C compiler is not + included in the CVS tree you just checked out. +

The other LLVM tools are part of the LLVM source +base and are built when compiling LLVM. They will be built into the +OBJ_ROOT/tools/Debug directory.

+ + +

Compiling the source code

+ + +

Every directory in the LLVM source tree includes a Makefile to + build it and any subdirectories that it contains. These makefiles require + GNU Make (gmake) instead of make to build them, but +can otherwise be used freely. To build the entire LLVM system, just +enter the top level llvm directory and type gmake. + A few minutes later you will hopefully have a freshly compiled toolchain +waiting for you in OBJ_ROOT/llvm/tools/Debug. + If you want to look at the libraries that were compiled, look in OBJ_ROOT/llvm/lib/Debug.

+ If you get an error about the /localhome directory, chances +are good that something has been misconfigured.  Follow the instructions +in the section about Setting Up Your Environment. + + +
+

Program Layout

+
+ + +

One useful source of infomation about the LLVM sourcebase is the LLVM +doxygen documentation, available at +http://llvm.cs.uiuc.edu/doxygen/. +The following is a brief introduction to code layout:

+ + +

CVS directories

+ + Every directory checked out of CVS will contain a CVS directory; + for the most part, these can just be ignored. + +

Depend, Debug, & Release directories

- - - If you are building with the "BUILD_ROOT=." option enabled in the - Makefile.common file, most source directories will contain two - directories, Depend and Debug. The Depend - directory contains automatically generated dependance files which are used - during compilation to make sure that source files get rebuilt if a header - file they use is modified. The Debug directory holds the object - files, library files and executables that are used for building a debug - enabled build. The Release directory is created to hold the same - files when the ENABLE_OPTIMIZED=1 flag is passed to gmake, - causing an optimized built to be performed.

- - - -

llvm/include

- - - This directory contains public header files exported from the LLVM - library. The two main subdirectories of this directory are:

- + + If you are building with the "OBJ_ROOT=." option enabled in +the Makefile.config file, most source directories will contain +two directories, Depend and Debug. The Depend + directory contains automatically generated dependance files which are +used during compilation to make sure that source files get rebuilt if +a header file they use is modified. The Debug directory holds +the object files, library files, and executables that are used for building +a debug enabled build. The Release directory is created to +hold the same files when the ENABLE_OPTIMIZED=1 flag is passed +to gmake, causing an optimized built to be performed. +

+

+

llvm/include

+ + This directory contains public header files exported from the LLVM + library. The two main subdirectories of this directory are: +

+
    +
  1. llvm/include/llvm - This directory contains all of the +LLVM specific header files. This directory also has subdirectories +for different portions of LLVM: Analysis, CodeGen, + Reoptimizer, Target, Transforms, etc... +
  2. +
  3. llvm/include/Support - This directory contains generic + support libraries that are independant of LLVM, but are used by LLVM. + For example, some C++ STL utilities and a Command Line option processing + library.
  4. +
+ + +

llvm/lib

+ + This directory contains most source files of LLVM system. In LLVM almost +all code exists in libraries, making it very easy to share code among +the different tools. +

+
+
llvm/lib/VMCore/
+
This directory holds the core LLVM source files that implement +core classes like Instruction and BasicBlock.
+
llvm/lib/AsmParser/
+
This directory holds the source code for the LLVM assembly language +parser library.
+
llvm/lib/ByteCode/
+
This directory holds code for reading and write LLVM bytecode. +
+
llvm/lib/CWriter/
+
This directory implements the LLVM to C converter.
+
llvm/lib/Analysis/
+
This directory contains a variety of different program analyses, +such as Dominator Information, Call Graphs, Induction Variables, Interval +Identification, Natural Loop Identification, etc...
+
llvm/lib/Transforms/
+
This directory contains the source code for the LLVM to LLVM +program transformations, such as Aggressive Dead Code Elimination, +Sparse Conditional Constant Propagation, Inlining, Loop Invarient Code +Motion, Dead Global Elimination, Pool Allocation, and many others... +
+
llvm/lib/Target/
+
This directory contains files that describe various target architectures +for code generation. For example, the llvm/lib/Target/Sparc directory +holds the Sparc machine description.
+
+
llvm/lib/CodeGen/
+
This directory contains the major parts of the code generator: +Instruction Selector, Instruction Scheduling, and Register Allocation. +
+
llvm/lib/Reoptimizer/
+
This directory holds code related to the runtime reoptimizer +framework that is currently under development.
+
llvm/lib/Support/
+
This directory contains the source code that corresponds to +the header files located in llvm/include/Support/.
+
+ + +

llvm/test

+ + +

This directory contains regression tests and source code that is used +to test the LLVM infrastructure...

+ + +

llvm/tools

+ + +

The tools directory contains the executables built out of the + libraries above, which form the main part of the user interface. You +can always get help for a tool by typing tool_name --help. +The following is a brief introduction to the most important tools.

+ +
+
as
+
The assembler transforms the human readable LLVM assembly to +LLVM bytecode. +

+
+
dis
+
The disassembler transforms the LLVM bytecode to human readable +LLVM assembly. Additionally it can convert LLVM bytecode to C, which +is enabled with the -c option. +

+
+
lli
+
lli is the LLVM interpreter, which can directly execute +LLVM bytecode (although very slowly...). In addition to a simple intepreter, + lli is also has debugger and tracing modes (entered by +specifying -debug or -trace on the command line, +respectively). +

+
+
llc
+
llc is the LLVM backend compiler, which translates +LLVM bytecode to a SPARC assembly file. +

+
+
llvmgcc
+
llvmgcc is a GCC based C frontend that has been retargeted +to emit LLVM code as the machine code output. It works just like any +other GCC compiler, taking the typical -c, -S, -E, -o options +that are typically used. The source code for the llvmgcc +tool is currently not included in the LLVM cvs tree because it is quite +large and not very interesting. +

    -
  1. llvm/include/llvm - This directory contains all of the LLVM - specific header files. This directory also has subdirectories for - different portions of LLVM: Analysis, CodeGen, - Reoptimizer, Target, Transforms, etc... - -
  2. llvm/include/Support - This directory contains generic - support libraries that are independant of LLVM, but are used by LLVM. - For example, some C++ STL utilities and a Command Line option processing - library. +
    gccas
    +
    This tool is invoked by the llvmgcc frontend +as the "assembler" part of the compiler. This tool actually assembles +LLVM assembly to LLVM bytecode, performs a variety of optimizations, + and outputs LLVM bytecode. Thus when you invoke llvmgcc -c x.c +-o x.o, you are causing gccas to be run, which writes +the x.o file (which is an LLVM bytecode file that can be + disassembled or manipulated just like any other bytecode file). +The command line interface to gccas is designed to be as +close as possible to the system 'as' utility so that +the gcc frontend itself did not have to be modified to interface +to a "wierd" assembler. +

    +
    +
    gccld
    +
    gccld links together several LLVM bytecode files +into one bytecode file and does some optimization. It is the linker +invoked by the gcc frontend when multiple .o files need to be linked +together. Like gccas the command line interface of gccld +is designed to match the system linker, to aid interfacing with the +GCC frontend. +

    +
- - -

llvm/lib

- - - This directory contains most source files of LLVM system. In LLVM almost all - code exists in libraries, making it very easy to share code among the - different tools.

- -

-
llvm/lib/VMCore/
This directory holds the core LLVM - source files that implement core classes like Instruction and BasicBlock. - -
llvm/lib/AsmParser/
This directory holds the source code - for the LLVM assembly language parser library. - -
llvm/lib/ByteCode/
This directory holds code for reading - and write LLVM bytecode. - -
llvm/lib/CWriter/
This directory implements the LLVM to C - converter. - -
llvm/lib/Analysis/
This directory contains a variety of - different program analyses, such as Dominator Information, Call Graphs, - Induction Variables, Interval Identification, Natural Loop Identification, - etc... - -
llvm/lib/Transforms/
This directory contains the source - code for the LLVM to LLVM program transformations, such as Aggressive Dead - Code Elimination, Sparse Conditional Constant Propagation, Inlining, Loop - Invarient Code Motion, Dead Global Elimination, Pool Allocation, and many - others... - -
llvm/lib/Target/
This directory contains files that - describe various target architectures for code generation. For example, - the llvm/lib/Target/Sparc directory holds the Sparc machine - description.
- -
llvm/lib/CodeGen/
This directory contains the major parts - of the code generator: Instruction Selector, Instruction Scheduling, and - Register Allocation. - -
llvm/lib/Reoptimizer/
This directory holds code related - to the runtime reoptimizer framework that is currently under development. - -
llvm/lib/Support/
This directory contains the source code - that corresponds to the header files located in - llvm/include/Support/. -
- - -

llvm/test

- - -

This directory contains regression tests and source code that is used to - test the LLVM infrastructure...

- - -

llvm/tools

- - -

The tools directory contains the executables built out of the - libraries above, which form the main part of the user interface. You can - always get help for a tool by typing tool_name --help. The - following is a brief introduction to the most important tools.

- -
-
as
The assembler transforms the human readable - LLVM assembly to LLVM bytecode.

- -

dis
The disassembler transforms the LLVM bytecode - to human readable LLVM assembly. Additionally it can convert LLVM - bytecode to C, which is enabled with the -c option.

- -

lli
lli is the LLVM interpreter, which - can directly execute LLVM bytecode (although very slowly...). In addition - to a simple intepreter, lli is also has debugger and tracing - modes (entered by specifying -debug or -trace on the - command line, respectively).

- -

llc
llc is the LLVM backend compiler, - which translates LLVM bytecode to a SPARC assembly file.

- -

llvmgcc
llvmgcc is a GCC based C frontend - that has been retargeted to emit LLVM code as the machine code output. It - works just like any other GCC compiler, taking the typical -c, -S, -E, - -o options that are typically used. The source code for the - llvmgcc tool is currently not included in the LLVM cvs tree - because it is quite large and not very interesting.

- -

    -
    gccas
    This tool is invoked by the - llvmgcc frontend as the "assembler" part of the compiler. This - tool actually assembles LLVM assembly to LLVM bytecode, - performs a variety of optimizations, - and outputs LLVM bytecode. Thus when you invoke llvmgcc -c x.c -o - x.o, you are causing gccas to be run, which writes the - x.o file (which is an LLVM bytecode file that can be - disassembled or manipulated just like any other bytecode file). The - command line interface to gccas is designed to be as close as - possible to the system 'as' utility so that the gcc - frontend itself did not have to be modified to interface to a "wierd" - assembler.

    - -

    gccld
    gccld links together several LLVM - bytecode files into one bytecode file and does some optimization. It is - the linker invoked by the gcc frontend when multiple .o files need to be - linked together. Like gccas the command line interface of - gccld is designed to match the system linker, to aid - interfacing with the GCC frontend.

    -

- -
opt
opt reads LLVM bytecode, applies a - series of LLVM to LLVM transformations (which are specified on the command - line), and then outputs the resultant bytecode. The 'opt --help' - command is a good way to get a list of the program transformations - available in LLVM.

- - -

analyze
analyze is used to run a specific - analysis on an input LLVM bytecode file and print out the results. It is - primarily useful for debugging analyses, or familiarizing yourself with - what an analysis does.

- -

- - -

An example using the LLVM tool chain

- - -
    -
  1. First, create a simple C file, name it 'hello.c': -
    -   #include <stdio.h>
    -   int main() {
    -     printf("hello world\n");
    -     return 0;
    -   }
    -       
    - -
  2. Next, compile the C file into a LLVM bytecode file:

    - - % llvmgcc hello.c -o hello

    - - This will create two result files: hello and - hello.bc. The hello.bc is the LLVM bytecode that - corresponds the the compiled program and the library facilities that it - required. hello is a simple shell script that runs the bytecode - file with lli, making the result directly executable.

    - -

  3. Run the program. To make sure the program ran, execute one of the - following commands:

    +

+
opt
+
opt reads LLVM bytecode, applies a series of LLVM to +LLVM transformations (which are specified on the command line), and +then outputs the resultant bytecode. The 'opt --help' command +is a good way to get a list of the program transformations available +in LLVM. +

+
+
analyze
+
analyze is used to run a specific analysis on an input +LLVM bytecode file and print out the results. It is primarily useful +for debugging analyses, or familiarizing yourself with what an analysis +does. +

+
+
+ + +

An example using the LLVM tool chain

+ + +
    +
  1. First, create a simple C file, name it 'hello.c': + +
       #include <stdio.h>
    int main() {
    printf("hello world\n");
    return 0;
    }
    +
  2. +
  3. Next, compile the C file into a LLVM bytecode file: +

    % llvmgcc hello.c -o hello

    +

    This will create two result files: hello and + hello.bc. The hello.bc is the LLVM bytecode that + corresponds the the compiled program and the library facilities that it + required. hello is a simple shell script that runs the bytecode + file with lli, making the result directly executable.

    +

    +
  4. +
  5. Run the program. To make sure the program ran, execute one of the + following commands: +

    % ./hello

    +

    or

    +

    % lli hello.bc

    +

    +
  6. +
  7. Use the dis utility to take a look at the LLVM assembly + code: +

    % dis < hello.bc | less

    +

    +
  8. +
  9. Compile the program to native Sparc assembly using the code generator: +

    % llc hello.bc -o hello.s

    +

    +
  10. +
  11. Assemble the native sparc assemble file into a program: +

    % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.sparc

    +

    +
  12. +
  13. Execute the native sparc program: +

    % ./hello.sparc

    +

    +
  14. +
    +
+ + +

Links

+ + +

This document is just an introduction to how to use LLVM to do + some simple things... there are many more interesting and complicated +things that you can do that aren't documented here (but we'll gladly +accept a patch if you want to write something up!). For more information +about LLVM, check out:

- % ./hello

- - or

- - % lli hello.bc

- -

  • Use the dis utility to take a look at the LLVM assembly - code:

    - - % dis < hello.bc | less

    - -

  • Compile the program to native Sparc assembly using the code - generator:

    - - % llc hello.bc -o hello.s

    - -

  • Assemble the native sparc assemble file into a program:

    - - % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.sparc

    - -

  • Execute the native sparc program:

    - - % ./hello.sparc

    - - - - - -

    Links

    - - -

    This document is just an introduction to how to use LLVM to do - some simple things... there are many more interesting and complicated things - that you can do that aren't documented here (but we'll gladly accept a patch - if you want to write something up!). For more information about LLVM, check - out:

    - - - -
    - - If you have any questions or run into any snags (or you have any - additions...), please send an email to - Chris Lattner.

    - - - -Last modified: Tue Jun 3 22:06:43 CDT 2003 - - + + +
    If you have any questions or run into any snags (or you have any + additions...), please send an email to Chris Lattner. +

    + +Last modified: Tue Jun 3 22:06:43 CDT 2003
    + From lattner at cs.uiuc.edu Thu Jun 12 13:58:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Jun 12 13:58:01 2003 Subject: [llvm-commits] CVS: llvm/tools/link/link.cpp Message-ID: <200306121857.NAA23370@apoc.cs.uiuc.edu> Changes in directory llvm/tools/link: link.cpp updated: 1.24 -> 1.25 --- Log message: Remove obsolete comments about llvm-ar --- Diffs of the changes: Index: llvm/tools/link/link.cpp diff -u llvm/tools/link/link.cpp:1.24 llvm/tools/link/link.cpp:1.25 --- llvm/tools/link/link.cpp:1.24 Thu May 22 15:13:15 2003 +++ llvm/tools/link/link.cpp Thu Jun 12 13:57:42 2003 @@ -4,9 +4,6 @@ // This utility may be invoked in the following manner: // link a.bc b.bc c.bc -o x.bc // -// Alternatively, this can be used as an 'ar' tool as well. If invoked as -// either 'ar' or 'llvm-ar', it accepts a 'rc' parameter as well. -// //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/Linker.h" @@ -90,13 +87,6 @@ unsigned BaseArg = 0; std::string ErrorMessage; - // TODO: TEST argv[0] for llvm-ar forms... for now, this is a huge hack. - if (InputFilenames.size() >= 3 && InputFilenames[0] == "rc" && - OutputFilename == "-") { - BaseArg = 2; - OutputFilename = InputFilenames[1]; - } - std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg])); if (Composite.get() == 0) return 1; @@ -116,7 +106,6 @@ if (DumpAsm) std::cerr << "Here's the assembly:\n" << Composite.get(); std::ostream *Out = &std::cout; // Default to printing to stdout... - if (OutputFilename != "-") { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! std::cerr << argv[0] << ": error opening '" << OutputFilename From criswell at cs.uiuc.edu Thu Jun 12 14:35:01 2003 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu Jun 12 14:35:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/GettingStarted.html Message-ID: <200306121934.OAA22775@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: GettingStarted.html updated: 1.13 -> 1.14 --- Log message: Reverted back to hand-made HTML. Added in updates for new Makefile variables and corrected some punctuation. --- Diffs of the changes: Index: llvm/www/docs/GettingStarted.html diff -u llvm/www/docs/GettingStarted.html:1.13 llvm/www/docs/GettingStarted.html:1.14 --- llvm/www/docs/GettingStarted.html:1.13 Wed Jun 11 15:46:40 2003 +++ llvm/www/docs/GettingStarted.html Thu Jun 12 14:34:44 2003 @@ -1,468 +1,480 @@ - - Getting Started with LLVM System - - - -
    -

    Getting Started with the LLVM System
    -By: Guochun Shi, Chris Lattner and Vikram Adve

    -
    - - -

    Contents

    - - - - - -
    -

    Overview

    -
    - - -

    The next section of this guide is meant to -get you up and running with LLVM, and to give you some basic information -about the LLVM environment. The first subsection -gives a short summary for those who are already familiar with the system -and want to get started as quickly as possible.

    -

    The later sections of this guide describe the general -layout of the LLVM source-tree, a simple example -using the LLVM tool chain, and links to find more information -about LLVM or to get help via e-mail. -

    -
    -

    Getting Started

    -
    - - - -

    Getting Started Quickly (A Summary)

    - - Here's the short story for getting up and running quickly with LLVM: - -
      -
    1. Find the path to the CVS repository containing LLVM (we'll call -this CVSROOTDIR).
    2. -
    3. cd where-you-want-llvm-to-live
    4. -
    5. cvs -d CVSROOTDIR checkout llvm
    6. -
    7. cd llvm
    8. -
    9. Edit Makefile.config to set local paths. This includes - setting the install location of the C frontend and the various paths - to the C and C++ compilers used to build LLVM itself.
    10. -
    11. Set your LLVM_LIB_SEARCH_PATH environment variable.
    12. -
    13. gmake -k |& tee gnumake.out    # this is -csh or tcsh syntax
    14. -
    - -

    See Setting up your environment on tips to - simplify working with the LLVM front-end and compiled tools. See the - other sub-sections below for other useful details in working with LLVM, - or go straight to Program Layout to learn about -the layout of the source code tree. -

    -

    Terminology and Notation

    - - -

    Through this manual, the following names are used to denote paths -specific to the local system and working environment. These are not - environment variables you need to set, but just strings used in the rest - of this document below. In any of the examples below, simply replace - each of these names with the appropriate pathname on your local system. + +

    See Setting up your environment on tips to + simplify working with the LLVM front-end and compiled tools. See the + other sub-sections below for other useful details in working with LLVM, + or go straight to Program Layout to learn about the + layout of the source code tree. + + +

    Terminology and Notation

    + + +

    Throughout this manual, the following names are used to denote paths + specific to the local system and working environment. These are not + environment variables you need to set, but just strings used in the rest + of this document below.. In any of the examples below, simply replace + each of these names with the appropriate pathname on your local system. All these paths are absolute:

    - -
      - -
    - - -

    Checkout LLVM from CVS

    - - -

    Before checking out the source code, you will need to know the path to - the CVS repository containing LLVM source code (we'll call this CVSROOTDIR -below). Ask the person responsible for your local LLVM installation -to give you this path.

    -

    To get a fresh copy of the entire source code, all you need to do -is check it out from CVS as follows:

    -
      -
    • cd where-you-want-llvm-to-live
    • -
    • cvs -d CVSROOTDIR checkout llvm -

      -
    • -
    - -

    This will create an 'llvm' directory in the current directory -and fully populate it with the LLVM source code, Makefiles, test directories, -and local copies of documentation files.

    - - -

    Local Configuration Options

    - - -

    The file llvm/Makefile.config defines the following path -variables which are specific to a particular installation of LLVM. - These should need to be modified only once after checking out a copy - of LLVM (if the default values do not already match your system): -

    -
      - -

      -
    • CXX = Path to C++ compiler to use. -

      -
    • -
    • OBJ_ROOT = Path to the llvm directory where object files -should be placed. (See the Section on The -location for LLVM object files for more information.) -

      -
    • -
    • LLVMGCCDIR = Path to the location of the LLVM front-end -binaries and associated libraries. -

      -
    • -
    • PURIFY = Path to the purify program.
    • -
    - In addition to settings in this file, you must set a LLVM_LIB_SEARCH_PATH -environment variable in your startup scripts. This environment variable -is used to locate "system" libraries like "-lc" and "-lm" -when linking. This variable should be set to the absolute path for the -bytecode-libs subdirectory of the C front-end install. For example, - /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs is used -for the X86 version of the C front-end on our research machines. -

    -

    -

    The location for LLVM object files

    - - -

    The LLVM make system sends most output files generated during the build - into the directory defined by the variable OBJ_ROOT in llvm/Makefile.config. - This can be either just your normal LLVM source tree or some other directory -writable by you. You may wish to put object files on a different filesystem -either to keep them from being backed up or to speed up local builds. -

    -

    If you do not wish to use a different location for object files (i.e. -building into the source tree directly), just set this variable to ".".

    -

    -

    -

    Setting up your environment

    - - NOTE: This step is optional but will set up your environment so you - can use the compiled LLVM tools with as little hassle as possible.) - -

    Add the following lines to your .cshrc (or the corresponding - lines to your .profile if you use a bourne shell derivative). -

    -
           # Make the C front end easy to use...
    alias llvmgcc LLVMGCCDIR/bin/llvm-gcc +
      +
    + + +

    Checkout LLVM from CVS

    + + +

    Before checking out the source code, you will need to know the path to + the CVS repository containing LLVM source code (we'll call this + CVSROOTDIR below). Ask the person responsible for your local LLVM + installation to give you this path. + +

    To get a fresh copy of the entire source code, all you + need to do is check it out from CVS as follows: +

      +
    • cd where-you-want-llvm-to-live +
    • cvs -d CVSROOTDIR checkout llvm

      +
    + +

    This will create an 'llvm' directory in the current + directory and fully populate it with the LLVM source code, Makefiles, + test directories, and local copies of documentation files.

    + + +

    Local Configuration Options

    + + +

    The file llvm/Makefile.config + defines the following path variables + which are specific to a particular installation of LLVM. + These need to be modified only once after checking out a copy + of LLVM (if the default values do not already match your system): + +

      +

    • CXX = Path to C++ compiler to use. +

    • OBJ_ROOT = Path to the llvm directory where + object files should be placed. + (See the Section on + The location for LLVM object files + for more information.) +

    • LLVMGCCDIR = Path to the location of the LLVM front-end + binaries and associated libraries. +

    • PURIFY = Path to the purify program. +
    + + In addition to settings in this file, you must set a + LLVM_LIB_SEARCH_PATH environment variable in your startup scripts. + This environment variable is used to locate "system" libraries like + "-lc" and "-lm" when linking. This variable should be set + to the absolute path for the bytecode-libs subdirectory of the C front-end + install. For example, one might use + /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86 + version of the C front-end on our research machines.

    + + +

    The location for LLVM object files

    + + +

    The LLVM make system sends most output files generated during the build + into the directory defined by the variable OBJ_ROOT in + llvm/Makefile.config. This can be either just your normal LLVM + source tree or some other directory writable by you. You may wish to put + object files on a different filesystem either to keep them from being backed + up or to speed up local builds. + +

    If you do not wish to use a different location for object files (i.e. + you are building into the source tree directly), just set this variable to + ".".

    + + +

    Setting up your environment

    + + + NOTE: This step is optional but will set up your environment so you + can use the compiled LLVM tools with as little hassle as + possible.) + +

    Add the following lines to your .cshrc (or the corresponding + lines to your .profile if you use a bourne shell derivative). + +

    +       # Make the C front end easy to use...
    +       alias llvmgcc LLVMGCCDIR/bin/llvm-gcc
     
            # Make the LLVM tools easy to use...
    -       setenv PATH OBJ_ROOT/llvm/tools/Debug:${PATH}
    - The llvmgcc alias is useful because the C compiler is not - included in the CVS tree you just checked out. -

    The other LLVM tools are part of the LLVM source -base and are built when compiling LLVM. They will be built into the -OBJ_ROOT/tools/Debug directory.

    - - -

    Compiling the source code

    - - -

    Every directory in the LLVM source tree includes a Makefile to - build it and any subdirectories that it contains. These makefiles require - GNU Make (gmake) instead of make to build them, but -can otherwise be used freely. To build the entire LLVM system, just -enter the top level llvm directory and type gmake. - A few minutes later you will hopefully have a freshly compiled toolchain -waiting for you in OBJ_ROOT/llvm/tools/Debug. - If you want to look at the libraries that were compiled, look in OBJ_ROOT/llvm/lib/Debug.

    - If you get an error about the /localhome directory, chances -are good that something has been misconfigured.  Follow the instructions -in the section about Setting Up Your Environment. - - -
    -

    Program Layout

    -
    - - -

    One useful source of infomation about the LLVM sourcebase is the LLVM -doxygen documentation, available at -http://llvm.cs.uiuc.edu/doxygen/. -The following is a brief introduction to code layout:

    - - -

    CVS directories

    - - Every directory checked out of CVS will contain a CVS directory; - for the most part, these can just be ignored. - -

    Depend, Debug, & Release + setenv PATH OBJ_ROOT/llvm/tools/Debug:${PATH} +

    + The llvmgcc alias is useful because the C compiler is not + included in the CVS tree you just checked out. + +

    The other LLVM tools are part of the LLVM + source base and built when compiling LLVM. They will be built into the + OBJ_ROOT/tools/Debug directory.

    + + +

    Compiling the source code

    + + +

    Every directory in the LLVM source tree includes a Makefile to + build it and any subdirectories that it contains. These makefiles require + that you use GNU Make (aka gmake) instead of make to + build them, but can + otherwise be used freely. To build the entire LLVM system, just enter the + top level llvm directory and type gmake. A few minutes + later you will hopefully have a freshly compiled toolchain waiting for you + in OBJ_ROOT/llvm/tools/Debug. If you want to look at the + libraries that were compiled, look in + OBJ_ROOT/llvm/lib/Debug.

    + + If you get an error about a /localhome directory, follow the + instructions in the section about Setting Up Your + Environment. + + + + +
    +

    Program Layout

    +
    + + +

    One useful source of infomation about the LLVM sourcebase is the LLVM doxygen documentation, available at http://llvm.cs.uiuc.edu/doxygen/. The + following is a brief introduction to code layout:

    + + + +

    CVS directories

    + + + Every directory checked out of CVS will contain a CVS directory; + for the most part these can just be ignored. + + + +

    Depend, Debug, & Release directories

    - - If you are building with the "OBJ_ROOT=." option enabled in -the Makefile.config file, most source directories will contain -two directories, Depend and Debug. The Depend - directory contains automatically generated dependance files which are -used during compilation to make sure that source files get rebuilt if -a header file they use is modified. The Debug directory holds -the object files, library files, and executables that are used for building -a debug enabled build. The Release directory is created to -hold the same files when the ENABLE_OPTIMIZED=1 flag is passed -to gmake, causing an optimized built to be performed. -

    -

    -

    llvm/include

    - - This directory contains public header files exported from the LLVM - library. The two main subdirectories of this directory are: -

    -
      -
    1. llvm/include/llvm - This directory contains all of the -LLVM specific header files. This directory also has subdirectories -for different portions of LLVM: Analysis, CodeGen, - Reoptimizer, Target, Transforms, etc... -
    2. -
    3. llvm/include/Support - This directory contains generic - support libraries that are independant of LLVM, but are used by LLVM. - For example, some C++ STL utilities and a Command Line option processing - library.
    4. -
    - - -

    llvm/lib

    - - This directory contains most source files of LLVM system. In LLVM almost -all code exists in libraries, making it very easy to share code among -the different tools. -

    -
    -
    llvm/lib/VMCore/
    -
    This directory holds the core LLVM source files that implement -core classes like Instruction and BasicBlock.
    -
    llvm/lib/AsmParser/
    -
    This directory holds the source code for the LLVM assembly language -parser library.
    -
    llvm/lib/ByteCode/
    -
    This directory holds code for reading and write LLVM bytecode. -
    -
    llvm/lib/CWriter/
    -
    This directory implements the LLVM to C converter.
    -
    llvm/lib/Analysis/
    -
    This directory contains a variety of different program analyses, -such as Dominator Information, Call Graphs, Induction Variables, Interval -Identification, Natural Loop Identification, etc...
    -
    llvm/lib/Transforms/
    -
    This directory contains the source code for the LLVM to LLVM -program transformations, such as Aggressive Dead Code Elimination, -Sparse Conditional Constant Propagation, Inlining, Loop Invarient Code -Motion, Dead Global Elimination, Pool Allocation, and many others... -
    -
    llvm/lib/Target/
    -
    This directory contains files that describe various target architectures -for code generation. For example, the llvm/lib/Target/Sparc directory -holds the Sparc machine description.
    -
    -
    llvm/lib/CodeGen/
    -
    This directory contains the major parts of the code generator: -Instruction Selector, Instruction Scheduling, and Register Allocation. -
    -
    llvm/lib/Reoptimizer/
    -
    This directory holds code related to the runtime reoptimizer -framework that is currently under development.
    -
    llvm/lib/Support/
    -
    This directory contains the source code that corresponds to -the header files located in llvm/include/Support/.
    -
    - - -

    llvm/test

    - - -

    This directory contains regression tests and source code that is used -to test the LLVM infrastructure...

    - - -

    llvm/tools

    - - -

    The tools directory contains the executables built out of the - libraries above, which form the main part of the user interface. You -can always get help for a tool by typing tool_name --help. -The following is a brief introduction to the most important tools.

    - -
    -
    as
    -
    The assembler transforms the human readable LLVM assembly to -LLVM bytecode. -

    -
    -
    dis
    -
    The disassembler transforms the LLVM bytecode to human readable -LLVM assembly. Additionally it can convert LLVM bytecode to C, which -is enabled with the -c option. -

    -
    -
    lli
    -
    lli is the LLVM interpreter, which can directly execute -LLVM bytecode (although very slowly...). In addition to a simple intepreter, - lli is also has debugger and tracing modes (entered by -specifying -debug or -trace on the command line, -respectively). -

    -
    -
    llc
    -
    llc is the LLVM backend compiler, which translates -LLVM bytecode to a SPARC assembly file. -

    -
    -
    llvmgcc
    -
    llvmgcc is a GCC based C frontend that has been retargeted -to emit LLVM code as the machine code output. It works just like any -other GCC compiler, taking the typical -c, -S, -E, -o options -that are typically used. The source code for the llvmgcc -tool is currently not included in the LLVM cvs tree because it is quite -large and not very interesting. -

    + + + If you are building with the "OBJ_ROOT=." option enabled in the + Makefile.config file, most source directories will contain two + directories, Depend and Debug. The Depend + directory contains automatically generated dependance files which are used + during compilation to make sure that source files get rebuilt if a header + file they use is modified. The Debug directory holds the object + files, library files, and executables that are used for building a debug + enabled build. The Release directory is created to hold the same + files when the ENABLE_OPTIMIZED=1 flag is passed to gmake, + causing an optimized built to be performed.

    + + + +

    llvm/include

    + + + This directory contains public header files exported from the LLVM + library. The two main subdirectories of this directory are:

    +

      -
      gccas
      -
      This tool is invoked by the llvmgcc frontend -as the "assembler" part of the compiler. This tool actually assembles -LLVM assembly to LLVM bytecode, performs a variety of optimizations, - and outputs LLVM bytecode. Thus when you invoke llvmgcc -c x.c --o x.o, you are causing gccas to be run, which writes -the x.o file (which is an LLVM bytecode file that can be - disassembled or manipulated just like any other bytecode file). -The command line interface to gccas is designed to be as -close as possible to the system 'as' utility so that -the gcc frontend itself did not have to be modified to interface -to a "wierd" assembler. -

      -
      -
      gccld
      -
      gccld links together several LLVM bytecode files -into one bytecode file and does some optimization. It is the linker -invoked by the gcc frontend when multiple .o files need to be linked -together. Like gccas the command line interface of gccld -is designed to match the system linker, to aid interfacing with the -GCC frontend. -

      -
      +
    1. llvm/include/llvm - This directory contains all of the LLVM + specific header files. This directory also has subdirectories for + different portions of LLVM: Analysis, CodeGen, + Reoptimizer, Target, Transforms, etc... + +
    2. llvm/include/Support - This directory contains generic + support libraries that are independant of LLVM, but are used by LLVM. + For example, header files for some C++ STL utilities and a Command Line + option processing library are located here.
    -
    -
    opt
    -
    opt reads LLVM bytecode, applies a series of LLVM to -LLVM transformations (which are specified on the command line), and -then outputs the resultant bytecode. The 'opt --help' command -is a good way to get a list of the program transformations available -in LLVM. -

    -
    -
    analyze
    -
    analyze is used to run a specific analysis on an input -LLVM bytecode file and print out the results. It is primarily useful -for debugging analyses, or familiarizing yourself with what an analysis -does. -

    -
    -
    - - -

    An example using the LLVM tool chain

    - - -
      -
    1. First, create a simple C file, name it 'hello.c': - -
         #include <stdio.h>
      int main() {
      printf("hello world\n");
      return 0;
      }
      -
    2. -
    3. Next, compile the C file into a LLVM bytecode file: -

      % llvmgcc hello.c -o hello

      -

      This will create two result files: hello and - hello.bc. The hello.bc is the LLVM bytecode that - corresponds the the compiled program and the library facilities that it - required. hello is a simple shell script that runs the bytecode - file with lli, making the result directly executable.

      -

      -
    4. -
    5. Run the program. To make sure the program ran, execute one of the - following commands: -

      % ./hello

      -

      or

      -

      % lli hello.bc

      -

      -
    6. -
    7. Use the dis utility to take a look at the LLVM assembly - code: -

      % dis < hello.bc | less

      -

      -
    8. -
    9. Compile the program to native Sparc assembly using the code generator: -

      % llc hello.bc -o hello.s

      -

      -
    10. -
    11. Assemble the native sparc assemble file into a program: -

      % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.sparc

      -

      -
    12. -
    13. Execute the native sparc program: -

      % ./hello.sparc

      -

      -
    14. -
      -
    - - -

    Links

    - - -

    This document is just an introduction to how to use LLVM to do - some simple things... there are many more interesting and complicated -things that you can do that aren't documented here (but we'll gladly -accept a patch if you want to write something up!). For more information -about LLVM, check out:

    - - + + +

    llvm/lib

    + + + This directory contains most source files of LLVM system. In LLVM, almost + all code exists in libraries, making it very easy to share code among the + different tools.

    + +

    +
    llvm/lib/VMCore/
    This directory holds the core LLVM + source files that implement core classes like Instruction and BasicBlock. + +
    llvm/lib/AsmParser/
    This directory holds the source code + for the LLVM assembly language parser library. + +
    llvm/lib/ByteCode/
    This directory holds code for reading + and write LLVM bytecode. + +
    llvm/lib/CWriter/
    This directory implements the LLVM to C + converter. + +
    llvm/lib/Analysis/
    This directory contains a variety of + different program analyses, such as Dominator Information, Call Graphs, + Induction Variables, Interval Identification, Natural Loop Identification, + etc... + +
    llvm/lib/Transforms/
    This directory contains the source + code for the LLVM to LLVM program transformations, such as Aggressive Dead + Code Elimination, Sparse Conditional Constant Propagation, Inlining, Loop + Invarient Code Motion, Dead Global Elimination, Pool Allocation, and many + others... + +
    llvm/lib/Target/
    This directory contains files that + describe various target architectures for code generation. For example, + the llvm/lib/Target/Sparc directory holds the Sparc machine + description.
    + +
    llvm/lib/CodeGen/
    This directory contains the major parts + of the code generator: Instruction Selector, Instruction Scheduling, and + Register Allocation. + +
    llvm/lib/Reoptimizer/
    This directory holds code related + to the runtime reoptimizer framework that is currently under development. + +
    llvm/lib/Support/
    This directory contains the source code + that corresponds to the header files located in + llvm/include/Support/. +
    + + +

    llvm/test

    + + +

    This directory contains regression tests and source code that is used to + test the LLVM infrastructure...

    + + +

    llvm/tools

    + + +

    The tools directory contains the executables built out of the + libraries above, which form the main part of the user interface. You can + always get help for a tool by typing tool_name --help. The + following is a brief introduction to the most important tools.

    + +
    +
    as
    The assembler transforms the human readable + LLVM assembly to LLVM bytecode.

    + +

    dis
    The disassembler transforms the LLVM bytecode + to human readable LLVM assembly. Additionally it can convert LLVM + bytecode to C, which is enabled with the -c option.

    + +

    lli
    lli is the LLVM interpreter, which + can directly execute LLVM bytecode (although very slowly...). In addition + to a simple intepreter, lli is also has debugger and tracing + modes (entered by specifying -debug or -trace on the + command line, respectively).

    + +

    llc
    llc is the LLVM backend compiler, + which translates LLVM bytecode to a SPARC assembly file.

    + +

    llvmgcc
    llvmgcc is a GCC based C frontend + that has been retargeted to emit LLVM code as the machine code output. It + works just like any other GCC compiler, taking the typical -c, -S, -E, + -o options that are typically used. The source code for the + llvmgcc tool is currently not included in the LLVM cvs tree + because it is quite large and not very interesting.

    + +

      +
      gccas
      This tool is invoked by the + llvmgcc frontend as the "assembler" part of the compiler. This + tool actually assembles LLVM assembly to LLVM bytecode, + performs a variety of optimizations, + and outputs LLVM bytecode. Thus when you invoke llvmgcc -c x.c -o + x.o, you are causing gccas to be run, which writes the + x.o file (which is an LLVM bytecode file that can be + disassembled or manipulated just like any other bytecode file). The + command line interface to gccas is designed to be as close as + possible to the system 'as' utility so that the gcc + frontend itself did not have to be modified to interface to a "wierd" + assembler.

      + +

      gccld
      gccld links together several LLVM + bytecode files into one bytecode file and does some optimization. It is + the linker invoked by the gcc frontend when multiple .o files need to be + linked together. Like gccas the command line interface of + gccld is designed to match the system linker, to aid + interfacing with the GCC frontend.

      +

    + +
    opt
    opt reads LLVM bytecode, applies a + series of LLVM to LLVM transformations (which are specified on the command + line), and then outputs the resultant bytecode. The 'opt --help' + command is a good way to get a list of the program transformations + available in LLVM.

    + + +

    analyze
    analyze is used to run a specific + analysis on an input LLVM bytecode file and print out the results. It is + primarily useful for debugging analyses, or familiarizing yourself with + what an analysis does.

    + +

    + + +

    An example using the LLVM tool chain

    + + +
      +
    1. First, create a simple C file, name it 'hello.c': +
      +   #include <stdio.h>
      +   int main() {
      +     printf("hello world\n");
      +     return 0;
      +   }
      +       
      + +
    2. Next, compile the C file into a LLVM bytecode file:

      + + % llvmgcc hello.c -o hello

      + + This will create two result files: hello and + hello.bc. The hello.bc is the LLVM bytecode that + corresponds the the compiled program and the library facilities that it + required. hello is a simple shell script that runs the bytecode + file with lli, making the result directly executable.

      + +

    3. Run the program. To make sure the program ran, execute one of the + following commands:

      -


      If you have any questions or run into any snags (or you have any - additions...), please send an email to
      Chris Lattner. -

      - -Last modified: Tue Jun 3 22:06:43 CDT 2003
      - + % ./hello

      + + or

      + + % lli hello.bc

      + +

    4. Use the dis utility to take a look at the LLVM assembly + code:

      + + % dis < hello.bc | less

      + +

    5. Compile the program to native Sparc assembly using the code + generator:

      + + % llc hello.bc -o hello.s

      + +

    6. Assemble the native sparc assemble file into a program:

      + + % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.sparc

      + +

    7. Execute the native sparc program:

      + + % ./hello.sparc

      + +

    + + + +

    Links

    + + +

    This document is just an introduction to how to use LLVM to do + some simple things... there are many more interesting and complicated things + that you can do that aren't documented here (but we'll gladly accept a patch + if you want to write something up!). For more information about LLVM, check + out:

    + + + +
    + + If you have any questions or run into any snags (or you have any + additions...), please send an email to + Chris Lattner.

    + + + +Last modified: Tue Jun 3 22:06:43 CDT 2003 + + From lattner at cs.uiuc.edu Fri Jun 13 11:11:04 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Jun 13 11:11:04 2003 Subject: [llvm-commits] CVS: llvm/tools/link/link.cpp Message-ID: <200306131610.LAA29064@apoc.cs.uiuc.edu> Changes in directory llvm/tools/link: link.cpp updated: 1.25 -> 1.26 --- Log message: Fix major bug in my last checkin. :( --- Diffs of the changes: Index: llvm/tools/link/link.cpp diff -u llvm/tools/link/link.cpp:1.25 llvm/tools/link/link.cpp:1.26 --- llvm/tools/link/link.cpp:1.25 Thu Jun 12 13:57:42 2003 +++ llvm/tools/link/link.cpp Fri Jun 13 11:10:26 2003 @@ -106,6 +106,7 @@ if (DumpAsm) std::cerr << "Here's the assembly:\n" << Composite.get(); std::ostream *Out = &std::cout; // Default to printing to stdout... + if (OutputFilename != "-") { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! std::cerr << argv[0] << ": error opening '" << OutputFilename