From ashukla at cs.uiuc.edu Mon Sep 16 00:25:01 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Mon Sep 16 00:25:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Message-ID: <200209160524.AAA25776@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: ProfilePaths.cpp updated: 1.19 -> 1.20 --- Log message: Incorporated changes in alloca instruction --- Diffs of the changes: Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.19 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.20 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.19 Thu Aug 8 14:01:24 2002 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp Mon Sep 16 00:24:49 2002 @@ -74,14 +74,9 @@ return false; } - //std::cerr<<"Instrumenting\n-----------------\n"; - //std::cerr<().getExitNode(); @@ -120,10 +115,10 @@ Graph g(nodes,edges, startNode, exitNode); - //#ifdef DEBUG_PATH_PROFILES - //std::cerr<<"Original graph\n"; - //printGraph(g); - //#endif +#ifdef DEBUG_PATH_PROFILES + std::cerr<<"Original graph\n"; + printGraph(g); +#endif BasicBlock *fr = &F.front(); @@ -132,19 +127,15 @@ vector be; std::map nodePriority; //it ranks nodes in depth first order traversal g.getBackEdges(be, nodePriority); - /* - std::cerr<<"Node priority--------------\n"; - for(std::map::iterator MI = nodePriority.begin(), - ME = nodePriority.end(); MI!=ME; ++MI) - std::cerr<first->getElement()->getName()<<"->"<second<<"\n"; - std::cerr<<"End Node priority--------------\n"; - */ - //std::cerr<<"BackEdges-------------\n"; - // for(vector::iterator VI=be.begin(); VI!=be.end(); ++VI){ - //printEdge(*VI); - //cerr<<"\n"; - //} - //std::cerr<<"------\n"; + +#ifdef DEBUG_PATH_PROFILES + std::cerr<<"BackEdges-------------\n"; + for(vector::iterator VI=be.begin(); VI!=be.end(); ++VI){ + printEdge(*VI); + cerr<<"\n"; + } + std::cerr<<"------\n"; +#endif #ifdef DEBUG_PATH_PROFILES cerr<<"Backedges:"< exDummy; addDummyEdges(stDummy, exDummy, g, be); - //std::cerr<<"After adding dummy edges\n"; - //printGraph(g); - +#ifdef DEBUG_PATH_PROFILES + std::cerr<<"After adding dummy edges\n"; + printGraph(g); +#endif + // Now, every edge in the graph is assigned a weight // This weight later adds on to assign path // numbers to different paths in the graph // All paths for now are acyclic, // since no back edges in the graph now // numPaths is the number of acyclic paths in the graph - int numPaths=valueAssignmentToEdges(g, nodePriority); + int numPaths=valueAssignmentToEdges(g, nodePriority, be); if(numPaths<=1 || numPaths >5000) return false; - //std::cerr<<"Numpaths="< Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: EdgeCode.cpp updated: 1.15 -> 1.16 --- Log message: Incorporated changes in alloca and getElementPointer instruction --- Diffs of the changes: Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.15 llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.16 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.15 Sat Sep 14 14:33:16 2002 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp Mon Sep 16 00:25:35 2002 @@ -16,7 +16,6 @@ #include "llvm/iOperators.h" #include "llvm/iPHINode.h" #include "llvm/Module.h" -#include #include #define INSERT_LOAD_COUNT @@ -27,11 +26,7 @@ static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, Value *cnt, Instruction *InsertPos){ - static int i=-1; - i++; - char gstr[100]; - sprintf(gstr,"globalVar%d",i); - std::string globalVarName=gstr; + vector args; //args.push_back(PointerType::get(Type::SByteTy)); args.push_back(Type::IntTy); @@ -39,39 +34,15 @@ args.push_back(Type::IntTy); const FunctionType *MTy = FunctionType::get(Type::VoidTy, args, false); - // Function *triggerMeth = M->getOrInsertFunction("trigger", MTy); Function *trigMeth = M->getOrInsertFunction("trigger", MTy); assert(trigMeth && "trigger method could not be inserted!"); - //if (Value *triggerMeth = ST->lookup(PointerType::get(MTy), "trigger")) { - //Function *trigMeth = cast(triggerMeth); - vector trargs; - - //pred_iterator piter=BB->pred_begin(); - //std::string predName = "uu";//BB->getName(); - //Constant *bbName=ConstantArray::get(predName);//BB->getName()); - //GlobalVariable *gbl=new GlobalVariable(ArrayType::get(Type::SByteTy, - // predName.size()+1), - // true, true, bbName, gstr); - - //M->getGlobalList().push_back(gbl); - //vector elargs; - //elargs.push_back(ConstantSInt::get(Type::LongTy, 0)); - //elargs.push_back(ConstantSInt::get(Type::LongTy, 0)); - - // commented out bb name frm which its called - //Instruction *getElmntInst=new GetElementPtrInst(gbl,elargs,"elmntInst"); - - //trargs.push_back(ConstantArray::get(BB->getName())); - - //trargs.push_back(getElmntInst); - //trargs.push_back(bbName); + vector trargs; trargs.push_back(ConstantSInt::get(Type::IntTy,MethNo)); - - //trargs.push_back(ConstantSInt::get(Type::IntTy,-1));//erase this trargs.push_back(pathNo); trargs.push_back(cnt); + Instruction *callInst=new CallInst(trigMeth, trargs, "", InsertPos); } @@ -83,7 +54,7 @@ Function *M, BasicBlock *BB, int numPaths, int MethNo){ - Instruction *InsertPos = BB->begin(); + Instruction *InsertPos = BB->getInstList().begin(); //case: r=k code to be inserted switch(cond){ @@ -149,10 +120,8 @@ Value *val=ConstantSInt::get(Type::IntTy,inc); Instruction *addIndex=BinaryOperator:: create(Instruction::Add, ldIndex, val,"ti2", InsertPos); - //erase following 1 line - //Value *valtemp=ConstantSInt::get(Type::IntTy,999); - //now load count[addIndex] + //now load count[addIndex] Instruction *castInst=new CastInst(addIndex, Type::LongTy,"ctin", InsertPos); Instruction *Idx = new GetElementPtrInst(countInst, @@ -162,13 +131,11 @@ Instruction *ldInst=new LoadInst(Idx, "ti3", InsertPos); Value *cons=ConstantSInt::get(Type::IntTy,1); //count[addIndex]++ - Value *addIn = BinaryOperator::create(Instruction::Add, ldInst, cons, - "ti4", InsertPos); + Value *addIn = BinaryOperator::create(Instruction::Add, ldInst, + cons,"", InsertPos); #ifdef INSERT_STORE - ///* - new StoreInst(addIn, Idx, InsertPos); - //*/ + Instruction *stInst = new StoreInst(addIn, Idx, InsertPos); #endif //insert trigger @@ -202,7 +169,6 @@ //insert trigger getTriggerCode(M->getParent(), BB, MethNo, ldIndex, addIn, InsertPos); //end trigger code - break; } @@ -252,6 +218,30 @@ //store uint 0, uint *%R new StoreInst(Int0, rVar, here); + + if(front->getParent()->getName() == "main"){ + + //if its a main function, do the following! + //A global variable: %llvm_threshold + //%llvm_threshold = uninitialized global int + GlobalVariable *threshold = new GlobalVariable(Type::IntTy, false, true, 0, + "reopt_threshold"); + + front->getParent()->getParent()->getGlobalList().push_back(threshold); + + vector initialize_args; + initialize_args.push_back(PointerType::get(Type::IntTy)); + + const FunctionType *Fty = FunctionType::get(Type::VoidTy, initialize_args, + false); + Function *initialMeth = front->getParent()->getParent()->getOrInsertFunction("reoptimizerInitialize", Fty); + assert(initialMeth && "Initialize method could not be inserted!"); + + vector trargs; + trargs.push_back(threshold); + + new CallInst(initialMeth, trargs, "", front->begin()); + } } @@ -262,8 +252,7 @@ Instruction *rInst, Instruction *countInst, int numPaths, int Methno){ - static int i=-1; - i++; + BasicBlock* BB1=ed.getFirst()->getElement(); BasicBlock* BB2=ed.getSecond()->getElement(); @@ -274,21 +263,13 @@ cerr<<"########################\n"; #endif - char counterstr[100]; - sprintf(counterstr,"counter%d",i); - std::string ctr=counterstr; - //We need to insert a BB between BB1 and BB2 TerminatorInst *TI=BB1->getTerminator(); - BasicBlock *newBB=new BasicBlock(ctr, BB1->getParent()); + BasicBlock *newBB=new BasicBlock("counter", BB1->getParent()); //Is terminator a branch instruction? //then we need to change branch destinations to include new BB - //std::cerr<<"before cast!\n"; - //std::cerr<<"Method no in Edgecode:"<(TI); if(BI->isUnconditional()){ @@ -310,10 +291,8 @@ //get code for the new BB edgeCode->getCode(rInst, countInst, BB1->getParent(), newBB, numPaths, Methno); - - //std::cerr<<"After casting\n"; //get code for the new BB - //now iterate over BB2, and set its Phi nodes right + //now iterate over BB2, and set its Phi nodes right for(BasicBlock::iterator BB2Inst = BB2->begin(), BBend = BB2->end(); BB2Inst != BBend; ++BB2Inst){ From ashukla at cs.uiuc.edu Mon Sep 16 00:26:10 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Mon Sep 16 00:26:10 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp Message-ID: <200209160525.AAA25804@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: Graph.cpp updated: 1.5 -> 1.6 --- Log message: Incorporated changes in alloca and getElementPointer instruction --- Diffs of the changes: Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.5 llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.6 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.5 Thu Jul 18 15:56:01 2002 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp Mon Sep 16 00:25:42 2002 @@ -52,30 +52,75 @@ } //sorting edgelist, called by backEdgeVist ONLY!!! -Graph::nodeList &Graph::sortNodeList(Node *par, nodeList &nl){ +Graph::nodeList &Graph::sortNodeList(Node *par, nodeList &nl, vector &be){ assert(par && "null node pointer"); BasicBlock *bbPar = par->getElement(); if(nl.size()<=1) return nl; + if(getExit() == par) return nl; for(nodeList::iterator NLI = nl.begin(), NLE = nl.end()-1; NLI != NLE; ++NLI){ nodeList::iterator min = NLI; for(nodeList::iterator LI = NLI+1, LE = nl.end(); LI!=LE; ++LI){ //if LI < min, min = LI - if(min->element->getElement() == LI->element->getElement()) - continue; - + if(min->element->getElement() == LI->element->getElement() && + min->element == getExit()){ - TerminatorInst *tti = par->getElement()->getTerminator(); - BranchInst *ti = cast(tti); - assert(ti && "not a branch"); - assert(ti->getNumSuccessors()==2 && "less successors!"); - - BasicBlock *tB = ti->getSuccessor(0); - BasicBlock *fB = ti->getSuccessor(1); + //same successors: so might be exit??? + //if it is exit, then see which is backedge + //check if LI is a left back edge! + + TerminatorInst *tti = par->getElement()->getTerminator(); + BranchInst *ti = cast(tti); + + assert(ti && "not a branch"); + assert(ti->getNumSuccessors()==2 && "less successors!"); + + BasicBlock *tB = ti->getSuccessor(0); + BasicBlock *fB = ti->getSuccessor(1); + //so one of LI or min must be back edge! + //Algo: if succ(0)!=LI (and so !=min) then succ(0) is backedge + //and then see which of min or LI is backedge + //THEN if LI is in be, then min=LI + if(LI->element->getElement() != tB){//so backedge must be made min! + for(vector::iterator VBEI = be.begin(), VBEE = be.end(); + VBEI != VBEE; ++VBEI){ + if(VBEI->getRandId() == LI->randId){ + min = LI; + break; + } + else if(VBEI->getRandId() == min->randId) + break; + } + } + else{// if(LI->element->getElement() != fB) + for(vector::iterator VBEI = be.begin(), VBEE = be.end(); + VBEI != VBEE; ++VBEI){ + if(VBEI->getRandId() == min->randId){ + min = LI; + break; + } + else if(VBEI->getRandId() == LI->randId) + break; + } + } + } - if(tB == LI->element->getElement() || fB == min->element->getElement()) - min = LI; + else if (min->element->getElement() != LI->element->getElement()){ + TerminatorInst *tti = par->getElement()->getTerminator(); + BranchInst *ti = cast(tti); + assert(ti && "not a branch"); + + if(ti->getNumSuccessors()<=1) continue; + + assert(ti->getNumSuccessors()==2 && "less successors!"); + + BasicBlock *tB = ti->getSuccessor(0); + BasicBlock *fB = ti->getSuccessor(1); + + if(tB == LI->element->getElement() || fB == min->element->getElement()) + min = LI; + } } graphListElement tmpElmnt = *min; @@ -416,12 +461,6 @@ DFS_Visit(*LI, toReturn); } - //print nodes - //std::cerr<<"Topological sort--------\n"; - //for(vector::iterator VI = toReturn.begin(), VE = toReturn.end(); - // VI!=VE; ++VI) - //std::cerr<<(*VI)->getElement()->getName()<<"->"; - //std::cerr<<"\n----------------------\n"; return toReturn; } @@ -487,15 +526,9 @@ //a node with smaller time, and GREY color void Graph::getBackEdges(vector &be, map &d){ map color; - //map d; - //vector allNodes=getAllNodes(); int time=0; - //for(vector::iterator NI=allNodes.begin(), NE=allNodes.end(); - // NI!=NE; ++NI){ - //if(color[*NI]!=GREY && color[*NI]!=BLACK) - //printGraph(); - getBackEdgesVisit(getRoot(), be, color, d, time);//*NI, be, color, d, time); - //} + + getBackEdgesVisit(getRoot(), be, color, d, time); } //helper function to get back edges: it is called by @@ -507,25 +540,14 @@ time++; d[u]=time; - //std::cerr<<"Node list-----\n"; - vector succ_list = getSortedNodeList(u); - - //for(vector::iterator vl=succ_list.begin(), - // ve=succ_list.end(); vl!=ve; ++vl){ - //Node *v=vl->element; - //std::cerr<getElement()->getName()<<"->"; - //} - //std::cerr<<"\n-------- end Node list\n"; + vector &succ_list = getNodeList(u); for(vector::iterator vl=succ_list.begin(), ve=succ_list.end(); vl!=ve; ++vl){ Node *v=vl->element; - // for(vector::const_iterator v=succ_list.begin(), ve=succ_list.end(); - // v!=ve; ++v){ - - if(color[v]!=GREY && color[v]!=BLACK){ - getBackEdgesVisit(v, be, color, d, time); - } + if(color[v]!=GREY && color[v]!=BLACK){ + getBackEdgesVisit(v, be, color, d, time); + } //now checking for d and f vals if(color[v]==GREY){ From ashukla at cs.uiuc.edu Mon Sep 16 00:27:00 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Mon Sep 16 00:27:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp Message-ID: <200209160526.AAA25818@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: GraphAuxillary.cpp updated: 1.8 -> 1.9 --- Log message: Incorporated changes in alloca and getElementPointer instruction --- Diffs of the changes: Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp:1.8 llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp:1.9 --- llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp:1.8 Thu Jul 18 15:56:07 2002 +++ llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxillary.cpp Mon Sep 16 00:26:28 2002 @@ -7,15 +7,18 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" +#include "llvm/Transforms/Instrumentation/Graph.h" #include "llvm/Function.h" #include "llvm/Pass.h" +#include "llvm/Module.h" +#include "llvm/Function.h" #include "llvm/BasicBlock.h" #include "llvm/InstrTypes.h" -#include "llvm/Transforms/Instrumentation/Graph.h" #include "llvm/iTerminators.h" #include #include #include +#include #include //using std::list; @@ -69,7 +72,8 @@ //such that if we traverse along any path from root to exit, and //add up the edge values, we get a path number that uniquely //refers to the path we travelled -int valueAssignmentToEdges(Graph& g, map nodePriority){ +int valueAssignmentToEdges(Graph& g, map nodePriority, + vector &be){ vector revtop=g.reverseTopologicalSort(); map NumPaths; for(vector::iterator RI=revtop.begin(), RE=revtop.end(); @@ -79,7 +83,9 @@ else{ NumPaths[*RI]=0; - Graph::nodeList &nlist=g.getNodeList(*RI); + // Modified Graph::nodeList &nlist=g.getNodeList(*RI); + Graph::nodeList &nlist=g.getSortedNodeList(*RI, be); + //sort nodelist by increasing order of numpaths int sz=nlist.size(); @@ -104,7 +110,7 @@ else{ TerminatorInst *tti = (*RI)->getElement()->getTerminator(); - //std::cerr<<*tti<(tti); assert(ti && "not a branch"); assert(ti->getNumSuccessors()==2 && "less successors!"); @@ -123,14 +129,11 @@ } //sorted now! - //std::cerr<<"Considering Order-----\n"; for(Graph::nodeList::iterator GLI=nlist.begin(), GLE=nlist.end(); GLI!=GLE; ++GLI){ - //std::cerr<element->getElement()->getName()<<"->"; - GLI->weight=NumPaths[*RI]; + GLI->weight=NumPaths[*RI]; NumPaths[*RI]+=NumPaths[GLI->element]; } - //std::cerr<<"\nend order $$$$$$$$$$$$$$$$$$$$$$$$\n"; } } return NumPaths[g.getRoot()]; @@ -165,7 +168,7 @@ //used for getting edge increments (read comments above in inc_Dir) //inc_DFS is a modification of DFS -static void inc_DFS(Graph& g,Graph& t,map& Increment, +static void inc_DFS(Graph& g,Graph& t,map& Increment, int events, Node *v, Edge e){ vector allNodes=t.getAllNodes(); @@ -219,15 +222,17 @@ //and assign them some values such that //if we consider just this subset, it still represents //the path sum along any path in the graph -static map getEdgeIncrements(Graph& g, Graph& t){ +static map getEdgeIncrements(Graph& g, Graph& t, + vector &be){ //get all edges in g-t - map Increment; + map Increment; vector allNodes=g.getAllNodes(); for(vector::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; ++NI){ - Graph::nodeList node_list=g.getNodeList(*NI); + Graph::nodeList node_list=g.getSortedNodeList(*NI, be); + //modified g.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); NLI!=NLE; ++NLI){ Edge ed(*NI, NLI->element,NLI->weight,NLI->randId); @@ -242,7 +247,8 @@ for(vector::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE; ++NI){ - Graph::nodeList node_list=g.getNodeList(*NI); + Graph::nodeList node_list=g.getSortedNodeList(*NI, be); + //modified g.getNodeList(*NI); for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end(); NLI!=NLE; ++NLI){ Edge ed(*NI, NLI->element,NLI->weight, NLI->randId); @@ -267,9 +273,9 @@ //the kind of code to be inserted along an edge //The idea here is to minimize the computation //by inserting only the needed code -static void getCodeInsertions(Graph &g, map &instr, +static void getCodeInsertions(Graph &g, map &instr, vector &chords, - map &edIncrements){ + map &edIncrements){ //Register initialization code vector ws; @@ -302,14 +308,12 @@ } else if(g.getNumberOfIncomingEdges(w)==1){ ws.push_back(w); - //std::cerr<<"Added w\n"; } else{ getEdgeCode *edCd=new getEdgeCode(); edCd->setCond(2); edCd->setInc(0); instr[ed]=edCd; - //std::cerr<<"Case 2\n"; } } } @@ -328,39 +332,42 @@ for(vector::iterator EII=lllt.begin(); EII!=lllt.end() ;++EII){ Node *lnode=*EII; Graph::nodeList &nl = g.getNodeList(lnode); - graphListElement *N = findNodeInList(nl, w); - if (N){ - Node *v=lnode; - - //if chords has v->w - Edge ed(v,w, N->weight, N->randId); - getEdgeCode *edCd=new getEdgeCode(); - bool hasEdge=false; - for(vector::iterator CI=chords.begin(), CE=chords.end(); CI!=CE; - ++CI){ - if(*CI==ed && CI->getWeight()==N->weight){ - hasEdge=true; - break; - } - } - if(hasEdge){ - char str[100]; - if(instr[ed]!=NULL && instr[ed]->getCond()==1){ - instr[ed]->setCond(4); - } - else{ - edCd->setCond(5); - edCd->setInc(edIncrements[ed]); - instr[ed]=edCd; - } - - } - else if(g.getNumberOfOutgoingEdges(v)==1) - ws.push_back(v); - else{ - edCd->setCond(6); - instr[ed]=edCd; - } + //graphListElement *N = findNodeInList(nl, w); + for(Graph::nodeList::const_iterator N = nl.begin(), + NNEN = nl.end(); N!= NNEN; ++N){ + if (*N->element == *w){ + Node *v=lnode; + + //if chords has v->w + Edge ed(v,w, N->weight, N->randId); + getEdgeCode *edCd=new getEdgeCode(); + bool hasEdge=false; + for(vector::iterator CI=chords.begin(), CE=chords.end(); CI!=CE; + ++CI){ + if(*CI==ed && CI->getWeight()==N->weight){ + hasEdge=true; + break; + } + } + if(hasEdge){ + //char str[100]; + if(instr[ed]!=NULL && instr[ed]->getCond()==1){ + instr[ed]->setCond(4); + } + else{ + edCd->setCond(5); + edCd->setInc(edIncrements[ed]); + instr[ed]=edCd; + } + + } + else if(g.getNumberOfOutgoingEdges(v)==1) + ws.push_back(v); + else{ + edCd->setCond(6); + instr[ed]=edCd; + } + } } } } @@ -416,14 +423,14 @@ static void moveDummyCode(vector &stDummy, vector &exDummy, vector &be, - map &insertions, + map &insertions, Graph &g){ typedef vector::iterator vec_iter; - map temp; + map temp; //iterate over edges with code std::vector toErase; - for(map::iterator MI=insertions.begin(), + for(map::iterator MI=insertions.begin(), ME=insertions.end(); MI!=ME; ++MI){ Edge ed=MI->first; getEdgeCode *edCd=MI->second; @@ -462,7 +469,7 @@ g.removeEdgeWithWt(*vmi); } - for(map::iterator MI=temp.begin(), + for(map::iterator MI=temp.begin(), ME=temp.end(); MI!=ME; ++MI){ insertions[MI->first]=MI->second; } @@ -584,15 +591,15 @@ //if we consider just this subset, it still represents //the path sum along any path in the graph - map increment=getEdgeIncrements(g,*t); + map increment=getEdgeIncrements(g,*t, be); #ifdef DEBUG_PATH_PROFILES //print edge increments for debugging - - for(map::iterator M_I=increment.begin(), M_E=increment.end(); - M_I!=M_E; ++M_I){ - printEdge(M_I->first); - cerr<<"Increment for above:"<second<<"\n"; + std::cerr<<"Edge Increments------\n"; + for(map::iterator MMI=increment.begin(), MME=increment.end(); MMI != MME; ++MMI){ + printEdge(MMI->first); + std::cerr<<"Increment for above:"<second<<"\n"; } + std::cerr<<"-------end of edge increments\n"; #endif @@ -606,15 +613,13 @@ getChords(chords, g, *t); - //cerr<<"Graph before getCodeInsertion:\n"; - //printGraph(g); - map codeInsertions; + map codeInsertions; getCodeInsertions(g, codeInsertions, chords,increment); #ifdef DEBUG_PATH_PROFILES //print edges with code for debugging cerr<<"Code inserted in following---------------\n"; - for(map::iterator cd_i=codeInsertions.begin(), + for(map::iterator cd_i=codeInsertions.begin(), cd_e=codeInsertions.end(); cd_i!=cd_e; ++cd_i){ printEdge(cd_i->first); cerr<second->getCond()<<":"<second->getInc()<<"\n"; From ashukla at cs.uiuc.edu Mon Sep 16 00:27:10 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Mon Sep 16 00:27:10 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Instrumentation/Graph.h Message-ID: <200209160526.AAA25832@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms/Instrumentation: Graph.h updated: 1.2 -> 1.3 --- Log message: Incorporated changes in alloca and getElementPointer instruction --- Diffs of the changes: Index: llvm/include/llvm/Transforms/Instrumentation/Graph.h diff -u llvm/include/llvm/Transforms/Instrumentation/Graph.h:1.2 llvm/include/llvm/Transforms/Instrumentation/Graph.h:1.3 --- llvm/include/llvm/Transforms/Instrumentation/Graph.h:1.2 Thu Jul 18 15:56:47 2002 +++ llvm/include/llvm/Transforms/Instrumentation/Graph.h Mon Sep 16 00:26:51 2002 @@ -149,7 +149,8 @@ return name1 &be, std::map &d); - nodeList &sortNodeList(Node *par, nodeList &nl); + nodeList &sortNodeList(Node *par, nodeList &nl, std::vector &be); //Get the Maximal spanning tree (also a graph) //of the graph @@ -324,10 +334,10 @@ return nodes[nd];//sortNodeList(nd, nli->second); } - nodeList &getSortedNodeList(Node *nd) { + nodeList &getSortedNodeList(Node *nd, std::vector &be) { elementIterator nli = nodes.find(nd); assert(nli != nodes.end() && "Node must be in nodes map"); - return sortNodeList(nd, nodes[nd]); + return sortNodeList(nd, nodes[nd], be); } //get the root of the graph @@ -450,7 +460,8 @@ //such that if we traverse along any path from root to exit, and //add up the edge values, we get a path number that uniquely //refers to the path we travelled -int valueAssignmentToEdges(Graph& g, std::map nodePriority); +int valueAssignmentToEdges(Graph& g, std::map nodePriority, + std::vector &be); void getBBtrace(std::vector &vBB, int pathNo, Function *M); #endif From vadve at cs.uiuc.edu Mon Sep 16 10:15:02 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:15:02 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/MachineCodeForInstruction.cpp Message-ID: <200209161514.KAA17079@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: MachineCodeForInstruction.cpp updated: 1.4 -> 1.5 --- Log message: Add an assertion. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/MachineCodeForInstruction.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineCodeForInstruction.cpp:1.4 llvm/lib/CodeGen/InstrSelection/MachineCodeForInstruction.cpp:1.5 --- llvm/lib/CodeGen/InstrSelection/MachineCodeForInstruction.cpp:1.4 Mon Jul 8 18:04:31 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineCodeForInstruction.cpp Mon Sep 16 10:13:59 2002 @@ -38,6 +38,7 @@ MachineCodeForInstruction& MachineCodeForInstruction::get(const Instruction *I){ + assert(I != NULL); return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID); } From vadve at cs.uiuc.edu Mon Sep 16 10:17:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:17:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Message-ID: <200209161516.KAA17099@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelectionSupport.cpp updated: 1.30 -> 1.31 --- Log message: Add a version of ChooseRegOrImmed to handle numerical constants introduced by InstrSelection. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.30 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.31 --- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.30 Thu Sep 12 15:27:10 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Mon Sep 16 10:15:57 2002 @@ -313,41 +313,53 @@ MachineOperand::MachineOperandType -ChooseRegOrImmed(Value* val, +ChooseRegOrImmed(int64_t intValue, + bool isSigned, MachineOpCode opCode, const TargetMachine& target, bool canUseImmed, unsigned int& getMachineRegNum, int64_t& getImmedValue) { - MachineOperand::MachineOperandType opType = - MachineOperand::MO_VirtualRegister; + MachineOperand::MachineOperandType opType=MachineOperand::MO_VirtualRegister; getMachineRegNum = 0; getImmedValue = 0; - - // Check for the common case first: argument is not constant - // - Constant *CPV = dyn_cast(val); - if (!CPV) return opType; - if (ConstantBool *CPB = dyn_cast(CPV)) + if (canUseImmed && + target.getInstrInfo().constantFitsInImmedField(opCode, intValue)) { - if (!CPB->getValue() && target.getRegInfo().getZeroRegNum() >= 0) - { - getMachineRegNum = target.getRegInfo().getZeroRegNum(); - return MachineOperand::MO_MachineRegister; - } - - getImmedValue = 1; - return MachineOperand::MO_SignExtendedImmed; + opType = isSigned? MachineOperand::MO_SignExtendedImmed + : MachineOperand::MO_UnextendedImmed; + getImmedValue = intValue; } - - // Otherwise it needs to be an integer or a NULL pointer - if (! CPV->getType()->isInteger() && - ! (isa(CPV->getType()) && - CPV->isNullValue())) - return opType; - + else if (intValue == 0 && target.getRegInfo().getZeroRegNum() >= 0) + { + opType = MachineOperand::MO_MachineRegister; + getMachineRegNum = target.getRegInfo().getZeroRegNum(); + } + + return opType; +} + + +MachineOperand::MachineOperandType +ChooseRegOrImmed(Value* val, + MachineOpCode opCode, + const TargetMachine& target, + bool canUseImmed, + unsigned int& getMachineRegNum, + int64_t& getImmedValue) +{ + getMachineRegNum = 0; + getImmedValue = 0; + + // To use reg or immed, constant needs to be integer, bool, or a NULL pointer + Constant *CPV = dyn_cast(val); + if (CPV == NULL || + (! CPV->getType()->isIntegral() && + ! (isa(CPV->getType()) && CPV->isNullValue()))) + return MachineOperand::MO_VirtualRegister; + // Now get the constant value and check if it fits in the IMMED field. // Take advantage of the fact that the max unsigned value will rarely // fit into any IMMED field and ignore that case (i.e., cast smaller @@ -355,35 +367,22 @@ // int64_t intValue; if (isa(CPV->getType())) - { - intValue = 0; - } + intValue = 0; // We checked above that it is NULL + else if (ConstantBool* CB = dyn_cast(CPV)) + intValue = (int64_t) CB->getValue(); else if (CPV->getType()->isSigned()) - { - intValue = cast(CPV)->getValue(); - } + intValue = cast(CPV)->getValue(); else { + assert(CPV->getType()->isUnsigned() && "Not pointer, bool, or integer?"); uint64_t V = cast(CPV)->getValue(); - if (V >= INT64_MAX) return opType; - intValue = (int64_t)V; + if (V >= INT64_MAX) return MachineOperand::MO_VirtualRegister; + intValue = (int64_t) V; } - if (intValue == 0 && target.getRegInfo().getZeroRegNum() >= 0) - { - opType = MachineOperand::MO_MachineRegister; - getMachineRegNum = target.getRegInfo().getZeroRegNum(); - } - else if (canUseImmed && - target.getInstrInfo().constantFitsInImmedField(opCode, intValue)) - { - opType = CPV->getType()->isSigned() - ? MachineOperand::MO_SignExtendedImmed - : MachineOperand::MO_UnextendedImmed; - getImmedValue = intValue; - } - - return opType; + return ChooseRegOrImmed(intValue, CPV->getType()->isSigned(), + opCode, target, canUseImmed, + getMachineRegNum, getImmedValue); } @@ -409,55 +408,91 @@ { vector loadConstVec; - const MachineInstrDescriptor& instrDesc = - target.getInstrInfo().getDescriptor(minstr->getOpCode()); - + MachineOpCode opCode = minstr->getOpCode(); + const MachineInstrInfo& instrInfo = target.getInstrInfo(); + const MachineInstrDescriptor& instrDesc = instrInfo.getDescriptor(opCode); + int immedPos = instrInfo.getImmedConstantPos(opCode); + Function *F = vmInstr->getParent()->getParent(); - + for (unsigned op=0; op < minstr->getNumOperands(); op++) { const MachineOperand& mop = minstr->getOperand(op); - // skip the result position (for efficiency below) and any other - // positions already marked as not a virtual register - if (instrDesc.resultPos == (int) op || - mop.getOperandType() != MachineOperand::MO_VirtualRegister || - mop.getVRegValue() == NULL) + // Skip the result position, preallocated machine registers, or operands + // that cannot be constants (CC regs or PC-relative displacements) + if (instrDesc.resultPos == (int) op || + mop.getOperandType() == MachineOperand::MO_MachineRegister || + mop.getOperandType() == MachineOperand::MO_CCRegister || + mop.getOperandType() == MachineOperand::MO_PCRelativeDisp) + continue; + + bool constantThatMustBeLoaded = false; + unsigned int machineRegNum = 0; + int64_t immedValue = 0; + Value* opValue = NULL; + MachineOperand::MachineOperandType opType = + MachineOperand::MO_VirtualRegister; + + // Operand may be a virtual register or a compile-time constant + if (mop.getOperandType() == MachineOperand::MO_VirtualRegister) { - continue; + assert(mop.getVRegValue() != NULL); + opValue = mop.getVRegValue(); + if (Constant *opConst = dyn_cast(opValue)) + { + opType = ChooseRegOrImmed(opConst, opCode, target, + (immedPos == (int)op), machineRegNum, immedValue); + if (opType == MachineOperand::MO_VirtualRegister) + constantThatMustBeLoaded = true; + } } - - Value* opValue = mop.getVRegValue(); - bool constantThatMustBeLoaded = false; - - if (Constant *opConst = dyn_cast(opValue)) + else { - unsigned int machineRegNum; - int64_t immedValue; - MachineOperand::MachineOperandType opType = - ChooseRegOrImmed(opValue, minstr->getOpCode(), target, - (target.getInstrInfo().getImmedConstantPos(minstr->getOpCode()) == (int) op), - machineRegNum, immedValue); - - if (opType == MachineOperand::MO_MachineRegister) - minstr->SetMachineOperandReg(op, machineRegNum); - else if (opType == MachineOperand::MO_VirtualRegister) - constantThatMustBeLoaded = true; // load is generated below - else - minstr->SetMachineOperandConst(op, opType, immedValue); + assert(mop.getOperandType() == MachineOperand::MO_SignExtendedImmed || + mop.getOperandType() == MachineOperand::MO_UnextendedImmed); + + bool isSigned = (mop.getOperandType() == + MachineOperand::MO_SignExtendedImmed); + + // Bit-selection flags indicate an instruction that is extracting + // bits from its operand so ignore this even if it is a big constant. + if (mop.opHiBits32() || mop.opLoBits32() || + mop.opHiBits64() || mop.opLoBits64()) + continue; + + opType = ChooseRegOrImmed(mop.getImmedValue(), isSigned, + opCode, target, (immedPos == (int)op), + machineRegNum, immedValue); + + if (opType == mop.getOperandType()) + continue; // no change: this is the most common case + + if (opType == MachineOperand::MO_VirtualRegister) + { + constantThatMustBeLoaded = true; + opValue = isSigned + ? ConstantSInt::get(Type::LongTy, immedValue) + : ConstantUInt::get(Type::ULongTy, (uint64_t) immedValue); + } } - - if (constantThatMustBeLoaded || isa(opValue)) - { // opValue is a constant that must be explicitly loaded into a reg. - TmpInstruction* tmpReg = InsertCodeToLoadConstant(F, opValue,vmInstr, - loadConstVec, - target); + + if (opType == MachineOperand::MO_MachineRegister) + minstr->SetMachineOperandReg(op, machineRegNum); + else if (opType == MachineOperand::MO_SignExtendedImmed || + opType == MachineOperand::MO_UnextendedImmed) + minstr->SetMachineOperandConst(op, opType, immedValue); + else if (constantThatMustBeLoaded || + (opValue && isa(opValue))) + { // opValue is a constant that must be explicitly loaded into a reg + assert(opValue); + TmpInstruction* tmpReg = InsertCodeToLoadConstant(F, opValue, vmInstr, + loadConstVec, target); minstr->SetMachineOperandVal(op, MachineOperand::MO_VirtualRegister, tmpReg); } } - // // Also, check for implicit operands used by the machine instruction // (no need to check those defined since they cannot be constants). // These include: @@ -468,7 +503,7 @@ // have no immediate fields, so the constant always needs to be loaded // into a register. // - bool isCall = target.getInstrInfo().isCall(minstr->getOpCode()); + bool isCall = instrInfo.isCall(opCode); unsigned lastCallArgNum = 0; // unused if not a call CallArgsDescriptor* argDesc = NULL; // unused if not a call if (isCall) From vadve at cs.uiuc.edu Mon Sep 16 10:19:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:19:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp Message-ID: <200209161518.KAA17131@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: MachineCodeForFunction.cpp updated: 1.14 -> 1.15 --- Log message: Improve and fix error in allocating stack slots: adjust alignment after adding base address of the relevant region (instead of assuming that each region is maximally aligned). --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp:1.14 llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp:1.15 --- llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp:1.14 Thu Jul 25 01:17:45 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp Mon Sep 16 10:18:16 2002 @@ -100,10 +100,13 @@ } // Align data larger than one L1 cache line on L1 cache line boundaries. -// Align all smaller data on the next higher 2^x boundary (4, 8, ...). +// Align all smaller data on the next higher 2^x boundary (4, 8, ...), +// but not higher than the alignment of the largest type we support +// (currently a double word). -- see class TargetData). // -// THIS FUNCTION HAS BEEN COPIED FROM EMITASSEMBLY.CPP AND -// SHOULD BE USED DIRECTLY THERE +// This function is similar to the corresponding function in EmitAssembly.cpp +// but they are unrelated. This one does not align at more than a +// double-word boundary whereas that one might. // inline unsigned int SizeToAlignment(unsigned int size, const TargetMachine& target) @@ -113,12 +116,11 @@ return cacheLineSize; else for (unsigned sz=1; /*no condition*/; sz *= 2) - if (sz >= size) + if (sz >= size || sz >= target.DataLayout.getDoubleAlignment()) return sz; } - /*ctor*/ MachineCodeForMethod::MachineCodeForMethod(const Function *F, const TargetMachine& target) @@ -141,34 +143,20 @@ unsigned int& getPaddedSize, unsigned int sizeToUse) { - bool growUp; - int firstOffset =target.getFrameInfo().getFirstAutomaticVarOffset(*this, - growUp); - unsigned char align; if (sizeToUse == 0) - { - sizeToUse = target.findOptimalStorageSize(val->getType()); - // align = target.DataLayout.getTypeAlignment(val->getType()); - } - - align = SizeToAlignment(sizeToUse, target); - - int offset = getAutomaticVarsSize(); - if (! growUp) - offset += sizeToUse; - - if (unsigned int mod = offset % align) - { - offset += align - mod; - getPaddedSize = sizeToUse + align - mod; - } - else - getPaddedSize = sizeToUse; - - offset = growUp? firstOffset + offset - : firstOffset - offset; - - return offset; + sizeToUse = target.findOptimalStorageSize(val->getType()); + unsigned int align = SizeToAlignment(sizeToUse, target); + + bool growUp; + int firstOffset = target.getFrameInfo().getFirstAutomaticVarOffset(*this, + growUp); + int offset = growUp? firstOffset + getAutomaticVarsSize() + : firstOffset - (getAutomaticVarsSize() + sizeToUse); + + int aligned = target.getFrameInfo().adjustAlignment(offset, growUp, align); + getPaddedSize = sizeToUse + abs(aligned - offset); + + return aligned; } int @@ -193,7 +181,7 @@ } return offset; } - + int MachineCodeForMethod::allocateSpilledValue(const TargetMachine& target, const Type* type) @@ -208,59 +196,41 @@ bool growUp; int firstOffset = target.getFrameInfo().getRegSpillAreaOffset(*this, growUp); - int offset = getRegSpillsSize(); - if (! growUp) - offset += size; - - if (unsigned int mod = offset % align) - { - offset += align - mod; - size += align - mod; - } - - offset = growUp? firstOffset + offset - : firstOffset - offset; - - incrementRegSpillsSize(size); + int offset = growUp? firstOffset + getRegSpillsSize() + : firstOffset - (getRegSpillsSize() + size); + + int aligned = target.getFrameInfo().adjustAlignment(offset, growUp, align); + size += abs(aligned - offset); // include alignment padding in size - return offset; + incrementRegSpillsSize(size); // update size of reg. spills area + + return aligned; } int MachineCodeForMethod::pushTempValue(const TargetMachine& target, unsigned int size) { - // Compute a power-of-2 alignment according to the possible sizes, - // but not greater than the alignment of the largest type we support - // (currently a double word -- see class TargetData). - unsigned char align = 1; - for (; align < size && align < target.DataLayout.getDoubleAlignment(); - align = 2*align) - ; - + unsigned int align = SizeToAlignment(size, target); + bool growUp; - int firstTmpOffset = target.getFrameInfo().getTmpAreaOffset(*this, growUp); - - int offset = currentTmpValuesSize; - if (! growUp) - offset += size; - - if (unsigned int mod = offset % align) - { - offset += align - mod; - size += align - mod; - } - - offset = growUp ? firstTmpOffset + offset : firstTmpOffset - offset; - - incrementTmpAreaSize(size); - return offset; + int firstOffset = target.getFrameInfo().getTmpAreaOffset(*this, growUp); + + int offset = growUp? firstOffset + currentTmpValuesSize + : firstOffset - (currentTmpValuesSize + size); + + int aligned = target.getFrameInfo().adjustAlignment(offset, growUp, align); + size += abs(aligned - offset); // include alignment padding in size + + incrementTmpAreaSize(size); // update "current" size of tmp area + + return aligned; } void MachineCodeForMethod::popAllTempValues(const TargetMachine& target) { - resetTmpAreaSize(); + resetTmpAreaSize(); // clear tmp area to reuse } int From vadve at cs.uiuc.edu Mon Sep 16 10:19:13 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:19:13 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp Message-ID: <200209161518.KAA17146@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: MachineInstr.cpp updated: 1.45 -> 1.46 --- Log message: Dump routine now writes out allocated register numbers if available. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.45 llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.46 --- llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.45 Wed Aug 14 11:52:58 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp Mon Sep 16 10:18:53 2002 @@ -112,8 +112,8 @@ cerr << " " << *this; } -static inline std::ostream &OutputValue(std::ostream &os, - const Value* val) +static inline std::ostream& +OutputValue(std::ostream &os, const Value* val) { os << "(val "; if (val && val->hasName()) @@ -122,6 +122,12 @@ return os << (void*) val << ")"; // print address only } +static inline std::ostream& +OutputReg(std::ostream &os, unsigned int regNum) +{ + return os << "%mreg(" << regNum << ")"; +} + std::ostream &operator<<(std::ostream& os, const MachineInstr& minstr) { os << TargetInstrDescriptors[minstr.opCode].opCodeString; @@ -165,14 +171,17 @@ case MachineOperand::MO_VirtualRegister: os << "%reg"; OutputValue(os, mop.getVRegValue()); + if (mop.hasAllocatedReg()) + os << "==" << OutputReg(os, mop.getAllocatedRegNum()); break; case MachineOperand::MO_CCRegister: os << "%ccreg"; OutputValue(os, mop.getVRegValue()); + if (mop.hasAllocatedReg()) + os << "==" << OutputReg(os, mop.getAllocatedRegNum()); break; case MachineOperand::MO_MachineRegister: - os << "%reg"; - os << "(" << mop.getMachineRegNum() << ")"; + OutputReg(os, mop.getMachineRegNum()); break; case MachineOperand::MO_SignExtendedImmed: os << (long)mop.immedVal; From vadve at cs.uiuc.edu Mon Sep 16 10:29:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:29:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PreSelection/- New directory Message-ID: <200209161528.KAA17298@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PreSelection: - updated: -> New updated: -> directory updated: -> --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/CodeGen/PreSelection added to the repository --- Diffs of the changes: From vadve at cs.uiuc.edu Mon Sep 16 10:32:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:32:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PreSelection/Makefile PreSelection.cpp Message-ID: <200209161531.KAA17312@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PreSelection: Makefile added (r1.1) PreSelection.cpp added (r1.1) --- Log message: New preselection pass that specializes LLVM code for a target machine, while remaining in legal portable LLVM form and preserving type information and type safety. --- Diffs of the changes: From vadve at cs.uiuc.edu Mon Sep 16 10:33:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:33:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Makefile Message-ID: <200209161532.KAA17332@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: Makefile updated: 1.6 -> 1.7 --- Log message: Add subdirectory PreSelection. --- Diffs of the changes: Index: llvm/lib/CodeGen/Makefile diff -u llvm/lib/CodeGen/Makefile:1.6 llvm/lib/CodeGen/Makefile:1.7 --- llvm/lib/CodeGen/Makefile:1.6 Tue Aug 27 17:45:49 2002 +++ llvm/lib/CodeGen/Makefile Mon Sep 16 10:32:07 2002 @@ -1,4 +1,4 @@ LEVEL = ../.. -DIRS = InstrSelection InstrSched RegAlloc Mapping +DIRS = PreSelection InstrSelection InstrSched RegAlloc Mapping include $(LEVEL)/Makefile.common From vadve at cs.uiuc.edu Mon Sep 16 10:45:03 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:45:03 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200209161544.KAA17384@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.11 -> 1.12 --- Log message: --- Diffs of the changes: Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.11 llvm/include/llvm/Target/TargetMachine.h:1.12 --- llvm/include/llvm/Target/TargetMachine.h:1.11 Sun May 19 10:44:07 2002 +++ llvm/include/llvm/Target/TargetMachine.h Mon Sep 16 10:39:35 2002 @@ -17,6 +17,7 @@ class MachineFrameInfo; class MachineCacheInfo; class PassManager; +class Pass; //--------------------------------------------------------------------------- // class TargetMachine @@ -62,17 +63,35 @@ virtual const MachineFrameInfo& getFrameInfo() const = 0; virtual const MachineCacheInfo& getCacheInfo() const = 0; - // // Data storage information // virtual unsigned int findOptimalStorageSize (const Type* ty) const; - // // addPassesToEmitAssembly - Add passes to the specified pass manager to get // assembly langage code emited. Typically this will involve several steps of - // code generation. + // code generation. This provides a default ordering of passes that could + // be overridden for a particular target. // - virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) = 0; + virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); + + // getPrologEpilogCodeInserter - Create pass to insert prolog/epilog code. + // + virtual Pass* getPrologEpilogInsertionPass() = 0; + + // getFunctionAsmPrinterPass - Create a pass to write out the generated + // machine code for a single function to the generated assembly file. + // + virtual Pass* getFunctionAsmPrinterPass(std::ostream &Out) = 0; + + // getModuleAsmPrinterPass - Create a pass to write out module-level + // information to the generated assembly file. + // + virtual Pass* getModuleAsmPrinterPass(std::ostream &Out) = 0; + + // getEmitBytecodeToAsmPass - Create a pass to emit the final LLVM bytecode + // to the generated assembly file. + // + virtual Pass* getEmitBytecodeToAsmPass(std::ostream &Out) = 0; }; #endif From vadve at cs.uiuc.edu Mon Sep 16 10:46:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:46:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.cpp SparcInternals.h PrologEpilogCodeInserter.cpp Message-ID: <200209161545.KAA17403@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Sparc.cpp updated: 1.44 -> 1.45 SparcInternals.h updated: 1.62 -> 1.63 PrologEpilogCodeInserter.cpp updated: 1.12 -> 1.13 --- Log message: Move all the code that creates code generation passes from Sparc.cpp to TargetMachine.cpp, since it is entirely machine-independent. Also, add options to disable optional back-end passes (preselection and instr. scheduling). --- Diffs of the changes: Index: llvm/lib/Target/Sparc/Sparc.cpp diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.44 llvm/lib/Target/Sparc/Sparc.cpp:1.45 --- llvm/lib/Target/Sparc/Sparc.cpp:1.44 Tue Aug 27 11:45:17 2002 +++ llvm/lib/Target/Sparc/Sparc.cpp Mon Sep 16 10:39:26 2002 @@ -7,16 +7,9 @@ #include "SparcInternals.h" #include "llvm/Target/Sparc.h" -#include "llvm/CodeGen/InstrScheduling.h" -#include "llvm/CodeGen/InstrSelection.h" -#include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" -#include "llvm/CodeGen/RegisterAllocation.h" -#include "llvm/Reoptimizer/Mapping/MappingInfo.h" -#include "llvm/Reoptimizer/Mapping/FInfo.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" -#include "llvm/PassManager.h" +#include "llvm/CodeGen/MachineCodeForMethod.h" #include using std::cerr; @@ -90,6 +83,8 @@ // dynamic-size alloca. pos = false; unsigned int optArgsSize = mcInfo.getMaxOptionalArgsSize(); + if (int extra = optArgsSize % getStackFrameSizeAlignment()) + optArgsSize += (getStackFrameSizeAlignment() - extra); int offset = optArgsSize + FirstOptionalOutgoingArgOffsetFromSP; assert((offset - OFFSET) % getStackFrameSizeAlignment() == 0); return offset; @@ -118,86 +113,5 @@ optSizeForSubWordData = 4; minMemOpWordSize = 8; maxAtomicMemOpWordSize = 8; -} - - - -//===---------------------------------------------------------------------===// -// GenerateCodeForTarget Pass -// -// Native code generation for a specified target. -//===---------------------------------------------------------------------===// - -class ConstructMachineCodeForFunction : public FunctionPass { - TargetMachine &Target; -public: - inline ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {} - - const char *getPassName() const { - return "Sparc ConstructMachineCodeForFunction"; - } - - bool runOnFunction(Function &F) { - MachineCodeForMethod::construct(&F, Target); - return false; - } -}; - -struct FreeMachineCodeForFunction : public FunctionPass { - const char *getPassName() const { return "Sparc FreeMachineCodeForFunction"; } - - static void freeMachineCode(Instruction &I) { - MachineCodeForInstruction::destroy(&I); - } - - bool runOnFunction(Function &F) { - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) - for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E; ++I) - MachineCodeForInstruction::get(I).dropAllReferences(); - - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) - for_each(FI->begin(), FI->end(), freeMachineCode); - - return false; - } -}; - -// addPassesToEmitAssembly - This method controls the entire code generation -// process for the ultra sparc. -// -void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) { - // Construct and initialize the MachineCodeForMethod object for this fn. - PM.add(new ConstructMachineCodeForFunction(*this)); - - PM.add(createInstructionSelectionPass(*this)); - - PM.add(createInstructionSchedulingWithSSAPass(*this)); - - PM.add(getRegisterAllocator(*this)); - - //PM.add(new OptimizeLeafProcedures()); - //PM.add(new DeleteFallThroughBranches()); - //PM.add(new RemoveChainedBranches()); // should be folded with previous - //PM.add(new RemoveRedundantOps()); // operations with %g0, NOP, etc. - - PM.add(createPrologEpilogCodeInserter(*this)); - - PM.add(MappingInfoForFunction(Out)); - - // Output assembly language to the .s file. Assembly emission is split into - // two parts: Function output and Global value output. This is because - // function output is pipelined with all of the rest of code generation stuff, - // allowing machine code representations for functions to be free'd after the - // function has been emitted. - // - PM.add(getFunctionAsmPrinterPass(PM, Out)); - PM.add(new FreeMachineCodeForFunction()); // Free stuff no longer needed - - // Emit Module level assembly after all of the functions have been processed. - PM.add(getModuleAsmPrinterPass(PM, Out)); - - // Emit bytecode to the sparc assembly file into its special section next - PM.add(getEmitBytecodeToAsmPass(Out)); - PM.add(getFunctionInfo(Out)); } Index: llvm/lib/Target/Sparc/SparcInternals.h diff -u llvm/lib/Target/Sparc/SparcInternals.h:1.62 llvm/lib/Target/Sparc/SparcInternals.h:1.63 --- llvm/lib/Target/Sparc/SparcInternals.h:1.62 Thu Sep 5 13:34:31 2002 +++ llvm/lib/Target/Sparc/SparcInternals.h Mon Sep 16 10:39:26 2002 @@ -21,8 +21,6 @@ class PhyRegAlloc; class Pass; -Pass *createPrologEpilogCodeInserter(TargetMachine &TM); - // OpCodeMask definitions for the Sparc V9 // const OpCodeMask Immed = 0x00002000; // immed or reg operand? @@ -88,7 +86,7 @@ // // All immediate constants are in position 1 except the - // store instructions. + // store instructions and SETxx. // virtual int getImmedConstantPos(MachineOpCode opCode) const { bool ignore; @@ -96,7 +94,11 @@ { assert(! this->isStore((MachineOpCode) STB - 1)); // 1st store opcode assert(! this->isStore((MachineOpCode) STXFSR+1));// last store opcode - return (opCode >= STB && opCode <= STXFSR)? 2 : 1; + if (opCode==SETSW || opCode==SETUW || opCode==SETX || opCode==SETHI) + return 0; + if (opCode >= STB && opCode <= STXFSR) + return 2; + return 1; } else return -1; @@ -114,6 +116,13 @@ } //------------------------------------------------------------------------- + // Queries about representation of LLVM quantities (e.g., constants) + //------------------------------------------------------------------------- + + virtual bool ConstantMayNotFitInImmedField(const Constant* CV, + const Instruction* I) const; + + //------------------------------------------------------------------------- // Code generation support for creating individual machine instructions //------------------------------------------------------------------------- @@ -538,13 +547,22 @@ UltraSparcFrameInfo(const TargetMachine &tgt) : MachineFrameInfo(tgt) {} public: + // These methods provide constant parameters of the frame layout. + // int getStackFrameSizeAlignment() const { return StackFrameSizeAlignment;} int getMinStackFrameSize() const { return MinStackFrameSize; } int getNumFixedOutgoingArgs() const { return NumFixedOutgoingArgs; } int getSizeOfEachArgOnStack() const { return SizeOfEachArgOnStack; } bool argsOnStackHaveFixedSize() const { return true; } - // + // This method adjusts a stack offset to meet alignment rules of target. + // The fixed OFFSET (0x7ff) must be subtracted and the result aligned. + virtual int adjustAlignment (int unalignedOffset, + bool growUp, + unsigned int align) const { + return unalignedOffset + (growUp? +1:-1)*((unalignedOffset-OFFSET) % align); + } + // These methods compute offsets using the frame contents for a // particular function. The frame contents are obtained from the // MachineCodeInfoForMethod object for the given function. @@ -601,15 +619,58 @@ } private: + /*---------------------------------------------------------------------- + This diagram shows the stack frame layout used by llc on Sparc V9. + Note that only the location of automatic variables, spill area, + temporary storage, and dynamically allocated stack area are chosen + by us. The rest conform to the Sparc V9 ABI. + All stack addresses are offset by OFFSET = 0x7ff (2047). + + Alignment assumpteions and other invariants: + (1) %sp+OFFSET and %fp+OFFSET are always aligned on 16-byte boundary + (2) Variables in automatic, spill, temporary, or dynamic regions + are aligned according to their size as in all memory accesses. + (3) Everything below the dynamically allocated stack area is only used + during a call to another function, so it is never needed when + the current function is active. This is why space can be allocated + dynamically by incrementing %sp any time within the function. + + STACK FRAME LAYOUT: + + ... + %fp+OFFSET+176 Optional extra incoming arguments# 1..N + %fp+OFFSET+168 Incoming argument #6 + ... ... + %fp+OFFSET+128 Incoming argument #1 + ... ... + ---%fp+OFFSET-0--------Bottom of caller's stack frame-------------------- + %fp+OFFSET-8 Automatic variables <-- ****TOP OF STACK FRAME**** + Spill area + Temporary storage + ... + + %sp+OFFSET+176+8N Bottom of dynamically allocated stack area + %sp+OFFSET+168+8N Optional extra outgoing argument# N + ... ... + %sp+OFFSET+176 Optional extra outgoing argument# 1 + %sp+OFFSET+168 Outgoing argument #6 + ... ... + %sp+OFFSET+128 Outgoing argument #1 + %sp+OFFSET+120 Save area for %i7 + ... ... + %sp+OFFSET+0 Save area for %l0 <-- ****BOTTOM OF STACK FRAME**** + + *----------------------------------------------------------------------*/ + // All stack addresses must be offset by 0x7ff (2047) on Sparc V9. static const int OFFSET = (int) 0x7ff; static const int StackFrameSizeAlignment = 16; static const int MinStackFrameSize = 176; static const int NumFixedOutgoingArgs = 6; static const int SizeOfEachArgOnStack = 8; - static const int StaticAreaOffsetFromFP = 0 + OFFSET; static const int FirstIncomingArgOffsetFromFP = 128 + OFFSET; static const int FirstOptionalIncomingArgOffsetFromFP = 176 + OFFSET; + static const int StaticAreaOffsetFromFP = 0 + OFFSET; static const int FirstOutgoingArgOffsetFromSP = 128 + OFFSET; static const int FirstOptionalOutgoingArgOffsetFromSP = 176 + OFFSET; }; @@ -655,16 +716,17 @@ virtual const MachineFrameInfo &getFrameInfo() const { return frameInfo; } virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; } - // - // addPassesToEmitAssembly - Add passes to the specified pass manager to get - // assembly langage code emited. For sparc, we have to do ... - // - virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); + // getPrologEpilogCodeInserter - Inserts prolog/epilog code. + virtual Pass* getPrologEpilogInsertionPass(); -private: - Pass *getFunctionAsmPrinterPass(PassManager &PM, std::ostream &Out); - Pass *getModuleAsmPrinterPass(PassManager &PM, std::ostream &Out); - Pass *getEmitBytecodeToAsmPass(std::ostream &Out); + // getFunctionAsmPrinterPass - Writes out machine code for a single function + virtual Pass* getFunctionAsmPrinterPass(std::ostream &Out); + + // getModuleAsmPrinterPass - Writes generated machine code to assembly file. + virtual Pass* getModuleAsmPrinterPass(std::ostream &Out); + + // getEmitBytecodeToAsmPass - Emits final LLVM bytecode to assembly file. + virtual Pass* getEmitBytecodeToAsmPass(std::ostream &Out); }; #endif Index: llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp diff -u llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.12 llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.13 --- llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.12 Mon Aug 12 16:25:04 2002 +++ llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp Mon Sep 16 10:39:26 2002 @@ -162,6 +162,6 @@ } } -Pass *createPrologEpilogCodeInserter(TargetMachine &TM) { - return new InsertPrologEpilogCode(TM); +Pass* UltraSparc::getPrologEpilogInsertionPass() { + return new InsertPrologEpilogCode(*this); } From vadve at cs.uiuc.edu Mon Sep 16 10:47:03 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:47:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200209161546.KAA17414@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.7 -> 1.8 --- Log message: Move all the code that creates code generation passes from Sparc.cpp to TargetMachine.cpp, since it is entirely machine-independent. Also, add options to disable optional back-end passes (preselection and instr. scheduling). --- Diffs of the changes: Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.7 llvm/lib/Target/TargetMachine.cpp:1.8 --- llvm/lib/Target/TargetMachine.cpp:1.7 Thu Nov 8 20:20:18 2001 +++ llvm/lib/Target/TargetMachine.cpp Mon Sep 16 10:39:03 2002 @@ -8,9 +8,31 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineInstrInfo.h" #include "llvm/Target/MachineCacheInfo.h" +#include "llvm/CodeGen/PreSelection.h" +#include "llvm/CodeGen/InstrSelection.h" +#include "llvm/CodeGen/InstrScheduling.h" +#include "llvm/CodeGen/RegisterAllocation.h" +#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineCodeForInstruction.h" +#include "llvm/Reoptimizer/Mapping/MappingInfo.h" +#include "llvm/Reoptimizer/Mapping/FInfo.h" +#include "llvm/Transforms/Scalar.h" +#include "Support/CommandLine.h" +#include "llvm/PassManager.h" +#include "llvm/Function.h" #include "llvm/DerivedTypes.h" //--------------------------------------------------------------------------- +// Command line options to control choice of code generation passes. +//--------------------------------------------------------------------------- + +static cl::opt DisablePreSelect("nopreselect", + cl::desc("Disable preselection pass")); + +static cl::opt DisableSched("nosched", + cl::desc("Disable local scheduling pass")); + +//--------------------------------------------------------------------------- // class TargetMachine // // Purpose: @@ -44,6 +66,99 @@ } +//===---------------------------------------------------------------------===// +// Default code generation passes. +// +// Native code generation for a specified target. +//===---------------------------------------------------------------------===// + +class ConstructMachineCodeForFunction : public FunctionPass { + TargetMachine &Target; +public: + inline ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {} + + const char *getPassName() const { + return "ConstructMachineCodeForFunction"; + } + + bool runOnFunction(Function &F) { + MachineCodeForMethod::construct(&F, Target); + return false; + } +}; + +struct FreeMachineCodeForFunction : public FunctionPass { + const char *getPassName() const { return "FreeMachineCodeForFunction"; } + + static void freeMachineCode(Instruction &I) { + MachineCodeForInstruction::destroy(&I); + } + + bool runOnFunction(Function &F) { + for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) + for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E; ++I) + MachineCodeForInstruction::get(I).dropAllReferences(); + + for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) + for_each(FI->begin(), FI->end(), freeMachineCode); + + return false; + } +}; + +// addPassesToEmitAssembly - This method controls the entire code generation +// process for the ultra sparc. +// +void +TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) +{ + // Construct and initialize the MachineCodeForMethod object for this fn. + PM.add(new ConstructMachineCodeForFunction(*this)); + + // Specialize LLVM code for this target machine and then + // run basic dataflow optimizations on LLVM code. + if (!DisablePreSelect) + { + PM.add(createPreSelectionPass(*this)); + PM.add(createReassociatePass()); + PM.add(createGCSEPass()); + PM.add(createLICMPass()); + } + + PM.add(createInstructionSelectionPass(*this)); + + if (!DisableSched) + PM.add(createInstructionSchedulingWithSSAPass(*this)); + + PM.add(getRegisterAllocator(*this)); + + //PM.add(new OptimizeLeafProcedures()); + //PM.add(new DeleteFallThroughBranches()); + //PM.add(new RemoveChainedBranches()); // should be folded with previous + //PM.add(new RemoveRedundantOps()); // operations with %g0, NOP, etc. + + PM.add(getPrologEpilogInsertionPass()); + + PM.add(MappingInfoForFunction(Out)); + + // Output assembly language to the .s file. Assembly emission is split into + // two parts: Function output and Global value output. This is because + // function output is pipelined with all of the rest of code generation stuff, + // allowing machine code representations for functions to be free'd after the + // function has been emitted. + // + PM.add(getFunctionAsmPrinterPass(Out)); + PM.add(new FreeMachineCodeForFunction()); // Free stuff no longer needed + + // Emit Module level assembly after all of the functions have been processed. + PM.add(getModuleAsmPrinterPass(Out)); + + // Emit bytecode to the assembly file into its special section next + PM.add(getEmitBytecodeToAsmPass(Out)); + PM.add(getFunctionInfo(Out)); +} + + //--------------------------------------------------------------------------- // class MachineInstructionInfo // Interface to description of machine instructions @@ -79,6 +194,10 @@ uint64_t maxImmedValue = maxImmedConstant(opCode, isSignExtended); if (maxImmedValue != 0) { + // NEED TO HANDLE UNSIGNED VALUES SINCE THEY MAY BECOME MUCH + // SMALLER AFTER CASTING TO SIGN-EXTENDED int, short, or char. + // See CreateUIntSetInstruction in SparcInstrInfo.cpp. + // Now check if the constant fits if (intValue <= (int64_t) maxImmedValue && intValue >= -((int64_t) maxImmedValue+1)) From vadve at cs.uiuc.edu Mon Sep 16 10:55:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:55:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp Message-ID: <200209161554.KAA17446@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.59 -> 1.60 --- Log message: Don't print out global names unnecesssarily. Also, expose pass constructors so passes can be inserted by TargetMachine.cpp. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.59 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.60 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.59 Fri Sep 13 21:07:43 2002 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Mon Sep 16 10:54:02 2002 @@ -508,7 +508,7 @@ } // End anonymous namespace -Pass *UltraSparc::getFunctionAsmPrinterPass(PassManager &PM, std::ostream &Out){ +Pass *UltraSparc::getFunctionAsmPrinterPass(std::ostream &Out) { return new SparcFunctionAsmPrinter(Out, *this); } @@ -830,7 +830,8 @@ void SparcModuleAsmPrinter::printGlobalVariable(const GlobalVariable* GV) { - toAsm << "\t.global\t" << getID(GV) << "\n"; + if (GV->hasExternalLinkage()) + toAsm << "\t.global\t" << getID(GV) << "\n"; if (GV->hasInitializer()) printConstant(GV->getInitializer(), getID(GV)); @@ -879,6 +880,6 @@ } // End anonymous namespace -Pass *UltraSparc::getModuleAsmPrinterPass(PassManager &PM, std::ostream &Out) { +Pass *UltraSparc::getModuleAsmPrinterPass(std::ostream &Out) { return new SparcModuleAsmPrinter(Out, *this); } From vadve at cs.uiuc.edu Mon Sep 16 10:56:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:56:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.cpp Message-ID: <200209161555.KAA17464@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrInfo.cpp updated: 1.26 -> 1.27 --- Log message: Add methods to query about the representation of LLVM quantities (e.g., constants). Useful for target-dependent LLVM transformations like Preselection. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.26 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.27 --- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.26 Thu Sep 5 13:33:59 2002 +++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp Mon Sep 16 10:55:52 2002 @@ -11,6 +11,7 @@ #include "llvm/Function.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +#include using std::vector; static const uint32_t MAXLO = (1 << 10) - 1; // set bits set by %lo(*) @@ -258,6 +259,61 @@ //--------------------------------------------------------------------------- +// Create a table of LLVM opcode -> max. immediate constant likely to +// be usable for that operation. +//--------------------------------------------------------------------------- + +// Entry == 0 ==> no immediate constant field exists at all. +// Entry > 0 ==> abs(immediate constant) <= Entry +// +vector MaxConstantsTable(Instruction::NumOtherOps); + +static int +MaxConstantForInstr(unsigned llvmOpCode) +{ + int modelOpCode = -1; + + if (llvmOpCode >= Instruction::FirstBinaryOp && + llvmOpCode < Instruction::NumBinaryOps) + modelOpCode = ADD; + else + switch(llvmOpCode) { + case Instruction::Ret: modelOpCode = JMPLCALL; break; + + case Instruction::Malloc: + case Instruction::Alloca: + case Instruction::GetElementPtr: + case Instruction::PHINode: + case Instruction::Cast: + case Instruction::Call: modelOpCode = ADD; break; + + case Instruction::Shl: + case Instruction::Shr: modelOpCode = SLLX; break; + + default: break; + }; + + return (modelOpCode < 0)? 0: SparcMachineInstrDesc[modelOpCode].maxImmedConst; +} + +static void +InitializeMaxConstantsTable() +{ + unsigned op; + assert(MaxConstantsTable.size() == Instruction::NumOtherOps && + "assignments below will be illegal!"); + for (op = Instruction::FirstTermOp; op < Instruction::NumTermOps; ++op) + MaxConstantsTable[op] = MaxConstantForInstr(op); + for (op = Instruction::FirstBinaryOp; op < Instruction::NumBinaryOps; ++op) + MaxConstantsTable[op] = MaxConstantForInstr(op); + for (op = Instruction::FirstMemoryOp; op < Instruction::NumMemoryOps; ++op) + MaxConstantsTable[op] = MaxConstantForInstr(op); + for (op = Instruction::FirstOtherOp; op < Instruction::NumOtherOps; ++op) + MaxConstantsTable[op] = MaxConstantForInstr(op); +} + + +//--------------------------------------------------------------------------- // class UltraSparcInstrInfo // // Purpose: @@ -273,6 +329,29 @@ /*descSize = */ NUM_TOTAL_OPCODES, /*numRealOpCodes = */ NUM_REAL_OPCODES) { + InitializeMaxConstantsTable(); +} + +bool +UltraSparcInstrInfo::ConstantMayNotFitInImmedField(const Constant* CV, + const Instruction* I) const +{ + if (I->getOpcode() >= MaxConstantsTable.size()) // user-defined op (or bug!) + return true; + + if (isa(CV)) // can always use %g0 + return false; + + if (const ConstantUInt* U = dyn_cast(CV)) + return (U->getValue() > MaxConstantsTable[I->getOpcode()]); + + if (const ConstantSInt* S = dyn_cast(CV)) + return (labs(S->getValue()) > (int) MaxConstantsTable[I->getOpcode()]); + + if (isa(CV)) + return (1U > MaxConstantsTable[I->getOpcode()]); + + return true; } // From vadve at cs.uiuc.edu Mon Sep 16 10:57:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:57:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp Message-ID: <200209161556.KAA17497@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrSelection.cpp updated: 1.71 -> 1.72 --- Log message: Use ulong instead of uint for size expressions. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.71 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.72 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.71 Tue Sep 10 20:20:07 2002 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Mon Sep 16 10:56:45 2002 @@ -998,7 +998,6 @@ && "Array refs must be lowered before Instruction Selection"); Value* idxVal = idxVec[firstIdxIsZero]; - assert(! isa(idxVal) && "Need to sign-extend uint to 64b!"); vector mulVec; Instruction* addr = new TmpInstruction(Type::UIntTy, memInst); @@ -1012,7 +1011,7 @@ /*AllowCompositeLeaf*/ true) : ptrType); const Type* eltType = cast(vecType)->getElementType(); - ConstantUInt* eltSizeVal = ConstantUInt::get(Type::UIntTy, + ConstantUInt* eltSizeVal = ConstantUInt::get(Type::ULongTy, target.DataLayout.getTypeSize(eltType)); // CreateMulInstruction() folds constants intelligently enough. From vadve at cs.uiuc.edu Mon Sep 16 10:57:11 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:57:11 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineInstrInfo.h Message-ID: <200209161556.KAA17480@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineInstrInfo.h updated: 1.19 -> 1.20 --- Log message: Add methods to query about the representation of LLVM quantities (e.g., constants). Useful for target-dependent LLVM transformations like Preselection. --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineInstrInfo.h diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.19 llvm/include/llvm/Target/MachineInstrInfo.h:1.20 --- llvm/include/llvm/Target/MachineInstrInfo.h:1.19 Thu Sep 5 13:36:41 2002 +++ llvm/include/llvm/Target/MachineInstrInfo.h Mon Sep 16 10:56:01 2002 @@ -9,6 +9,8 @@ #include "Support/NonCopyable.h" #include "Support/DataTypes.h" +#include "llvm/Constant.h" +#include "llvm/DerivedTypes.h" #include #include @@ -237,6 +239,27 @@ bool &isSignExtended) const { isSignExtended = getDescriptor(opCode).immedIsSignExtended; return getDescriptor(opCode).maxImmedConst; + } + + //------------------------------------------------------------------------- + // Queries about representation of LLVM quantities (e.g., constants) + //------------------------------------------------------------------------- + + // Test if this type of constant must be loaded from memory into + // a register, i.e., cannot be set bitwise in register and cannot + // use immediate fields of instructions. Note that this only makes + // sense for primitive types. + virtual bool ConstantTypeMustBeLoaded(const Constant* CV) const { + assert(CV->getType()->isPrimitiveType() || isa(CV->getType())); + return !(CV->getType()->isIntegral() || isa(CV->getType())); + } + + // Test if this constant may not fit in the immediate field of the + // machine instructions (probably) generated for this instruction. + // + virtual bool ConstantMayNotFitInImmedField(const Constant* CV, + const Instruction* I) const { + return true; // safe but very conservative } //------------------------------------------------------------------------- From vadve at cs.uiuc.edu Mon Sep 16 10:58:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:58:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineFrameInfo.h Message-ID: <200209161557.KAA17513@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineFrameInfo.h updated: 1.4 -> 1.5 --- Log message: Add method adjustAlignment so that stack slot alignments can be computed in a target-dependent manner (because of the dang OFFSET in Sparc v9). --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineFrameInfo.h diff -u llvm/include/llvm/Target/MachineFrameInfo.h:1.4 llvm/include/llvm/Target/MachineFrameInfo.h:1.5 --- llvm/include/llvm/Target/MachineFrameInfo.h:1.4 Fri Aug 9 15:07:44 2002 +++ llvm/include/llvm/Target/MachineFrameInfo.h Mon Sep 16 10:57:43 2002 @@ -19,7 +19,6 @@ public: MachineFrameInfo(const TargetMachine& tgt) : target(tgt) {} - // // These methods provide constant parameters of the frame layout. // virtual int getStackFrameSizeAlignment () const = 0; @@ -27,8 +26,15 @@ virtual int getNumFixedOutgoingArgs () const = 0; virtual int getSizeOfEachArgOnStack () const = 0; virtual bool argsOnStackHaveFixedSize () const = 0; - - // + + // This method adjusts a stack offset to meet alignment rules of target. + // + virtual int adjustAlignment (int unalignedOffset, + bool growUp, + unsigned int align) const { + return unalignedOffset + (growUp? +1:-1)*(unalignedOffset % align); + } + // These methods compute offsets using the frame contents for a // particular method. The frame contents are obtained from the // MachineCodeInfoForMethod object for the given method. From vadve at cs.uiuc.edu Mon Sep 16 10:59:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:59:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/InstrSelectionSupport.h Message-ID: <200209161558.KAA17530@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: InstrSelectionSupport.h updated: 1.12 -> 1.13 --- Log message: Add a version of ChooseRegOrImmed to handle numerical constants introduced by InstrSelection. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/InstrSelectionSupport.h diff -u llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.12 llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.13 --- llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.12 Sat Aug 24 16:03:10 2002 +++ llvm/include/llvm/CodeGen/InstrSelectionSupport.h Mon Sep 16 10:58:34 2002 @@ -296,6 +296,14 @@ unsigned int& getMachineRegNum, int64_t& getImmedValue); +MachineOperand::MachineOperandType ChooseRegOrImmed(int64_t intValue, + bool isSigned, + MachineOpCode opCode, + const TargetMachine& target, + bool canUseImmed, + unsigned int& getMachineRegNum, + int64_t& getImmedValue); + //--------------------------------------------------------------------------- // Function: FixConstantOperandsForInstr From vadve at cs.uiuc.edu Mon Sep 16 10:59:11 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 10:59:11 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200209161558.KAA17544@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.63 -> 1.64 --- Log message: Add method MachineOperand::hasAllocatedReg(). --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.63 llvm/include/llvm/CodeGen/MachineInstr.h:1.64 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.63 Wed Aug 14 11:54:11 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Mon Sep 16 10:58:54 2002 @@ -136,14 +136,21 @@ inline bool opLoBits64 () const { return flags & LOFLAG64; } - - // used to get the reg number if when one is allocated (must be - // called only after reg alloc) + + // used to check if a machine register has been allocated to this operand + inline bool hasAllocatedReg() const { + return (regNum >= 0 && + (opType == MO_VirtualRegister || opType == MO_CCRegister || + opType == MO_MachineRegister)); + } + + // used to get the reg number if when one is allocated inline int getAllocatedRegNum() const { assert(opType == MO_VirtualRegister || opType == MO_CCRegister || opType == MO_MachineRegister); return regNum; } + public: friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); From vadve at cs.uiuc.edu Mon Sep 16 11:05:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:05:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/PassSupport.h Message-ID: <200209161604.LAA17582@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassSupport.h updated: 1.8 -> 1.9 --- Log message: Add support for passes that use a TargetMachine object. --- Diffs of the changes: Index: llvm/include/llvm/PassSupport.h diff -u llvm/include/llvm/PassSupport.h:1.8 llvm/include/llvm/PassSupport.h:1.9 --- llvm/include/llvm/PassSupport.h:1.8 Fri Aug 30 15:20:39 2002 +++ llvm/include/llvm/PassSupport.h Mon Sep 16 11:01:39 2002 @@ -33,7 +33,8 @@ std::vector ItfImpl;// Interfaces implemented by this pass Pass *(*NormalCtor)(); // No argument ctor - Pass *(*DataCtor)(const TargetData&);// Ctor taking TargetData object... + Pass *(*DataCtor)(const TargetData&);// Ctor taking const TargetData object... + Pass *(*TargetCtor)(TargetMachine&); // Ctor taking TargetMachine object... public: /// PassType - Define symbolic constants that can be used to test to see if @@ -48,9 +49,11 @@ /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. PassInfo(const char *name, const char *arg, const std::type_info &ti, - unsigned pt, Pass *(*normal)(), Pass *(*data)(const TargetData &)) + unsigned pt, Pass *(*normal)() = 0, + Pass *(*datactor)(const TargetData &) = 0, + Pass *(*targetctor)(TargetMachine &) = 0) : PassName(name), PassArgument(arg), TypeInfo(ti), PassType(pt), - NormalCtor(normal), DataCtor(data) { + NormalCtor(normal), DataCtor(datactor), TargetCtor(targetctor) { } /// getPassName - Return the friendly name for the pass, never returns null @@ -96,12 +99,20 @@ /// getDataCtor - Return a pointer to a function that creates an instance of /// the pass and returns it. This returns a constructor for a version of the - /// pass that takes a TArgetData object as a parameter. + /// pass that takes a TargetData object as a parameter. /// Pass *(*getDataCtor() const)(const TargetData &) { return DataCtor; } + /// getTargetCtor - Return a pointer to a function that creates an instance of + /// the pass and returns it. This returns a constructor for a version of the + /// pass that takes a TargetMachine object as a parameter. + /// + Pass *(*getTargetCtor() const)(TargetMachine &) { + return TargetCtor; + } + /// addInterfaceImplemented - This method is called when this pass is /// registered as a member of an analysis group with the RegisterAnalysisGroup /// template. @@ -167,13 +178,13 @@ // Register Pass using default constructor... RegisterPass(const char *PassArg, const char *Name, unsigned PassTy = 0) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, - callDefaultCtor, 0)); + callDefaultCtor)); } // Register Pass using default constructor explicitly... RegisterPass(const char *PassArg, const char *Name, unsigned PassTy, Pass *(*ctor)()) { - registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, ctor,0)); + registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, ctor)); } // Register Pass using TargetData constructor... @@ -183,11 +194,18 @@ 0, datactor)); } + // Register Pass using TargetMachine constructor... + RegisterPass(const char *PassArg, const char *Name, unsigned PassTy, + Pass *(*targetctor)(TargetMachine &)) { + registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, + 0, 0, targetctor)); + } + // Generic constructor version that has an unknown ctor type... template RegisterPass(const char *PassArg, const char *Name, unsigned PassTy, CtorType *Fn) { - registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, 0, 0)); + registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, 0)); } }; @@ -199,14 +217,14 @@ RegisterOpt(const char *PassArg, const char *Name) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassInfo::Optimization, - callDefaultCtor, 0)); + callDefaultCtor)); } /// Register Pass using default constructor explicitly... /// RegisterOpt(const char *PassArg, const char *Name, Pass *(*ctor)()) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), - PassInfo::Optimization, ctor, 0)); + PassInfo::Optimization, ctor)); } /// Register Pass using TargetData constructor... @@ -216,6 +234,14 @@ registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassInfo::Optimization, 0, datactor)); } + + /// Register Pass using TargetMachine constructor... + /// + RegisterOpt(const char *PassArg, const char *Name, + Pass *(*targetctor)(TargetMachine &)) { + registerPass(new PassInfo(Name, PassArg, typeid(PassName), + PassInfo::Optimization, 0, 0, targetctor)); + } }; /// RegisterAnalysis - Register something that is to show up in Analysis, this @@ -230,7 +256,7 @@ bool CFGOnly = false) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassInfo::Analysis, - callDefaultCtor, 0)); + callDefaultCtor)); if (CFGOnly) setPreservesCFG(); } @@ -244,14 +270,14 @@ RegisterLLC(const char *PassArg, const char *Name) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassInfo::LLC, - callDefaultCtor, 0)); + callDefaultCtor)); } /// Register Pass using default constructor explicitly... /// RegisterLLC(const char *PassArg, const char *Name, Pass *(*ctor)()) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), - PassInfo::LLC, ctor, 0)); + PassInfo::LLC, ctor)); } /// Register Pass using TargetData constructor... @@ -267,7 +293,7 @@ RegisterLLC(const char *PassArg, const char *Name, Pass *(*datactor)(TargetMachine &)) { registerPass(new PassInfo(Name, PassArg, typeid(PassName), - PassInfo::LLC, 0, 0)); + PassInfo::LLC)); } }; From vadve at cs.uiuc.edu Mon Sep 16 11:05:14 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:05:14 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/PassNameParser.h Message-ID: <200209161604.LAA17589@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PassNameParser.h updated: 1.1 -> 1.2 --- Log message: --- Diffs of the changes: Index: llvm/include/llvm/Support/PassNameParser.h diff -u llvm/include/llvm/Support/PassNameParser.h:1.1 llvm/include/llvm/Support/PassNameParser.h:1.2 --- llvm/include/llvm/Support/PassNameParser.h:1.1 Fri Jul 26 16:09:10 2002 +++ llvm/include/llvm/Support/PassNameParser.h Mon Sep 16 11:01:41 2002 @@ -47,7 +47,8 @@ // Ignore non-selectable and non-constructible passes! Ignore // non-optimizations. return P->getPassArgument() == 0 || - (P->getNormalCtor() == 0 && P->getDataCtor() == 0) || + (P->getNormalCtor() == 0 && P->getDataCtor() == 0 && + P->getTargetCtor() == 0) || ignorablePassImpl(P); } From vadve at cs.uiuc.edu Mon Sep 16 11:07:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:07:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/User.h iMemory.h iPHINode.h Message-ID: <200209161606.LAA17608@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm: User.h updated: 1.14 -> 1.15 iMemory.h updated: 1.36 -> 1.37 iPHINode.h updated: 1.4 -> 1.5 --- Log message: Add routines to update or erase operands (and to do so without external assumptions about which operand number stores what operand). --- Diffs of the changes: Index: llvm/include/llvm/User.h diff -u llvm/include/llvm/User.h:1.14 llvm/include/llvm/User.h:1.15 --- llvm/include/llvm/User.h:1.14 Sun Aug 25 17:54:55 2002 +++ llvm/include/llvm/User.h Mon Sep 16 11:06:12 2002 @@ -34,6 +34,10 @@ assert(i < Operands.size() && "setOperand() out of range!"); Operands[i] = Val; } + inline void eraseOperand(unsigned i) { + assert(i < Operands.size() && "setOperand() out of range!"); + Operands.erase(Operands.begin() + i); + } inline unsigned getNumOperands() const { return Operands.size(); } // --------------------------------------------------------------------------- Index: llvm/include/llvm/iMemory.h diff -u llvm/include/llvm/iMemory.h:1.36 llvm/include/llvm/iMemory.h:1.37 --- llvm/include/llvm/iMemory.h:1.36 Fri Sep 13 17:28:50 2002 +++ llvm/include/llvm/iMemory.h Mon Sep 16 11:06:12 2002 @@ -150,6 +150,7 @@ Value *getPointerOperand() { return getOperand(0); } const Value *getPointerOperand() const { return getOperand(0); } + static unsigned getPointerOperandIndex() { return 0U; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const LoadInst *) { return true; } @@ -180,6 +181,7 @@ Value *getPointerOperand() { return getOperand(1); } const Value *getPointerOperand() const { return getOperand(1); } + static unsigned getPointerOperandIndex() { return 1U; } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StoreInst *) { return true; } @@ -238,7 +240,10 @@ const Value *getPointerOperand() const { return getOperand(0); } - + static unsigned getPointerOperandIndex() { + return 0U; // get index for modifying correct operand + } + inline unsigned getNumIndices() const { // Note: always non-negative return getNumOperands() - 1; } Index: llvm/include/llvm/iPHINode.h diff -u llvm/include/llvm/iPHINode.h:1.4 llvm/include/llvm/iPHINode.h:1.5 --- llvm/include/llvm/iPHINode.h:1.4 Tue Sep 10 10:36:11 2002 +++ llvm/include/llvm/iPHINode.h Mon Sep 16 11:06:12 2002 @@ -42,6 +42,9 @@ void setIncomingValue(unsigned i, Value *V) { Operands[i*2] = V; } + inline unsigned getOperandNumForIncomingValue(unsigned i) { + return i*2; + } /// getIncomingBlock - Return incoming basic block #x const BasicBlock *getIncomingBlock(unsigned i) const { @@ -52,6 +55,9 @@ } inline void setIncomingBlock(unsigned i, BasicBlock *BB) { Operands[i*2+1] = (Value*)BB; + } + inline unsigned getOperandNumForIncomingBlock(unsigned i) { + return i*2+1; } /// addIncoming - Add an incoming value to the end of the PHI list From vadve at cs.uiuc.edu Mon Sep 16 11:08:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:08:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Scalar.h Message-ID: <200209161607.LAA17628@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms: Scalar.h updated: 1.8 -> 1.9 --- Log message: Allow transformation DecomposeArrayRef(GetElementPtrInst* GEP) to be invoked on a single instruction at a time, for use in other passes. --- Diffs of the changes: Index: llvm/include/llvm/Transforms/Scalar.h diff -u llvm/include/llvm/Transforms/Scalar.h:1.8 llvm/include/llvm/Transforms/Scalar.h:1.9 --- llvm/include/llvm/Transforms/Scalar.h:1.8 Fri Sep 6 13:39:29 2002 +++ llvm/include/llvm/Transforms/Scalar.h Mon Sep 16 11:07:19 2002 @@ -10,6 +10,8 @@ class Pass; class TargetData; +class BasicBlock; +class GetElementPtrInst; //===----------------------------------------------------------------------===// // @@ -60,9 +62,14 @@ // instructions (using getelementpr and cast) so that each instruction has at // most one index (except structure references, which need an extra leading // index of [0]). -// + +// This pass decomposes all multi-dimensional references in a function. Pass *createDecomposeMultiDimRefsPass(); +// This function decomposes a single instance of such a reference. +// Return value: true if the instruction was replaced; false otherwise. +// +bool DecomposeArrayRef(GetElementPtrInst* GEP); //===----------------------------------------------------------------------===// // From vadve at cs.uiuc.edu Mon Sep 16 11:15:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:15:01 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/opt.cpp Message-ID: <200209161609.LAA17667@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/opt: opt.cpp updated: 1.72 -> 1.73 --- Log message: Add support for optimization passes that use a TargetMachine object. --- Diffs of the changes: Index: llvm/tools/opt/opt.cpp diff -u llvm/tools/opt/opt.cpp:1.72 llvm/tools/opt/opt.cpp:1.73 --- llvm/tools/opt/opt.cpp:1.72 Wed Jul 31 11:52:49 2002 +++ llvm/tools/opt/opt.cpp Mon Sep 16 11:09:24 2002 @@ -12,7 +12,8 @@ #include "llvm/Bytecode/WriteBytecodePass.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Analysis/Verifier.h" -#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/Sparc.h" #include "llvm/Support/PassNameParser.h" #include "Support/Signals.h" #include @@ -60,10 +61,15 @@ cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .bc modular optimizer\n"); - // FIXME: This should be parameterizable eventually for different target - // types... + // FIXME: The choice of target should be controllable on the command line. TargetData TD("opt target"); + // Allocate a full target machine description only if necessary... + // FIXME: The choice of target should be controllable on the command line. + std::auto_ptr target; + + TargetMachine* TM = NULL; + // Load the input module... std::auto_ptr M(ParseBytecodeFile(InputFilename)); if (M.get() == 0) { @@ -105,8 +111,13 @@ if (Opt->getNormalCtor()) Passes.add(Opt->getNormalCtor()()); else if (Opt->getDataCtor()) - Passes.add(Opt->getDataCtor()(TD)); // Pass dummy target data... - else + Passes.add(Opt->getDataCtor()(TD)); // Provide dummy target data... + else if (Opt->getTargetCtor()) { + if (target.get() == NULL) + target.reset(allocateSparcTargetMachine()); // FIXME: target option + assert(target.get() && "Could not allocate target machine!"); + Passes.add(Opt->getTargetCtor()(*target.get())); + } else cerr << argv[0] << ": cannot create pass: " << Opt->getPassName() << "\n"; if (PrintEachXForm) From vadve at cs.uiuc.edu Mon Sep 16 11:15:11 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:15:11 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200209161609.LAA17684@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.26 -> 1.27 --- Log message: Add support for optimization passes that use a TargetMachine object. --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.26 llvm/tools/opt/Makefile:1.27 --- llvm/tools/opt/Makefile:1.26 Fri Aug 30 15:25:41 2002 +++ llvm/tools/opt/Makefile Mon Sep 16 11:09:43 2002 @@ -1,8 +1,10 @@ LEVEL = ../.. TOOLNAME = opt -USEDLIBS = bcreader bcwriter instrument profpaths scalaropts \ - ipo ipa.a datastructure.a transforms target.a analysis \ +USEDLIBS = bcreader bcwriter instrument profpaths \ + sparc.a target.a mapping.a regalloc.a sched.a select.a preselect \ + livevar.a sparc.a scalaropts \ + ipo ipa.a datastructure.a transforms target.a analysis \ transformutils vmcore support TOOLLINKOPTS = -ldl From vadve at cs.uiuc.edu Mon Sep 16 11:36:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:36:01 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200209161635.LAA17733@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.57 -> 1.58 --- Log message: Make all registered optimization passes available to llc. Eliminate duplicate tracing options and use those defined by the trace passes. Making the tracing step a module pass that runs before any llc-specific passes. --- Diffs of the changes: Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.57 llvm/tools/llc/llc.cpp:1.58 --- llvm/tools/llc/llc.cpp:1.57 Fri Sep 13 22:03:22 2002 +++ llvm/tools/llc/llc.cpp Mon Sep 16 11:35:34 2002 @@ -15,6 +15,8 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Module.h" #include "llvm/PassManager.h" +#include "llvm/Pass.h" +#include "llvm/Support/PassNameParser.h" #include "Support/CommandLine.h" #include "Support/Signals.h" #include @@ -22,6 +24,25 @@ using std::string; using std::cerr; +//------------------------------------------------------------------------------ +// Option declarations for LLC. +//------------------------------------------------------------------------------ + +// Make all registered optimization passes available to llc. These passes +// will all be run before the simplification and lowering steps used by the +// back-end code generator, and will be run in the order specified on the +// command line. The OptimizationList is automatically populated with +// registered Passes by the PassNameParser. +// +static cl::list > +OptimizationList(cl::desc("Optimizations available:")); + + +// General options for llc. Other pass-specific options are specified +// within the corresponding llc passes, and target-specific options +// and back-end code generation options are specified with the target machine. +// static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); @@ -38,20 +59,16 @@ TraceLibPath("tracelibpath", cl::desc("Path to libinstr for trace code"), cl::value_desc("directory"), cl::Hidden); -enum TraceLevel { - TraceOff, TraceFunctions, TraceBasicBlocks -}; -static cl::opt -TraceValues("trace", cl::desc("Trace values through functions or basic blocks"), - cl::values( - clEnumValN(TraceOff , "off", "Disable trace code"), - clEnumValN(TraceFunctions , "function", "Trace each function"), - clEnumValN(TraceBasicBlocks, "basicblock", "Trace each basic block"), - 0)); +// flags set from -tracem and -trace options to control tracing +static bool TraceFunctions = false; +static bool TraceBasicBlocks = false; + // GetFileNameRoot - Helper function to get the basename of a filename... -static inline string GetFileNameRoot(const string &InputFilename) { +static inline string +GetFileNameRoot(const string &InputFilename) +{ string IFN = InputFilename; string outputFilename; int Len = IFN.length(); @@ -63,22 +80,19 @@ return outputFilename; } -static void insertTraceCodeFor(Module &M) { +static bool +insertTraceCodeFor(Module &M) +{ PassManager Passes; // Insert trace code in all functions in the module - switch (TraceValues) { - case TraceBasicBlocks: + if (TraceBasicBlocks) Passes.add(createTraceValuesPassForBasicBlocks()); - break; - case TraceFunctions: + else if (TraceFunctions) Passes.add(createTraceValuesPassForFunction()); - break; - default: - assert(0 && "Bad value for TraceValues!"); - abort(); - } - + else + return false; + // Eliminate duplication in constant pool Passes.add(createConstantMergePass()); @@ -92,46 +106,55 @@ // Module *TraceModule = ParseBytecodeFile(TraceLibPath+"libinstr.bc"); - // Ok, the TraceLibPath didn't contain a valid module. Try to load the module - // from the current LLVM-GCC install directory. This is kindof a hack, but - // allows people to not HAVE to have built the library. + // Check if the TraceLibPath contains a valid module. If not, try to load + // the module from the current LLVM-GCC install directory. This is kindof + // a hack, but allows people to not HAVE to have built the library. // if (TraceModule == 0) TraceModule = ParseBytecodeFile("/home/vadve/lattner/cvs/gcc_install/lib/" "gcc-lib/llvm/3.1/libinstr.bc"); // If we still didn't get it, cancel trying to link it in... - if (TraceModule == 0) { + if (TraceModule == 0) cerr << "Warning, could not load trace routines to link into program!\n"; - } else { - - // Link in the trace routines... if the link fails, don't panic, because the - // compile should still succeed, just the native linker will probably fail. - // - std::auto_ptr TraceRoutines(TraceModule); - if (LinkModules(&M, TraceRoutines.get(), &ErrorMessage)) - cerr << "Warning: Error linking in trace routines: " - << ErrorMessage << "\n"; - } - + else + { + // Link in the trace routines... if this fails, don't panic, because the + // compile should still succeed, but the native linker will probably fail. + // + std::auto_ptr TraceRoutines(TraceModule); + if (LinkModules(&M, TraceRoutines.get(), &ErrorMessage)) + cerr << "Warning: Error linking in trace routines: " + << ErrorMessage << "\n"; + } // Write out the module with tracing code just before code generation - if (InputFilename != "-") { - string TraceFilename = GetFileNameRoot(InputFilename) + ".trace.bc"; - - std::ofstream Out(TraceFilename.c_str()); - if (!Out.good()) { - cerr << "Error opening '" << TraceFilename - << "'!: Skipping output of trace code as bytecode\n"; - } else { + assert (InputFilename != "-" + && "Cannot write out traced bytecode when reading input from stdin"); + string TraceFilename = GetFileNameRoot(InputFilename) + ".trace.bc"; + + std::ofstream Out(TraceFilename.c_str()); + if (!Out.good()) + cerr << "Error opening '" << TraceFilename + << "'!: Skipping output of trace code as bytecode\n"; + else + { cerr << "Emitting trace code to '" << TraceFilename << "' for comparison...\n"; WriteBytecodeToFile(&M, Out); } - } + return true; } - + +// Making tracing a module pass so the entire module with tracing +// can be written out before continuing. +struct InsertTracingCodePass: public Pass { + virtual bool run(Module &M) { + return insertTraceCodeFor(M); + } +}; + //===---------------------------------------------------------------------===// // Function main() @@ -139,7 +162,9 @@ // Entry point for the llc compiler. //===---------------------------------------------------------------------===// -int main(int argc, char **argv) { +int +main(int argc, char **argv) +{ cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n"); // Allocate a target... in the future this will be controllable on the @@ -148,28 +173,55 @@ assert(target.get() && "Could not allocate target machine!"); TargetMachine &Target = *target.get(); - + // Load the module to be compiled... std::auto_ptr M(ParseBytecodeFile(InputFilename)); - if (M.get() == 0) { - cerr << argv[0] << ": bytecode didn't read correctly.\n"; - return 1; - } - - if (TraceValues != TraceOff) // If tracing enabled... - insertTraceCodeFor(*M.get()); // Hack up module before using passmanager... + if (M.get() == 0) + { + cerr << argv[0] << ": bytecode didn't read correctly.\n"; + return 1; + } // Build up all of the passes that we want to do to the module... PassManager Passes; + // Create a new optimization pass for each one specified on the command line + // Deal specially with tracing passes, which must be run differently than opt. + // + for (unsigned i = 0; i < OptimizationList.size(); ++i) + { + const PassInfo *Opt = OptimizationList[i]; + + if (strcmp(Opt->getPassArgument(), "trace") == 0) + TraceFunctions = !(TraceBasicBlocks = true); + else if (strcmp(Opt->getPassArgument(), "tracem") == 0) + TraceFunctions = !(TraceBasicBlocks = false); + else + { // handle other passes as normal optimization passes + if (Opt->getNormalCtor()) + Passes.add(Opt->getNormalCtor()()); + else if (Opt->getDataCtor()) + Passes.add(Opt->getDataCtor()(Target.DataLayout)); + else if (Opt->getTargetCtor()) + Passes.add(Opt->getTargetCtor()(Target)); + else + cerr << argv[0] << ": cannot create pass: " + << Opt->getPassName() << "\n"; + } + } + + // Run tracing passes after other optimization passes and before llc passes. + if (TraceFunctions || TraceBasicBlocks) + Passes.add(new InsertTracingCodePass); + // Decompose multi-dimensional refs into a sequence of 1D refs Passes.add(createDecomposeMultiDimRefsPass()); - + // Replace malloc and free instructions with library calls. // Do this after tracing until lli implements these lib calls. // For now, it will emulate malloc and free internally. Passes.add(createLowerAllocationsPass(Target.DataLayout)); - + // If LLVM dumping after transformations is requested, add it to the pipeline if (DumpAsm) Passes.add(new PrintFunctionPass("Code after xformations: \n", &cerr)); @@ -179,27 +231,8 @@ // Figure out where we are going to send the output... std::ostream *Out = 0; - if (OutputFilename != "") { // Specified an output filename? - if (!Force && std::ifstream(OutputFilename.c_str())) { - // If force is not specified, make sure not to overwrite a file! - cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; - return 1; - } - Out = new std::ofstream(OutputFilename.c_str()); - - // Make sure that the Out file gets unlink'd from the disk if we get a - // SIGINT - RemoveFileOnSignal(OutputFilename); - } else { - if (InputFilename == "-") { - OutputFilename = "-"; - Out = &std::cout; - } else { - string OutputFilename = GetFileNameRoot(InputFilename); - OutputFilename += ".s"; - + if (OutputFilename != "") + { // Specified an output filename? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! cerr << argv[0] << ": error opening '" << OutputFilename @@ -207,21 +240,49 @@ << "Use -f command line argument to force output\n"; return 1; } - Out = new std::ofstream(OutputFilename.c_str()); - if (!Out->good()) { - cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; - delete Out; - return 1; - } - // Make sure that the Out file gets unlink'd from the disk if we get a - // SIGINT + + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT RemoveFileOnSignal(OutputFilename); } - } - + else + { + if (InputFilename == "-") + { + OutputFilename = "-"; + Out = &std::cout; + } + else + { + string OutputFilename = GetFileNameRoot(InputFilename); + OutputFilename += ".s"; + + if (!Force && std::ifstream(OutputFilename.c_str())) + { + // If force is not specified, make sure not to overwrite a file! + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; + return 1; + } + + Out = new std::ofstream(OutputFilename.c_str()); + if (!Out->good()) + { + cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + delete Out; + return 1; + } + + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT + RemoveFileOnSignal(OutputFilename); + } + } + Target.addPassesToEmitAssembly(Passes, *Out); - + // Run our queue of passes all at once now, efficiently. Passes.run(*M.get()); From vadve at cs.uiuc.edu Mon Sep 16 11:37:00 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:37:00 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200209161636.LAA17751@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.25 -> 1.26 --- Log message: Change several entries to use the .o instead of .a to expose pass options. --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.25 llvm/tools/llc/Makefile:1.26 --- llvm/tools/llc/Makefile:1.25 Tue Aug 27 11:46:11 2002 +++ llvm/tools/llc/Makefile Mon Sep 16 11:36:13 2002 @@ -1,8 +1,9 @@ LEVEL = ../.. TOOLNAME = llc -USEDLIBS = mapping sparc regalloc sched select target \ - instrument.a livevar bcreader bcwriter analysis.a transforms.a \ - ipo.a scalaropts.a transformutils.a vmcore support.a +USEDLIBS = mapping sparc target.a regalloc sched select preselect target.a \ + instrument livevar bcreader bcwriter ipo ipa.a datastructure.a \ + scalaropts transforms analysis transformutils vmcore support +TOOLLINKOPTS = -ldl include $(LEVEL)/Makefile.common From vadve at cs.uiuc.edu Mon Sep 16 11:41:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:41:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp Message-ID: <200209161640.LAA17772@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: DecomposeMultiDimRefs.cpp updated: 1.24 -> 1.25 --- Log message: Extract most of the transformation into an externally accessible function -- DecomposeArrayRef(GetElementPtrInst* GEP) -- that can be invoked on a single instruction at a time. --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp diff -u llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.24 llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.25 --- llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp:1.24 Tue Sep 10 20:21:33 2002 +++ llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp Mon Sep 16 11:40:07 2002 @@ -21,16 +21,14 @@ namespace { Statistic<> NumAdded("lowerrefs\t\t- # of getelementptr instructions added"); - class DecomposePass : public BasicBlockPass { - static bool decomposeArrayRef(GetElementPtrInst &GEP); - public: + struct DecomposePass : public BasicBlockPass { virtual bool runOnBasicBlock(BasicBlock &BB); }; - - RegisterOpt X("lowerrefs", "Decompose multi-dimensional " - "structure/array references"); } +RegisterOpt X("lowerrefs", "Decompose multi-dimensional " + "structure/array references"); + Pass *createDecomposeMultiDimRefsPass() { @@ -44,17 +42,17 @@ bool DecomposePass::runOnBasicBlock(BasicBlock &BB) { - bool Changed = false; - for (BasicBlock::iterator II = BB.begin(); II != BB.end(); ) { - Instruction *I = II; - ++II; - if (GetElementPtrInst *GEP = dyn_cast(I)) - if (GEP->getNumIndices() >= 2) - Changed |= decomposeArrayRef(*GEP); // always modifies II - } - return Changed; + bool changed = false; + for (BasicBlock::iterator II = BB.begin(); II != BB.end(); ) + if (GetElementPtrInst *gep = dyn_cast(&*II++)) // pre-inc + if (gep->getNumIndices() >= 2) + changed |= DecomposeArrayRef(gep); // always modifies II + return changed; } + +// Function: DecomposeArrayRef() +// // For any GetElementPtrInst with 2 or more array and structure indices: // // opCode CompositeType* P, [uint|ubyte] idx1, ..., [uint|ubyte] idxN @@ -77,25 +75,30 @@ // Return value: true if the instruction was replaced; false otherwise. // bool -DecomposePass::decomposeArrayRef(GetElementPtrInst &GEP) +DecomposeArrayRef(GetElementPtrInst* GEP) { - BasicBlock *BB = GEP.getParent(); - Value *LastPtr = GEP.getPointerOperand(); - Instruction *InsertPoint = GEP.getNext(); // Insert before the next insn + if (GEP->getNumIndices() < 2) + return false; + + BasicBlock *BB = GEP->getParent(); + Value *LastPtr = GEP->getPointerOperand(); + Instruction *InsertPoint = GEP->getNext(); // Insert before the next insn + + // The vector of new instructions to be created + std::vector NewInsts; // Process each index except the last one. - User::const_op_iterator OI = GEP.idx_begin(), OE = GEP.idx_end(); + User::const_op_iterator OI = GEP->idx_begin(), OE = GEP->idx_end(); for (; OI+1 != OE; ++OI) { std::vector Indices; // If this is the first index and is 0, skip it and move on! - if (OI == GEP.idx_begin()) { + if (OI == GEP->idx_begin()) { if (*OI == ConstantInt::getNullValue((*OI)->getType())) continue; - } else { - // Not the first index: include initial [0] to deref the last ptr - Indices.push_back(Constant::getNullValue(Type::LongTy)); } + else // Not the first index: include initial [0] to deref the last ptr + Indices.push_back(Constant::getNullValue(Type::LongTy)); Indices.push_back(*OI); @@ -113,13 +116,14 @@ Indices.push_back(Constant::getNullValue(Type::LongTy)); Indices.push_back(*OI); - Value *NewVal = new GetElementPtrInst(LastPtr, Indices, GEP.getName(), + Value *NewVal = new GetElementPtrInst(LastPtr, Indices, GEP->getName(), InsertPoint); // Replace all uses of the old instruction with the new - GEP.replaceAllUsesWith(NewVal); + GEP->replaceAllUsesWith(NewVal); // Now remove and delete the old instruction... - BB->getInstList().erase(&GEP); + BB->getInstList().erase(GEP); + return true; } From vadve at cs.uiuc.edu Mon Sep 16 11:47:00 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:47:00 2002 Subject: [llvm-commits] CVS: llvm/include/Support/ilist Message-ID: <200209161646.LAA17823@morpheus.cs.uiuc.edu> Changes in directory llvm/include/Support: ilist updated: 1.4 -> 1.5 --- Log message: Add ilist_iterator constructor from a node reference. --- Diffs of the changes: Index: llvm/include/Support/ilist diff -u llvm/include/Support/ilist:1.4 llvm/include/Support/ilist:1.5 --- llvm/include/Support/ilist:1.4 Wed Jul 24 17:07:42 2002 +++ llvm/include/Support/ilist Mon Sep 16 11:46:17 2002 @@ -82,6 +82,7 @@ typedef size_t size_type; ilist_iterator(pointer NP) : NodePtr(NP) {} + ilist_iterator(reference NR) : NodePtr(&NR) {} ilist_iterator() : NodePtr(0) {} // This is templated so that we can allow constructing a const iterator from From vadve at cs.uiuc.edu Mon Sep 16 11:48:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 11:48:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Olden-bh/defs.h Message-ID: <200209161647.LAA17842@morpheus.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource/Olden-bh: defs.h updated: 1.2 -> 1.3 --- Log message: Make assertions abort instead of exit. --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Olden-bh/defs.h diff -u llvm/test/Programs/MultiSource/Olden-bh/defs.h:1.2 llvm/test/Programs/MultiSource/Olden-bh/defs.h:1.3 --- llvm/test/Programs/MultiSource/Olden-bh/defs.h:1.2 Mon Feb 18 11:03:35 2002 +++ llvm/test/Programs/MultiSource/Olden-bh/defs.h Mon Sep 16 11:47:11 2002 @@ -231,7 +231,7 @@ -#define assert(b,n) if (!(b)) {chatting("Assertion Failure #%d", (n)); exit(0);} +#define assert(b,n) if (!(b)) {chatting("Assertion Failure #%d", (n)); abort();} #define TASKLIMIT 256 From hldnbrnd at cs.uiuc.edu Mon Sep 16 12:21:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Sep 16 12:21:01 2002 Subject: [llvm-commits] CVS: llvm/utils/- New directory Message-ID: <200209161720.MAA15201@trinity.cs.uiuc.edu> Changes in directory llvm/utils: - updated: -> New updated: -> directory updated: -> --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/utils added to the repository --- Diffs of the changes: From hldnbrnd at cs.uiuc.edu Mon Sep 16 12:57:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Mon Sep 16 12:57:00 2002 Subject: [llvm-commits] CVS: llvm/cvsupdate getsrcs.sh makellvm Message-ID: <200209161756.MAA17652@trinity.cs.uiuc.edu> Changes in directory llvm: cvsupdate (r1.3) removed getsrcs.sh (r1.7) removed makellvm (r1.3) removed --- Log message: Moved these files to the utils directory. --- Diffs of the changes: From vadve at cs.uiuc.edu Mon Sep 16 13:09:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 13:09:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/PreSelection.h Message-ID: <200209161808.NAA21436@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: PreSelection.h added (r1.1) --- Log message: New preselection pass that specializes LLVM code for a target machine, while remaining in legal portable LLVM form and preserving type information and type safety. --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Sep 16 13:10:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 13:10:01 2002 Subject: [llvm-commits] CVS: llvm/utils/cvsupdate Message-ID: <200209161809.NAA17823@trinity.cs.uiuc.edu> Changes in directory llvm/utils: cvsupdate updated: 1.3 -> 1.4 --- Log message: Print information about files that were removed --- Diffs of the changes: Index: llvm/utils/cvsupdate diff -u llvm/utils/cvsupdate:1.3 llvm/utils/cvsupdate:1.4 --- llvm/utils/cvsupdate:1.3 Sun Sep 15 11:45:10 2002 +++ llvm/utils/cvsupdate Mon Sep 16 13:09:42 2002 @@ -46,6 +46,9 @@ echo ""; echo " UPDATE CONFLICTS OCCURRED FOR THE FOLLOWING FILES:" grep '^C' cvs.out +echo ""; echo " FILES REMOVED FROM YOUR DIRECTORY:" +grep 'no longer in the repository' cvs.out + echo ""; echo " FILES SUCCESSFULLY MERGED (or locally modified):" grep '^M' cvs.out | grep -v Merging From vadve at cs.uiuc.edu Mon Sep 16 13:14:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 13:14:01 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200209161813.NAA21556@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.27 -> 1.28 --- Log message: Use .o files instead of .a files for several cases (that don't actually need them) until other Makefiles can be updated to build archives. --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.27 llvm/tools/opt/Makefile:1.28 --- llvm/tools/opt/Makefile:1.27 Mon Sep 16 11:09:43 2002 +++ llvm/tools/opt/Makefile Mon Sep 16 13:13:12 2002 @@ -2,8 +2,8 @@ TOOLNAME = opt USEDLIBS = bcreader bcwriter instrument profpaths \ - sparc.a target.a mapping.a regalloc.a sched.a select.a preselect \ - livevar.a sparc.a scalaropts \ + sparc target.a mapping regalloc.a sched select preselect \ + livevar sparc scalaropts \ ipo ipa.a datastructure.a transforms target.a analysis \ transformutils vmcore support TOOLLINKOPTS = -ldl From vadve at cs.uiuc.edu Mon Sep 16 13:29:00 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Mon Sep 16 13:29:00 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200209161828.NAA21740@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.28 -> 1.29 --- Log message: Remove duplicate sparc entry. --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.28 llvm/tools/opt/Makefile:1.29 --- llvm/tools/opt/Makefile:1.28 Mon Sep 16 13:13:12 2002 +++ llvm/tools/opt/Makefile Mon Sep 16 13:28:27 2002 @@ -3,7 +3,7 @@ USEDLIBS = bcreader bcwriter instrument profpaths \ sparc target.a mapping regalloc.a sched select preselect \ - livevar sparc scalaropts \ + livevar scalaropts \ ipo ipa.a datastructure.a transforms target.a analysis \ transformutils vmcore support TOOLLINKOPTS = -ldl From lattner at cs.uiuc.edu Mon Sep 16 13:33:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 13:33:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp TransformInternals.cpp TransformInternals.h Message-ID: <200209161832.NAA19373@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.58 -> 1.59 TransformInternals.cpp updated: 1.29 -> 1.30 TransformInternals.h updated: 1.15 -> 1.16 --- Log message: Fix: test/Regression/LLC/badidx.c problem --- Diffs of the changes: Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.58 llvm/lib/Transforms/ExprTypeConvert.cpp:1.59 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.58 Fri Sep 13 17:28:40 2002 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Sep 16 13:32:32 2002 @@ -53,13 +53,13 @@ if (!Expr.Offset && !Expr.Scale && OldTypeSize == 1) return false; // Get the offset and scale of the allocation... - int OffsetVal = Expr.Offset ? getConstantValue(Expr.Offset) : 0; - int ScaleVal = Expr.Scale ? getConstantValue(Expr.Scale) : (Expr.Var ? 1 : 0); + int64_t OffsetVal = Expr.Offset ? getConstantValue(Expr.Offset) : 0; + int64_t ScaleVal = Expr.Scale ? getConstantValue(Expr.Scale) :(Expr.Var != 0); // The old type might not be of unit size, take old size into consideration // here... - int Offset = OffsetVal * OldTypeSize; - int Scale = ScaleVal * OldTypeSize; + int64_t Offset = OffsetVal * OldTypeSize; + int64_t Scale = ScaleVal * OldTypeSize; // In order to be successful, both the scale and the offset must be a multiple // of the requested data type's size. @@ -87,13 +87,13 @@ unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType()); // Get the offset and scale coefficients that we are allocating... - int OffsetVal = (Expr.Offset ? getConstantValue(Expr.Offset) : 0); - int ScaleVal = Expr.Scale ? getConstantValue(Expr.Scale) : (Expr.Var ? 1 : 0); + int64_t OffsetVal = (Expr.Offset ? getConstantValue(Expr.Offset) : 0); + int64_t ScaleVal = Expr.Scale ? getConstantValue(Expr.Scale) : (Expr.Var !=0); // The old type might not be of unit size, take old size into consideration // here... - unsigned Offset = (unsigned)OffsetVal * OldTypeSize / DataSize; - unsigned Scale = (unsigned)ScaleVal * OldTypeSize / DataSize; + unsigned Offset = (uint64_t)OffsetVal * OldTypeSize / DataSize; + unsigned Scale = (uint64_t)ScaleVal * OldTypeSize / DataSize; // Locate the malloc instruction, because we may be inserting instructions It = MI; Index: llvm/lib/Transforms/TransformInternals.cpp diff -u llvm/lib/Transforms/TransformInternals.cpp:1.29 llvm/lib/Transforms/TransformInternals.cpp:1.30 --- llvm/lib/Transforms/TransformInternals.cpp:1.29 Tue Sep 10 20:21:23 2002 +++ llvm/lib/Transforms/TransformInternals.cpp Mon Sep 16 13:32:32 2002 @@ -18,7 +18,7 @@ const TargetData TD("LevelRaise: Should be GCC though!"); -static const Type *getStructOffsetStep(const StructType *STy, unsigned &Offset, +static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, std::vector &Indices) { assert(Offset < TD.getTypeSize(STy) && "Offset not in composite!"); const StructLayout *SL = TD.getStructLayout(STy); @@ -56,7 +56,7 @@ if (Offset == 0 && StopEarly && !Indices.empty()) return Ty; // Return the leaf type - unsigned ThisOffset; + uint64_t ThisOffset; const Type *NextType; if (const StructType *STy = dyn_cast(Ty)) { ThisOffset = Offset; @@ -99,8 +99,8 @@ // Get the offset and scale values if they exists... // A scale of zero with Expr.Var != 0 means a scale of 1. // - int Offset = Expr.Offset ? getConstantValue(Expr.Offset) : 0; - int Scale = Expr.Scale ? getConstantValue(Expr.Scale) : 0; + int64_t Offset = Expr.Offset ? getConstantValue(Expr.Offset) : 0; + int64_t Scale = Expr.Scale ? getConstantValue(Expr.Scale) : 0; if (Expr.Var && Scale == 0) Scale = 1; // Scale != 0 if Expr.Var != 0 @@ -115,7 +115,7 @@ if (const StructType *StructTy = dyn_cast(CompTy)) { // Step into the appropriate element of the structure... - unsigned ActualOffset = (Offset < 0) ? 0 : (unsigned)Offset; + uint64_t ActualOffset = (Offset < 0) ? 0 : (uint64_t)Offset; NextTy = getStructOffsetStep(StructTy, ActualOffset, Indices); Offset -= ActualOffset; } else { @@ -123,7 +123,7 @@ if (!ElTy->isSized()) return 0; // Type is unreasonable... escape! unsigned ElSize = TD.getTypeSize(ElTy); - int ElSizeS = (int)ElSize; + int64_t ElSizeS = ElSize; // See if the user is indexing into a different cell of this array... if (Scale && (Scale >= ElSizeS || -Scale >= ElSizeS)) { @@ -131,12 +131,12 @@ // array by one. In this case, we will have to insert math to munge // the index. // - int ScaleAmt = Scale/ElSizeS; + int64_t ScaleAmt = Scale/ElSizeS; if (Scale-ScaleAmt*ElSizeS) return 0; // Didn't scale by a multiple of element size, bail out Scale = 0; // Scale is consumed - int Index = Offset/ElSize; // is zero unless Offset > ElSize + int64_t Index = Offset/ElSize; // is zero unless Offset > ElSize Offset -= Index*ElSize; // Consume part of the offset if (BI) { // Generate code? @@ -165,11 +165,11 @@ Indices.push_back(Expr.Var); Expr.Var = 0; - } else if (Offset >= (int)ElSize || -Offset >= (int)ElSize) { + } else if (Offset >= (int64_t)ElSize || -Offset >= (int64_t)ElSize) { // Calculate the index that we are entering into the array cell with - unsigned Index = Offset/ElSize; + uint64_t Index = Offset/ElSize; Indices.push_back(ConstantSInt::get(Type::LongTy, Index)); - Offset -= (int)(Index*ElSize); // Consume part of the offset + Offset -= (int64_t)(Index*ElSize); // Consume part of the offset } else if (isa(CompTy) || Indices.empty()) { // Must be indexing a small amount into the first cell of the array Index: llvm/lib/Transforms/TransformInternals.h diff -u llvm/lib/Transforms/TransformInternals.h:1.15 llvm/lib/Transforms/TransformInternals.h:1.16 --- llvm/lib/Transforms/TransformInternals.h:1.15 Wed Jul 17 12:11:33 2002 +++ llvm/lib/Transforms/TransformInternals.h Mon Sep 16 13:32:33 2002 @@ -23,10 +23,10 @@ // extern const TargetData TD; -static inline int getConstantValue(const ConstantInt *CPI) { +static inline int64_t getConstantValue(const ConstantInt *CPI) { if (const ConstantSInt *CSI = dyn_cast(CPI)) - return (int)CSI->getValue(); - return (int)cast(CPI)->getValue(); + return CSI->getValue(); + return (int64_t)cast(CPI)->getValue(); } From lattner at cs.uiuc.edu Mon Sep 16 14:09:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 14:09:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/CorrelatedExprs/Makefile basictest.ll branchtest.ll Message-ID: <200209161908.OAA19872@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/CorrelatedExprs: Makefile added (r1.1) basictest.ll added (r1.1) branchtest.ll added (r1.1) --- Log message: Checking testcases for cee pass --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Sep 16 14:10:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 14:10:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/Makefile Message-ID: <200209161909.OAA19963@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms: Makefile updated: 1.15 -> 1.16 --- Log message: Run the cee pass tests --- Diffs of the changes: Index: llvm/test/Regression/Transforms/Makefile diff -u llvm/test/Regression/Transforms/Makefile:1.15 llvm/test/Regression/Transforms/Makefile:1.16 --- llvm/test/Regression/Transforms/Makefile:1.15 Mon Sep 9 23:55:36 2002 +++ llvm/test/Regression/Transforms/Makefile Mon Sep 16 14:09:11 2002 @@ -1,5 +1,6 @@ LEVEL = ../../.. -DIRS = ADCE CFGSimplify ConstProp DecomposeMultiDimRefs FunctionResolve GCSE \ +DIRS = ADCE CFGSimplify ConstProp CorrelatedExprs DecomposeMultiDimRefs \ + FunctionResolve GCSE \ GlobalDCE IndVarSimplify Inline InstCombine LevelRaise LICM Mem2Reg \ PiNodeInserter ProfilePaths Reassociate SCCP SimplifyCFG include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Sep 16 15:45:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 15:45:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h Message-ID: <200209162044.PAA26989@trinity.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.7 -> 1.8 --- Log message: Fix compile problem on linux. Noone should ever #include directly. Instead, include Support/DataTypes.h --- Diffs of the changes: Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.7 llvm/include/llvm/Target/TargetData.h:1.8 --- llvm/include/llvm/Target/TargetData.h:1.7 Sun May 19 10:28:02 2002 +++ llvm/include/llvm/Target/TargetData.h Mon Sep 16 15:44:19 2002 @@ -14,8 +14,8 @@ #define LLVM_TARGET_TARGETDATA_H #include "llvm/Annotation.h" +#include "Support/DataTypes.h" #include -#include class Value; class Type; class StructType; From lattner at cs.uiuc.edu Mon Sep 16 17:09:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 17:09:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209162208.RAA04339@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.24 -> 1.25 --- Log message: Fix typeo --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.24 llvm/www/docs/ProgrammersManual.html:1.25 --- llvm/www/docs/ProgrammersManual.html:1.24 Thu Sep 12 14:08:16 2002 +++ llvm/www/docs/ProgrammersManual.html Mon Sep 16 17:08:07 2002 @@ -526,7 +526,7 @@ virtual runOnFunction(Function& F) { for(Function::iterator b = F.begin(), be = F.end(); b != be; ++b) { for(BasicBlock::iterator i = b->begin(); ie = b->end(); i != ie; ++i) { - if (CallInst* callInst = dyn_cast<CallInst>(&*inst)) { + if (CallInst* callInst = dyn_cast<CallInst>(&*i)) { // we know we've encountered a call instruction, so we // need to determine if it's a call to the // function pointed to by m_func or not. @@ -1575,6 +1575,6 @@ Chris Lattner -Last modified: Thu Sep 12 14:07:53 CDT 2002 +Last modified: Mon Sep 16 17:07:43 CDT 2002 From lattner at cs.uiuc.edu Mon Sep 16 17:31:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 17:31:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/FunctionInlining.cpp Message-ID: <200209162230.RAA28064@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: FunctionInlining.cpp updated: 1.34 -> 1.35 --- Log message: Fix FunctionInlining pass assertion failure: ilist:104: failed assertion `Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"' --- Diffs of the changes: Index: llvm/lib/Transforms/FunctionInlining.cpp diff -u llvm/lib/Transforms/FunctionInlining.cpp:1.34 llvm/lib/Transforms/FunctionInlining.cpp:1.35 --- llvm/lib/Transforms/FunctionInlining.cpp:1.34 Tue Sep 10 17:38:44 2002 +++ llvm/lib/Transforms/FunctionInlining.cpp Mon Sep 16 17:30:20 2002 @@ -163,7 +163,7 @@ } // Add a branch to the code that was after the original Call. - new BranchInst(NewBB, IBB->end()); + IBB->getInstList().push_back(new BranchInst(NewBB)); break; } case Instruction::Br: From lattner at cs.uiuc.edu Mon Sep 16 17:36:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 17:36:00 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200209162235.RAA28160@trinity.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.47 -> 1.48 --- Log message: Handle whitespace in LIBRARYNAME gracefully --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.47 llvm/Makefile.common:1.48 --- llvm/Makefile.common:1.47 Fri Sep 13 17:14:47 2002 +++ llvm/Makefile.common Mon Sep 16 17:34:56 2002 @@ -206,6 +206,8 @@ ifdef LIBRARYNAME +LIBRARYNAME := $(strip $(LIBRARYNAME)) + LIBNAME_O := $(LIBRELEASE)/lib$(LIBRARYNAME).so LIBNAME_G := $(LIBDEBUG)/lib$(LIBRARYNAME).so LIBNAME_AO := $(LIBRELEASE)/lib$(LIBRARYNAME).a From lattner at cs.uiuc.edu Mon Sep 16 17:37:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 17:37:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200209162236.RAA28175@trinity.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.48 -> 1.49 --- Log message: Comment line of the makefile --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.48 llvm/Makefile.common:1.49 --- llvm/Makefile.common:1.48 Mon Sep 16 17:34:56 2002 +++ llvm/Makefile.common Mon Sep 16 17:36:42 2002 @@ -206,6 +206,7 @@ ifdef LIBRARYNAME +# Make sure there isn't any extranous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) LIBNAME_O := $(LIBRELEASE)/lib$(LIBRARYNAME).so From lattner at cs.uiuc.edu Mon Sep 16 17:39:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Sep 16 17:39:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/WritingAnLLVMPass.html Message-ID: <200209162238.RAA06227@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: WritingAnLLVMPass.html updated: 1.8 -> 1.9 --- Log message: Remove warning that is no longer applicable --- Diffs of the changes: Index: llvm/www/docs/WritingAnLLVMPass.html diff -u llvm/www/docs/WritingAnLLVMPass.html:1.8 llvm/www/docs/WritingAnLLVMPass.html:1.9 --- llvm/www/docs/WritingAnLLVMPass.html:1.8 Thu Sep 12 12:06:43 2002 +++ llvm/www/docs/WritingAnLLVMPass.html Mon Sep 16 17:37:56 2002 @@ -131,9 +131,7 @@ source base. For this example, we'll assume that you made "lib/Transforms/Hello". The first thing you must do is set up a build script (Makefile) that will compile the source code for the new pass. To do -this, copy this into "Makefile" (be very careful that there are no -extra space characters at the end of the lines though... that seems to confuse -gmake):

+this, copy this into "Makefile":


     # Makefile for hello pass
    @@ -1203,6 +1201,6 @@
     
    Chris Lattner
    -Last modified: Thu Sep 12 11:46:40 CDT 2002 +Last modified: Mon Sep 16 17:37:27 CDT 2002 From vadve at cs.uiuc.edu Tue Sep 17 06:11:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Tue Sep 17 06:11:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200209171110.GAA28236@morpheus.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.27 -> 1.28 --- Log message: Fix typo in comment. --- Diffs of the changes: Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.27 llvm/include/llvm/Pass.h:1.28 --- llvm/include/llvm/Pass.h:1.27 Thu Sep 12 12:06:38 2002 +++ llvm/include/llvm/Pass.h Tue Sep 17 06:09:59 2002 @@ -247,7 +247,7 @@ /// instruction at a time. /// 2. Optimizations do not modify the CFG of the contained function, or any /// other basic block in the function. -/// 3. Optimizations conform to all of the contstraints of FunctionPass's. +/// 3. Optimizations conform to all of the constraints of FunctionPass's. /// struct BasicBlockPass : public FunctionPass { /// doInitialization - Virtual method overridden by subclasses to do From vadve at cs.uiuc.edu Tue Sep 17 06:51:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Tue Sep 17 06:51:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200209171150.GAA29318@morpheus.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.44 -> 1.45 --- Log message: Don't print global variable definitions twice! Sun's pathetic compiler never complained about this. --- Diffs of the changes: Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.44 llvm/lib/CWriter/Writer.cpp:1.45 --- llvm/lib/CWriter/Writer.cpp:1.44 Sun Sep 15 16:51:04 2002 +++ llvm/lib/CWriter/Writer.cpp Tue Sep 17 06:50:38 2002 @@ -522,11 +522,13 @@ // Global variable declarations... if (!M->gempty()) { - Out << "\n/* Global Variable Declarations */\n"; + Out << "\n/* External Global Variable Declarations */\n"; for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) { - Out << (I->hasExternalLinkage() ? "extern " : "static "); - printType(I->getType()->getElementType(), getValueName(I)); - Out << ";\n"; + if (I->hasExternalLinkage()) { + Out << "extern "; + printType(I->getType()->getElementType(), getValueName(I)); + Out << ";\n"; + } } } @@ -539,11 +541,13 @@ } } - // Output the global variable contents... + // Output the global variable definitions and contents... if (!M->gempty()) { - Out << "\n\n/* Global Data */\n"; + Out << "\n\n/* Global Variable Definitions and Initialization */\n"; for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) { - if (I->hasInternalLinkage()) Out << "static "; + if (I->hasExternalLinkage()) + continue; // printed above! + Out << "static "; printType(I->getType()->getElementType(), getValueName(I)); if (I->hasInitializer()) { From lattner at cs.uiuc.edu Tue Sep 17 11:48:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Sep 17 11:48:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/WritingAnLLVMPass.html Message-ID: <200209171647.LAA04441@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: WritingAnLLVMPass.html updated: 1.9 -> 1.10 --- Log message: Fix typeo --- Diffs of the changes: Index: llvm/www/docs/WritingAnLLVMPass.html diff -u llvm/www/docs/WritingAnLLVMPass.html:1.9 llvm/www/docs/WritingAnLLVMPass.html:1.10 --- llvm/www/docs/WritingAnLLVMPass.html:1.9 Mon Sep 16 17:37:56 2002 +++ llvm/www/docs/WritingAnLLVMPass.html Tue Sep 17 11:47:06 2002 @@ -1139,7 +1139,7 @@


Multithreaded LLVM

@@ -718,17 +717,59 @@ BB->getInstList().erase(I);

-


Replacing an Instruction with another Value

    - @@ -1575,6 +1616,6 @@ Chris Lattner -Last modified: Tue Sep 17 17:41:54 CDT 2002 +Last modified: Tue Sep 17 22:16:24 CDT 2002 From lattner at apoc.cs.uiuc.edu Tue Sep 17 22:23:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Tue Sep 17 22:23:00 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200209180322.g8I3MVG16220@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.51 -> 1.52 --- Log message: Add support for the new PARALLEL_DIRS option --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.51 llvm/Makefile.common:1.52 --- llvm/Makefile.common:1.51 Tue Sep 17 18:45:34 2002 +++ llvm/Makefile.common Tue Sep 17 22:22:27 2002 @@ -13,10 +13,15 @@ # example, ../.. for two levels deep. # # 2. DIRS - A list of subdirectories to be built. Fake targets are set up -# so that each of the targets "all", "install", and "clean" each build. -# the subdirectories before the local target. +# so that each of the targets "all", "install", and "clean" each build +# the subdirectories before the local target. DIRS are guaranteed to be +# built in order. +# +# 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be +# built in any order. All DIRS are built in order before PARALLEL_DIRS are +# built, which are then built in any order. # -# 3. Source - If specified, this sets the source code filenames. If this +# 4. Source - If specified, this sets the source code filenames. If this # is not set, it defaults to be all of the .cpp, .c, .y, and .l files # in the current directory. Also, if you want to build files in addition # to the local files, you can use the ExtraSource variable @@ -174,15 +179,23 @@ #--------------------------------------------------------- -# Handle the DIRS option +# Handle the DIRS and PARALLEL_DIRS options #--------------------------------------------------------- -ifdef DIRS # Only do this if we're using DIRS! - -all install clean:: +all install clean :: $(VERB) for dir in ${DIRS}; do \ (cd $$dir; $(MAKE) $@) || exit 1; \ done + +# Handle PARALLEL_DIRS +ifdef PARALLEL_DIRS +all :: $(addsuffix /.makeall , $(PARALLEL_DIRS)) +install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS)) +clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS)) + +%/.makeall %/.makeinstall %/.makeclean: + $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@) + endif #--------------------------------------------------------- From lattner at apoc.cs.uiuc.edu Tue Sep 17 22:26:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Tue Sep 17 22:26:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Makefile Message-ID: <200209180325.g8I3PxE16515@apoc.cs.uiuc.edu> Changes in directory llvm/lib: Makefile updated: 1.10 -> 1.11 --- Log message: Compile sub-directories in parallel, because they don't have interdependencies --- Diffs of the changes: Index: llvm/lib/Makefile diff -u llvm/lib/Makefile:1.10 llvm/lib/Makefile:1.11 --- llvm/lib/Makefile:1.10 Tue Aug 27 17:05:53 2002 +++ llvm/lib/Makefile Tue Sep 17 22:25:55 2002 @@ -1,6 +1,6 @@ LEVEL = .. -DIRS = VMCore Analysis Transforms AsmParser Bytecode Support CodeGen Target CWriter Reoptimizer +PARALLEL_DIRS = VMCore Analysis Transforms AsmParser Bytecode Support CodeGen Target CWriter Reoptimizer include $(LEVEL)/Makefile.common From lattner at apoc.cs.uiuc.edu Tue Sep 17 22:26:02 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Tue Sep 17 22:26:02 2002 Subject: [llvm-commits] CVS: llvm/tools/Makefile Message-ID: <200209180326.g8I3Q1f16522@apoc.cs.uiuc.edu> Changes in directory llvm/tools: Makefile updated: 1.13 -> 1.14 --- Log message: Compile sub-directories in parallel, because they don't have interdependencies --- Diffs of the changes: Index: llvm/tools/Makefile diff -u llvm/tools/Makefile:1.13 llvm/tools/Makefile:1.14 --- llvm/tools/Makefile:1.13 Wed Jul 31 19:01:33 2002 +++ llvm/tools/Makefile Tue Sep 17 22:25:58 2002 @@ -1,5 +1,5 @@ LEVEL = .. -DIRS = as dis opt gccas llc link lli gccld analyze extract +PARALLEL_DIRS = as dis opt gccas llc link lli gccld analyze extract include $(LEVEL)/Makefile.common From ashukla at cs.uiuc.edu Tue Sep 17 22:56:01 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Tue Sep 17 22:56:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp Message-ID: <200209180355.WAA14309@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths: RetracePath.cpp added (r1.1) --- Log message: split retracing into a separate file --- Diffs of the changes: From ashukla at cs.uiuc.edu Tue Sep 17 23:30:01 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Tue Sep 17 23:30:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200209180429.XAA15126@trinity.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.52 -> 1.53 --- Log message: corrected small bug, to handle when DIRS is not defined. --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.52 llvm/Makefile.common:1.53 --- llvm/Makefile.common:1.52 Tue Sep 17 22:22:27 2002 +++ llvm/Makefile.common Tue Sep 17 23:29:30 2002 @@ -182,10 +182,12 @@ # Handle the DIRS and PARALLEL_DIRS options #--------------------------------------------------------- +ifdef DIRS all install clean :: $(VERB) for dir in ${DIRS}; do \ (cd $$dir; $(MAKE) $@) || exit 1; \ done +endif # Handle PARALLEL_DIRS ifdef PARALLEL_DIRS From lattner at cs.uiuc.edu Wed Sep 18 00:15:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed Sep 18 00:15:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209180514.AAA09562@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.28 -> 1.29 --- Log message: Clean up tags, link to the right .h file --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.28 llvm/www/docs/ProgrammersManual.html:1.29 --- llvm/www/docs/ProgrammersManual.html:1.28 Tue Sep 17 22:17:23 2002 +++ llvm/www/docs/ProgrammersManual.html Wed Sep 18 00:14:25 2002 @@ -713,8 +713,8 @@
       Instruction *I = .. ;
    -  BasicBlock *BB = I->getParent();
    -  BB->getInstList().erase(I);
    +  BasicBlock *BB = I->getParent();
    +  BB->getInstList().erase(I);
     

    @@ -724,13 +724,13 @@

    Replacing individual instructions

    Including "llvm/Transforms/Utils/BasicBlock.h +href="/doxygen/BasicBlockUtils_8h-source.html">llvm/Transforms/Utils/BasicBlockUtils.h " permits use of two very useful replace functions: ReplaceInstWithValue and ReplaceInstWithInst.

      -
    • ReplaceInstWithValue +
    • ReplaceInstWithValue

      This function replaces all uses (within a basic block) of a given instruction with a value, and then removes the original instruction. @@ -740,11 +740,11 @@

       AllocaInst* instToReplace = ...;
      -ReplaceInstWithValue(*instToReplace->getParent(), instToReplace,
      +ReplaceInstWithValue(*instToReplace->getParent(), instToReplace,
                            Constant::getNullValue(PointerType::get(Type::IntTy)));
       
      -
    • ReplaceInstWithInst +
    • ReplaceInstWithInst

      This function replaces a particular instruction with another instruction. The following example illustrates the replacement of one @@ -752,7 +752,7 @@

       AllocaInst* instToReplace = ...;
      -ReplaceInstWithInst(*instToReplace->getParent(), instToReplace,
      +ReplaceInstWithInst(*instToReplace->getParent(), instToReplace,
                           new AllocaInst(Type::IntTy, 0, "ptrToReplacedInt");
       
      From vadve at cs.uiuc.edu Wed Sep 18 06:56:01 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Wed Sep 18 06:56:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200209181155.GAA02740@morpheus.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.53 -> 1.54 --- Log message: Strip tools/Debug/ executables by default. Define KEEP_SYMBOLS to turn off stripping for any executable. --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.53 llvm/Makefile.common:1.54 --- llvm/Makefile.common:1.53 Tue Sep 17 23:29:30 2002 +++ llvm/Makefile.common Wed Sep 18 06:55:13 2002 @@ -131,6 +131,13 @@ PROFILE = endif +# By default, strip symbol information from executable +ifdef KEEP_SYMBOLS +STRIP = +else +STRIP = -s +endif + # Allow gnu extensions... CPPFLAGS += -D_GNU_SOURCE @@ -149,7 +156,7 @@ else Link := $(CXX) $(PROFILE) endif -LinkG := $(Link) -g -L $(LIBDEBUG) +LinkG := $(Link) -g -L $(LIBDEBUG) $(STRIP) LinkO := $(Link) -O3 -L $(LIBRELEASE) # Create one .o file from a bunch of .o files... From vadve at cs.uiuc.edu Wed Sep 18 06:56:08 2002 From: vadve at cs.uiuc.edu (vadve at cs.uiuc.edu) Date: Wed Sep 18 06:56:08 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200209181155.GAA02758@morpheus.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.30 -> 1.31 --- Log message: KEEP_SYMBOLS by default. --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.30 llvm/tools/opt/Makefile:1.31 --- llvm/tools/opt/Makefile:1.30 Tue Sep 17 15:40:24 2002 +++ llvm/tools/opt/Makefile Wed Sep 18 06:55:44 2002 @@ -8,5 +8,7 @@ transformutils vmcore support TOOLLINKOPTS = -ldl $(ExportSymbols) +KEEP_SYMBOLS = 1 + include $(LEVEL)/Makefile.common From lattner at apoc.cs.uiuc.edu Wed Sep 18 14:33:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Wed Sep 18 14:33:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.config Message-ID: <200209181932.g8IJWLE12794@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.config updated: 1.3 -> 1.4 --- Log message: Change Makefile.config to support building on the group's linux machines --- Diffs of the changes: Index: llvm/Makefile.config diff -u llvm/Makefile.config:1.3 llvm/Makefile.config:1.4 --- llvm/Makefile.config:1.3 Tue Sep 17 18:24:57 2002 +++ llvm/Makefile.config Wed Sep 18 14:32:17 2002 @@ -10,8 +10,8 @@ # Set LLVM_OBJ_DIR to "." if you do not want to use a separate place for # object files. # -# LLVM_OBJ_DIR = . -LLVM_OBJ_DIR = /shared/$(shell whoami) +#LLVM_OBJ_DIR = . +LLVM_OBJ_DIR = /localhome/$(shell whoami) # Path to executable for Burg # @@ -24,3 +24,10 @@ # Path to location for LLVM front-end # LLVMGCCDIR = /home/vadve/lattner/cvs/gcc_install + +# Path to the C++ compiler to use. Under linux, for some reason the compiler +# driver wants to search the PATH to find the system assembler, which breaks if +# the LLVM assembler is in our path. Hack it to use the assembler in /usr/bin +# directly. +# +CXX = PATH=/usr/bin /usr/dcs/software/evaluation/bin/g++ From vadve at psmith.cs.uiuc.edu Wed Sep 18 18:23:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Wed Sep 18 18:23:01 2002 Subject: [llvm-commits] CVS: llvm/utils/makellvm Message-ID: <200209182322.g8INMUb13846@psmith.cs.uiuc.edu> Changes in directory llvm/utils: makellvm updated: 1.3 -> 1.4 --- Log message: Fix to work in new location (utils/) and to use gmake instead of gnumake since gnumake doesn't exist on our new spiffy Linux machines. --- Diffs of the changes: Index: llvm/utils/makellvm diff -u llvm/utils/makellvm:1.3 llvm/utils/makellvm:1.4 --- llvm/utils/makellvm:1.3 Sun Sep 15 13:22:47 2002 +++ llvm/utils/makellvm Wed Sep 18 18:22:27 2002 @@ -1,8 +1,8 @@ #!/bin/csh -f ## LLVMDIR is simply the directory where this script resides! -set THISEXEC = $0 ## cannot use :h on $0 for some reason -set LLVMDIR = $THISEXEC:h +set thisExec = $0 ## cannot use :h on $0 for some reason +set LLVMDIR = `echo {$thisExec:h} | sed 's/\/utils$//'` set EXEC = opt if ($#argv > 0) then @@ -13,4 +13,4 @@ set EXEC = $argv[1] endif -gnumake && (cd $LLVMDIR/tools/$EXEC && gnumake) +gmake && (cd $LLVMDIR/tools/$EXEC && gmake) From lattner at apoc.cs.uiuc.edu Wed Sep 18 18:30:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Wed Sep 18 18:30:00 2002 Subject: [llvm-commits] CVS: llvm/tools/dis/dis.cpp Message-ID: <200209182330.g8INU8v07408@apoc.cs.uiuc.edu> Changes in directory llvm/tools/dis: dis.cpp updated: 1.25 -> 1.26 --- Log message: Avoid deleting the ostream more than once. --- Diffs of the changes: Index: llvm/tools/dis/dis.cpp diff -u llvm/tools/dis/dis.cpp:1.25 llvm/tools/dis/dis.cpp:1.26 --- llvm/tools/dis/dis.cpp:1.25 Fri Aug 30 19:30:15 2002 +++ llvm/tools/dis/dis.cpp Wed Sep 18 18:30:05 2002 @@ -106,7 +106,7 @@ switch (WriteMode) { case llvm: // Output LLVM assembly - Passes.add(new PrintModulePass(Out, Out != &std::cout)); + Passes.add(new PrintModulePass(Out, false)); break; case c: // Convert LLVM to C Passes.add(createWriteToCPass(*Out)); From lattner at apoc.cs.uiuc.edu Wed Sep 18 23:24:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Wed Sep 18 23:24:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2002-09-18-UnionProblem.c Message-ID: <200209190424.g8J4O2u09537@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2002-09-18-UnionProblem.c added (r1.1) --- Log message: New testcase for a bug fixed in the GCC SSA construction algorithm: http://gcc.gnu.org/ml/gcc/2002-09/msg00760.html --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 09:55:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 09:55:01 2002 Subject: [llvm-commits] CVS: llvm/utils/makellvm Message-ID: <200209191454.g8JEsuG17838@psmith.cs.uiuc.edu> Changes in directory llvm/utils: makellvm updated: 1.4 -> 1.5 --- Log message: Add support for passing in arbitrary flags to gmake (except -n and -h which are interpreted by this script). --- Diffs of the changes: Index: llvm/utils/makellvm diff -u llvm/utils/makellvm:1.4 llvm/utils/makellvm:1.5 --- llvm/utils/makellvm:1.4 Wed Sep 18 18:22:27 2002 +++ llvm/utils/makellvm Thu Sep 19 09:54:53 2002 @@ -1,16 +1,46 @@ #!/bin/csh -f +set pstatus = 0 +onintr cleanup +alias usage 'echo "USAGE: $0:t [-h] [-n] [gmake-flag...] [toolname]"; set pstatus = 1; goto cleanup' + ## LLVMDIR is simply the directory where this script resides! set thisExec = $0 ## cannot use :h on $0 for some reason set LLVMDIR = `echo {$thisExec:h} | sed 's/\/utils$//'` set EXEC = opt +set GMAKE_OPTS = "" + +set doit = 1 +unset options_done +while ( !( $?options_done ) && ($#argv > 0)) + switch ($argv[1]) + case -h : + usage + case -n : + set doit = 0; shift argv; breaksw + case -* : + set GMAKE_OPTS = ( $GMAKE_OPTS $argv[1] ); shift argv; breaksw + default : + set options_done; breaksw + endsw +end if ($#argv > 0) then - if ($argv[1] == "-h") then - echo 'USAGE: makellvm [toolname] (toolname defaults to "opt").' - exit 0 - endif set EXEC = $argv[1] endif -gmake && (cd $LLVMDIR/tools/$EXEC && gmake) +set CMD = "gmake $GMAKE_OPTS && (cd $LLVMDIR/tools/$EXEC && gmake $GMAKE_OPTS)" + +if ($doit == 1) then + csh -f -c "$CMD" +else + echo '(NOT EXECUTING) COMMAND:' + echo " $CMD" +endif + + +#========================================================= +# CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED +#========================================================= +cleanup: + exit($pstatus) From lattner at apoc.cs.uiuc.edu Thu Sep 19 11:07:02 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 11:07:02 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200209191606.g8JG6Vm11641@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.58 -> 1.59 --- Log message: Indent a comment right, add a new one --- Diffs of the changes: Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.58 llvm/tools/llc/llc.cpp:1.59 --- llvm/tools/llc/llc.cpp:1.58 Mon Sep 16 11:35:34 2002 +++ llvm/tools/llc/llc.cpp Thu Sep 19 11:06:28 2002 @@ -242,8 +242,8 @@ } Out = new std::ofstream(OutputFilename.c_str()); - // Make sure that the Out file gets unlink'd from the disk if we get a - // SIGINT + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT RemoveFileOnSignal(OutputFilename); } else @@ -286,6 +286,7 @@ // Run our queue of passes all at once now, efficiently. Passes.run(*M.get()); + // Delete the ostream if it's not a stdout stream if (Out != &std::cout) delete Out; return 0; From lattner at apoc.cs.uiuc.edu Thu Sep 19 11:13:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 11:13:01 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200209191612.g8JGCMp12160@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.37 -> 1.38 --- Log message: Make sure that we abort if an error happens as early as neccesary. Before it was possible for the passmanager to continue running passes after the verifier even if the module was not well formed. --- Diffs of the changes: Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.37 llvm/lib/VMCore/Verifier.cpp:1.38 --- llvm/lib/VMCore/Verifier.cpp:1.37 Mon Sep 9 23:52:59 2002 +++ llvm/lib/VMCore/Verifier.cpp Thu Sep 19 11:12:19 2002 @@ -48,7 +48,6 @@ #include "llvm/Support/InstVisitor.h" #include "Support/STLExtras.h" #include -#include namespace { // Anonymous namespace for class @@ -67,6 +66,13 @@ bool doInitialization(Module &M) { verifySymbolTable(M.getSymbolTable()); + + // If this is a real pass, in a pass manager, we must abort before + // returning back to the pass manager, or else the pass manager may try to + // run other passes on the broken module. + // + if (RealPass) + abortIfBroken(); return false; } @@ -74,6 +80,14 @@ // Get dominator information if we are being run by PassManager if (RealPass) DS = &getAnalysis(); visit(F); + + // If this is a real pass, in a pass manager, we must abort before + // returning back to the pass manager, or else the pass manager may try to + // run other passes on the broken module. + // + if (RealPass) + abortIfBroken(); + return false; } @@ -83,10 +97,8 @@ if (I->isExternal() && I->hasInternalLinkage()) CheckFailed("Function Declaration has Internal Linkage!", I); - if (Broken && AbortBroken) { - std::cerr << "Broken module found, compilation aborted!\n"; - abort(); - } + // If the module is broken, abort at this time. + abortIfBroken(); return false; } @@ -94,6 +106,16 @@ AU.setPreservesAll(); if (RealPass) AU.addRequired(); + } + + // abortIfBroken - If the module is broken and we are supposed to abort on + // this condition, do so. + // + void abortIfBroken() const { + if (Broken && AbortBroken) { + std::cerr << "Broken module found, compilation aborted!\n"; + abort(); + } } // Verification methods... From lattner at apoc.cs.uiuc.edu Thu Sep 19 11:55:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 11:55:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2002-09-19-StarInLabel.c Message-ID: <200209191655.g8JGt0S26283@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2002-09-19-StarInLabel.c added (r1.1) --- Log message: New testcase that breaks the CFE. --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 13:24:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 13:24:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs Message-ID: <200209191823.g8JINHD22483@psmith.cs.uiuc.edu> Changes in directory llvm/test/Programs: Makefile.programs updated: 1.12 -> 1.13 --- Log message: Add flag RUN_GCC_ONLY to build only .ll files for all .c files. --- Diffs of the changes: Index: llvm/test/Programs/Makefile.programs diff -u llvm/test/Programs/Makefile.programs:1.12 llvm/test/Programs/Makefile.programs:1.13 --- llvm/test/Programs/Makefile.programs:1.12 Tue Aug 27 10:40:09 2002 +++ llvm/test/Programs/Makefile.programs Thu Sep 19 13:23:14 2002 @@ -42,6 +42,7 @@ PREFIXED_PROGRAMS_TO_TEST := $(addprefix Output/,$(PROGRAMS_TO_TEST)) # Output produced by programs run +GCCOUTPUT := $(addsuffix .ll, $(addprefix Output/,$(Source:.c=))) NATOUTPUT := $(addsuffix .out-nat, $(PREFIXED_PROGRAMS_TO_TEST)) LLIOUTPUT := $(addsuffix .out-lli, $(PREFIXED_PROGRAMS_TO_TEST)) LLCOUTPUT := $(addsuffix .out-llc, $(PREFIXED_PROGRAMS_TO_TEST)) @@ -57,6 +58,13 @@ # Build diffs for LLI and LLC output... .PRECIOUS: Output/%.diff-lli Output/%.diff-llc Output/%.diff-cbe + +ifdef RUN_GCC_ONLY +DISABLE_LLC = 1 +DISABLE_CBE_DIFFS = 1 +ENABLE_LLI_DIFFS = +all:: $(GCCOUTPUT) +endif ifndef DISABLE_LLC all:: $(LLCOUTPUT) From vadve at psmith.cs.uiuc.edu Thu Sep 19 13:46:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 13:46:00 2002 Subject: [llvm-commits] CVS: llvm/test/Makefile.tests Message-ID: <200209191845.g8JIjE523183@psmith.cs.uiuc.edu> Changes in directory llvm/test: Makefile.tests updated: 1.40 -> 1.41 --- Log message: Avoid Solaris-specific defines. --- Diffs of the changes: Index: llvm/test/Makefile.tests diff -u llvm/test/Makefile.tests:1.40 llvm/test/Makefile.tests:1.41 --- llvm/test/Makefile.tests:1.40 Thu Aug 29 22:27:36 2002 +++ llvm/test/Makefile.tests Thu Sep 19 13:45:11 2002 @@ -40,11 +40,11 @@ # Native Tool Definitions NATGCC = /usr/dcs/software/supported/bin/gcc -CC = /opt/SUNWspro/bin/cc -AS = /opt/SUNWspro/bin/cc -DIS = /usr/ccs/bin/dis +## CC = /opt/SUNWspro/bin/cc +## AS = /opt/SUNWspro/bin/cc +## DIS = /usr/ccs/bin/dis +## CFLAGS += -g -xarch=v9 CP = /bin/cp -f -CFLAGS += -g -xarch=v9 ifeq ($(TRACE), yes) From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:06:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:06:00 2002 Subject: [llvm-commits] CVS: llvm/test/Makefile.tests Message-ID: <200209191906.g8JJ68606517@apoc.cs.uiuc.edu> Changes in directory llvm/test: Makefile.tests updated: 1.41 -> 1.42 --- Log message: It turns out that the cannonical name for the llvm-gcc compiler is, well llvm-gcc, not gcc. --- Diffs of the changes: Index: llvm/test/Makefile.tests diff -u llvm/test/Makefile.tests:1.41 llvm/test/Makefile.tests:1.42 --- llvm/test/Makefile.tests:1.41 Thu Sep 19 13:45:11 2002 +++ llvm/test/Makefile.tests Thu Sep 19 14:06:05 2002 @@ -20,7 +20,7 @@ # LLVM Tool Definitions... # -LCC = $(LLVMGCCDIR)/bin/gcc +LCC = $(LLVMGCCDIR)/bin/llvm-gcc LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1 TOOLS = $(BUILD_ROOT_TOP)/tools/Debug LLI = $(TOOLS)/lli From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:22:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:22:00 2002 Subject: [llvm-commits] CVS: llvm/Makefile.config Message-ID: <200209191921.g8JJLLG07008@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.config updated: 1.4 -> 1.5 --- Log message: Switch over to using the x86 version of the C frontend, by default. --- Diffs of the changes: Index: llvm/Makefile.config diff -u llvm/Makefile.config:1.4 llvm/Makefile.config:1.5 --- llvm/Makefile.config:1.4 Wed Sep 18 14:32:17 2002 +++ llvm/Makefile.config Thu Sep 19 14:21:18 2002 @@ -23,7 +23,7 @@ # Path to location for LLVM front-end # -LLVMGCCDIR = /home/vadve/lattner/cvs/gcc_install +LLVMGCCDIR = /home/vadve/lattner/cvs/gcc_install_x86 # Path to the C++ compiler to use. Under linux, for some reason the compiler # driver wants to search the PATH to find the system assembler, which breaks if From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:23:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:23:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/LeakDetector.cpp Message-ID: <200209191922.g8JJME107021@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: LeakDetector.cpp updated: 1.2 -> 1.3 --- Log message: Add an optimization to support the most common access pattern for the library. This speeds debug builds up significantly. --- Diffs of the changes: Index: llvm/lib/Support/LeakDetector.cpp diff -u llvm/lib/Support/LeakDetector.cpp:1.2 llvm/lib/Support/LeakDetector.cpp:1.3 --- llvm/lib/Support/LeakDetector.cpp:1.2 Tue Sep 10 10:43:30 2002 +++ llvm/lib/Support/LeakDetector.cpp Thu Sep 19 14:22:11 2002 @@ -12,6 +12,13 @@ static std::set *Objects = 0; static std::set *LLVMObjects = 0; +// Because the most common usage pattern, by far, is to add a garbage object, +// then remove it immediately, we optimize this case. When an object is added, +// it is not added to the set immediately, it is added to the CachedValue Value. +// If it is immediately removed, no set search need be performed. +// +static const Value *CachedValue; + void LeakDetector::addGarbageObjectImpl(void *Object) { if (Objects == 0) Objects = new std::set(); @@ -25,18 +32,28 @@ } void LeakDetector::addGarbageObjectImpl(const Value *Object) { - if (LLVMObjects == 0) - LLVMObjects = new std::set(); - assert(LLVMObjects->count(Object) == 0 && "Object already in set!"); - LLVMObjects->insert(Object); + if (CachedValue) { + if (LLVMObjects == 0) + LLVMObjects = new std::set(); + assert(LLVMObjects->count(CachedValue) == 0 && "Object already in set!"); + LLVMObjects->insert(CachedValue); + } + CachedValue = Object; } void LeakDetector::removeGarbageObjectImpl(const Value *Object) { - if (LLVMObjects) + if (Object == CachedValue) + CachedValue = 0; // Cache hit! + else if (LLVMObjects) LLVMObjects->erase(Object); } void LeakDetector::checkForGarbageImpl(const std::string &Message) { + if (CachedValue) // Flush the cache to the set... + addGarbageObjectImpl((Value*)0); + + assert(CachedValue == 0 && "No value should be cached anymore!"); + if ((Objects && !Objects->empty()) || (LLVMObjects && !LLVMObjects->empty())){ std::cerr << "Leaked objects found: " << Message << "\n"; From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:23:03 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:23:03 2002 Subject: [llvm-commits] CVS: llvm/test/Makefile.tests Message-ID: <200209191922.g8JJMXR07036@apoc.cs.uiuc.edu> Changes in directory llvm/test: Makefile.tests updated: 1.42 -> 1.43 --- Log message: Point gccld to the correct library directory. --- Diffs of the changes: Index: llvm/test/Makefile.tests diff -u llvm/test/Makefile.tests:1.42 llvm/test/Makefile.tests:1.43 --- llvm/test/Makefile.tests:1.42 Thu Sep 19 14:06:05 2002 +++ llvm/test/Makefile.tests Thu Sep 19 14:22:30 2002 @@ -27,7 +27,7 @@ LLC = $(TOOLS)/llc LAS = $(TOOLS)/as LGCCAS = $(TOOLS)/gccas -LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/ +LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib LDIS = $(TOOLS)/dis LOPT = $(TOOLS)/opt LLINK = $(TOOLS)/link From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:43:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:43:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200209191942.g8JJgRU07175@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.54 -> 1.55 --- Log message: Move the burg option out of Makefile.config into Makefile.common since it no longer needs to be configured. --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.54 llvm/Makefile.common:1.55 --- llvm/Makefile.common:1.54 Wed Sep 18 06:55:13 2002 +++ llvm/Makefile.common Thu Sep 19 14:42:24 2002 @@ -121,8 +121,12 @@ # Compilation options... #--------------------------------------------------------- -# Special tools used while building -RunBurg := $(BURG) $(BURG_OPTS) +# Special tools used while building the LLVM tree. Burg is built as part of the +# utils directory. +# +BURG := $(LEVEL)/utils/Burg/burg +RunBurg := $(BURG) $(BURG_OPTS) + # Enable this for profiling support with 'gprof' ifdef ENABLE_PROFILING @@ -181,8 +185,8 @@ Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l) Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source))))) -ObjectsO = $(addprefix $(BUILD_ROOT)/Release/,$(Objs))) -ObjectsG = $(addprefix $(BUILD_ROOT)/Debug/,$(Objs)) +ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs))) +ObjectsG := $(addprefix $(BUILD_ROOT)/Debug/,$(Objs)) #--------------------------------------------------------- From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:44:00 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:44:00 2002 Subject: [llvm-commits] CVS: llvm/Makefile.config Message-ID: <200209191943.g8JJhXC07188@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.config updated: 1.5 -> 1.6 --- Log message: * Move the burg option into Makefile.common, since it is no longer configurable * Makefile.config now should only specify the location of the gcc frontend if it is not in the place specified by the platform makefile. --- Diffs of the changes: Index: llvm/Makefile.config diff -u llvm/Makefile.config:1.5 llvm/Makefile.config:1.6 --- llvm/Makefile.config:1.5 Thu Sep 19 14:21:18 2002 +++ llvm/Makefile.config Thu Sep 19 14:43:29 2002 @@ -13,17 +13,15 @@ #LLVM_OBJ_DIR = . LLVM_OBJ_DIR = /localhome/$(shell whoami) -# Path to executable for Burg -# -BURG = $(LEVEL)/utils/Burg/burg - -# Path to location for purify +# Path to location for purify, this is only needed if you build with +# ENABLE_PURIFY=1 # PURIFY = /usr/dcs/applications/purify/bin/purify -# Path to location for LLVM front-end -# -LLVMGCCDIR = /home/vadve/lattner/cvs/gcc_install_x86 +# Path to location for LLVM front-end this should only be specified here if you +# want to override the value set in Makefile.$(uname) +# +#LLVMGCCDIR := /home/vadve/lattner/cvs/gcc_install_x86 # Path to the C++ compiler to use. Under linux, for some reason the compiler # driver wants to search the PATH to find the system assembler, which breaks if From lattner at apoc.cs.uiuc.edu Thu Sep 19 14:45:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:45:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.SunOS Makefile.Linux Message-ID: <200209191944.g8JJiVA07204@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.SunOS updated: 1.1 -> 1.2 Makefile.Linux updated: 1.1 -> 1.2 --- Log message: Platform specific makefiles specify where to find the GCC frontend for their architecture. The location of the GCC frontend may be overridden by the Makefile.config file. --- Diffs of the changes: Index: llvm/Makefile.SunOS diff -u llvm/Makefile.SunOS:1.1 llvm/Makefile.SunOS:1.2 --- llvm/Makefile.SunOS:1.1 Fri Sep 13 17:14:46 2002 +++ llvm/Makefile.SunOS Thu Sep 19 14:44:28 2002 @@ -15,4 +15,9 @@ # ExportSymbols := - +# Path to location for LLVM front-end for this architecture. This setting may +# be overriden by the Makefile.config option, and should not override it if set. +# +ifndef LLVMGCCDIR +LLVMGCCDIR := /home/vadve/lattner/cvs/gcc_install +endif Index: llvm/Makefile.Linux diff -u llvm/Makefile.Linux:1.1 llvm/Makefile.Linux:1.2 --- llvm/Makefile.Linux:1.1 Fri Sep 13 17:14:46 2002 +++ llvm/Makefile.Linux Thu Sep 19 14:44:28 2002 @@ -15,4 +15,9 @@ # ExportSymbols := -Wl,--export-dynamic - +# Path to location for LLVM front-end for this architecture. This setting may +# be overriden by the Makefile.config option, and should not override it if set. +# +ifndef LLVMGCCDIR +LLVMGCCDIR := /home/vadve/lattner/cvs/gcc_install_x86 +endif From lattner at cs.uiuc.edu Thu Sep 19 14:57:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 14:57:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/GettingStarted.html Message-ID: <200209191956.OAA11018@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: GettingStarted.html updated: 1.6 -> 1.7 --- Log message: * Burg is no longer configured in Makefile.config * CXX now is configured in Makefile.config (optionally) * The GCC command is now no longer bin/gcc, it's bin/llvm-gcc * Minor cleanups --- Diffs of the changes: Index: llvm/www/docs/GettingStarted.html diff -u llvm/www/docs/GettingStarted.html:1.6 llvm/www/docs/GettingStarted.html:1.7 --- llvm/www/docs/GettingStarted.html:1.6 Fri Sep 6 11:26:13 2002 +++ llvm/www/docs/GettingStarted.html Thu Sep 19 14:56:53 2002 @@ -55,7 +55,7 @@ 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 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. @@ -83,7 +83,7 @@

    See Setting up your environment on tips to - simplify working with the llvm front-end and compiled tools. See the + 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. @@ -132,6 +132,7 @@ of LLVM (if the default values do not already match your system):

    @@ -150,28 +149,28 @@

    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. + 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, - just set this variable to ".". +

    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.) + 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/gcc
    +       alias llvmgcc LLVMGCCDIR/bin/llvm-gcc
     
            # Make the LLVM tools easy to use...
            setenv PATH LLVM_OBJ_DIR/tools/Debug:${PATH}
    @@ -179,7 +178,7 @@
         The llvmgcc alias is useful because the C compiler is not
         included in the CVS tree you just checked out.
         
    -    

    The other LLVM LLVM tools are part of the LLVM +

    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.

    @@ -187,17 +186,17 @@

    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 +

    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 /shared directory, follow the - instructions in the section about Setting Up Your + If you get an error talking about a /localhome directory, follow + the instructions in the section about Setting Up Your Environment. @@ -249,7 +248,7 @@
    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, + different portions of LLVM: Analysis, CodeGen, Reoptimizer, Target, Transforms, etc...
    2. llvm/include/Support - This directory contains generic @@ -276,7 +275,7 @@
      llvm/lib/ByteCode/
      This directory holds code for reading and write LLVM bytecode. -
      llvm/lib/CWrite/
      This directory implements the LLVM to C +
      llvm/lib/CWriter/
      This directory implements the LLVM to C converter.
      llvm/lib/Analysis/
      This directory contains a variety of @@ -325,10 +324,10 @@
      as
      The assembler transforms the human readable - llvm assembly to llvm bytecode.

      + LLVM assembly to LLVM bytecode.

      -

      dis
      The disassembler transforms the llvm bytecode - to human readable llvm assembly. Additionally it can convert LLVM +
      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 @@ -361,7 +360,7 @@ frontend itself did not have to be modified to interface to a "wierd" assembler.

      -

      gccld
      gccld links together several llvm +
      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 @@ -369,7 +368,7 @@ interfacing with the GCC frontend.

    -
    opt
    opt reads llvm bytecode, applies a +
    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 @@ -461,7 +460,7 @@ -Last modified: Tue Aug 13 16:09:25 CDT 2002 +Last modified: Thu Sep 19 14:55:19 CDT 2002 From lattner at apoc.cs.uiuc.edu Thu Sep 19 15:00:03 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 15:00:03 2002 Subject: [llvm-commits] CVS: llvm/Makefile.config Message-ID: <200209191959.g8JJxjk07288@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.config updated: 1.6 -> 1.7 --- Log message: Reorder options to be sorted basically by how important they are. --- Diffs of the changes: Index: llvm/Makefile.config diff -u llvm/Makefile.config:1.6 llvm/Makefile.config:1.7 --- llvm/Makefile.config:1.6 Thu Sep 19 14:43:29 2002 +++ llvm/Makefile.config Thu Sep 19 14:59:42 2002 @@ -4,7 +4,14 @@ # values specific to a particular installation of LLVM. #===-----------------------------------------------------------------------==== -# Current working directory, used below +# Path to the C++ compiler to use. This is an optional setting, which defaults +# to whatever your gmake defaults to. +# +# Under Linux, for some reason the compiler driver wants to search the PATH to +# find the system assembler, which breaks if the LLVM assembler is in our path. +# Hack it to use the assembler in /usr/bin directly. +# +CXX = PATH=/usr/bin /usr/dcs/software/evaluation/bin/g++ # 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 @@ -13,19 +20,13 @@ #LLVM_OBJ_DIR = . LLVM_OBJ_DIR = /localhome/$(shell whoami) -# Path to location for purify, this is only needed if you build with -# ENABLE_PURIFY=1 -# -PURIFY = /usr/dcs/applications/purify/bin/purify - # Path to location for LLVM front-end this should only be specified here if you # want to override the value set in Makefile.$(uname) # #LLVMGCCDIR := /home/vadve/lattner/cvs/gcc_install_x86 -# Path to the C++ compiler to use. Under linux, for some reason the compiler -# driver wants to search the PATH to find the system assembler, which breaks if -# the LLVM assembler is in our path. Hack it to use the assembler in /usr/bin -# directly. -# -CXX = PATH=/usr/bin /usr/dcs/software/evaluation/bin/g++ +# Path to location for purify, this is only needed if you build with +# ENABLE_PURIFY=1 +# +PURIFY = /usr/dcs/applications/purify/bin/purify + From lattner at apoc.cs.uiuc.edu Thu Sep 19 15:49:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 15:49:01 2002 Subject: [llvm-commits] CVS: llvm/tools/dis/dis.cpp Message-ID: <200209192048.g8JKmq607970@apoc.cs.uiuc.edu> Changes in directory llvm/tools/dis: dis.cpp updated: 1.26 -> 1.27 --- Log message: Minor non-functionality changing changes. --- Diffs of the changes: Index: llvm/tools/dis/dis.cpp diff -u llvm/tools/dis/dis.cpp:1.26 llvm/tools/dis/dis.cpp:1.27 --- llvm/tools/dis/dis.cpp:1.26 Wed Sep 18 18:30:05 2002 +++ llvm/tools/dis/dis.cpp Thu Sep 19 15:48:48 2002 @@ -106,9 +106,9 @@ switch (WriteMode) { case llvm: // Output LLVM assembly - Passes.add(new PrintModulePass(Out, false)); + Passes.add(new PrintModulePass(Out)); break; - case c: // Convert LLVM to C + case c: // Convert LLVM to C Passes.add(createWriteToCPass(*Out)); break; } From lattner at apoc.cs.uiuc.edu Thu Sep 19 15:50:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 15:50:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Assembly/PrintModulePass.h Message-ID: <200209192049.g8JKnSp07989@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Assembly: PrintModulePass.h updated: 1.11 -> 1.12 --- Log message: Workaround for bug in GCC 3.1.1 iostreams library on sparc. It apprarently isn't flushing an ostream when it is deleted. --- Diffs of the changes: Index: llvm/include/llvm/Assembly/PrintModulePass.h diff -u llvm/include/llvm/Assembly/PrintModulePass.h:1.11 llvm/include/llvm/Assembly/PrintModulePass.h:1.12 --- llvm/include/llvm/Assembly/PrintModulePass.h:1.11 Sat Aug 17 19:37:14 2002 +++ llvm/include/llvm/Assembly/PrintModulePass.h Thu Sep 19 15:49:25 2002 @@ -28,7 +28,7 @@ } bool run(Module &M) { - (*Out) << M; + (*Out) << M << std::flush; return false; } From lattner at apoc.cs.uiuc.edu Thu Sep 19 16:33:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 16:33:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.Linux Message-ID: <200209192132.g8JLWmM08867@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.Linux updated: 1.2 -> 1.3 --- Log message: Don't run llc tests on linux, they won't work. --- Diffs of the changes: Index: llvm/Makefile.Linux diff -u llvm/Makefile.Linux:1.2 llvm/Makefile.Linux:1.3 --- llvm/Makefile.Linux:1.2 Thu Sep 19 14:44:28 2002 +++ llvm/Makefile.Linux Thu Sep 19 16:32:44 2002 @@ -21,3 +21,7 @@ ifndef LLVMGCCDIR LLVMGCCDIR := /home/vadve/lattner/cvs/gcc_install_x86 endif + +# For now we disable all LLC tests, because LLC does not generate x86 code +# +DISABLE_LLC := 1 \ No newline at end of file From lattner at apoc.cs.uiuc.edu Thu Sep 19 16:34:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 16:34:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.config Message-ID: <200209192133.g8JLXEl09212@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.config updated: 1.7 -> 1.8 --- Log message: Native CC compiler has the same problem as CXX compiler. --- Diffs of the changes: Index: llvm/Makefile.config diff -u llvm/Makefile.config:1.7 llvm/Makefile.config:1.8 --- llvm/Makefile.config:1.7 Thu Sep 19 14:59:42 2002 +++ llvm/Makefile.config Thu Sep 19 16:33:10 2002 @@ -13,6 +13,11 @@ # CXX = PATH=/usr/bin /usr/dcs/software/evaluation/bin/g++ +# We have the same problem with the CC binary, which use used by testcases for +# native builds. +# +CC := PATH=/usr/bin $(CC) + # 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. From lattner at apoc.cs.uiuc.edu Thu Sep 19 16:46:01 2002 From: lattner at apoc.cs.uiuc.edu (Chris Lattner) Date: Thu Sep 19 16:46:01 2002 Subject: [llvm-commits] CVS: llvm/test/Makefile.tests Message-ID: <200209192146.g8JLk7J10702@apoc.cs.uiuc.edu> Changes in directory llvm/test: Makefile.tests updated: 1.43 -> 1.44 --- Log message: Reenable these options because they break testing on sparc without them. Conditionalizing them on DISABLE_LLC means they aren't enabled under linux. --- Diffs of the changes: Index: llvm/test/Makefile.tests diff -u llvm/test/Makefile.tests:1.43 llvm/test/Makefile.tests:1.44 --- llvm/test/Makefile.tests:1.43 Thu Sep 19 14:22:30 2002 +++ llvm/test/Makefile.tests Thu Sep 19 16:46:03 2002 @@ -40,11 +40,14 @@ # Native Tool Definitions NATGCC = /usr/dcs/software/supported/bin/gcc -## CC = /opt/SUNWspro/bin/cc -## AS = /opt/SUNWspro/bin/cc -## DIS = /usr/ccs/bin/dis -## CFLAGS += -g -xarch=v9 CP = /bin/cp -f + +ifndef DISABLE_LLC +CC = /opt/SUNWspro/bin/cc +AS = /opt/SUNWspro/bin/cc +DIS = /usr/ccs/bin/dis +CFLAGS += -g -xarch=v9 +endif ifeq ($(TRACE), yes) From ashukla at cs.uiuc.edu Thu Sep 19 18:02:01 2002 From: ashukla at cs.uiuc.edu (Anand Shukla) Date: Thu Sep 19 18:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/Trigger/Trigger.cpp Message-ID: <200209192301.SAA02629@trinity.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer/Trigger: Trigger.cpp updated: 1.8 -> 1.9 --- Log message: Recent Trigger file --- Diffs of the changes: Index: llvm/lib/Reoptimizer/Trigger/Trigger.cpp diff -u llvm/lib/Reoptimizer/Trigger/Trigger.cpp:1.8 llvm/lib/Reoptimizer/Trigger/Trigger.cpp:1.9 --- llvm/lib/Reoptimizer/Trigger/Trigger.cpp:1.8 Sun Sep 15 21:14:33 2002 +++ llvm/lib/Reoptimizer/Trigger/Trigger.cpp Thu Sep 19 18:00:45 2002 @@ -25,6 +25,17 @@ void getBBtrace(vector &vBB, int pathNo, Function *M); +extern "C" void llvmInitializeCounter(int *cnt, int k){ + for(int i=0; i &vBB, int pn){ std::cerr<<"Path no:"<::iterator VVI = vBB.begin(), VVE = vBB.end(); @@ -34,17 +45,22 @@ } -extern "C" void trigger(int mn, int pn, int cnt){ +extern "C" void trigger(int mn, int pn, int *cnt){ static bool initialized = false; //so module is read just once static Module *M; static std::vector funcList; //map of functions + //std::cerr<<"Meth: "< vBB; + + //for(int ppn =0; ppn<8; ppn++){ + //std::vector vBB; + //getBBtrace(vBB, ppn, funcList[mn]); + //printTrace(vBB, ppn); + //} + + //exit(0); + getBBtrace(vBB, pn, funcList[mn]); + + //return;//just measure time to retrace! if(vBB[0] == &funcList[mn]->front() || isa(vBB[vBB.size()-1]->getTerminator())){ @@ -174,7 +199,7 @@ //then read until last 4 int skipIndex = (isCondBranch ? 4:2); - std::cerr<<"From->to"<<(void *)bbInst.first<<"->"<<(void *)(bbInst.second-4*skipIndex)<<"\n"; + //std::cerr<<"From->to"<<(void *)bbInst.first<<"->"<<(void *)(bbInst.second-4*skipIndex)<<"\n"; for(uint64_t addr = bbInst.first, endAddr = bbInst.second; addr<=endAddr-4*skipIndex; addr+=4, instIndex++){ @@ -184,15 +209,15 @@ //handle call instructions later! if(isCallInstr(inst)){ callMap[instIndex] = addr; - std::cerr<<(void *)inst; - std::cerr<<"\t\tcall is index:"< invertedBranch = vm->getInvertedBranch(br1, br2); - //insert ds1, br2, ds2 in the trace (in that order) + //insert (del cmp) ds1, cmp, br2, ds2 in the trace (in that order) //store branches and PCs for later correction in branchMap - trace.push_back(ds1); + unsigned int last_inst = trace[instIndex-1]; + if(invertedBranch.first == 0){ + trace[instIndex-1] = ds1; + trace.push_back(last_inst); + } + else + trace.push_back(ds1); + instIndex++; if(invertedBranch.first != 0){ trace.push_back(invertedBranch.first); @@ -319,28 +351,30 @@ else assert(false && "Branch not handled!"); - assert( (tar1 == bbDest.first || tar2 == bbDest.first) && - "Last BB must point to first BB"); + //assert( (tar1 == bbDest.first || tar2 == bbDest.first) && + // "Last BB must point to first BB"); + assert(tar2 == bbDest.first && "Last BB must point to first BB"); + //insert code - trace.push_back(br1); - branchMap[instIndex] = addrbr1; - if(isBPR(br1)){ - trace.push_back(0); - instIndex++; - } + //trace.push_back(br1); + //branchMap[instIndex] = addrbr1; + //if(isBPR(br1)){ + //trace.push_back(0); + //instIndex++; + //} trace.push_back(ds1); trace.push_back(br2); - branchMap[instIndex+2] = addrbr2; + branchMap[instIndex+1] = addrbr2; if(isBPR(br2)){ trace.push_back(0); instIndex++; } trace.push_back(ds2); - instIndex += 4; + instIndex += 3; } } //is unconditional branch @@ -351,15 +385,15 @@ if(isBranchInstr(instrCheck)){ br1 = instrCheck; addrbr1 = bbInst.second-4; - ds1 = vm->readInstrFrmVm(bbInst.second); + ds1 = vm->readInstrFrmVm(bbInst.second); } else{ trace.push_back(instrCheck); if(isCallInstr(instrCheck)){ callMap[instIndex] = bbInst.second - 4; - std::cerr<<(void *)instrCheck; - std::cerr<<"\t\tcall is index:"<readInstrFrmVm(bbInst.second+4); } - std::cerr<<"Branch: "<<(void *)br1<<"\n"; + //std::cerr<<"Branch: "<<(void *)br1<<"\n"; assert( (isBranchAlways(br1) || isBranchNever(br1) ) && "Unconditional branch: should be branch always, or branch never!"); @@ -388,7 +422,7 @@ else if(isBPR(br1)) tar1 = getBPRTarget(br1, addrbr1); else{ - std::cerr<<(void *)br1<<"\n"; + //std::cerr<<(void *)br1<<"\n"; assert(false && "Branch not handled!"); } @@ -409,7 +443,7 @@ else if(isBPR(br1)) tar1 = getBPRTarget(br1, addrbr1); else{ - std::cerr<<(void *)br1<<"\n"; + //std::cerr<<(void *)br1<<"\n"; assert(false && "Branch not handled!"); } From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:25:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:25:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PreOpts/ Message-ID: <200209200024.g8K0OjQ25938@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PreOpts: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/CodeGen/PreOpts added to the repository --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:30:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:30:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PreOpts/PreSelection.cpp Makefile Message-ID: <200209200029.g8K0TVm25981@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PreOpts: PreSelection.cpp added (r1.1) Makefile added (r1.1) --- Log message: Moving these files from Code/PreSelection to here. Original logs for PreSelection.cpp: revision 1.2 date: 2002/09/17 23:50:32; author: lattner; state: Exp; lines: +1 -3 Don't put default parameter values into .cpp files, it breaks 3.x compilers revision 1.1 date: 2002/09/16 15:31:13; author: vadve; state: Exp; New preselection pass that specializes LLVM code for a target machine, while remaining in legal portable LLVM form and preserving type information and type safety. --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:31:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:31:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PreSelection/Makefile PreSelection.cpp Message-ID: <200209200030.g8K0UnH26010@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PreSelection: Makefile (r1.1) removed PreSelection.cpp (r1.2) removed --- Log message: Files moved to CodeGen/PreOpts. --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:41:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:41:00 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200209200040.g8K0eXh26102@psmith.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.27 -> 1.28 --- Log message: Renamed library preselect to preopts. --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.27 llvm/tools/llc/Makefile:1.28 --- llvm/tools/llc/Makefile:1.27 Tue Sep 17 15:40:22 2002 +++ llvm/tools/llc/Makefile Thu Sep 19 19:38:30 2002 @@ -1,9 +1,11 @@ LEVEL = ../.. TOOLNAME = llc -USEDLIBS = mapping sparc target.a regalloc sched select preselect target.a \ +USEDLIBS = mapping sparc target.a regalloc sched select preopts postopts.a target.a \ instrument livevar bcreader bcwriter ipo ipa.a datastructure.a \ scalaropts transforms analysis transformutils vmcore support TOOLLINKOPTS = -ldl $(ExportSymbols) + +KEEP_SYMBOLS = 1 include $(LEVEL)/Makefile.common From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:42:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:42:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PostOpts/ Message-ID: <200209200041.g8K0f4X26114@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PostOpts: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/CodeGen/PostOpts added to the repository --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:43:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:43:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp Makefile Message-ID: <200209200042.g8K0gE926129@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PostOpts: PeepholeOpts.cpp added (r1.1) Makefile added (r1.1) --- Log message: Peephole optimization pass on final machine code. --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:44:04 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:44:04 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200209200043.g8K0hNc26156@psmith.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.31 -> 1.32 --- Log message: Renamed library preselect to preopts. --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.31 llvm/tools/opt/Makefile:1.32 --- llvm/tools/opt/Makefile:1.31 Wed Sep 18 06:55:44 2002 +++ llvm/tools/opt/Makefile Thu Sep 19 19:43:20 2002 @@ -2,7 +2,7 @@ TOOLNAME = opt USEDLIBS = bcreader bcwriter instrument profpaths \ - sparc target.a mapping regalloc.a sched select preselect \ + sparc target.a mapping regalloc.a sched select preopts postopts.a \ livevar scalaropts \ ipo ipa.a datastructure.a transforms target.a analysis \ transformutils vmcore support From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:46:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:46:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/IGNode.cpp LiveRangeInfo.cpp Message-ID: <200209200045.g8K0joN26183@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: IGNode.cpp updated: 1.7 -> 1.8 LiveRangeInfo.cpp updated: 1.27 -> 1.28 --- Log message: Allow copy coalescing in more cases: if sum of node degrees is more than than #available regs, compute the sum excluding duplicates and if that is less than #regs, go ahead and coalesce. Add method IGNode::getCombinedDegree to count excluding duplicates. --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/IGNode.cpp diff -u llvm/lib/CodeGen/RegAlloc/IGNode.cpp:1.7 llvm/lib/CodeGen/RegAlloc/IGNode.cpp:1.8 --- llvm/lib/CodeGen/RegAlloc/IGNode.cpp:1.7 Sat Sep 14 18:05:33 2002 +++ llvm/lib/CodeGen/RegAlloc/IGNode.cpp Thu Sep 19 19:45:46 2002 @@ -36,3 +36,19 @@ assert( It != AdjList.end() ); // the node must be there AdjList.erase(It); } + +//----------------------------------------------------------------------------- +// Get the number of unique neighbors if these two nodes are merged +//----------------------------------------------------------------------------- + +unsigned +IGNode::getCombinedDegree(const IGNode* otherNode) const +{ + std::vector nbrs(AdjList); + nbrs.insert(nbrs.end(), otherNode->AdjList.begin(), otherNode->AdjList.end()); + sort(nbrs.begin(), nbrs.end()); + std::vector::iterator new_end = unique(nbrs.begin(), nbrs.end()); + return new_end - nbrs.begin(); +} + + Index: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.27 llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.28 --- llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.27 Sat Sep 14 18:05:33 2002 +++ llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp Thu Sep 19 19:45:47 2002 @@ -318,6 +318,12 @@ LROfDef->getUserIGNode()->getNumOfNeighbors() + LROfUse->getUserIGNode()->getNumOfNeighbors(); + if (CombinedDegree > RCOfDef->getNumOfAvailRegs()) { + // get more precise estimate of combined degree + CombinedDegree = LROfDef->getUserIGNode()-> + getCombinedDegree(LROfUse->getUserIGNode()); + } + if (CombinedDegree <= RCOfDef->getNumOfAvailRegs()) { // if both LRs do not have suggested colors if (!(LROfDef->hasSuggestedColor() && @@ -353,7 +359,10 @@ for( ; HMI != LiveRangeMap.end(); ++HMI) { if (HMI->first && HMI->second) { cerr << " Value* " << RAV(HMI->first) << "\t: "; - cerr << "LR# " << HMI->second->getUserIGNode()->getIndex(); + if (IGNode* igNode = HMI->second->getUserIGNode()) + cerr << "LR# " << igNode->getIndex(); + else + cerr << "LR# " << ""; cerr << "\t:Values = "; printSet(*HMI->second); cerr << "\n"; } } From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:48:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:48:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp Message-ID: <200209200047.g8K0leI26203@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: MachineInstr.cpp updated: 1.46 -> 1.47 --- Log message: Add method MachineInstr::replace to rewrite a machine instruction in place. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.46 llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.47 --- llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.46 Mon Sep 16 10:18:53 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp Thu Sep 19 19:47:37 2002 @@ -27,6 +27,22 @@ { } +// +// Support for replacing opcode and operands of a MachineInstr in place. +// This only resets the size of the operand vector and initializes it. +// The new operands must be set explicitly later. +// +void +MachineInstr::replace(MachineOpCode _opCode, + unsigned numOperands, + OpCodeMask _opCodeMask) +{ + opCode = _opCode; + opCodeMask = _opCodeMask; + operands.clear(); + operands.resize(numOperands); +} + void MachineInstr::SetMachineOperandVal(unsigned int i, MachineOperand::MachineOperandType opType, From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:48:03 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:48:03 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200209200047.g8K0lqn26216@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.64 -> 1.65 --- Log message: Add method MachineInstr::replace to rewrite a machine instruction in place. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.64 llvm/include/llvm/CodeGen/MachineInstr.h:1.65 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.64 Mon Sep 16 10:58:54 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Thu Sep 19 19:47:49 2002 @@ -295,6 +295,18 @@ unsigned numOperands, OpCodeMask _opCodeMask = 0x0); inline ~MachineInstr () {} + + // + // Support to rewrite a machine instruction in place: for now, simply + // replace() and then set new operands with Set.*Operand methods below. + // + void replace (MachineOpCode _opCode, + unsigned numOperands, + OpCodeMask _opCodeMask = 0x0); + + // + // The op code. Note that MachineOpCode is a target-specific type. + // const MachineOpCode getOpCode () const { return opCode; } // From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:50:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:50:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineOptInfo.h Message-ID: <200209200049.g8K0nOA26235@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineOptInfo.h added (r1.1) --- Log message: Interface to target-specific routines that support machine code optimization. --- Diffs of the changes: From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:51:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:51:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineInstrInfo.h TargetMachine.h Message-ID: <200209200050.g8K0omd26258@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineInstrInfo.h updated: 1.20 -> 1.21 TargetMachine.h updated: 1.12 -> 1.13 --- Log message: Added class MachineOptInfo as interface to target-specific routines supporting machine code optimization. Also added method MachineInstrInfo::getNOPOpCode(). --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineInstrInfo.h diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.20 llvm/include/llvm/Target/MachineInstrInfo.h:1.21 --- llvm/include/llvm/Target/MachineInstrInfo.h:1.20 Mon Sep 16 10:56:01 2002 +++ llvm/include/llvm/Target/MachineInstrInfo.h Thu Sep 19 19:50:44 2002 @@ -191,7 +191,7 @@ bool isPseudoInstr(const MachineOpCode opCode) const { return getDescriptor(opCode).iclass & M_PSEUDO_FLAG; } - + // Check if an instruction can be issued before its operands are ready, // or if a subsequent instruction that uses its result can be issued // before the results are ready. @@ -265,7 +265,12 @@ //------------------------------------------------------------------------- // Code generation support for creating individual machine instructions //------------------------------------------------------------------------- - + + // Get certain common op codes for the current target. this and all the + // Create* methods below should be moved to a machine code generation class + // + virtual MachineOpCode getNOPOpCode() const = 0; + // Create an instruction sequence to put the constant `val' into // the virtual register `dest'. `val' may be a Constant or a // GlobalValue, viz., the constant address of a global variable or function. Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.12 llvm/include/llvm/Target/TargetMachine.h:1.13 --- llvm/include/llvm/Target/TargetMachine.h:1.12 Mon Sep 16 10:39:35 2002 +++ llvm/include/llvm/Target/TargetMachine.h Thu Sep 19 19:50:44 2002 @@ -16,6 +16,7 @@ class MachineRegInfo; class MachineFrameInfo; class MachineCacheInfo; +class MachineOptInfo; class PassManager; class Pass; @@ -56,13 +57,17 @@ // -- Instruction opcode and operand information // -- Pipelines and scheduling information // -- Register information + // -- Stack frame information + // -- Cache hierarchy information + // -- Machine-level optimization information (peephole only) // virtual const MachineInstrInfo& getInstrInfo() const = 0; virtual const MachineSchedInfo& getSchedInfo() const = 0; virtual const MachineRegInfo& getRegInfo() const = 0; virtual const MachineFrameInfo& getFrameInfo() const = 0; virtual const MachineCacheInfo& getCacheInfo() const = 0; - + virtual const MachineOptInfo& getOptInfo() const = 0; + // Data storage information // virtual unsigned int findOptimalStorageSize (const Type* ty) const; From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:53:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:53:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInternals.h Sparc.cpp Message-ID: <200209200052.g8K0qCt26277@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInternals.h updated: 1.63 -> 1.64 Sparc.cpp updated: 1.45 -> 1.46 --- Log message: Added class MachineOptInfo as interface to target-specific routines supporting machine code optimization. Also added method MachineInstrInfo::getNOPOpCode(). --- Diffs of the changes: Index: llvm/lib/Target/Sparc/SparcInternals.h diff -u llvm/lib/Target/Sparc/SparcInternals.h:1.63 llvm/lib/Target/Sparc/SparcInternals.h:1.64 --- llvm/lib/Target/Sparc/SparcInternals.h:1.63 Mon Sep 16 10:39:26 2002 +++ llvm/lib/Target/Sparc/SparcInternals.h Thu Sep 19 19:52:09 2002 @@ -13,6 +13,7 @@ #include "llvm/Target/MachineFrameInfo.h" #include "llvm/Target/MachineCacheInfo.h" #include "llvm/Target/MachineRegInfo.h" +#include "llvm/Target/MachineOptInfo.h" #include "llvm/Type.h" #include @@ -125,7 +126,12 @@ //------------------------------------------------------------------------- // Code generation support for creating individual machine instructions //------------------------------------------------------------------------- - + + // Get certain common op codes for the current target. This and all the + // Create* methods below should be moved to a machine code generation class + // + virtual MachineOpCode getNOPOpCode() const { return NOP; } + // Create an instruction sequence to put the constant `val' into // the virtual register `dest'. `val' may be a Constant or a // GlobalValue, viz., the constant address of a global variable or function. @@ -691,6 +697,21 @@ //--------------------------------------------------------------------------- +// class UltraSparcOptInfo +// +// Purpose: +// Interface to machine-level optimization routines for the UltraSPARC. +//--------------------------------------------------------------------------- + +class UltraSparcOptInfo: public MachineOptInfo { +public: + UltraSparcOptInfo(const TargetMachine &T) : MachineOptInfo(T) {} + + virtual bool IsUselessCopy (const MachineInstr* MI) const; +}; + + +//--------------------------------------------------------------------------- // class UltraSparcMachine // // Purpose: @@ -707,14 +728,16 @@ UltraSparcRegInfo regInfo; UltraSparcFrameInfo frameInfo; UltraSparcCacheInfo cacheInfo; + UltraSparcOptInfo optInfo; public: UltraSparc(); - + virtual const MachineInstrInfo &getInstrInfo() const { return instrInfo; } virtual const MachineSchedInfo &getSchedInfo() const { return schedInfo; } virtual const MachineRegInfo &getRegInfo() const { return regInfo; } virtual const MachineFrameInfo &getFrameInfo() const { return frameInfo; } virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; } + virtual const MachineOptInfo &getOptInfo() const { return optInfo; } // getPrologEpilogCodeInserter - Inserts prolog/epilog code. virtual Pass* getPrologEpilogInsertionPass(); Index: llvm/lib/Target/Sparc/Sparc.cpp diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.45 llvm/lib/Target/Sparc/Sparc.cpp:1.46 --- llvm/lib/Target/Sparc/Sparc.cpp:1.45 Mon Sep 16 10:39:26 2002 +++ llvm/lib/Target/Sparc/Sparc.cpp Thu Sep 19 19:52:09 2002 @@ -108,7 +108,8 @@ schedInfo(*this), regInfo(*this), frameInfo(*this), - cacheInfo(*this) + cacheInfo(*this), + optInfo(*this) { optSizeForSubWordData = 4; minMemOpWordSize = 8; From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:53:03 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:53:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200209200052.g8K0qkg26292@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.8 -> 1.9 --- Log message: Add peephole optimization pass at the end of code generation. --- Diffs of the changes: Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.8 llvm/lib/Target/TargetMachine.cpp:1.9 --- llvm/lib/Target/TargetMachine.cpp:1.8 Mon Sep 16 10:39:03 2002 +++ llvm/lib/Target/TargetMachine.cpp Thu Sep 19 19:52:43 2002 @@ -12,6 +12,7 @@ #include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/InstrScheduling.h" #include "llvm/CodeGen/RegisterAllocation.h" +#include "llvm/CodeGen/PeepholeOpts.h" #include "llvm/CodeGen/MachineCodeForMethod.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Reoptimizer/Mapping/MappingInfo.h" @@ -32,6 +33,9 @@ static cl::opt DisableSched("nosched", cl::desc("Disable local scheduling pass")); +static cl::opt DisablePeephole("nopeephole", + cl::desc("Disable peephole optimization pass")); + //--------------------------------------------------------------------------- // class TargetMachine // @@ -132,12 +136,10 @@ PM.add(getRegisterAllocator(*this)); - //PM.add(new OptimizeLeafProcedures()); - //PM.add(new DeleteFallThroughBranches()); - //PM.add(new RemoveChainedBranches()); // should be folded with previous - //PM.add(new RemoveRedundantOps()); // operations with %g0, NOP, etc. - PM.add(getPrologEpilogInsertionPass()); + + if (!DisablePeephole) + PM.add(createPeepholeOptsPass(*this)); PM.add(MappingInfoForFunction(Out)); From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:54:00 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:54:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Makefile Message-ID: <200209200053.g8K0rud26313@psmith.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: Makefile updated: 1.7 -> 1.8 --- Log message: Add PostOpts/ and rename PreSelection/ to PreOpts/. --- Diffs of the changes: Index: llvm/lib/CodeGen/Makefile diff -u llvm/lib/CodeGen/Makefile:1.7 llvm/lib/CodeGen/Makefile:1.8 --- llvm/lib/CodeGen/Makefile:1.7 Mon Sep 16 10:32:07 2002 +++ llvm/lib/CodeGen/Makefile Thu Sep 19 19:53:53 2002 @@ -1,4 +1,4 @@ LEVEL = ../.. -DIRS = PreSelection InstrSelection InstrSched RegAlloc Mapping +DIRS = PreOpts InstrSelection InstrSched RegAlloc PostOpts Mapping include $(LEVEL)/Makefile.common From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:56:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:56:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/IGNode.h Message-ID: <200209200055.g8K0t8s26331@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: IGNode.h updated: 1.9 -> 1.10 --- Log message: Add method IGNode::getCombinedDegree to count the sum of the degrees of two nodes, excluding duplicates. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/IGNode.h diff -u llvm/include/llvm/CodeGen/IGNode.h:1.9 llvm/include/llvm/CodeGen/IGNode.h:1.10 --- llvm/include/llvm/CodeGen/IGNode.h:1.9 Mon Apr 29 12:41:31 2002 +++ llvm/include/llvm/CodeGen/IGNode.h Thu Sep 19 19:55:04 2002 @@ -72,6 +72,9 @@ inline unsigned getNumOfNeighbors() const { return AdjList.size(); } + // Get the number of unique neighbors if these two nodes are merged + unsigned getCombinedDegree(const IGNode* otherNode) const; + inline bool isOnStack() const { return OnStack; } // remove form IG and pushes on to stack (reduce the degree of neighbors) From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:57:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:57:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Message-ID: <200209200056.g8K0u0Q26344@psmith.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForBasicBlock.h updated: 1.1 -> 1.2 --- Log message: Add erase() method for a single element. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.1 llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.2 --- llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.1 Mon Jul 8 17:40:34 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Thu Sep 19 19:55:57 2002 @@ -58,9 +58,10 @@ void insert(iterator I, IT S, IT E) { Insts.insert(I, S, E); } iterator insert(iterator I, MachineInstr *M) { return Insts.insert(I, M); } - // erase - Remove the specified range from the instruction list. This does - // not delete in instructions removed. + // erase - Remove the specified element or range from the instruction list. + // These functions do not delete any instructions removed. // + iterator erase(iterator I) { return Insts.erase(I); } iterator erase(iterator I, iterator E) { return Insts.erase(I, E); } MachineInstr *pop_back() { From vadve at psmith.cs.uiuc.edu Thu Sep 19 19:58:01 2002 From: vadve at psmith.cs.uiuc.edu (Vikram Adve) Date: Thu Sep 19 19:58:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/LLC/select.ll Message-ID: <200209200057.g8K0veT26365@psmith.cs.uiuc.edu> Changes in directory llvm/test/Regression/LLC: select.ll updated: 1.5 -> 1.6 --- Log message: Fix to avoid addition on pointers, which is no longer legal. --- Diffs of the changes: Index: llvm/test/Regression/LLC/select.ll diff -u llvm/test/Regression/LLC/select.ll:1.5 llvm/test/Regression/LLC/select.ll:1.6 --- llvm/test/Regression/LLC/select.ll:1.5 Wed Aug 21 22:05:13 2002 +++ llvm/test/Regression/LLC/select.ll Thu Sep 19 19:57:37 2002 @@ -165,9 +165,11 @@ bb2: ;;
  • The Core LLVM Class Hierarchy Reference @@ -183,6 +183,16 @@ to write maintainable code more than where to put your curly braces.

    + + +
    +Important and useful LLVM APIs +

      + + +Here we highlight some LLVM APIs that are generally useful and good to know +about when writing transformations.

      +

       @@ -292,13 +302,145 @@ lots of examples in the LLVM source base.

    + + +
       + +The DEBUG() macro & -debug option +

      + +Often when working on your pass you will put a bunch of debugging printouts and +other code into your pass. After you get it working, you want to remove +it... but you may need it again in the future (to work out new bugs that you run +across).

      + +Naturally, because of this, you don't want to delete the debug printouts, but +you don't want them to always be noisy. A standard compromise is to comment +them out, allowing you to enable them if you need them in the future.

      + +The "StatisticReporter.h" +file provides a macro named DEBUG() that is a much nicer solution to +this problem. Basically, you can put arbitrary code into the argument of the +DEBUG macro, and it is only executed if 'opt' is run with the +'-debug' command line argument: + +

      +     ... 
      +     DEBUG(std::cerr << "I am here!\n");
      +     ...
      +

      + +Then you can run your pass like this:

      + +

      +  $ opt < a.bc > /dev/null -mypass
      +    <no output>
      +  $ opt < a.bc > /dev/null -mypass -debug
      +    I am here!
      +  $
      +

      + +Using the DEBUG() macro instead of a home brewed solution allows you to +now have to create "yet another" command line option for the debug output for +your pass. Note that DEBUG() macros are disabled for optimized +builds, so they do not cause a performance impact at all.

      + + + +

    +
       + +The Statistic template & -stats +option +
      + +The "StatisticReporter.h" +file provides a template named Statistic that is used as a unified way +to keeping track of what the LLVM compiler is doing and how effective various +optimizations are. It is useful to see what optimizations are contributing to +making a particular program run faster.

      + +Often you may run your pass on some big program, and you're interested to see +how many times it makes a certain transformation. Although you can do this with +hand inspection, or some ad-hoc method, this is a real pain and not very useful +for big programs. Using the Statistic template makes it very easy to +keep track of this information, and the calculated information is presented in a +uniform manner with the rest of the passes being executed.

      + +There are many examples of Statistic users, but this basics of using it +are as follows:

      + +

        +
      1. Define your statistic like this:

        + +

        +static Statistic<> NumXForms("mypassname\t- The # of times I did stuff");
        +

        + +The Statistic template can emulate just about any data-type, but if you +do not specify a template argument, it defaults to acting like an unsigned int +counter (this is usually what you want).

        + +

      2. Whenever you make a transformation, bump the counter:

        + +

        +   ++NumXForms;   // I did stuff
        +

        + +

      + +That's all you have to do. To get 'opt' to print out the statistics +gathered, use the '-stats' option:

      + +

      +   $ opt -stats -mypassname < program.bc > /dev/null
      +    ... statistic output ...
      +

      + +When running gccas on a C file from the SPEC benchmark suite, it gives +a report that looks like this:

      + +

      +   7646 bytecodewriter  - Number of normal instructions
      +    725 bytecodewriter  - Number of oversized instructions
      + 129996 bytecodewriter  - Number of bytecode bytes written
      +   2817 raise           - Number of insts DCEd or constprop'd
      +   3213 raise           - Number of cast-of-self removed
      +   5046 raise           - Number of expression trees converted
      +     75 raise           - Number of other getelementptr's formed
      +    138 raise           - Number of load/store peepholes
      +     42 deadtypeelim    - Number of unused typenames removed from symtab
      +    392 funcresolve     - Number of varargs functions resolved
      +     27 globaldce       - Number of global variables removed
      +      2 adce            - Number of basic blocks removed
      +    134 cee             - Number of branches revectored
      +     49 cee             - Number of setcc instruction eliminated
      +    532 gcse            - Number of loads removed
      +   2919 gcse            - Number of instructions removed
      +     86 indvars         - Number of cannonical indvars added
      +     87 indvars         - Number of aux indvars removed
      +     25 instcombine     - Number of dead inst eliminate
      +    434 instcombine     - Number of insts combined
      +    248 licm            - Number of load insts hoisted
      +   1298 licm            - Number of insts hoisted to a loop pre-header
      +      3 licm            - Number of insts hoisted to multiple loop preds (bad, no loop pre-header)
      +     75 mem2reg         - Number of alloca's promoted
      +   1444 cfgsimplify     - Number of blocks simplified
      +

      + +Obviously, with so many optimizations, having a unified framework for this stuff +is very nice. Making your pass fit well into the framework makes it more +maintainable and useful.

      +

    Helpful Hints for Common Operations -
      - +
      This section describes how to perform some very simple transformations of LLVM code. This is meant to give examples of common idioms used, showing the @@ -1616,6 +1758,6 @@ Chris Lattner -Last modified: Tue Sep 17 22:16:24 CDT 2002 +Last modified: Sun Sep 22 14:38:05 CDT 2002 From lattner at cs.uiuc.edu Sun Sep 22 16:26:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Sep 22 16:26:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/ProgrammersManual.html Message-ID: <200209222125.QAA12283@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: ProgrammersManual.html updated: 1.30 -> 1.31 --- Log message: Update url --- Diffs of the changes: Index: llvm/www/docs/ProgrammersManual.html diff -u llvm/www/docs/ProgrammersManual.html:1.30 llvm/www/docs/ProgrammersManual.html:1.31 --- llvm/www/docs/ProgrammersManual.html:1.30 Sun Sep 22 14:38:40 2002 +++ llvm/www/docs/ProgrammersManual.html Sun Sep 22 16:25:12 2002 @@ -161,7 +161,7 @@ Here are some useful links:

        -
      1. Dinkumware C++ +
      2. Dinkumware C++ Library reference - an excellent reference for the STL and other parts of the standard C++ library.