From lattner at cs.uiuc.edu Mon Oct 21 08:24:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:24:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/InstrSelectionSupport.h Message-ID: <200210211323.IAA26910@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: InstrSelectionSupport.h updated: 1.15 -> 1.16 --- Log message: Add a missing std:: qualifier --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/InstrSelectionSupport.h diff -u llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.15 llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.16 --- llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.15 Mon Oct 14 11:31:27 2002 +++ llvm/include/llvm/CodeGen/InstrSelectionSupport.h Mon Oct 21 08:23:42 2002 @@ -54,7 +54,7 @@ //--------------------------------------------------------------------------- Value* GetMemInstArgs (InstructionNode* memInstrNode, - vector& idxVec, + std::vector& idxVec, bool& allConstantIndices); From lattner at cs.uiuc.edu Mon Oct 21 08:26:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:26:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210211325.IAA27033@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.65 -> 1.66 --- Log message: Remove a 'using' directives from a header file. Using directives cause global changes, so aren't good for headers. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.65 llvm/include/llvm/CodeGen/MachineInstr.h:1.66 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.65 Thu Sep 19 19:47:49 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Mon Oct 21 08:24:50 2002 @@ -14,7 +14,6 @@ #include #include class Instruction; -using std::vector; //--------------------------------------------------------------------------- // class MachineOperand @@ -281,10 +280,10 @@ public NonCopyable { // Disable copy operations MachineOpCode opCode; // the opcode OpCodeMask opCodeMask; // extra bits for variants of an opcode - vector operands; // the operands - vector implicitRefs; // values implicitly referenced by this - vector implicitIsDef; // machine instruction (eg, call args) - vector implicitIsDefAndUse; // + std::vector operands; // the operands + std::vector implicitRefs; // values implicitly referenced by this + std::vector implicitIsDef; // machine instruction (eg, call args) + std::vector implicitIsDefAndUse; hash_set regsUsed; // all machine registers used for this // instruction, including regs used // to save values across the instr. From lattner at cs.uiuc.edu Mon Oct 21 08:28:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:28:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/VirtualMem.h Message-ID: <200210211327.IAA27315@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Reoptimizer: VirtualMem.h updated: 1.4 -> 1.5 --- Log message: Remove using::cerr directive from header file --- Diffs of the changes: Index: llvm/include/llvm/Reoptimizer/VirtualMem.h diff -u llvm/include/llvm/Reoptimizer/VirtualMem.h:1.4 llvm/include/llvm/Reoptimizer/VirtualMem.h:1.5 --- llvm/include/llvm/Reoptimizer/VirtualMem.h:1.4 Tue Oct 8 11:31:20 2002 +++ llvm/include/llvm/Reoptimizer/VirtualMem.h Mon Oct 21 08:27:27 2002 @@ -19,24 +19,21 @@ #include "llvm/Reoptimizer/GetTraceTime.h" -using std::cerr; - -class VirtualMem{ - private: +class VirtualMem { int fp; //file pointer - public: +public: //constructor VirtualMem(); //reading/modifying process space VM - void copyToVM(std::vector &trace, + void copyToVM(std::vector &trace, uint64_t traceStartAddr); void changeBranchTarget(uint64_t frm, uint64_t to); uint64_t getBranchTarget(const std::pair &n); unsigned int readInstrFrmVm(uint64_t frm); - void writeInstToVM(uint64_t dest, unsigned int newInstr); + void writeInstToVM(uint64_t dest, unsigned newInstr); void writeBranchInstruction(uint64_t location, uint64_t target); From lattner at cs.uiuc.edu Mon Oct 21 08:30:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:30:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h Message-ID: <200210211329.IAA27581@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Reoptimizer/Mapping: LLVMinfo.h updated: 1.4 -> 1.5 --- Log message: Remove using declaration from header file --- Diffs of the changes: Index: llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h diff -u llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.4 llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.5 --- llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.4 Wed Sep 11 17:39:41 2002 +++ llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h Mon Oct 21 08:28:54 2002 @@ -1,11 +1,9 @@ #include "llvm/Instruction.h" #include "Support/DataTypes.h" -#include -using std::vector; //vector getBasicBlockInfo(int FunctionNo, int //BasicBlockNo); //vector getLLVMInstrInfo(int FunctionNo, int BasicBlockNo, // int LLVMInstrNo); -vector getLLVMInstrInfo(Instruction *LI); +std::vector getLLVMInstrInfo(Instruction *LI); std::pair getBasicBlockInfo(BasicBlock *BB); From lattner at cs.uiuc.edu Mon Oct 21 08:32:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:32:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp TopDownClosure.cpp Message-ID: <200210211331.IAA27630@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.31 -> 1.32 TopDownClosure.cpp updated: 1.12 -> 1.13 --- Log message: Remove some unneccesary 'using' directives --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.31 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.32 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.31 Sun Oct 20 21:18:55 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Oct 21 08:31:48 2002 @@ -386,7 +386,7 @@ DSGraph::~DSGraph() { FunctionCalls.clear(); ValueMap.clear(); - RetNode = 0; + RetNode.setNode(0); #ifndef NDEBUG // Drop all intra-node references, so that assertions don't fail... Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.12 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.13 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.12 Sun Oct 20 21:08:03 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Mon Oct 21 08:31:48 2002 @@ -12,8 +12,6 @@ #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" -using std::map; -using std::vector; static RegisterAnalysis Y("tddatastructure", "Top-down Data Structure Analysis Closure"); @@ -22,7 +20,7 @@ // our memory... here... // void TDDataStructures::releaseMemory() { - for (map::iterator I = DSInfo.begin(), + for (std::map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -86,7 +84,7 @@ DSGraph &BUGraph = BU.getDSGraph(F); Graph = new DSGraph(BUGraph); - const vector *CallSitesP = BU.getCallSites(F); + const std::vector *CallSitesP = BU.getCallSites(F); if (CallSitesP == 0) { DEBUG(std::cerr << " [TD] No callers for: " << F.getName() << "\n"); return *Graph; // If no call sites, the graph is the same as the BU graph! @@ -96,7 +94,7 @@ // graph. // DEBUG(std::cerr << " [TD] Inlining callers for: " << F.getName() << "\n"); - const vector &CallSites = *CallSitesP; + const std::vector &CallSites = *CallSitesP; for (unsigned c = 0, ce = CallSites.size(); c != ce; ++c) { const DSCallSite &CallSite = CallSites[c]; // Copy Function &Caller = CallSite.getCaller(); From lattner at cs.uiuc.edu Mon Oct 21 08:39:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:39:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200210211338.IAA27753@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.14 -> 1.15 --- Log message: Make sure to initialize isArray member --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.14 llvm/include/llvm/Analysis/DSGraph.h:1.15 --- llvm/include/llvm/Analysis/DSGraph.h:1.14 Sun Oct 20 21:09:03 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Mon Oct 21 08:38:07 2002 @@ -127,8 +127,8 @@ unsigned Offset; // The offset in the node bool isArray; // Have we accessed an array of elements? - TypeRec() : Ty(0), Offset(0) {} - TypeRec(const Type *T, unsigned O) : Ty(T), Offset(O) {} + TypeRec() : Ty(0), Offset(0), isArray(false) {} + TypeRec(const Type *T, unsigned O) : Ty(T), Offset(O), isArray(false) {} bool operator<(const TypeRec &TR) const { // Sort first by offset! From lattner at cs.uiuc.edu Mon Oct 21 08:49:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:49:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp Message-ID: <200210211348.IAA27830@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Printer.cpp updated: 1.26 -> 1.27 --- Log message: Fix a confusing bug that caused return value and callee pointers to not be printed! --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Printer.cpp diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.26 llvm/lib/Analysis/DataStructure/Printer.cpp:1.27 --- llvm/lib/Analysis/DataStructure/Printer.cpp:1.26 Sun Oct 20 21:08:03 2002 +++ llvm/lib/Analysis/DataStructure/Printer.cpp Mon Oct 21 08:47:57 2002 @@ -112,6 +112,16 @@ const DSCallSite &Call = FCs[i]; GW.emitSimpleNode(&Call, "shape=record", "call", Call.getNumPtrArgs()+2); + if (DSNode *N = Call.getRetVal().getNode()) { + int EdgeDest = Call.getRetVal().getOffset(); + if (EdgeDest == 0) EdgeDest = -1; + GW.emitEdge(&Call, 0, N, EdgeDest, "color=gray63"); + } + if (DSNode *N = Call.getCallee().getNode()) { + int EdgeDest = Call.getCallee().getOffset(); + if (EdgeDest == 0) EdgeDest = -1; + GW.emitEdge(&Call, 1, N, EdgeDest, "color=gray63"); + } for (unsigned j = 0, e = Call.getNumPtrArgs(); j != e; ++j) if (DSNode *N = Call.getPtrArg(j).getNode()) { int EdgeDest = Call.getPtrArg(j).getOffset(); From lattner at cs.uiuc.edu Mon Oct 21 08:52:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 08:52:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200210211351.IAA27890@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.20 -> 1.21 --- Log message: Don't create a new node for every reference to a global. This caused a huge node explosion that doesn't help anything at all. In previous versions of the representation this DID help, but not anymore. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.20 llvm/lib/Analysis/DataStructure/Local.cpp:1.21 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.20 Sun Oct 20 21:08:03 2002 +++ llvm/lib/Analysis/DataStructure/Local.cpp Mon Oct 21 08:51:30 2002 @@ -186,12 +186,9 @@ // DSNodeHandle GraphBuilder::getValueNode(Value &V) { assert(isPointerType(V.getType()) && "Should only use pointer scalars!"); - // Do not share the pointer value to globals... this would cause way too much - // false merging. - // + DSNodeHandle &NH = ValueMap[&V]; - if (!isa(V) && NH.getNode()) - return NH; // Already have a node? Just return it... + if (NH.getNode()) return NH; // Already have a node? Just return it... // Otherwise we need to create a new scalar node... DSNode *N = createNode(DSNode::ScalarNode, V.getType()); From lattner at cs.uiuc.edu Mon Oct 21 10:04:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 10:04:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200210211503.KAA02961@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.15 -> 1.16 --- Log message: As it turns out, we don't need a fully generic mapping copy ctor, we just need something that maps through a std::map. Since this simplified the client and implementation code, do so now. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.15 llvm/include/llvm/Analysis/DSGraph.h:1.16 --- llvm/include/llvm/Analysis/DSGraph.h:1.15 Mon Oct 21 08:38:07 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Mon Oct 21 10:03:35 2002 @@ -368,10 +368,18 @@ DSNodeHandle Callee; // The function node called std::vector CallArgs; // The pointer arguments + static DSNode *mapLookup(const DSNode *Node, + const std::map &NodeMap) { + if (Node == 0) return 0; + std::map::const_iterator I = NodeMap.find(Node); + assert(I != NodeMap.end() && "Not not in mapping!"); + return I->second; + } + DSCallSite(); // DO NOT IMPLEMENT public: - /// Note - This ctor destroys the argument vector passed in. On exit, the - /// argument vector is empty. + /// Constructor. Note - This ctor destroys the argument vector passed in. On + /// exit, the argument vector is empty. /// DSCallSite(CallInst &inst, const DSNodeHandle &rv, const DSNodeHandle &callee, std::vector &Args) @@ -379,16 +387,29 @@ Args.swap(CallArgs); } - /// Copy constructor with helper for cloning nodes. The helper should be a - /// model of unary_function, i.e., it - /// should take a pointer to DSNodeHandle and return a fresh DSNodeHandle. - /// If no helper is specified, this defaults to a simple copy constructor. - /// - template - DSCallSite(const DSCallSite &FromCall, CopyFunctor nodeCopier); - DSCallSite(const DSCallSite &DSCS) + DSCallSite(const DSCallSite &DSCS) // Simple copy ctor : Inst(DSCS.Inst), RetVal(DSCS.RetVal), Callee(DSCS.Callee), CallArgs(DSCS.CallArgs) {} + + /// Mapping copy constructor - This constructor takes a preexisting call site + /// to copy plus a map that specifies how the links should be transformed. + /// This is useful when moving a call site from one graph to another. + /// + DSCallSite(const DSCallSite &FromCall, + const std::map &NodeMap) { + Inst = FromCall.Inst; + RetVal.setOffset(FromCall.RetVal.getOffset()); + RetVal.setNode(mapLookup(FromCall.RetVal.getNode(), NodeMap)); + Callee.setOffset(FromCall.Callee.getOffset()); + Callee.setNode(mapLookup(FromCall.Callee.getNode(), NodeMap)); + CallArgs.reserve(FromCall.CallArgs.size()); + + for (unsigned i = 0, e = FromCall.CallArgs.size(); i != e; ++i) { + const DSNodeHandle &OldNH = FromCall.CallArgs[i]; + CallArgs.push_back(DSNodeHandle(mapLookup(OldNH.getNode(), NodeMap), + OldNH.getOffset())); + } + } // Accessor functions... Function &getCaller() const; From lattner at cs.uiuc.edu Mon Oct 21 10:05:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 10:05:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp TopDownClosure.cpp Message-ID: <200210211504.KAA02978@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.32 -> 1.33 TopDownClosure.cpp updated: 1.13 -> 1.14 --- Log message: As it turns out, we don't need a fully generic mapping copy ctor, we just need something that maps through a std::map. Since this simplified the client and implementation code, do so now. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.32 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.33 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.32 Mon Oct 21 08:31:48 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Oct 21 10:04:17 2002 @@ -361,18 +361,6 @@ return *Inst->getParent()->getParent(); } -template -DSCallSite::DSCallSite(const DSCallSite &FromCall, CopyFunctor nodeCopier) - : Inst(FromCall.Inst) { - - RetVal = nodeCopier(&FromCall.RetVal); - Callee = nodeCopier(&FromCall.Callee); - - CallArgs.reserve(FromCall.CallArgs.size()); - for (unsigned j = 0, ej = FromCall.CallArgs.size(); j != ej; ++j) - CallArgs.push_back(nodeCopier(&FromCall.CallArgs[j])); -} - //===----------------------------------------------------------------------===// // DSGraph Implementation @@ -402,11 +390,6 @@ void DSGraph::dump() const { print(std::cerr); } -static DSNodeHandle copyHelper(const DSNodeHandle* fromNode, - std::map *NodeMap) { - return DSNodeHandle((*NodeMap)[fromNode->getNode()], fromNode->getOffset()); -} - // Helper function used to clone a function list. // static void CopyFunctionCallsList(const vector& fromCalls, @@ -415,8 +398,7 @@ unsigned FC = toCalls.size(); // FirstCall toCalls.reserve(FC+fromCalls.size()); for (unsigned i = 0, ei = fromCalls.size(); i != ei; ++i) - toCalls.push_back(DSCallSite(fromCalls[i], - std::bind2nd(std::ptr_fun(©Helper), &NodeMap))); + toCalls.push_back(DSCallSite(fromCalls[i], NodeMap)); } /// remapLinks - Change all of the Links in the current node according to the Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.13 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.14 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.13 Mon Oct 21 08:31:48 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Mon Oct 21 10:04:18 2002 @@ -57,8 +57,8 @@ // TD ...Merge the formal arg scalar with the actual arg node DSNodeHandle &NodeForFormal = Graph.getNodeForValue(AI); - if (NodeForFormal.getNode()) - NodeForFormal.mergeWith(CallSite.getPtrArg(i)); + assert(NodeForFormal.getNode() && "Pointer argument has no dest node!"); + NodeForFormal.mergeWith(CallSite.getPtrArg(i)); } // Merge returned node in the caller with the "return" node in callee @@ -67,12 +67,6 @@ } -static DSNodeHandle copyHelper(const DSNodeHandle* fromNode, - std::map *NodeMap) { - return DSNodeHandle((*NodeMap)[fromNode->getNode()], fromNode->getOffset()); -} - - DSGraph &TDDataStructures::calculateGraph(Function &F) { // Make sure this graph has not already been calculated, or that we don't get // into an infinite loop with mutually recursive functions. @@ -103,12 +97,9 @@ DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '" << Caller.getName() << "' into callee: " << F.getName() << "\n"); - if (&Caller == &F) { - // Self-recursive call: this can happen after a cycle of calls is inlined. - ResolveCallSite(*Graph, CallSite); - } else { - // Recursively compute the graph for the Caller. That should - // be fully resolved except if there is mutual recursion... + if (&Caller != &F) { + // Recursively compute the graph for the Caller. It should be fully + // resolved except if there is mutual recursion... // DSGraph &CG = calculateGraph(Caller); // Graph to inline @@ -133,10 +124,9 @@ // Make a temporary copy of the call site, and transform the argument node // pointers. - DSCallSite TmpCallSite(CallSite, std::bind2nd(std::ptr_fun(©Helper), - &OldNodeMap)); - ResolveCallSite(*Graph, CallSite); + // } + ResolveCallSite(*Graph, CallSite); } // Recompute the Incomplete markers and eliminate unreachable nodes. From lattner at cs.uiuc.edu Mon Oct 21 10:33:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 10:33:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200210211532.KAA03336@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.16 -> 1.17 --- Log message: Add another copy ctor form --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.16 llvm/include/llvm/Analysis/DSGraph.h:1.17 --- llvm/include/llvm/Analysis/DSGraph.h:1.16 Mon Oct 21 10:03:35 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Mon Oct 21 10:32:32 2002 @@ -473,7 +473,12 @@ public: DSGraph() : Func(0) {} // Create a new, empty, DSGraph. DSGraph(Function &F); // Compute the local DSGraph - DSGraph(const DSGraph &DSG); // Copy ctor + + // Copy ctor - If you want to capture the node mapping between the source and + // destination graph, you may optionally do this by specifying a map to record + // this into. + DSGraph(const DSGraph &DSG); + DSGraph(const DSGraph &DSG, std::map &BUNodeMapTy); ~DSGraph(); bool hasFunction() const { return Func != 0; } From lattner at cs.uiuc.edu Mon Oct 21 10:33:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 10:33:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200210211532.KAA03343@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.33 -> 1.34 --- Log message: Add another copy ctor form --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.33 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.34 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.33 Mon Oct 21 10:04:17 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Oct 21 10:32:34 2002 @@ -371,6 +371,11 @@ RetNode = cloneInto(G, ValueMap, NodeMap); } +DSGraph::DSGraph(const DSGraph &G, std::map &NodeMap) + : Func(G.Func) { + RetNode = cloneInto(G, ValueMap, NodeMap); +} + DSGraph::~DSGraph() { FunctionCalls.clear(); ValueMap.clear(); From brukman at cs.uiuc.edu Mon Oct 21 13:23:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 13:23:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/ticm/ Message-ID: <200210211822.NAA09866@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer/ticm: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Regression/Reoptimizer/ticm added to the repository --- Diffs of the changes: From brukman at cs.uiuc.edu Mon Oct 21 13:24:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 13:24:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/Makefile.mk Message-ID: <200210211823.NAA09884@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer: Makefile.mk added (r1.1) --- Log message: Added common Makefile for instrumenting and profiling test cases. --- Diffs of the changes: From brukman at cs.uiuc.edu Mon Oct 21 13:25:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 13:25:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/ticm/Makefile ticm.c Message-ID: <200210211824.NAA09895@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer/ticm: Makefile added (r1.1) ticm.c added (r1.1) --- Log message: First test case to use the common Makefile system for instrumentating and profiling. --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Oct 21 14:48:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 14:48:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DataStructure.h Message-ID: <200210211947.OAA05754@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.17 -> 1.18 DataStructure.h updated: 1.45 -> 1.46 --- Log message: - Add "ResolvingCaller" to the CallSite record. This keeps track of which function was finally able to resolve the function call. Adding this allows the TD pass to actually work right! - Temporarily disable dead node pruning. This will be reenabled soon. --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.17 llvm/include/llvm/Analysis/DSGraph.h:1.18 --- llvm/include/llvm/Analysis/DSGraph.h:1.17 Mon Oct 21 10:32:32 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Mon Oct 21 14:47:14 2002 @@ -361,19 +361,40 @@ /// DSCallSite - Representation of a call site via its call instruction, /// the DSNode handle for the callee function (or function pointer), and /// the DSNode handles for the function arguments. +/// +/// One unusual aspect of this callsite record is the ResolvingCaller member. +/// If this is non-null, then it indicates the function that allowed a call-site +/// to finally be resolved. Because of indirect calls, this function may not +/// actually be the function that contains the Call instruction itself. This is +/// used by the BU and TD passes to communicate. /// class DSCallSite { CallInst *Inst; // Actual call site DSNodeHandle RetVal; // Returned value DSNodeHandle Callee; // The function node called std::vector CallArgs; // The pointer arguments + Function *ResolvingCaller; // See comments above + + static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, + const std::map &NodeMap) { + if (DSNode *N = Src.getNode()) { + std::map::const_iterator I = NodeMap.find(N); + assert(I != NodeMap.end() && "Not not in mapping!"); + + NH.setOffset(Src.getOffset()); + NH.setNode(I->second); + } + } - static DSNode *mapLookup(const DSNode *Node, - const std::map &NodeMap) { - if (Node == 0) return 0; - std::map::const_iterator I = NodeMap.find(Node); - assert(I != NodeMap.end() && "Not not in mapping!"); - return I->second; + static void InitNH(DSNodeHandle &NH, const DSNodeHandle &Src, + const std::map &NodeMap) { + if (DSNode *N = Src.getNode()) { + std::map::const_iterator I = NodeMap.find(N); + assert(I != NodeMap.end() && "Not not in mapping!"); + + NH.setOffset(Src.getOffset()+I->second.getOffset()); + NH.setNode(I->second.getNode()); + } } DSCallSite(); // DO NOT IMPLEMENT @@ -383,32 +404,29 @@ /// DSCallSite(CallInst &inst, const DSNodeHandle &rv, const DSNodeHandle &callee, std::vector &Args) - : Inst(&inst), RetVal(rv), Callee(callee) { + : Inst(&inst), RetVal(rv), Callee(callee), ResolvingCaller(0) { Args.swap(CallArgs); } DSCallSite(const DSCallSite &DSCS) // Simple copy ctor : Inst(DSCS.Inst), RetVal(DSCS.RetVal), - Callee(DSCS.Callee), CallArgs(DSCS.CallArgs) {} + Callee(DSCS.Callee), CallArgs(DSCS.CallArgs), + ResolvingCaller(DSCS.ResolvingCaller) {} /// Mapping copy constructor - This constructor takes a preexisting call site /// to copy plus a map that specifies how the links should be transformed. /// This is useful when moving a call site from one graph to another. /// - DSCallSite(const DSCallSite &FromCall, - const std::map &NodeMap) { + template + DSCallSite(const DSCallSite &FromCall, const MapTy &NodeMap) { Inst = FromCall.Inst; - RetVal.setOffset(FromCall.RetVal.getOffset()); - RetVal.setNode(mapLookup(FromCall.RetVal.getNode(), NodeMap)); - Callee.setOffset(FromCall.Callee.getOffset()); - Callee.setNode(mapLookup(FromCall.Callee.getNode(), NodeMap)); - CallArgs.reserve(FromCall.CallArgs.size()); - - for (unsigned i = 0, e = FromCall.CallArgs.size(); i != e; ++i) { - const DSNodeHandle &OldNH = FromCall.CallArgs[i]; - CallArgs.push_back(DSNodeHandle(mapLookup(OldNH.getNode(), NodeMap), - OldNH.getOffset())); - } + InitNH(RetVal, FromCall.RetVal, NodeMap); + InitNH(Callee, FromCall.Callee, NodeMap); + + CallArgs.resize(FromCall.CallArgs.size()); + for (unsigned i = 0, e = FromCall.CallArgs.size(); i != e; ++i) + InitNH(CallArgs[i], FromCall.CallArgs[i], NodeMap); + ResolvingCaller = FromCall.ResolvingCaller; } // Accessor functions... @@ -420,6 +438,9 @@ const DSNodeHandle &getCallee() const { return Callee; } unsigned getNumPtrArgs() const { return CallArgs.size(); } + Function *getResolvingCaller() const { return ResolvingCaller; } + void setResolvingCaller(Function *F) { ResolvingCaller = F; } + DSNodeHandle &getPtrArg(unsigned i) { assert(i < CallArgs.size() && "Argument to getPtrArgNode is out of range!"); return CallArgs[i]; @@ -478,7 +499,7 @@ // destination graph, you may optionally do this by specifying a map to record // this into. DSGraph(const DSGraph &DSG); - DSGraph(const DSGraph &DSG, std::map &BUNodeMapTy); + DSGraph(const DSGraph &DSG, std::map &BUNodeMap); ~DSGraph(); bool hasFunction() const { return Func != 0; } Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.45 llvm/include/llvm/Analysis/DataStructure.h:1.46 --- llvm/include/llvm/Analysis/DataStructure.h:1.45 Sun Oct 20 13:08:55 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Mon Oct 21 14:47:14 2002 @@ -11,6 +11,7 @@ class Type; class DSGraph; +class DSNode; class DSNodeHandle; class DSCallSite; class LocalDataStructures; // A collection of local graphs for a program @@ -108,6 +109,15 @@ class TDDataStructures : public Pass { // DSInfo, one graph for each function std::map DSInfo; + + // Each graph in DSInfo is based on a graph in the BUDS object. The BUMaps + // member keeps the mappings from the BU graphs to the TD graphs as they are + // calculated by calculateGraph. This information is used to properly + // implement resolving of call sites, where the call sites in the BUGraph are + // in terms of the caller function's graph in the BUGraph. + // + typedef std::map BUNodeMapTy; + std::map BUMaps; public: ~TDDataStructures() { releaseMemory(); } @@ -134,8 +144,7 @@ private: DSGraph &calculateGraph(Function &F); - void ResolveCallSite(DSGraph &Graph, - const DSCallSite &CallSite); + void ResolveCallSite(DSGraph &Graph, const DSCallSite &CallSite); }; #if 0 From lattner at cs.uiuc.edu Mon Oct 21 14:48:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 14:48:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp TopDownClosure.cpp Message-ID: <200210211947.OAA05763@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.22 -> 1.23 TopDownClosure.cpp updated: 1.14 -> 1.15 --- Log message: - Add "ResolvingCaller" to the CallSite record. This keeps track of which function was finally able to resolve the function call. Adding this allows the TD pass to actually work right! - Temporarily disable dead node pruning. This will be reenabled soon. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.22 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.23 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.22 Sun Oct 20 21:08:03 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Mon Oct 21 14:47:18 2002 @@ -143,7 +143,9 @@ // Record that the original DSCallSite was a call site of FI. // This may or may not have been known when the DSCallSite was // originally created. - CallSites[&FI].push_back(Call); + std::vector &CallSitesForFunc = CallSites[&FI]; + CallSitesForFunc.push_back(Call); + CallSitesForFunc.back().setResolvingCaller(&F); // Clone the callee's graph into the current graph, keeping // track of where scalars in the old graph _used_ to point, Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.14 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.15 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.14 Mon Oct 21 10:04:18 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Mon Oct 21 14:47:18 2002 @@ -20,6 +20,7 @@ // our memory... here... // void TDDataStructures::releaseMemory() { + BUMaps.clear(); for (std::map::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -76,7 +77,14 @@ BUDataStructures &BU = getAnalysis(); DSGraph &BUGraph = BU.getDSGraph(F); - Graph = new DSGraph(BUGraph); + + // Copy the BU graph, keeping a mapping from the BUGraph to the current Graph + std::map BUNodeMap; + Graph = new DSGraph(BUGraph, BUNodeMap); + + // Convert the mapping from a node-to-node map into a node-to-nodehandle map + BUMaps[&F].insert(BUNodeMap.begin(), BUNodeMap.end()); + BUNodeMap.clear(); // We are done with the temporary map. const std::vector *CallSitesP = BU.getCallSites(F); if (CallSitesP == 0) { @@ -90,14 +98,19 @@ DEBUG(std::cerr << " [TD] Inlining callers for: " << F.getName() << "\n"); const std::vector &CallSites = *CallSitesP; for (unsigned c = 0, ce = CallSites.size(); c != ce; ++c) { - const DSCallSite &CallSite = CallSites[c]; // Copy - Function &Caller = CallSite.getCaller(); - assert(!Caller.isExternal() && "Externals function cannot 'call'!"); + const DSCallSite &CallSite = CallSites[c]; + Function &Caller = *CallSite.getResolvingCaller(); + assert(&Caller && !Caller.isExternal() && + "Externals function cannot 'call'!"); DEBUG(std::cerr << "\t [TD] Inlining caller #" << c << " '" << Caller.getName() << "' into callee: " << F.getName() << "\n"); - if (&Caller != &F) { + if (&Caller == &F) { + // Self-recursive call: this can happen after a cycle of calls is inlined. + ResolveCallSite(*Graph, CallSite); + } else { + // Recursively compute the graph for the Caller. It should be fully // resolved except if there is mutual recursion... // @@ -111,6 +124,9 @@ std::map OldValMap; std::map OldNodeMap; + // Translate call site from having links into the BU graph + DSCallSite CallSiteInCG(CallSite, BUMaps[&Caller]); + // Clone the Caller's graph into the current graph, keeping // track of where scalars in the old graph _used_ to point... // Do this here because it only needs to happens once for each Caller! @@ -121,20 +137,17 @@ /*StripAllocas*/ false, /*CopyCallers*/ true, /*CopyOrigCalls*/false); - - // Make a temporary copy of the call site, and transform the argument node - // pointers. - // + ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); } - ResolveCallSite(*Graph, CallSite); } // Recompute the Incomplete markers and eliminate unreachable nodes. +#if 0 Graph->maskIncompleteMarkers(); Graph->markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/); Graph->removeDeadNodes(/*KeepAllGlobals*/ false, /*KeepCalls*/ false); - +#endif DEBUG(std::cerr << " [TD] Done inlining callers for: " << F.getName() << " [" << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size() << "]\n"); From lattner at cs.uiuc.edu Mon Oct 21 14:51:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 14:51:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200210211950.OAA05879@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.18 -> 1.19 --- Log message: Delete unused arguments to DSGraph::cloneInto method --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.18 llvm/include/llvm/Analysis/DSGraph.h:1.19 --- llvm/include/llvm/Analysis/DSGraph.h:1.18 Mon Oct 21 14:47:14 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Mon Oct 21 14:50:27 2002 @@ -579,14 +579,11 @@ // is filled into the OldValMap member. // If StripScalars (StripAllocas) is set to true, Scalar (Alloca) markers // are removed from the graph as the graph is being cloned. - // If CopyCallers is set to true, the PendingCallers list is copied. - // If CopyOrigCalls is set to true, the OrigFunctionCalls list is copied. // DSNodeHandle cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - bool StripScalars = false, bool StripAllocas = false, - bool CopyCallers = true, bool CopyOrigCalls = true); + bool StripScalars = false, bool StripAllocas = false); #if 0 // cloneGlobalInto - Clone the given global node (or the node for the given From lattner at cs.uiuc.edu Mon Oct 21 14:51:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 14:51:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp TopDownClosure.cpp Message-ID: <200210211950.OAA05890@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.23 -> 1.24 DataStructure.cpp updated: 1.34 -> 1.35 TopDownClosure.cpp updated: 1.15 -> 1.16 --- Log message: Delete unused arguments to DSGraph::cloneInto method --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.23 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.24 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.23 Mon Oct 21 14:47:18 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Mon Oct 21 14:50:29 2002 @@ -157,9 +157,7 @@ // structure graph. Strip locals and don't copy the list of callers DSNodeHandle RetVal = Graph->cloneInto(GI, OldValMap, OldNodeMap, /*StripScalars*/ true, - /*StripAllocas*/ true, - /*CopyCallers*/ false, - /*CopyOrigCalls*/ false); + /*StripAllocas*/ true); // Resolve the arguments in the call to the actual values... ResolveArguments(Call, FI, OldValMap); Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.34 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.35 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.34 Mon Oct 21 10:32:34 2002 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Mon Oct 21 14:50:29 2002 @@ -423,8 +423,7 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G, std::map &OldValMap, std::map &OldNodeMap, - bool StripScalars, bool StripAllocas, - bool CopyCallers, bool CopyOrigCalls) { + bool StripScalars, bool StripAllocas) { assert(OldNodeMap.empty() && "Returned OldNodeMap should be empty!"); unsigned FN = Nodes.size(); // First new node... Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.15 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.16 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.15 Mon Oct 21 14:47:18 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Mon Oct 21 14:50:29 2002 @@ -134,9 +134,7 @@ // DSNodeHandle RetVal = Graph->cloneInto(CG, OldValMap, OldNodeMap, /*StripScalars*/ true, - /*StripAllocas*/ false, - /*CopyCallers*/ true, - /*CopyOrigCalls*/false); + /*StripAllocas*/ false); ResolveCallSite(*Graph, DSCallSite(CallSiteInCG, OldNodeMap)); } } From lattner at cs.uiuc.edu Mon Oct 21 14:59:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 14:59:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/WritingAnLLVMPass.html Message-ID: <200210211958.OAA20366@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: WritingAnLLVMPass.html updated: 1.11 -> 1.12 --- Log message: Rename Analysis Usage methods --- Diffs of the changes: Index: llvm/www/docs/WritingAnLLVMPass.html diff -u llvm/www/docs/WritingAnLLVMPass.html:1.11 llvm/www/docs/WritingAnLLVMPass.html:1.12 --- llvm/www/docs/WritingAnLLVMPass.html:1.11 Wed Sep 25 17:31:38 2002 +++ llvm/www/docs/WritingAnLLVMPass.html Mon Oct 21 14:57:59 2002 @@ -694,14 +694,14 @@ // setPreservesAll - Call this if the pass does not modify its input at all void AnalysisUsage::setPreservesAll(); - // preservesCFG - This function should be called by the pass, iff they do not: + // setPreservesCFG - This function should be called by the pass, iff they do not: // // 1. Add or remove basic blocks from the function // 2. Modify terminator instructions in any way. // // This is automatically implied for BasicBlockPass's // - void AnalysisUsage::preservesCFG(); + void AnalysisUsage::setPreservesCFG();

Some examples of how to use these methods are:

@@ -720,7 +720,7 @@

   // This example modifies the program, but does not modify the CFG
   void LICM::getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.preservesCFG();
+    AU.setPreservesCFG();
     AU.addRequired<LoopInfo>();
   }
 

@@ -1223,6 +1223,6 @@

Chris Lattner
-Last modified: Wed Sep 25 17:20:10 CDT 2002 +Last modified: Mon Oct 21 14:52:55 CDT 2002 From lattner at cs.uiuc.edu Mon Oct 21 15:01:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 15:01:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/PassAnalysisSupport.h Message-ID: <200210212000.PAA07289@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassAnalysisSupport.h updated: 1.10 -> 1.11 --- Log message: - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to setPreservesCFG to be less confusing. --- Diffs of the changes: Index: llvm/include/llvm/PassAnalysisSupport.h diff -u llvm/include/llvm/PassAnalysisSupport.h:1.10 llvm/include/llvm/PassAnalysisSupport.h:1.11 --- llvm/include/llvm/PassAnalysisSupport.h:1.10 Wed Sep 25 16:59:09 2002 +++ llvm/include/llvm/PassAnalysisSupport.h Mon Oct 21 15:00:19 2002 @@ -61,17 +61,18 @@ // setPreservesAll - Set by analyses that do not transform their input at all void setPreservesAll() { PreservesAll = true; } - bool preservesAll() const { return PreservesAll; } + bool getPreservesAll() const { return PreservesAll; } - // preservesCFG - This function should be called by the pass, iff they do not: - // - // 1. Add or remove basic blocks from the function - // 2. Modify terminator instructions in any way. - // - // This function annotates the AnalysisUsage info object to say that analyses - // that only depend on the CFG are preserved by this pass. - // - void preservesCFG(); + /// setPreservesCFG - This function should be called by the pass, iff they do + /// not: + /// + /// 1. Add or remove basic blocks from the function + /// 2. Modify terminator instructions in any way. + /// + /// This function annotates the AnalysisUsage info object to say that analyses + /// that only depend on the CFG are preserved by this pass. + /// + void setPreservesCFG(); const std::vector &getRequiredSet() const { return Required; } const std::vector &getPreservedSet() const { return Preserved; } From lattner at cs.uiuc.edu Mon Oct 21 15:01:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 15:01:02 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/LevelRaise.cpp Message-ID: <200210212000.PAA07296@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: LevelRaise.cpp updated: 1.73 -> 1.74 --- Log message: - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to setPreservesCFG to be less confusing. --- Diffs of the changes: Index: llvm/lib/Transforms/LevelRaise.cpp diff -u llvm/lib/Transforms/LevelRaise.cpp:1.73 llvm/lib/Transforms/LevelRaise.cpp:1.74 --- llvm/lib/Transforms/LevelRaise.cpp:1.73 Tue Oct 8 17:19:25 2002 +++ llvm/lib/Transforms/LevelRaise.cpp Mon Oct 21 15:00:21 2002 @@ -569,7 +569,7 @@ virtual bool runOnFunction(Function &F) { return doRPR(F); } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } }; } From lattner at cs.uiuc.edu Mon Oct 21 15:01:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 15:01:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/TraceValues.cpp Message-ID: <200210212000.PAA07305@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: TraceValues.cpp updated: 1.50 -> 1.51 --- Log message: - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to setPreservesCFG to be less confusing. --- Diffs of the changes: Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.50 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.51 --- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.50 Thu Oct 17 11:22:08 2002 +++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Mon Oct 21 15:00:23 2002 @@ -78,7 +78,7 @@ bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } }; From lattner at cs.uiuc.edu Mon Oct 21 15:01:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 15:01:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ConstantProp.cpp DCE.cpp GCSE.cpp IndVarSimplify.cpp InstructionCombining.cpp LICM.cpp PiNodeInsertion.cpp PromoteMemoryToRegister.cpp Reassociate.cpp SCCP.cpp Message-ID: <200210212000.PAA07330@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ConstantProp.cpp updated: 1.39 -> 1.40 DCE.cpp updated: 1.47 -> 1.48 GCSE.cpp updated: 1.24 -> 1.25 IndVarSimplify.cpp updated: 1.31 -> 1.32 InstructionCombining.cpp updated: 1.61 -> 1.62 LICM.cpp updated: 1.19 -> 1.20 PiNodeInsertion.cpp updated: 1.8 -> 1.9 PromoteMemoryToRegister.cpp updated: 1.32 -> 1.33 Reassociate.cpp updated: 1.11 -> 1.12 SCCP.cpp updated: 1.61 -> 1.62 --- Log message: - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to setPreservesCFG to be less confusing. --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/ConstantProp.cpp diff -u llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.39 llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.40 --- llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.39 Tue Oct 1 17:38:40 2002 +++ llvm/lib/Transforms/Scalar/ConstantProp.cpp Mon Oct 21 15:00:26 2002 @@ -27,7 +27,7 @@ bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } }; Index: llvm/lib/Transforms/Scalar/DCE.cpp diff -u llvm/lib/Transforms/Scalar/DCE.cpp:1.47 llvm/lib/Transforms/Scalar/DCE.cpp:1.48 --- llvm/lib/Transforms/Scalar/DCE.cpp:1.47 Tue Oct 1 17:38:40 2002 +++ llvm/lib/Transforms/Scalar/DCE.cpp Mon Oct 21 15:00:26 2002 @@ -38,7 +38,7 @@ } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } }; @@ -60,7 +60,7 @@ virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } }; Index: llvm/lib/Transforms/Scalar/GCSE.cpp diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.24 llvm/lib/Transforms/Scalar/GCSE.cpp:1.25 --- llvm/lib/Transforms/Scalar/GCSE.cpp:1.24 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/GCSE.cpp Mon Oct 21 15:00:26 2002 @@ -39,7 +39,7 @@ // This transformation requires dominator and immediate dominator info virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); AU.addRequired(); AU.addRequired(); AU.addRequired(); Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.31 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.32 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.31 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Oct 21 15:00:26 2002 @@ -190,7 +190,7 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); - AU.preservesCFG(); + AU.setPreservesCFG(); } }; RegisterOpt X("indvars", Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.61 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.62 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.61 Tue Oct 8 12:07:39 2002 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 21 15:00:26 2002 @@ -53,7 +53,7 @@ virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } // Visitation implementation - Implement instruction combining for different Index: llvm/lib/Transforms/Scalar/LICM.cpp diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.19 llvm/lib/Transforms/Scalar/LICM.cpp:1.20 --- llvm/lib/Transforms/Scalar/LICM.cpp:1.19 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/LICM.cpp Mon Oct 21 15:00:26 2002 @@ -29,7 +29,7 @@ /// loop preheaders be inserted into the CFG... /// virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); AU.addRequiredID(LoopPreheadersID); AU.addRequired(); AU.addRequired(); Index: llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp diff -u llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.8 llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.9 --- llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.8 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp Mon Oct 21 15:00:26 2002 @@ -42,7 +42,7 @@ virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); AU.addRequired(); } Index: llvm/lib/Transforms/Scalar/PromoteMemoryToRegister.cpp diff -u llvm/lib/Transforms/Scalar/PromoteMemoryToRegister.cpp:1.32 llvm/lib/Transforms/Scalar/PromoteMemoryToRegister.cpp:1.33 --- llvm/lib/Transforms/Scalar/PromoteMemoryToRegister.cpp:1.32 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/PromoteMemoryToRegister.cpp Mon Oct 21 15:00:26 2002 @@ -55,7 +55,7 @@ // virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); - AU.preservesCFG(); + AU.setPreservesCFG(); } private: Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.11 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.12 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.11 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Mon Oct 21 15:00:26 2002 @@ -37,7 +37,7 @@ bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } private: void BuildRankMap(Function &F); Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.61 llvm/lib/Transforms/Scalar/SCCP.cpp:1.62 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.61 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Oct 21 15:00:26 2002 @@ -96,7 +96,7 @@ bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.preservesCFG(); + AU.setPreservesCFG(); } From lattner at cs.uiuc.edu Mon Oct 21 15:01:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 15:01:05 2002 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManagerT.h Message-ID: <200210212000.PAA07339@apoc.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.39 -> 1.40 PassManagerT.h updated: 1.33 -> 1.34 --- Log message: - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to setPreservesCFG to be less confusing. --- Diffs of the changes: Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.39 llvm/lib/VMCore/Pass.cpp:1.40 --- llvm/lib/VMCore/Pass.cpp:1.39 Tue Oct 1 14:54:07 2002 +++ llvm/lib/VMCore/Pass.cpp Mon Oct 21 15:00:28 2002 @@ -43,7 +43,7 @@ // AnalysisUsage Class Implementation // -// preservesCFG - This function should be called to by the pass, iff they do +// setPreservesCFG - This function should be called to by the pass, iff they do // not: // // 1. Add or remove basic blocks from the function @@ -52,7 +52,7 @@ // This function annotates the AnalysisUsage info object to say that analyses // that only depend on the CFG are preserved by this pass. // -void AnalysisUsage::preservesCFG() { +void AnalysisUsage::setPreservesCFG() { // Since this transformation doesn't modify the CFG, it preserves all analyses // that only depend on the CFG (like dominators, loop info, etc...) // Index: llvm/lib/VMCore/PassManagerT.h diff -u llvm/lib/VMCore/PassManagerT.h:1.33 llvm/lib/VMCore/PassManagerT.h:1.34 --- llvm/lib/VMCore/PassManagerT.h:1.33 Tue Oct 1 15:12:06 2002 +++ llvm/lib/VMCore/PassManagerT.h Mon Oct 21 15:00:28 2002 @@ -252,7 +252,7 @@ // Erase all analyses not in the preserved set... - if (!AnUsage.preservesAll()) { + if (!AnUsage.getPreservesAll()) { const std::vector &PreservedSet = AnUsage.getPreservedSet(); for (std::map::iterator I = CurrentAnalyses.begin(), E = CurrentAnalyses.end(); I != E; ) @@ -472,7 +472,7 @@ markPassUsed(*I, P); // Mark *I as used by P // Erase all analyses not in the preserved set... - if (!AnUsage.preservesAll()) { + if (!AnUsage.getPreservesAll()) { const std::vector &PreservedSet = AnUsage.getPreservedSet(); for (std::map::iterator I = CurrentAnalyses.begin(), E = CurrentAnalyses.end(); I != E; ) { From brukman at cs.uiuc.edu Mon Oct 21 18:49:00 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 18:49:00 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/llub/ Message-ID: <200210212348.SAA10391@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer/llub: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Regression/Reoptimizer/llub added to the repository --- Diffs of the changes: From brukman at cs.uiuc.edu Mon Oct 21 18:50:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 18:50:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/llub/Makefile llub.c Message-ID: <200210212349.SAA10411@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer/llub: Makefile added (r1.1) llub.c added (r1.1) --- Log message: Added the llubenchmark.c test case: this failes with "Bus error" upon trying to execute it. --- Diffs of the changes: From brukman at cs.uiuc.edu Mon Oct 21 18:58:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 18:58:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/Makefile.mk Message-ID: <200210212357.SAA10473@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer: Makefile.mk updated: 1.1 -> 1.2 --- Log message: Fixed paths, eliminated unnecessary objects being linked in and kept around. --- Diffs of the changes: Index: llvm/test/Regression/Reoptimizer/Makefile.mk diff -u llvm/test/Regression/Reoptimizer/Makefile.mk:1.1 llvm/test/Regression/Reoptimizer/Makefile.mk:1.2 --- llvm/test/Regression/Reoptimizer/Makefile.mk:1.1 Mon Oct 21 13:23:20 2002 +++ llvm/test/Regression/Reoptimizer/Makefile.mk Mon Oct 21 18:56:53 2002 @@ -3,15 +3,10 @@ # using Anand's path profiling/trace cache instrumentation # find the src and obj root directories -#LEVEL := ../../../.. -#OBJ_ROOT := /localhome/$(USER) -#LLVM_SRC = $(shell cd $(LEVEL); pwd) -#LLVM_OBJ = $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(LLVM_SRC)) - -# switch to Anand's source base... -LLVM_SRC := /home/vadve/ashukla/cvs2/llvm -LLVM_OBJ := /localhome/ashukla/cvs2/llvm - +LEVEL := ../../../.. +OBJ_ROOT := /localhome/$(USER) +LLVM_SRC = $(shell cd $(LEVEL); pwd) +LLVM_OBJ = $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(LLVM_SRC)) LLVM_LIB := $(LLVM_OBJ)/lib/Debug # This lets us keep a single copy of Trigger.{s,o} in the common directory @@ -44,20 +39,17 @@ $(OUTS): $(OUTBC) llc -f $(OUTBC) -# Anand assures me this absolutely needs to be linked in -RUNTIME = /home/vadve/ashukla/runtime.o -LIB_DEBUG = $(LLVM_OBJ)/lib/Debug -OBJS = $(RUNTIME) $(TRIGGER_O) $(LIB_DEBUG)/tracecache.o $(LIB_DEBUG)/mapinfo.o -LIBS = -lbcreader -lvmcore -lsupport -ltransformutils -lprofpaths +OBJS = $(TRIGGER_O) $(LLVM_LIB)/tracecache.o $(LLVM_LIB)/mapinfo.o +LIBS = -lbcreader -lvmcore -lsupport -lprofpaths -ltransformutils $(OUTO): $(OUTS) - g++ $(GPROF) -c -L $(LIB_DEBUG) $(OUTS) -o $(OUTO) + g++ $(GPROF) -c -L $(LLVM_LIB) $(OUTS) -o $(OUTO) $(OUTR): $(OUTO) $(OBJS) - g++ $(GPROF) -L $(LIB_DEBUG) $(OUTO) -o $(OUTR) $(OBJS) $(LIBS) + g++ $(GPROF) -L $(LLVM_LIB) $(OUTO) -o $(OUTR) $(OBJS) $(LIBS) profile: $(OUTR) - env LD_LIBRARY_PATH=$(LLVM_LIB) ./$(OUTR) + tcsh -c "setenv LD_LIBRARY_PATH $(LLVM_LIB); ./$(OUTR); unsetenv LD_LIBRARY_PATH" ggprof -c $(OUTR) > $(OUT_PROF) clean: From brukman at cs.uiuc.edu Mon Oct 21 18:58:02 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 18:58:02 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/ticm.c Message-ID: <200210212357.SAA10496@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer: ticm.c (r1.1) removed --- Log message: This file has been moved to a separate subdirectory. --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Oct 21 19:16:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Oct 21 19:16:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210220015.TAA10650@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.66 -> 1.67 --- Log message: Small space optimization: Make MachineOperands take 16 bytes instead of 20 on intel or 24 on sparc --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.66 llvm/include/llvm/CodeGen/MachineInstr.h:1.67 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.66 Mon Oct 21 08:24:50 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Mon Oct 21 19:15:13 2002 @@ -72,8 +72,6 @@ static const char LOFLAG64 = 0x20; // operand is %lo64(value_or_immedVal) private: - MachineOperandType opType; - union { Value* value; // BasicBlockVal for a label operand. // ConstantVal for a non-address immediate. @@ -83,10 +81,10 @@ int64_t immedVal; // constant value for an explicit constant }; + MachineOperandType opType:8; // Pack into 8 bits efficiently after flags. + char flags; // see bit field definitions above int regNum; // register number for an explicit register // will be set for a value after reg allocation - char flags; // see bit field definitions above - public: /*ctor*/ MachineOperand (); /*ctor*/ MachineOperand (MachineOperandType operandType, @@ -189,25 +187,18 @@ inline MachineOperand::MachineOperand() - : opType(MO_VirtualRegister), - immedVal(0), - regNum(-1), - flags(0) + : immedVal(0), opType(MO_VirtualRegister), flags(0), regNum(-1) {} inline MachineOperand::MachineOperand(MachineOperandType operandType, Value* _val) - : opType(operandType), - immedVal(0), - regNum(-1), - flags(0) + : immedVal(0), opType(operandType), flags(0), regNum(-1) {} inline MachineOperand::MachineOperand(const MachineOperand& mo) - : opType(mo.opType), - flags(mo.flags) + : opType(mo.opType), flags(mo.flags) { switch(opType) { case MO_VirtualRegister: @@ -276,7 +267,7 @@ // a CALL (if any), and return value of a RETURN. //--------------------------------------------------------------------------- -class MachineInstr : public Annotable, // Values are annotable +class MachineInstr : public Annotable, // MachineInstrs are annotable public NonCopyable { // Disable copy operations MachineOpCode opCode; // the opcode OpCodeMask opCodeMask; // extra bits for variants of an opcode From brukman at cs.uiuc.edu Mon Oct 21 20:47:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 20:47:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/ticm/.cvsignore ticm.c Message-ID: <200210220146.UAA11395@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer/ticm: .cvsignore added (r1.1) ticm.c updated: 1.1 -> 1.2 --- Log message: Made ticm execute 5 loops instead of just one, this gives more profile information: there is only 77% time spent in dummyFunction now. .cvsignore helps to not have to see 7 out.* files when running `cvs up'. --- Diffs of the changes: Index: llvm/test/Regression/Reoptimizer/ticm/ticm.c diff -u llvm/test/Regression/Reoptimizer/ticm/ticm.c:1.1 llvm/test/Regression/Reoptimizer/ticm/ticm.c:1.2 --- llvm/test/Regression/Reoptimizer/ticm/ticm.c:1.1 Mon Oct 21 13:23:54 2002 +++ llvm/test/Regression/Reoptimizer/ticm/ticm.c Mon Oct 21 20:46:12 2002 @@ -1,7 +1,7 @@ #include #include -#define NMAX 1992 +#define NMAX 500 int main(int argc, char** argv) @@ -11,19 +11,20 @@ N = (argc >= 2)? atoi(argv[1]) : NMAX; k = N; -#define FORLOOP for (i=0; i < N*N; i++) \ +#define FORLOOP sum = 0; \ + for (i=0; i < N*N; i++) \ { \ if (N-i >= NMAX) \ k = k+1; \ sum += i * k * k; \ - } + } \ + printf("N = %d, k = %d, sum = %d\n", N, k, sum); FORLOOP; FORLOOP; FORLOOP; FORLOOP; FORLOOP; - - printf("N = %d, k = %d, sum = %d\n", N, k, sum); + return 0; } From brukman at cs.uiuc.edu Mon Oct 21 23:36:01 2002 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Oct 21 23:36:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Reoptimizer/llub/.cvsignore Message-ID: <200210220435.XAA11477@trinity.cs.uiuc.edu> Changes in directory llvm/test/Regression/Reoptimizer/llub: .cvsignore added (r1.1) --- Log message: This will quell cvs messages about all the by-product files of profiling. --- Diffs of the changes: From lattner at cs.uiuc.edu Tue Oct 22 10:59:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 10:59:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200210221558.KAA14292@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.19 -> 1.20 --- Log message: Allow modification of callee --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.19 llvm/include/llvm/Analysis/DSGraph.h:1.20 --- llvm/include/llvm/Analysis/DSGraph.h:1.19 Mon Oct 21 14:50:27 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Tue Oct 22 10:57:58 2002 @@ -436,6 +436,8 @@ DSNodeHandle &getCallee() { return Callee; } const DSNodeHandle &getRetVal() const { return RetVal; } const DSNodeHandle &getCallee() const { return Callee; } + void setCallee(const DSNodeHandle &H) { Callee = H; } + unsigned getNumPtrArgs() const { return CallArgs.size(); } Function *getResolvingCaller() const { return ResolvingCaller; } From lattner at cs.uiuc.edu Tue Oct 22 10:59:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 10:59:03 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure.h Message-ID: <200210221558.KAA14305@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DataStructure.h updated: 1.46 -> 1.47 --- Log message: We need to know the call sites each function hosts --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure.h:1.46 llvm/include/llvm/Analysis/DataStructure.h:1.47 --- llvm/include/llvm/Analysis/DataStructure.h:1.46 Mon Oct 21 14:47:14 2002 +++ llvm/include/llvm/Analysis/DataStructure.h Tue Oct 22 10:58:23 2002 @@ -65,7 +65,6 @@ // only performs a "Bottom Up" propogation (hence the name). // class BUDataStructures : public Pass { -private: // DSInfo, one graph for each function std::map DSInfo; std::map > CallSites; @@ -118,6 +117,15 @@ // typedef std::map BUNodeMapTy; std::map BUMaps; + + // CallSitesForFunction - This is a temporary map that is only kept around + // when building the top-down closures for a program. It traverses all of the + // call sites in the BU graph and holds all of the call sites that each + // function is the "resolving caller" for. + // + std::map > CallSitesForFunction; + public: ~TDDataStructures() { releaseMemory(); } From lattner at cs.uiuc.edu Tue Oct 22 10:59:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 10:59:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200210221558.KAA14314@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.24 -> 1.25 --- Log message: The callee is not correct, and confuses the TD pass. Null it out. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.24 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.25 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.24 Mon Oct 21 14:50:29 2002 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Tue Oct 22 10:58:46 2002 @@ -146,6 +146,7 @@ std::vector &CallSitesForFunc = CallSites[&FI]; CallSitesForFunc.push_back(Call); CallSitesForFunc.back().setResolvingCaller(&F); + CallSitesForFunc.back().setCallee(0); // Clone the callee's graph into the current graph, keeping // track of where scalars in the old graph _used_ to point, From lattner at cs.uiuc.edu Tue Oct 22 11:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 11:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200210221601.LAA14337@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.16 -> 1.17 --- Log message: - Make sure to only keep track of mappings that the TD pass may need in the future. This prevents having spurious map entries to nodes that we really don't care about. This allows us to reenable the DeadNodeElim, which was disabled. --- Diffs of the changes: Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.16 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.17 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.16 Mon Oct 21 14:50:29 2002 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Tue Oct 22 11:01:03 2002 @@ -12,6 +12,7 @@ #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" +#include static RegisterAnalysis Y("tddatastructure", "Top-down Data Structure Analysis Closure"); @@ -34,10 +35,23 @@ // program. // bool TDDataStructures::run(Module &M) { - // Simply calculate the graphs for each function... + BUDataStructures &BU = getAnalysis(); + + // Calculate the CallSitesForFunction mapping from the BU info... + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isExternal()) + if (const std::vector *CS = BU.getCallSites(*I)) + for (unsigned i = 0, e = CS->size(); i != e; ++i) + if (Function *F = (*CS)[i].getResolvingCaller()) + CallSitesForFunction[F].push_back(&(*CS)[i]); + + // Next calculate the graphs for each function... for (Module::reverse_iterator I = M.rbegin(), E = M.rend(); I != E; ++I) if (!I->isExternal()) calculateGraph(*I); + + // Destroy the temporary mapping... + CallSitesForFunction.clear(); return false; } @@ -82,8 +96,37 @@ std::map BUNodeMap; Graph = new DSGraph(BUGraph, BUNodeMap); + // We only need the BUMap entries for the nodes that are used in call sites. + // Calculate which nodes are needed. + std::set NeededNodes; + std::map >::iterator CSFFI + = CallSitesForFunction.find(&F); + if (CSFFI == CallSitesForFunction.end()) { + BUNodeMap.clear(); // No nodes are neccesary + } else { + std::vector &CSV = CSFFI->second; + for (unsigned i = 0, e = CSV.size(); i != e; ++i) { + NeededNodes.insert(CSV[i]->getRetVal().getNode()); + for (unsigned j = 0, je = CSV[i]->getNumPtrArgs(); j != je; ++j) + NeededNodes.insert(CSV[i]->getPtrArg(j).getNode()); + } + } + + // Loop through te BUNodeMap, keeping only the nodes that are "Needed" + for (std::map::iterator I = BUNodeMap.begin(); + I != BUNodeMap.end(); ) + if (NeededNodes.count(I->first) && I->first) // Keep needed nodes... + ++I; + else { + std::map::iterator J = I++; + BUNodeMap.erase(J); + } + + NeededNodes.clear(); // We are done with this temporary data structure + // Convert the mapping from a node-to-node map into a node-to-nodehandle map - BUMaps[&F].insert(BUNodeMap.begin(), BUNodeMap.end()); + BUNodeMapTy &BUMap = BUMaps[&F]; + BUMap.insert(BUNodeMap.begin(), BUNodeMap.end()); BUNodeMap.clear(); // We are done with the temporary map. const std::vector *CallSitesP = BU.getCallSites(F); @@ -140,12 +183,11 @@ } // Recompute the Incomplete markers and eliminate unreachable nodes. -#if 0 Graph->maskIncompleteMarkers(); Graph->markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage() /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/); Graph->removeDeadNodes(/*KeepAllGlobals*/ false, /*KeepCalls*/ false); -#endif + DEBUG(std::cerr << " [TD] Done inlining callers for: " << F.getName() << " [" << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size() << "]\n"); From lattner at cs.uiuc.edu Tue Oct 22 18:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:17:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210222316.SAA18460@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.67 -> 1.68 --- Log message: - Two minor improvements to the MachineInstr class to reduce footprint and overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a bitvector. Sped up LLC a little less than 10% in a debug build! --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.67 llvm/include/llvm/CodeGen/MachineInstr.h:1.68 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.67 Mon Oct 21 19:15:13 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Tue Oct 22 18:16:14 2002 @@ -12,7 +12,6 @@ #include "llvm/Target/MachineInstrInfo.h" #include "llvm/Annotation.h" #include -#include class Instruction; //--------------------------------------------------------------------------- @@ -267,17 +266,26 @@ // a CALL (if any), and return value of a RETURN. //--------------------------------------------------------------------------- -class MachineInstr : public Annotable, // MachineInstrs are annotable - public NonCopyable { // Disable copy operations +class MachineInstr : public Annotable, // MachineInstrs are annotable + public NonCopyable { // Disable copy operations MachineOpCode opCode; // the opcode OpCodeMask opCodeMask; // extra bits for variants of an opcode std::vector operands; // the operands - std::vector implicitRefs; // values implicitly referenced by this - std::vector implicitIsDef; // machine instruction (eg, call args) - std::vector implicitIsDefAndUse; - hash_set regsUsed; // all machine registers used for this - // instruction, including regs used - // to save values across the instr. + + struct ImplicitRef { + Value *Val; + bool isDef, isDefAndUse; + + ImplicitRef(Value *V, bool D, bool DU) : Val(V), isDef(D), isDefAndUse(DU){} + }; + + // implicitRefs - Values implicitly referenced by this machine instruction + // (eg, call args) + std::vector implicitRefs; + + // regsUsed - all machine registers used for this instruction, including regs + // used to save values across the instruction. This is a bitset of registers. + std::vector regsUsed; public: /*ctor*/ MachineInstr (MachineOpCode _opCode, OpCodeMask _opCodeMask = 0x0); @@ -313,7 +321,7 @@ // // Information about implicit operands of the instruction // - unsigned getNumImplicitRefs() const{return implicitRefs.size();} + unsigned getNumImplicitRefs() const{ return implicitRefs.size();} bool implicitRefIsDefined(unsigned i) const; bool implicitRefIsDefinedAndUsed(unsigned i) const; @@ -324,9 +332,15 @@ // // Information about registers used in this instruction // - const hash_set& getRegsUsed () const { return regsUsed; } - hash_set& getRegsUsed () { return regsUsed; } + const std::vector &getRegsUsed () const { return regsUsed; } + // insertUsedReg - Add a register to the Used registers set... + void insertUsedReg(unsigned Reg) { + if (Reg >= regsUsed.size()) + regsUsed.resize(Reg+1); + regsUsed[Reg] = true; + } + // // Debugging support // @@ -477,41 +491,38 @@ } inline bool -MachineInstr::implicitRefIsDefined(unsigned int i) const +MachineInstr::implicitRefIsDefined(unsigned i) const { - assert(i < implicitIsDef.size() && "operand out of range!"); - return implicitIsDef[i]; + assert(i < implicitRefs.size() && "operand out of range!"); + return implicitRefs[i].isDef; } inline bool -MachineInstr::implicitRefIsDefinedAndUsed(unsigned int i) const +MachineInstr::implicitRefIsDefinedAndUsed(unsigned i) const { - assert(i < implicitIsDefAndUse.size() && "operand out of range!"); - return implicitIsDefAndUse[i]; + assert(i < implicitRefs.size() && "operand out of range!"); + return implicitRefs[i].isDefAndUse; } inline const Value* -MachineInstr::getImplicitRef(unsigned int i) const +MachineInstr::getImplicitRef(unsigned i) const { assert(i < implicitRefs.size() && "getImplicitRef() out of range!"); - return implicitRefs[i]; + return implicitRefs[i].Val; } inline Value* -MachineInstr::getImplicitRef(unsigned int i) +MachineInstr::getImplicitRef(unsigned i) { assert(i < implicitRefs.size() && "getImplicitRef() out of range!"); - return implicitRefs[i]; + return implicitRefs[i].Val; } inline void MachineInstr::addImplicitRef(Value* val, bool isDef, - bool isDefAndUse) -{ - implicitRefs.push_back(val); - implicitIsDef.push_back(isDef); - implicitIsDefAndUse.push_back(isDefAndUse); + bool isDefAndUse) { + implicitRefs.push_back(ImplicitRef(val, isDef, isDefAndUse)); } inline void @@ -521,9 +532,9 @@ bool isDefAndUse) { assert(i < implicitRefs.size() && "setImplicitRef() out of range!"); - implicitRefs[i] = val; - implicitIsDef[i] = isDef; - implicitIsDefAndUse[i] = isDefAndUse; + implicitRefs[i].Val = val; + implicitRefs[i].isDef = isDef; + implicitRefs[i].isDefAndUse = isDefAndUse; } inline void From lattner at cs.uiuc.edu Tue Oct 22 18:17:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:17:03 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp Message-ID: <200210222316.SAA18467@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: MachineInstr.cpp updated: 1.47 -> 1.48 --- Log message: - Two minor improvements to the MachineInstr class to reduce footprint and overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a bitvector. Sped up LLC a little less than 10% in a debug build! --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.47 llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.48 --- llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp:1.47 Thu Sep 19 19:47:37 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineInstr.cpp Tue Oct 22 18:16:17 2002 @@ -82,14 +82,14 @@ operands[i].markDef(); if (isDefAndUse) operands[i].markDefAndUse(); - regsUsed.insert(regNum); + insertUsedReg(regNum); } void MachineInstr::SetRegForOperand(unsigned i, int regNum) { operands[i].setRegForValue(regNum); - regsUsed.insert(regNum); + insertUsedReg(regNum); } @@ -111,10 +111,10 @@ // Subsitute implicit refs for (unsigned i=0, N=implicitRefs.size(); i < N; ++i) - if (implicitRefs[i] == oldVal) + if (getImplicitRef(i) == oldVal) if (!defsOnly || implicitRefIsDefined(i)) { - implicitRefs[i] = newVal; + implicitRefs[i].Val = newVal; ++numSubst; } From lattner at cs.uiuc.edu Tue Oct 22 18:17:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:17:05 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Message-ID: <200210222316.SAA18474@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: PhyRegAlloc.cpp updated: 1.78 -> 1.79 --- Log message: - Two minor improvements to the MachineInstr class to reduce footprint and overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a bitvector. Sped up LLC a little less than 10% in a debug build! --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.78 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.79 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.78 Fri Oct 11 11:12:40 2002 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Tue Oct 22 18:16:19 2002 @@ -691,10 +691,10 @@ int scratchReg = -1; if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) { - scratchReg = this->getUsableUniRegAtMI(scratchRegType, &LVSetBef, - MInst, MIBef, MIAft); + scratchReg = getUsableUniRegAtMI(scratchRegType, &LVSetBef, + MInst, MIBef, MIAft); assert(scratchReg != MRI.getInvalidRegNum()); - MInst->getRegsUsed().insert(scratchReg); + MInst->insertUsedReg(scratchReg); } if (!isDef || isDefAndUse) { @@ -774,7 +774,7 @@ // of copying it to memory and back. But we have to mark the // register as used by this instruction, so it does not get used // as a scratch reg. by another operand or anyone else. - MInst->getRegsUsed().insert(scratchReg); + MInst->insertUsedReg(scratchReg); MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType); MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType); } @@ -874,12 +874,11 @@ // Add the registers already marked as used by the instruction. // This should include any scratch registers that are used to save // values across the instruction (e.g., for saving state register values). - const hash_set& regsUsed = MInst->getRegsUsed(); - for (hash_set::const_iterator SI=regsUsed.begin(), SE=regsUsed.end(); - SI != SE; ++SI) - { + const vector ®sUsed = MInst->getRegsUsed(); + for (unsigned i = 0, e = regsUsed.size(); i != e; ++i) + if (regsUsed[i]) { unsigned classId = 0; - int classRegNum = MRI.getClassRegNum(*SI, classId); + int classRegNum = MRI.getClassRegNum(i, classId); if (RC->getID() == classId) { assert(classRegNum < (int) IsColorUsedArr.size() && From lattner at cs.uiuc.edu Tue Oct 22 18:17:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:17:06 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcRegInfo.cpp Message-ID: <200210222316.SAA18481@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcRegInfo.cpp updated: 1.74 -> 1.75 --- Log message: - Two minor improvements to the MachineInstr class to reduce footprint and overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a bitvector. Sped up LLC a little less than 10% in a debug build! --- Diffs of the changes: Index: llvm/lib/Target/Sparc/SparcRegInfo.cpp diff -u llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.74 llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.75 --- llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.74 Mon Oct 14 11:32:49 2002 +++ llvm/lib/Target/Sparc/SparcRegInfo.cpp Tue Oct 22 18:16:21 2002 @@ -663,7 +663,7 @@ { isArgInReg = true; UniArgReg = (unsigned) UniArgRegOrNone; - CallMI->getRegsUsed().insert(UniArgReg); // mark the reg as used + CallMI->insertUsedReg(UniArgReg); // mark the reg as used } if (LR->hasColor()) { @@ -788,7 +788,7 @@ UniRetReg = getUnifiedRegNum(RegClassID, CorrectCol); // Mark the register as used by this instruction - CallMI->getRegsUsed().insert(UniRetReg); + CallMI->insertUsedReg(UniRetReg); // if the LR received the correct color, NOTHING to do recvCorrectColor = RetValLR->hasColor()? RetValLR->getColor() == CorrectCol @@ -1026,7 +1026,7 @@ unsigned UniRetReg = getUnifiedRegNum(RegClassID, CorrectCol); // Mark the register as used by this instruction - RetMI->getRegsUsed().insert(UniRetReg); + RetMI->insertUsedReg(UniRetReg); // if the LR received the correct color, NOTHING to do @@ -1433,7 +1433,7 @@ scratchReg = PRA.getUsableUniRegAtMI(scratchRegType, &LVSetBef, CallMI, AdIBef, AdIAft); assert(scratchReg != getInvalidRegNum()); - CallMI->getRegsUsed().insert(scratchReg); + CallMI->insertUsedReg(scratchReg); } if (AdIBef.size() > 0) @@ -1461,7 +1461,7 @@ scratchReg = PRA.getUsableUniRegAtMI(scratchRegType, &LVSetAft, CallMI, AdIBef, AdIAft); assert(scratchReg != getInvalidRegNum()); - CallMI->getRegsUsed().insert(scratchReg); + CallMI->insertUsedReg(scratchReg); } if (AdIBef.size() > 0) From lattner at cs.uiuc.edu Tue Oct 22 18:29:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:29:00 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200210222328.SAA18961@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.63 -> 1.64 --- Log message: Fix misspelled variable --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.63 llvm/Makefile.common:1.64 --- llvm/Makefile.common:1.63 Sun Oct 20 16:45:49 2002 +++ llvm/Makefile.common Tue Oct 22 18:28:23 2002 @@ -432,7 +432,7 @@ $(VERB) $(CompileO) $< -o $@ $(BUILD_ROOT)/Release/%.o: %.c $(BUILD_ROOT)/Release/.dir - $(VERB) $(CompileOC) $< -o $@ + $(VERB) $(CompileCO) $< -o $@ $(BUILD_ROOT)/Profile/%.o: %.cpp $(BUILD_ROOT)/Profile/.dir @echo "Compiling $<" From lattner at cs.uiuc.edu Tue Oct 22 18:35:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:35:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/RegClass.cpp Message-ID: <200210222334.SAA19634@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: RegClass.cpp updated: 1.17 -> 1.18 --- Log message: Ensure definate initialization --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/RegClass.cpp diff -u llvm/lib/CodeGen/RegAlloc/RegClass.cpp:1.17 llvm/lib/CodeGen/RegAlloc/RegClass.cpp:1.18 --- llvm/lib/CodeGen/RegAlloc/RegClass.cpp:1.17 Sat Sep 14 18:05:33 2002 +++ llvm/lib/CodeGen/RegAlloc/RegClass.cpp Tue Oct 22 18:33:57 2002 @@ -158,7 +158,7 @@ { unsigned int IGNodeListSize = IG.getIGNodeList().size(); - double MinSpillCost; + double MinSpillCost = 0; IGNode *MinCostIGNode = NULL; bool isFirstNode = true; From lattner at cs.uiuc.edu Tue Oct 22 18:35:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:35:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Transforms/LevelRaise.cpp Message-ID: <200210222334.SAA19663@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: LevelRaise.cpp updated: 1.74 -> 1.75 --- Log message: Ensure definate initialization --- Diffs of the changes: Index: llvm/lib/Transforms/LevelRaise.cpp diff -u llvm/lib/Transforms/LevelRaise.cpp:1.74 llvm/lib/Transforms/LevelRaise.cpp:1.75 --- llvm/lib/Transforms/LevelRaise.cpp:1.74 Mon Oct 21 15:00:21 2002 +++ llvm/lib/Transforms/LevelRaise.cpp Tue Oct 22 18:34:11 2002 @@ -158,7 +158,7 @@ Value *AddOp1, CastInst *AddOp2) { const CompositeType *CompTy; Value *OffsetVal = AddOp2->getOperand(0); - Value *SrcPtr; // Of type pointer to struct... + Value *SrcPtr = 0; // Of type pointer to struct... if ((CompTy = getPointedToComposite(AddOp1->getType()))) { SrcPtr = AddOp1; // Handle the first case... From lattner at cs.uiuc.edu Tue Oct 22 18:36:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:36:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200210222335.SAA20042@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.64 -> 1.65 --- Log message: Disable optimization that doesn't apply to C --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.64 llvm/Makefile.common:1.65 --- llvm/Makefile.common:1.64 Tue Oct 22 18:28:23 2002 +++ llvm/Makefile.common Tue Oct 22 18:35:28 2002 @@ -163,7 +163,7 @@ # Compile a c file, don't link... CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts) CompileCG := $(CompileC) -g -D_DEBUG -CompileCO := $(CompileC) -O3 -DNDEBUG -finline-functions -felide-constructors -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug +CompileCO := $(CompileC) -O3 -DNDEBUG -finline-functions -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug CompileCP := $(CompileCO) $(PROFILE) From lattner at cs.uiuc.edu Tue Oct 22 18:56:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 18:56:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200210222355.SAA21377@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.38 -> 1.39 --- Log message: Wow, for some reason, when reading bytecode from stdin, we were only reading 4 bytes at a time. Change this to read blocks of 4k --- Diffs of the changes: Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.38 llvm/lib/Bytecode/Reader/Reader.cpp:1.39 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.38 Sun Oct 13 22:33:02 2002 +++ llvm/lib/Bytecode/Reader/Reader.cpp Tue Oct 22 18:55:24 2002 @@ -624,7 +624,7 @@ size_t FileSize = 0; int BlockSize; uchar Buffer[4096], *FileData = 0; - while ((BlockSize = read(0, Buffer, 4))) { + while ((BlockSize = read(0, Buffer, 4096))) { if (BlockSize == -1) { free(FileData); return 0; } FileData = (uchar*)realloc(FileData, FileSize+BlockSize); From lattner at cs.uiuc.edu Tue Oct 22 19:53:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 19:53:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200210230052.TAA24641@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.39 -> 1.40 --- Log message: - Fix a really nasty bug in the bytecode reader that caused it to fail reading bytecode files with > 255 types in them, but only when optimization is enabled. This was caused by GCC shrinking an enum to a single byte instead of a whole word. --- Diffs of the changes: Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.39 llvm/lib/Bytecode/Reader/Reader.cpp:1.40 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.39 Tue Oct 22 18:55:24 2002 +++ llvm/lib/Bytecode/Reader/Reader.cpp Tue Oct 22 19:51:54 2002 @@ -48,15 +48,14 @@ } const Type *BytecodeParser::getType(unsigned ID) { - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); - if (T) return T; + if (ID < Type::NumPrimitiveIDs) { + const Type *T = Type::getPrimitiveType((Type::PrimitiveID)ID); + if (T) return T; + } //cerr << "Looking up Type ID: " << ID << "\n"; - - const Value *D = getValue(Type::TypeTy, ID, false); - if (D == 0) return 0; - - return cast(D); + const Value *V = getValue(Type::TypeTy, ID, false); + return cast_or_null(V); } int BytecodeParser::insertValue(Value *Val, std::vector &ValueTab) { @@ -82,8 +81,10 @@ if (type == Type::TypeTyID) { // The 'type' plane has implicit values assert(Create == false); - const Type *T = Type::getPrimitiveType((Type::PrimitiveID)Num); - if (T) return (Value*)T; // Asked for a primitive type... + if (Num < Type::NumPrimitiveIDs) { + const Type *T = Type::getPrimitiveType((Type::PrimitiveID)Num); + if (T) return (Value*)T; // Asked for a primitive type... + } // Otherwise, derived types need offset... Num -= FirstDerivedTyID; @@ -452,7 +453,7 @@ Error = "Function not ptr to func type! Ty = " + Ty->getDescription(); return true; } - + // We create methods by passing the underlying FunctionType to create... Ty = cast(Ty)->getElementType(); From lattner at cs.uiuc.edu Tue Oct 22 20:13:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 20:13:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/StackSlots.h Message-ID: <200210230112.UAA25946@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: StackSlots.h updated: 1.1 -> 1.2 --- Log message: Minor cleanups --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/StackSlots.h diff -u llvm/include/llvm/CodeGen/StackSlots.h:1.1 llvm/include/llvm/CodeGen/StackSlots.h:1.2 --- llvm/include/llvm/CodeGen/StackSlots.h:1.1 Fri Sep 20 23:57:57 2002 +++ llvm/include/llvm/CodeGen/StackSlots.h Tue Oct 22 20:11:51 2002 @@ -1,16 +1,15 @@ //===-- llvm/CodeGen/StackSots.h -------------------------------*- C++ -*--===// // -// External interface to stack-slots pass that enters 2 empty slots -// at the top of each function stack +// External interface to stack-slots pass that enters 2 empty slots at the top +// of each function stack // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_STACKSLOTS_H #define LLVM_CODEGEN_STACKSLOTS_H -class TargetMachine; class Pass; - -Pass *createStackSlotsPass(TargetMachine &Target); +class TargetMachine; +Pass *createStackSlotsPass(const TargetMachine &TM); #endif From lattner at cs.uiuc.edu Tue Oct 22 20:13:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 20:13:02 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Mapping/StackSlots.cpp Message-ID: <200210230112.UAA25954@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/Mapping: StackSlots.cpp updated: 1.1 -> 1.2 --- Log message: Minor cleanups Make sure to have a pass name --- Diffs of the changes: Index: llvm/lib/CodeGen/Mapping/StackSlots.cpp diff -u llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.1 llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.2 --- llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.1 Fri Sep 20 23:58:26 2002 +++ llvm/lib/CodeGen/Mapping/StackSlots.cpp Tue Oct 22 20:12:01 2002 @@ -1,41 +1,44 @@ //===- StackSlots.cpp - Specialize LLVM code for target machine ---------===// // -// This pass adds 2 empty slots at the top of function stack. -// These two slots are later used during code reoptimization -// for spilling the resgiter values when rewriting branches. +// This pass adds 2 empty slots at the top of function stack. These two slots +// are later used during code reoptimization for spilling the register values +// when rewriting branches. // //===----------------------------------------------------------------------===// +#include "llvm/CodeGen/StackSlots.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineInstrInfo.h" -#include "llvm/Constants.h" +#include "llvm/Constant.h" #include "llvm/Function.h" #include "llvm/DerivedTypes.h" #include "llvm/Pass.h" #include "llvm/CodeGen/MachineCodeForMethod.h" -using std::map; -using std::cerr; +class StackSlots : public FunctionPass { + const TargetMachine &Target; +public: + StackSlots (const TargetMachine &T) : Target(T) {} + const char *getPassName() const { + return "Stack Slot Insertion for profiling code"; + } -class StackSlots : public FunctionPass{ -private: - const TargetMachine ⌖ -public: - StackSlots (const TargetMachine &T): target(T) {} + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + } bool runOnFunction(Function &F) { - Value *v = ConstantSInt::get(Type::IntTy,0); + const Type *PtrInt = PointerType::get(Type::IntTy); + unsigned Size = Target.DataLayout.getTypeSize(PtrInt); + MachineCodeForMethod &mcInfo = MachineCodeForMethod::get(&F); - mcInfo.allocateLocalVar - (target, v, 2*target.DataLayout.getTypeSize(PointerType::get(Type::IntTy))); - + Value *V = Constant::getNullValue(Type::IntTy); + mcInfo.allocateLocalVar(Target, V, 2*Size); return true; } }; - -Pass* createStackSlotsPass(TargetMachine &T){ - return new StackSlots(T); +Pass *createStackSlotsPass(const TargetMachine &Target) { + return new StackSlots(Target); } - From lattner at cs.uiuc.edu Tue Oct 22 22:31:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 22:31:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Message-ID: <200210230330.WAA26779@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: InstrScheduling.cpp updated: 1.42 -> 1.43 --- Log message: Tell PassManager that this pass does not invalidate the CFG so that dominator information and Loop info will not have to be recomputed after this runs. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp diff -u llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.42 llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.43 --- llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.42 Sat Oct 12 19:40:37 2002 +++ llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Tue Oct 22 22:30:42 2002 @@ -1499,6 +1499,7 @@ // getAnalysisUsage - We use LiveVarInfo... virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); + AU.setPreservesCFG(); } bool runOnFunction(Function &F); From lattner at cs.uiuc.edu Tue Oct 22 22:31:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue Oct 22 22:31:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Message-ID: <200210230330.WAA26786@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.47 -> 1.48 --- Log message: Tell PassManager that this pass does not invalidate the CFG so that dominator information and Loop info will not have to be recomputed after this runs. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.47 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.48 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.47 Sun Sep 8 16:19:29 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Tue Oct 22 22:30:47 2002 @@ -63,6 +63,10 @@ int ruleForNode, short* nts); public: InstructionSelection(TargetMachine &T) : Target(T) {} + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesCFG(); + } bool runOnFunction(Function &F); }; From hldnbrnd at cs.uiuc.edu Wed Oct 23 12:34:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Oct 23 12:34:01 2002 Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs Message-ID: <200210231733.MAA17027@trinity.cs.uiuc.edu> Changes in directory llvm/test/Programs: Makefile.programs updated: 1.19 -> 1.20 --- Log message: Updated with the ability to just supress diffing of CBE, but still generate CBE code --- Diffs of the changes: Index: llvm/test/Programs/Makefile.programs diff -u llvm/test/Programs/Makefile.programs:1.19 llvm/test/Programs/Makefile.programs:1.20 --- llvm/test/Programs/Makefile.programs:1.19 Tue Oct 15 14:49:52 2002 +++ llvm/test/Programs/Makefile.programs Wed Oct 23 12:33:24 2002 @@ -48,7 +48,8 @@ # Generated code for llc (which does not require the target platform) LLCCODEGEN := $(addsuffix .llc.s, $(PREFIXED_PROGRAMS_TO_TEST)) - +CBECODEGEN := $(addsuffix .cbe.c, $(PREFIXED_PROGRAMS_TO_TEST)) + # Output produced by programs run GCCOUTPUT := $(addsuffix .ll, $(addprefix Output/,$(Source:.c=))) NATOUTPUT := $(addsuffix .out-nat, $(PREFIXED_PROGRAMS_TO_TEST)) @@ -89,6 +90,12 @@ endif ifndef DISABLE_CBE +all:: $(CBECODEGEN) +else +DISABLE_CBE_DIFFS = 1 +endif + +ifndef DISABLE_CBE_DIFFS all:: $(CBEDIFFS) endif From hldnbrnd at cs.uiuc.edu Wed Oct 23 14:00:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Oct 23 14:00:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp Message-ID: <200210231859.NAA21791@trinity.cs.uiuc.edu> Changes in directory llvm/lib/CWriter: Writer.cpp updated: 1.65 -> 1.66 --- Log message: Malloc prototyping now works even if the original file had its own prototype for malloc --- Diffs of the changes: Index: llvm/lib/CWriter/Writer.cpp diff -u llvm/lib/CWriter/Writer.cpp:1.65 llvm/lib/CWriter/Writer.cpp:1.66 --- llvm/lib/CWriter/Writer.cpp:1.65 Wed Oct 16 15:08:47 2002 +++ llvm/lib/CWriter/Writer.cpp Wed Oct 23 13:59:40 2002 @@ -3,7 +3,6 @@ // This library converts LLVM code to C code, compilable by GCC. // //===-----------------------------------------------------------------------==// - #include "llvm/Assembly/CWriter.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -28,6 +27,7 @@ using std::map; using std::ostream; + namespace { class CWriter : public Pass, public InstVisitor { ostream &Out; @@ -35,6 +35,7 @@ const Module *TheModule; map TypeNames; std::set MangledGlobals; + bool needsMalloc; map FPConstantMap; public: @@ -549,8 +550,6 @@ // Global variable declarations... if (!M->gempty()) { Out << "\n/* External Global Variable Declarations */\n"; - // Needed for malloc to work on sun. - Out << "extern void * malloc(size_t);\n"; for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) { if (I->hasExternalLinkage()) { Out << "extern "; @@ -563,12 +562,19 @@ // Function declarations if (!M->empty()) { Out << "\n/* Function Declarations */\n"; + needsMalloc = true; for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { printFunctionSignature(I, true); Out << ";\n"; } } + // Print Malloc prototype if needed + if (needsMalloc){ + Out << "\n/* Malloc to make sun happy */\n"; + Out << "extern void * malloc(size_t);\n\n"; + } + // Output the global variable definitions and contents... if (!M->gempty()) { Out << "\n\n/* Global Variable Definitions and Initialization */\n"; @@ -673,6 +679,10 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) { + // If the program provides it's own malloc prototype we don't need + // to include the general one. + if (getValueName(F) == "malloc") + needsMalloc = false; if (F->hasInternalLinkage()) Out << "static "; // Loop over the arguments, printing them... From hldnbrnd at cs.uiuc.edu Wed Oct 23 15:51:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Oct 23 15:51:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200210232050.PAA03069@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.7 -> 1.8 --- Log message: Added Burg --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.7 llvm/www/docs/TestStatus.html:1.8 --- llvm/www/docs/TestStatus.html:1.7 Wed Oct 16 17:12:31 2002 +++ llvm/www/docs/TestStatus.html Wed Oct 23 15:50:22 2002 @@ -3,7 +3,8 @@

Test Results

-
last updated: 10/13/2002
+
last updated: 10/23/2002
+
tests current: 10/15/2002

SingleSource

@@ -52,6 +53,7 @@

MultiSource

Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
+ From hldnbrnd at cs.uiuc.edu Wed Oct 23 16:50:00 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Wed Oct 23 16:50:00 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200210232149.QAA29208@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.8 -> 1.9 --- Log message: Fixed it --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.8 llvm/www/docs/TestStatus.html:1.9 --- llvm/www/docs/TestStatus.html:1.8 Wed Oct 23 15:50:22 2002 +++ llvm/www/docs/TestStatus.html Wed Oct 23 16:48:52 2002 @@ -53,7 +53,7 @@

MultiSource

Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
FhourstonesXXO
FhourstonesXXOSeg Fault
Olden-bhXXX
Olden-bisortXXX
- + From hldnbrnd at cs.uiuc.edu Thu Oct 24 15:56:01 2002 From: hldnbrnd at cs.uiuc.edu (Nicholas Hildenbrandt) Date: Thu Oct 24 15:56:01 2002 Subject: [llvm-commits] CVS: llvm/www/docs/TestStatus.html Message-ID: <200210242055.PAA21790@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: TestStatus.html updated: 1.9 -> 1.10 --- Log message: Updated --- Diffs of the changes: Index: llvm/www/docs/TestStatus.html diff -u llvm/www/docs/TestStatus.html:1.9 llvm/www/docs/TestStatus.html:1.10 --- llvm/www/docs/TestStatus.html:1.9 Wed Oct 23 16:48:52 2002 +++ llvm/www/docs/TestStatus.html Thu Oct 24 15:54:49 2002 @@ -3,8 +3,8 @@

Test Results

-
last updated: 10/23/2002
-
tests current: 10/15/2002
+
last updated: 10/24/2002
+
tests current: 10/24/2002

SingleSource

Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
FhourstonesXXO
BurgXXO
FhourstonesXXOSeg Fault
Olden-bhXXX
Olden-bisortXXX
@@ -48,17 +48,18 @@ +
Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
08-02-CastTestXXX
CodegenBugXXX
ArrayResolutionXXX
BadLoadXXO

MultiSource

- + - + From lattner at cs.uiuc.edu Thu Oct 24 17:35:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 24 17:35:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineInstrInfo.h Message-ID: <200210242234.RAA11271@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineInstrInfo.h updated: 1.22 -> 1.23 --- Log message: * Remove unneccesary #includes * Fix typeo in the (unused) MachineInstrInfo::isArith method --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineInstrInfo.h diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.22 llvm/include/llvm/Target/MachineInstrInfo.h:1.23 --- llvm/include/llvm/Target/MachineInstrInfo.h:1.22 Sun Sep 29 16:53:31 2002 +++ llvm/include/llvm/Target/MachineInstrInfo.h Thu Oct 24 17:34:41 2002 @@ -11,8 +11,6 @@ #include "Support/DataTypes.h" #include "llvm/Constant.h" #include "llvm/DerivedTypes.h" -#include -#include class MachineInstrDescriptor; class TmpInstruction; @@ -55,7 +53,7 @@ //--------------------------------------------------------------------------- -const unsigned int M_NOP_FLAG = 1; +const unsigned int M_NOP_FLAG = 1 << 0; const unsigned int M_BRANCH_FLAG = 1 << 1; const unsigned int M_CALL_FLAG = 1 << 2; const unsigned int M_RET_FLAG = 1 << 3; @@ -150,7 +148,7 @@ || getDescriptor(opCode).iclass & M_RET_FLAG; } bool isArith(MachineOpCode opCode) const { - return getDescriptor(opCode).iclass & M_RET_FLAG; + return getDescriptor(opCode).iclass & M_ARITH_FLAG; } bool isCCInstr(MachineOpCode opCode) const { return getDescriptor(opCode).iclass & M_CC_FLAG; @@ -164,7 +162,7 @@ bool isFloatInstr(MachineOpCode opCode) const { return getDescriptor(opCode).iclass & M_FLOAT_FLAG; } - bool isConditional(MachineOpCode opCode) const { + bool isConditional(MachineOpCode opCode) const { return getDescriptor(opCode).iclass & M_CONDL_FLAG; } bool isLoad(MachineOpCode opCode) const { From lattner at cs.uiuc.edu Thu Oct 24 20:44:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 24 20:44:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstr.def Message-ID: <200210250143.UAA12972@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstr.def updated: 1.12 -> 1.13 --- Log message: Fix misspelling --- Diffs of the changes: Index: llvm/lib/Target/Sparc/SparcInstr.def diff -u llvm/lib/Target/Sparc/SparcInstr.def:1.12 llvm/lib/Target/Sparc/SparcInstr.def:1.13 --- llvm/lib/Target/Sparc/SparcInstr.def:1.12 Sat Oct 12 19:22:32 2002 +++ llvm/lib/Target/Sparc/SparcInstr.def Thu Oct 24 20:43:26 2002 @@ -2,7 +2,7 @@ // // This file describes all of the instructions that the sparc backend uses. It // relys on an external 'I' macro being defined that takes the arguments -// specified below, and is used to make all of the information relavant to an +// specified below, and is used to make all of the information relevant to an // instruction be in one place. // //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Thu Oct 24 21:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu Oct 24 21:02:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.cpp Message-ID: <200210250201.VAA13083@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Sparc.cpp updated: 1.46 -> 1.47 --- Log message: Prune #includes --- Diffs of the changes: Index: llvm/lib/Target/Sparc/Sparc.cpp diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.46 llvm/lib/Target/Sparc/Sparc.cpp:1.47 --- llvm/lib/Target/Sparc/Sparc.cpp:1.46 Thu Sep 19 19:52:09 2002 +++ llvm/lib/Target/Sparc/Sparc.cpp Thu Oct 24 21:01:33 2002 @@ -8,9 +8,7 @@ #include "SparcInternals.h" #include "llvm/Target/Sparc.h" #include "llvm/Function.h" -#include "llvm/BasicBlock.h" #include "llvm/CodeGen/MachineCodeForMethod.h" -#include using std::cerr; // Build the MachineInstruction Description Array... From lattner at cs.uiuc.edu Fri Oct 25 09:33:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 09:33:01 2002 Subject: [llvm-commits] CVS: llvm/Makefile.common Message-ID: <200210251432.JAA15479@apoc.cs.uiuc.edu> Changes in directory llvm: Makefile.common updated: 1.65 -> 1.66 --- Log message: Patch submited by Casey to remove obnoxious warnings. --- Diffs of the changes: Index: llvm/Makefile.common diff -u llvm/Makefile.common:1.65 llvm/Makefile.common:1.66 --- llvm/Makefile.common:1.65 Tue Oct 22 18:35:28 2002 +++ llvm/Makefile.common Fri Oct 25 09:32:42 2002 @@ -476,5 +476,5 @@ # SourceDepend := $(addsuffix .d,$(addprefix $(BUILD_ROOT)/Depend/,$(basename $(filter-out Debug/%, $(Source))))) ifneq ($(SourceDepend),) -include $(SourceDepend) +-include $(SourceDepend) endif From vadve at cs.uiuc.edu Fri Oct 25 16:18:01 2002 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Fri Oct 25 16:18:01 2002 Subject: [llvm-commits] CVS: llvm/tools/gccas/Makefile Message-ID: <200210252117.QAA15453@psmith.cs.uiuc.edu> Changes in directory llvm/tools/gccas: Makefile updated: 1.13 -> 1.14 --- Log message: Added datastructure library to resolve link error. --- Diffs of the changes: Index: llvm/tools/gccas/Makefile diff -u llvm/tools/gccas/Makefile:1.13 llvm/tools/gccas/Makefile:1.14 --- llvm/tools/gccas/Makefile:1.13 Tue Sep 17 21:20:58 2002 +++ llvm/tools/gccas/Makefile Fri Oct 25 16:17:34 2002 @@ -2,6 +2,6 @@ TOOLNAME = gccas USEDLIBS = asmparser bcwriter transforms ipo scalaropts analysis \ - target.a transformutils ipa vmcore support.a + target.a transformutils ipa datastructure vmcore support.a include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Fri Oct 25 17:30:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:30:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/BasicAA/featuretest.ll Message-ID: <200210252229.RAA19033@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/BasicAA: featuretest.ll updated: 1.1 -> 1.2 --- Log message: Update test to use long instead of uint getelementptr subscripts --- Diffs of the changes: Index: llvm/test/Regression/Transforms/BasicAA/featuretest.ll diff -u llvm/test/Regression/Transforms/BasicAA/featuretest.ll:1.1 llvm/test/Regression/Transforms/BasicAA/featuretest.ll:1.2 --- llvm/test/Regression/Transforms/BasicAA/featuretest.ll:1.1 Sun Sep 8 13:08:36 2002 +++ llvm/test/Regression/Transforms/BasicAA/featuretest.ll Fri Oct 25 17:29:07 2002 @@ -10,14 +10,14 @@ ; Array test: Test that operations on one local array do not invalidate ; operations on another array. Important for scientific codes. ; -int %different_array_test(uint %A, uint %B) { +int %different_array_test(long %A, long %B) { %Array1 = alloca int, uint 100 %Array2 = alloca int, uint 200 - %pointer = getelementptr int* %Array1, uint %A + %pointer = getelementptr int* %Array1, long %A %val = load int* %pointer - %pointer2 = getelementptr int* %Array2, uint %B + %pointer2 = getelementptr int* %Array2, long %B store int 7, int* %pointer2 %REMOVE = load int* %pointer ; redundant with above load @@ -30,8 +30,8 @@ ; int %constant_array_index_test() { %Array = alloca int, uint 100 - %P1 = getelementptr int* %Array, uint 7 - %P2 = getelementptr int* %Array, uint 6 + %P1 = getelementptr int* %Array, long 7 + %P2 = getelementptr int* %Array, long 6 %A = load int* %P1 store int 1, int* %P2 ; Should not invalidate load From lattner at cs.uiuc.edu Fri Oct 25 17:55:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:55:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Reader.h Message-ID: <200210252254.RAA20094@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Reader.h updated: 1.6 -> 1.7 --- Log message: Fix typo --- Diffs of the changes: Index: llvm/include/llvm/Bytecode/Reader.h diff -u llvm/include/llvm/Bytecode/Reader.h:1.6 llvm/include/llvm/Bytecode/Reader.h:1.7 --- llvm/include/llvm/Bytecode/Reader.h:1.6 Sun Jul 21 04:31:59 2002 +++ llvm/include/llvm/Bytecode/Reader.h Fri Oct 25 17:53:56 2002 @@ -1,6 +1,6 @@ //===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=// // -// This functionality is implemented by the lib/BytecodeReader library. +// This functionality is implemented by the lib/Bytecode/Reader library. // This library is used to read VM bytecode files from an iostream. // // Note that performance of this library is _crucial_ for performance of the From lattner at cs.uiuc.edu Fri Oct 25 17:55:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:55:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MFunction.cpp MInstruction.cpp Makefile Message-ID: <200210252254.RAA20111@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MFunction.cpp added (r1.1) MInstruction.cpp added (r1.1) Makefile updated: 1.9 -> 1.10 --- Log message: Initial checkin of codegen infrastructure for LLVM-JIT --- Diffs of the changes: Index: llvm/lib/CodeGen/Makefile diff -u llvm/lib/CodeGen/Makefile:1.9 llvm/lib/CodeGen/Makefile:1.10 --- llvm/lib/CodeGen/Makefile:1.9 Sun Sep 29 06:52:04 2002 +++ llvm/lib/CodeGen/Makefile Fri Oct 25 17:54:41 2002 @@ -1,4 +1,5 @@ LEVEL = ../.. -PARALLEL_DIRS = PreOpts InstrSelection InstrSched RegAlloc PostOpts Mapping +PARALLEL_DIRS = PreOpts InstrSelection InstrSched RegAlloc PostOpts Mapping +LIBRARYNAME = codegen include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Fri Oct 25 17:56:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:56:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/ Message-ID: <200210252255.RAA20130@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/Target/X86 added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 17:56:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:56:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Makefile Message-ID: <200210252255.RAA20142@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target: Makefile updated: 1.3 -> 1.4 --- Log message: Build the X86 target as well --- Diffs of the changes: Index: llvm/lib/Target/Makefile diff -u llvm/lib/Target/Makefile:1.3 llvm/lib/Target/Makefile:1.4 --- llvm/lib/Target/Makefile:1.3 Tue Jul 23 12:52:34 2002 +++ llvm/lib/Target/Makefile Fri Oct 25 17:55:05 2002 @@ -1,5 +1,5 @@ LEVEL = ../.. -DIRS = Sparc +DIRS = Sparc X86 LIBRARYNAME = target BUILD_ARCHIVE = 1 From lattner at cs.uiuc.edu Fri Oct 25 17:57:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:57:00 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp Makefile Printer.cpp README.txt X86.h X86InstructionInfo.cpp X86InstructionInfo.def X86InstructionInfo.h X86RegisterInfo.cpp X86RegisterInfo.def X86RegisterInfo.h Message-ID: <200210252256.RAA20155@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp added (r1.1) Makefile added (r1.1) Printer.cpp added (r1.1) README.txt added (r1.1) X86.h added (r1.1) X86InstructionInfo.cpp added (r1.1) X86InstructionInfo.def added (r1.1) X86InstructionInfo.h added (r1.1) X86RegisterInfo.cpp added (r1.1) X86RegisterInfo.def added (r1.1) X86RegisterInfo.h added (r1.1) --- Log message: Initial checkin of X86 backend. We can instruction select exactly one instruction 'ret void'. Wow. --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 17:58:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 17:58:01 2002 Subject: [llvm-commits] CVS: llvm/tools/jello/ Message-ID: <200210252257.RAA20175@apoc.cs.uiuc.edu> Changes in directory llvm/tools/jello: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/tools/jello added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 18:00:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 18:00:01 2002 Subject: [llvm-commits] CVS: llvm/tools/jello/Makefile jello.cpp Message-ID: <200210252259.RAA20182@apoc.cs.uiuc.edu> Changes in directory llvm/tools/jello: Makefile added (r1.1) jello.cpp added (r1.1) --- Log message: Initial checkin of LLVM JIT, codenamed jello. This tool is not built by default, until it becomes stable. Even then it will only work for for X86 targets. --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 18:01:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 18:01:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MBasicBlock.h MFunction.h MInstBuilder.h MInstruction.h Message-ID: <200210252300.SAA20216@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MBasicBlock.h added (r1.1) MFunction.h added (r1.1) MInstBuilder.h added (r1.1) MInstruction.h added (r1.1) --- Log message: Initial checkin of Machine Code representation for X86 backend. This will eventually be merged with the sparc backend. --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 18:01:02 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 18:01:02 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MInstructionInfo.h MRegisterInfo.h Message-ID: <200210252300.SAA20245@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MInstructionInfo.h added (r1.1) MRegisterInfo.h added (r1.1) --- Log message: Initial checkin of target support for X86 backend. --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 18:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 18:02:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/ Message-ID: <200210252301.SAA20257@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/test/Regression/Jello added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 18:03:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 18:03:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/Makefile test0.ll test1.ll test2.ll test3.ll test4.ll Message-ID: <200210252302.SAA20267@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: Makefile added (r1.1) test0.ll added (r1.1) test1.ll added (r1.1) test2.ll added (r1.1) test3.ll added (r1.1) test4.ll added (r1.1) --- Log message: Checkin simple testcases for LLVM-JIT --- Diffs of the changes: From lattner at cs.uiuc.edu Fri Oct 25 20:58:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri Oct 25 20:58:01 2002 Subject: [llvm-commits] CVS: llvm/tools/lli/Execution.cpp Message-ID: <200210260157.UAA26262@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: Execution.cpp updated: 1.68 -> 1.69 --- Log message: Fix a major bug in lli --- Diffs of the changes: Index: llvm/tools/lli/Execution.cpp diff -u llvm/tools/lli/Execution.cpp:1.68 llvm/tools/lli/Execution.cpp:1.69 --- llvm/tools/lli/Execution.cpp:1.68 Tue Oct 15 15:34:05 2002 +++ llvm/tools/lli/Execution.cpp Fri Oct 25 20:57:15 2002 @@ -936,7 +936,7 @@ Ptr->Untyped[7] = (Val.ULongVal >> 56) & 255; break; default: - cout << "Cannot load value of type " << Ty << "!\n"; + cout << "Cannot store value of type " << Ty << "!\n"; } } else { switch (Ty->getPrimitiveID()) { @@ -967,7 +967,7 @@ Ptr->Untyped[0] = (Val.ULongVal >> 56) & 255; break; default: - cout << "Cannot load value of type " << Ty << "!\n"; + cout << "Cannot store value of type " << Ty << "!\n"; } } } @@ -975,7 +975,8 @@ static void executeStoreInst(StoreInst &I, ExecutionContext &SF) { GenericValue Val = getOperandValue(I.getOperand(0), SF); GenericValue SRC = getOperandValue(I.getPointerOperand(), SF); - StoreValueToMemory(Val, (GenericValue *)SRC.PointerVal, I.getType()); + StoreValueToMemory(Val, (GenericValue *)SRC.PointerVal, + I.getOperand(0)->getType()); } From lattner at cs.uiuc.edu Sun Oct 27 13:06:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:06:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h Message-ID: <200210271905.NAA06641@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: DSGraph.h updated: 1.20 -> 1.21 --- Log message: Add #include --- Diffs of the changes: Index: llvm/include/llvm/Analysis/DSGraph.h diff -u llvm/include/llvm/Analysis/DSGraph.h:1.20 llvm/include/llvm/Analysis/DSGraph.h:1.21 --- llvm/include/llvm/Analysis/DSGraph.h:1.20 Tue Oct 22 10:57:58 2002 +++ llvm/include/llvm/Analysis/DSGraph.h Sun Oct 27 13:04:59 2002 @@ -11,6 +11,7 @@ #include #include #include +#include class Function; class CallInst; From lattner at cs.uiuc.edu Sun Oct 27 13:08:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:08:00 2002 Subject: [llvm-commits] CVS: llvm/utils/Burg/Makefile Message-ID: <200210271907.NAA06688@apoc.cs.uiuc.edu> Changes in directory llvm/utils/Burg: Makefile updated: 1.10 -> 1.11 --- Log message: Work better with other versions of bison --- Diffs of the changes: Index: llvm/utils/Burg/Makefile diff -u llvm/utils/Burg/Makefile:1.10 llvm/utils/Burg/Makefile:1.11 --- llvm/utils/Burg/Makefile:1.10 Sat Sep 21 21:41:20 2002 +++ llvm/utils/Burg/Makefile Sun Oct 27 13:06:56 2002 @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.10 2002/09/22 02:41:20 lattner Exp $ +# $Id: Makefile,v 1.11 2002/10/27 19:06:56 lattner Exp $ LEVEL = ../.. TOOLNAME = burg EXTRASOURCES = gram.tab.c @@ -6,9 +6,7 @@ include $(LEVEL)/Makefile.common gram.tab.c gram.tab.h: gram.yc - $(VERB) $(BISON) -d $< - $(VERB) mv -f gram.tab.cc gram.tab.c - $(VERB) mv -f gram.tab.hc gram.tab.h + $(VERB) $(BISON) -o gram.tab.c -d $< clean:: rm -ff gram.tab.h gram.tab.c core* *.aux *.log *.dvi sample sample.c tmp From lattner at cs.uiuc.edu Sun Oct 27 13:08:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:08:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/Statistic.cpp Message-ID: <200210271907.NAA06702@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Statistic.cpp updated: 1.5 -> 1.6 --- Log message: Add #include --- Diffs of the changes: Index: llvm/lib/Support/Statistic.cpp diff -u llvm/lib/Support/Statistic.cpp:1.5 llvm/lib/Support/Statistic.cpp:1.6 --- llvm/lib/Support/Statistic.cpp:1.5 Fri Oct 4 18:56:18 2002 +++ llvm/lib/Support/Statistic.cpp Sun Oct 27 13:07:47 2002 @@ -18,6 +18,7 @@ #include "Support/CommandLine.h" #include #include +#include bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option From lattner at cs.uiuc.edu Sun Oct 27 13:09:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:09:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Support/Timer.cpp Message-ID: <200210271908.NAA06713@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Support: Timer.cpp updated: 1.2 -> 1.3 --- Log message: Add #include --- Diffs of the changes: Index: llvm/lib/Support/Timer.cpp diff -u llvm/lib/Support/Timer.cpp:1.2 llvm/lib/Support/Timer.cpp:1.3 --- llvm/lib/Support/Timer.cpp:1.2 Fri Oct 4 18:57:01 2002 +++ llvm/lib/Support/Timer.cpp Sun Oct 27 13:08:03 2002 @@ -12,6 +12,7 @@ #include #include #include +#include static TimerGroup *DefaultTimerGroup = 0; static TimerGroup *getDefaultTimerGroup() { From lattner at cs.uiuc.edu Sun Oct 27 13:11:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:11:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PreOpts/PreSelection.cpp Message-ID: <200210271910.NAA06730@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/PreOpts: PreSelection.cpp updated: 1.4 -> 1.5 --- Log message: change ++ to +1 when using random access iterators --- Diffs of the changes: Index: llvm/lib/CodeGen/PreOpts/PreSelection.cpp diff -u llvm/lib/CodeGen/PreOpts/PreSelection.cpp:1.4 llvm/lib/CodeGen/PreOpts/PreSelection.cpp:1.5 --- llvm/lib/CodeGen/PreOpts/PreSelection.cpp:1.4 Sun Oct 13 14:39:11 2002 +++ llvm/lib/CodeGen/PreOpts/PreSelection.cpp Sun Oct 27 13:09:51 2002 @@ -200,17 +200,15 @@ return new CastInst(getArg1, CE->getType(), "constantCast",&insertBefore); case Instruction::GetElementPtr: -# ifndef NDEBUG - assert(find_if(++CE->op_begin(), CE->op_end(),nonConstant) == CE->op_end() + assert(find_if(CE->op_begin()+1, CE->op_end(),nonConstant) == CE->op_end() && "All indices in ConstantExpr getelementptr must be constant!"); -# endif getArg1 = CE->getOperand(0); if (ConstantExpr* CEarg = dyn_cast(getArg1)) getArg1 = DecomposeConstantExpr(CEarg, insertBefore); else if (GetElementPtrInst* gep = getGlobalAddr(getArg1, insertBefore)) getArg1 = gep; return new GetElementPtrInst(getArg1, - std::vector(++CE->op_begin(), CE->op_end()), + std::vector(CE->op_begin()+1, CE->op_end()), "constantGEP", &insertBefore); default: // must be a binary operator From lattner at cs.uiuc.edu Sun Oct 27 13:11:03 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:11:03 2002 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp Message-ID: <200210271910.NAA06743@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer/TraceCache: VirtualMem.cpp updated: 1.5 -> 1.6 --- Log message: Silence warning --- Diffs of the changes: Index: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp diff -u llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.5 llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.6 --- llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.5 Tue Oct 8 11:30:08 2002 +++ llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp Sun Oct 27 13:10:31 2002 @@ -167,7 +167,7 @@ cond = cond << 25; //mask with 2^32-1-2^25-2^26-2^27 - return (br1 & 4060086271) | cond; + return (br1 & 4060086271U) | cond; } cond = (br1&0x1e000000)>>25; From lattner at cs.uiuc.edu Sun Oct 27 13:13:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:13:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/GraphWriter.h Message-ID: <200210271912.NAA06755@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: GraphWriter.h updated: 1.10 -> 1.11 --- Log message: Old GCC's don't have an --- Diffs of the changes: Index: llvm/include/Support/GraphWriter.h diff -u llvm/include/Support/GraphWriter.h:1.10 llvm/include/Support/GraphWriter.h:1.11 --- llvm/include/Support/GraphWriter.h:1.10 Fri Oct 18 09:55:44 2002 +++ llvm/include/Support/GraphWriter.h Sun Oct 27 13:12:37 2002 @@ -18,7 +18,7 @@ #include "Support/DOTGraphTraits.h" #include "Support/GraphTraits.h" -#include +#include namespace DOT { // Private functions... inline std::string EscapeString(const std::string &Label) { From lattner at cs.uiuc.edu Sun Oct 27 13:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 13:17:01 2002 Subject: [llvm-commits] CVS: llvm/include/Support/STLExtras.h Message-ID: <200210271916.NAA06773@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: STLExtras.h updated: 1.4 -> 1.5 --- Log message: Add neccesary #include --- Diffs of the changes: Index: llvm/include/Support/STLExtras.h diff -u llvm/include/Support/STLExtras.h:1.4 llvm/include/Support/STLExtras.h:1.5 --- llvm/include/Support/STLExtras.h:1.4 Sun Oct 13 14:30:44 2002 +++ llvm/include/Support/STLExtras.h Sun Oct 27 13:16:27 2002 @@ -11,6 +11,7 @@ #define LLVM_SUPPORT_STL_EXTRAS_H #include +#include "Support/iterator" //===----------------------------------------------------------------------===// // Extra additions to From lattner at cs.uiuc.edu Sun Oct 27 14:50:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 14:50:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Message-ID: <200210272049.OAA07703@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForBasicBlock.h updated: 1.2 -> 1.3 --- Log message: Prune #includes --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.2 llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.3 --- llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.2 Thu Sep 19 19:55:57 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Sun Oct 27 14:49:47 2002 @@ -1,20 +1,18 @@ //===-- llvm/CodeGen/MachineCodeForBasicBlock.h -----------------*- C++ -*--=// // -// Purpose: -// Collect the sequence of machine instructions for a basic block. +// Collect the sequence of machine instructions for a basic block. +// //===---------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINECODEFORBASICBLOCK_H #define LLVM_CODEGEN_MACHINECODEFORBASICBLOCK_H #include "llvm/BasicBlock.h" -#include "llvm/Annotation.h" -#include class MachineInstr; extern AnnotationID MCFBB_AID; -class MachineCodeForBasicBlock: public Annotation { +class MachineCodeForBasicBlock : public Annotation { std::vector Insts; public: MachineCodeForBasicBlock(); From lattner at cs.uiuc.edu Sun Oct 27 15:18:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 15:18:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp Message-ID: <200210272117.PAA08035@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp updated: 1.1 -> 1.2 --- Log message: Instruction select constant arguments correctly --- Diffs of the changes: Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.1 llvm/lib/Target/X86/InstSelectSimple.cpp:1.2 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.1 Fri Oct 25 17:55:53 2002 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Sun Oct 27 15:16:59 2002 @@ -9,6 +9,7 @@ #include "llvm/Function.h" #include "llvm/iTerminators.h" #include "llvm/Type.h" +#include "llvm/Constants.h" #include "llvm/CodeGen/MFunction.h" #include "llvm/CodeGen/MInstBuilder.h" #include "llvm/Support/InstVisitor.h" @@ -56,6 +57,12 @@ abort(); } + + /// copyConstantToRegister - Output the instructions required to put the + /// specified constant into the specified register. + /// + void copyConstantToRegister(Constant *C, unsigned Reg); + /// getReg - This method turns an LLVM value into a register number. This /// is guaranteed to produce the same register number for a particular value /// every time it is queried. @@ -66,6 +73,9 @@ if (Reg == 0) Reg = CurReg++; + if (Constant *C = dyn_cast(V)) + copyConstantToRegister(C, Reg); + // FIXME: Constants should be thrown into registers here and appended to // the end of the current basic block! @@ -74,6 +84,37 @@ }; } + + +/// copyConstantToRegister - Output the instructions required to put the +/// specified constant into the specified register. +/// +void ISel::copyConstantToRegister(Constant *C, unsigned R) { + assert (!isa(C) && "Constant expressions not yet handled!\n"); + + switch (C->getType()->getPrimitiveID()) { + case Type::SByteTyID: + BuildMInst(BB, X86::MOVir8, R).addSImm(cast(C)->getValue()); + break; + case Type::UByteTyID: + BuildMInst(BB, X86::MOVir8, R).addZImm(cast(C)->getValue()); + break; + case Type::ShortTyID: + BuildMInst(BB, X86::MOVir16, R).addSImm(cast(C)->getValue()); + break; + case Type::UShortTyID: + BuildMInst(BB, X86::MOVir16, R).addZImm(cast(C)->getValue()); + break; + case Type::IntTyID: + BuildMInst(BB, X86::MOVir32, R).addSImm(cast(C)->getValue()); + break; + case Type::UIntTyID: + BuildMInst(BB, X86::MOVir32, R).addZImm(cast(C)->getValue()); + break; + default: assert(0 && "Type not handled yet!"); + } +} + /// 'ret' instruction - Here we are interested in meeting the x86 ABI. As such, /// we have the following possibilities: From lattner at cs.uiuc.edu Sun Oct 27 15:18:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 15:18:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstructionInfo.def Message-ID: <200210272117.PAA08041@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstructionInfo.def updated: 1.1 -> 1.2 --- Log message: Add instruction definitions for mov r, imm instructions --- Diffs of the changes: Index: llvm/lib/Target/X86/X86InstructionInfo.def diff -u llvm/lib/Target/X86/X86InstructionInfo.def:1.1 llvm/lib/Target/X86/X86InstructionInfo.def:1.2 --- llvm/lib/Target/X86/X86InstructionInfo.def:1.1 Fri Oct 25 17:55:53 2002 +++ llvm/lib/Target/X86/X86InstructionInfo.def Sun Oct 27 15:16:44 2002 @@ -31,8 +31,14 @@ // Miscellaneous instructions I(RET , "ret", MIF::RET, 0) // ret CB -I(ADDrr8 , "add", 0, 0) // R8 += R8 00/r -I(ADDrr16 , "add", 0, 0) // R16 += R16 01/r +// Move instructions +I(MOVir8 , "movb", 0, 0) // R = imm8 B0+ rb +I(MOVir16 , "movw", 0, 0) // R = imm16 B8+ rw +I(MOVir32 , "movl", 0, 0) // R = imm32 B8+ rd + +// Arithmetic instructions +I(ADDrr8 , "addb", 0, 0) // R8 += R8 00/r +I(ADDrr16 , "addw", 0, 0) // R16 += R16 01/r I(ADDrr32 , "addl", 0, 0) // R32 += R32 02/r From lattner at cs.uiuc.edu Sun Oct 27 15:18:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 15:18:06 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MInstBuilder.h Message-ID: <200210272117.PAA08054@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MInstBuilder.h updated: 1.1 -> 1.2 --- Log message: Add support or other operand types --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MInstBuilder.h diff -u llvm/include/llvm/CodeGen/MInstBuilder.h:1.1 llvm/include/llvm/CodeGen/MInstBuilder.h:1.2 --- llvm/include/llvm/CodeGen/MInstBuilder.h:1.1 Fri Oct 25 18:00:13 2002 +++ llvm/include/llvm/CodeGen/MInstBuilder.h Sun Oct 27 15:17:45 2002 @@ -34,6 +34,26 @@ return *this; } + /// addSImm - Add a new sign extended immediate operand... + /// + MInstructionBuilder &addSImm(int Val) { + MI->addOperand(Val, MOperand::SignExtImmediate); + return *this; + } + + /// addZImm - Add a new zero extended immediate operand... + /// + MInstructionBuilder &addZImm(unsigned Val) { + MI->addOperand(Val, MOperand::ZeroExtImmediate); + return *this; + } + + /// addPCDisp - Add a PC Relative Displacement operand... + /// + MInstructionBuilder &addPCDisp(int Disp) { + MI->addOperand(Disp, MOperand::PCRelativeDisp); + return *this; + } }; /// BuildMInst - Builder interface. Specify how to create the initial From lattner at cs.uiuc.edu Sun Oct 27 15:19:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 15:19:01 2002 Subject: [llvm-commits] CVS: llvm/test/Regression/Jello/test0.ll Message-ID: <200210272118.PAA08065@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Jello: test0.ll updated: 1.1 -> 1.2 --- Log message: Make pointless testcase a bit more "challenging" --- Diffs of the changes: Index: llvm/test/Regression/Jello/test0.ll diff -u llvm/test/Regression/Jello/test0.ll:1.1 llvm/test/Regression/Jello/test0.ll:1.2 --- llvm/test/Regression/Jello/test0.ll:1.1 Fri Oct 25 18:01:51 2002 +++ llvm/test/Regression/Jello/test0.ll Sun Oct 27 15:18:06 2002 @@ -1,4 +1,5 @@ ; test ret void %main() { + add int 1, 2 ret void } From lattner at cs.uiuc.edu Sun Oct 27 15:24:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 15:24:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp Message-ID: <200210272123.PAA08086@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectSimple.cpp updated: 1.2 -> 1.3 --- Log message: Remove dead fixme --- Diffs of the changes: Index: llvm/lib/Target/X86/InstSelectSimple.cpp diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.2 llvm/lib/Target/X86/InstSelectSimple.cpp:1.3 --- llvm/lib/Target/X86/InstSelectSimple.cpp:1.2 Sun Oct 27 15:16:59 2002 +++ llvm/lib/Target/X86/InstSelectSimple.cpp Sun Oct 27 15:23:43 2002 @@ -73,11 +73,11 @@ if (Reg == 0) Reg = CurReg++; + // If this operand is a constant, emit the code to copy the constant into + // the register here... + // if (Constant *C = dyn_cast(V)) copyConstantToRegister(C, Reg); - - // FIXME: Constants should be thrown into registers here and appended to - // the end of the current basic block! return Reg; } From brukman at neo.cs.uiuc.edu Sun Oct 27 18:26:01 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:26:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h MachineCodeForMethod.h MachineFunction.h PhyRegAlloc.h Message-ID: <200210280025.g9S0PmQ02918@neo.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForBasicBlock.h updated: 1.3 -> 1.4 MachineCodeForMethod.h updated: 1.8 -> 1.9 MachineFunction.h updated: 1.8 -> 1.9 PhyRegAlloc.h updated: 1.36 -> 1.37 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.3 llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.4 --- llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.3 Sun Oct 27 14:49:47 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Sun Oct 27 18:25:36 2002 @@ -1,27 +1,31 @@ -//===-- llvm/CodeGen/MachineCodeForBasicBlock.h -----------------*- C++ -*--=// +//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*--=// // // Collect the sequence of machine instructions for a basic block. // //===---------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_MACHINECODEFORBASICBLOCK_H -#define LLVM_CODEGEN_MACHINECODEFORBASICBLOCK_H +#ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H +#define LLVM_CODEGEN_MACHINEBASICBLOCK_H #include "llvm/BasicBlock.h" class MachineInstr; extern AnnotationID MCFBB_AID; -class MachineCodeForBasicBlock : public Annotation { +// FIXME: this should go away soon +class MachineBasicBlock; +typedef MachineBasicBlock MachineCodeForBasicBlock; + +class MachineBasicBlock: public Annotation { std::vector Insts; public: - MachineCodeForBasicBlock(); - ~MachineCodeForBasicBlock() {} + MachineBasicBlock(); + ~MachineBasicBlock() {} - // Static methods to retrieve or destroy the MachineCodeForBasicBlock + // Static methods to retrieve or destroy the MachineBasicBlock // object for a given basic block. - static MachineCodeForBasicBlock& get(const BasicBlock *bb) { - return *(MachineCodeForBasicBlock*)bb->getOrCreateAnnotation(MCFBB_AID); + static MachineBasicBlock& get(const BasicBlock *bb) { + return *(MachineBasicBlock*)bb->getOrCreateAnnotation(MCFBB_AID); } static void destroy(const BasicBlock *bb) { Index: llvm/include/llvm/CodeGen/MachineCodeForMethod.h diff -u llvm/include/llvm/CodeGen/MachineCodeForMethod.h:1.8 llvm/include/llvm/CodeGen/MachineCodeForMethod.h:1.9 --- llvm/include/llvm/CodeGen/MachineCodeForMethod.h:1.8 Wed Jul 24 16:21:28 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForMethod.h Sun Oct 27 18:25:36 2002 @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/MachineCodeForMethod.h ----------------------*- C++ -*--=// +//===-- llvm/CodeGen/MachineFunction.h ----------------------*- C++ -*--=// // // Purpose: // Collect native machine code information for a method. @@ -6,8 +6,8 @@ // to be stored with each method. //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_MACHINECODEFORMETHOD_H -#define LLVM_CODEGEN_MACHINECODEFORMETHOD_H +#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H +#define LLVM_CODEGEN_MACHINEFUNCTION_H #include "llvm/Annotation.h" #include "Support/NonCopyable.h" @@ -19,8 +19,11 @@ class Type; class TargetMachine; +// FIXME: this should go away soon +class MachineFunction; +typedef MachineFunction MachineCodeForMethod; -class MachineCodeForMethod : private Annotation { +class MachineFunction : private Annotation { hash_set constantsForConstPool; hash_map offsets; const Function* method; @@ -36,20 +39,20 @@ bool automaticVarsAreaFrozen; public: - /*ctor*/ MachineCodeForMethod(const Function* function, + /*ctor*/ MachineFunction(const Function* function, const TargetMachine& target); // The next two methods are used to construct and to retrieve - // the MachineCodeForMethod object for the given method. + // the MachineFunction object for the given method. // construct() -- Allocates and initializes for a given method and target // get() -- Returns a handle to the object. // This should not be called before "construct()" // for a given Method. // - static MachineCodeForMethod& construct(const Function *method, + static MachineFunction& construct(const Function *method, const TargetMachine &target); static void destruct(const Function *F); - static MachineCodeForMethod& get(const Function* function); + static MachineFunction& get(const Function* function); // // Accessors for global information about generated code for a method. Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.8 llvm/include/llvm/CodeGen/MachineFunction.h:1.9 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.8 Wed Jul 24 16:21:28 2002 +++ llvm/include/llvm/CodeGen/MachineFunction.h Sun Oct 27 18:25:36 2002 @@ -1,13 +1,13 @@ -//===-- llvm/CodeGen/MachineCodeForMethod.h ----------------------*- C++ -*--=// +//===-- llvm/CodeGen/MachineFunction.h ---------------------------*- C++ -*--=// // -// Purpose: -// Collect native machine code information for a method. -// This allows target-specific information about the generated code -// to be stored with each method. +// Collect native machine code information for a method. This allows +// target-specific information about the generated code to be stored with each +// method. +// //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_MACHINECODEFORMETHOD_H -#define LLVM_CODEGEN_MACHINECODEFORMETHOD_H +#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H +#define LLVM_CODEGEN_MACHINEFUNCTION_H #include "llvm/Annotation.h" #include "Support/NonCopyable.h" @@ -20,7 +20,7 @@ class TargetMachine; -class MachineCodeForMethod : private Annotation { +class MachineFunction : private Annotation { hash_set constantsForConstPool; hash_map offsets; const Function* method; @@ -36,20 +36,20 @@ bool automaticVarsAreaFrozen; public: - /*ctor*/ MachineCodeForMethod(const Function* function, - const TargetMachine& target); + /*ctor*/ MachineFunction(const Function* function, + const TargetMachine& target); // The next two methods are used to construct and to retrieve - // the MachineCodeForMethod object for the given method. + // the MachineFunction object for the given method. // construct() -- Allocates and initializes for a given method and target // get() -- Returns a handle to the object. // This should not be called before "construct()" // for a given Method. // - static MachineCodeForMethod& construct(const Function *method, + static MachineFunction& construct(const Function *method, const TargetMachine &target); static void destruct(const Function *F); - static MachineCodeForMethod& get(const Function* function); + static MachineFunction& get(const Function* function); // // Accessors for global information about generated code for a method. Index: llvm/include/llvm/CodeGen/PhyRegAlloc.h diff -u llvm/include/llvm/CodeGen/PhyRegAlloc.h:1.36 llvm/include/llvm/CodeGen/PhyRegAlloc.h:1.37 --- llvm/include/llvm/CodeGen/PhyRegAlloc.h:1.36 Mon Jul 8 17:39:36 2002 +++ llvm/include/llvm/CodeGen/PhyRegAlloc.h Sun Oct 27 18:25:36 2002 @@ -35,7 +35,7 @@ #include #include -class MachineCodeForMethod; +class MachineFunction; class MachineRegInfo; class FunctionLiveVarInfo; class MachineInstr; @@ -71,7 +71,7 @@ std::vector RegClassList; // vector of register classes const TargetMachine &TM; // target machine const Function *Meth; // name of the function we work on - MachineCodeForMethod &mcInfo; // descriptor for method's native code + MachineFunction &mcInfo; // descriptor for method's native code FunctionLiveVarInfo *const LVI; // LV information for this method // (already computed for BBs) LiveRangeInfo LRI; // LR info (will be computed) From brukman at neo.cs.uiuc.edu Sun Oct 27 18:27:01 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:27:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineFrameInfo.h MachineInstrInfo.h Message-ID: <200210280026.g9S0QR902930@neo.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineFrameInfo.h updated: 1.5 -> 1.6 MachineInstrInfo.h updated: 1.23 -> 1.24 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineFrameInfo.h diff -u llvm/include/llvm/Target/MachineFrameInfo.h:1.5 llvm/include/llvm/Target/MachineFrameInfo.h:1.6 --- llvm/include/llvm/Target/MachineFrameInfo.h:1.5 Mon Sep 16 10:57:43 2002 +++ llvm/include/llvm/Target/MachineFrameInfo.h Sun Oct 27 18:26:17 2002 @@ -10,7 +10,7 @@ #include "Support/NonCopyable.h" #include -class MachineCodeForMethod; +class MachineFunction; class TargetMachine; struct MachineFrameInfo : public NonCopyableV { @@ -41,24 +41,24 @@ // The first few methods have default machine-independent implementations. // The rest must be implemented by the machine-specific subclass. // - virtual int getIncomingArgOffset (MachineCodeForMethod& mcInfo, + virtual int getIncomingArgOffset (MachineFunction& mcInfo, unsigned argNum) const; - virtual int getOutgoingArgOffset (MachineCodeForMethod& mcInfo, + virtual int getOutgoingArgOffset (MachineFunction& mcInfo, unsigned argNum) const; - virtual int getFirstIncomingArgOffset (MachineCodeForMethod& mcInfo, + virtual int getFirstIncomingArgOffset (MachineFunction& mcInfo, bool& growUp) const=0; - virtual int getFirstOutgoingArgOffset (MachineCodeForMethod& mcInfo, + virtual int getFirstOutgoingArgOffset (MachineFunction& mcInfo, bool& growUp) const=0; - virtual int getFirstOptionalOutgoingArgOffset (MachineCodeForMethod&, + virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&, bool& growUp) const=0; - virtual int getFirstAutomaticVarOffset (MachineCodeForMethod& mcInfo, + virtual int getFirstAutomaticVarOffset (MachineFunction& mcInfo, bool& growUp) const=0; - virtual int getRegSpillAreaOffset (MachineCodeForMethod& mcInfo, + virtual int getRegSpillAreaOffset (MachineFunction& mcInfo, bool& growUp) const=0; - virtual int getTmpAreaOffset (MachineCodeForMethod& mcInfo, + virtual int getTmpAreaOffset (MachineFunction& mcInfo, bool& growUp) const=0; - virtual int getDynamicAreaOffset (MachineCodeForMethod& mcInfo, + virtual int getDynamicAreaOffset (MachineFunction& mcInfo, bool& growUp) const=0; // Index: llvm/include/llvm/Target/MachineInstrInfo.h diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.23 llvm/include/llvm/Target/MachineInstrInfo.h:1.24 --- llvm/include/llvm/Target/MachineInstrInfo.h:1.23 Thu Oct 24 17:34:41 2002 +++ llvm/include/llvm/Target/MachineInstrInfo.h Sun Oct 27 18:26:17 2002 @@ -275,7 +275,7 @@ // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. // Symbolic constants or constants that must be accessed from memory - // are added to the constant pool via MachineCodeForMethod::get(F). + // are added to the constant pool via MachineFunction::get(F). // virtual void CreateCodeToLoadConst(const TargetMachine& target, Function* F, From brukman at neo.cs.uiuc.edu Sun Oct 27 18:27:03 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:27:03 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp SchedGraph.h Message-ID: <200210280027.g9S0R0j02949@neo.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: InstrScheduling.cpp updated: 1.43 -> 1.44 SchedGraph.h updated: 1.23 -> 1.24 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp diff -u llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.43 llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.44 --- llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.43 Tue Oct 22 22:30:42 2002 +++ llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Sun Oct 27 18:26:50 2002 @@ -9,7 +9,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" // FIXME: Remove when modularized better #include "llvm/Target/TargetMachine.h" #include "llvm/BasicBlock.h" @@ -1542,7 +1542,7 @@ if (SchedDebugLevel >= Sched_PrintMachineCode) { cerr << "\n*** Machine instructions after INSTRUCTION SCHEDULING\n"; - MachineCodeForMethod::get(&F).dump(); + MachineFunction::get(&F).dump(); } return false; Index: llvm/lib/CodeGen/InstrSched/SchedGraph.h diff -u llvm/lib/CodeGen/InstrSched/SchedGraph.h:1.23 llvm/lib/CodeGen/InstrSched/SchedGraph.h:1.24 --- llvm/lib/CodeGen/InstrSched/SchedGraph.h:1.23 Fri Aug 9 15:07:54 2002 +++ llvm/lib/CodeGen/InstrSched/SchedGraph.h Sun Oct 27 18:26:50 2002 @@ -31,7 +31,7 @@ class ValueToDefVecMap; class RefVec; class MachineInstr; -class MachineCodeForBasicBlock; +class MachineBasicBlock; /******************** Exported Data Types and Constants ********************/ @@ -312,7 +312,7 @@ const TargetMachine& target); void addCallCCEdges (const std::vector& memNod, - MachineCodeForBasicBlock& bbMvec, + MachineBasicBlock& bbMvec, const TargetMachine& target); void addMachineRegEdges (RegToRefVecMap& regToRefVecMap, From brukman at neo.cs.uiuc.edu Sun Oct 27 18:28:01 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:28:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp InstrSelectionSupport.cpp MachineCodeForFunction.cpp Message-ID: <200210280027.g9S0RTo02965@neo.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.48 -> 1.49 InstrSelectionSupport.cpp updated: 1.35 -> 1.36 MachineCodeForFunction.cpp updated: 1.16 -> 1.17 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.48 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.49 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.48 Tue Oct 22 22:30:47 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Sun Oct 27 18:27:19 2002 @@ -12,7 +12,7 @@ #include "llvm/CodeGen/InstrForest.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Function.h" @@ -155,7 +155,7 @@ if (SelectDebugLevel >= Select_PrintMachineCode) { cerr << "\n*** Machine instructions after INSTRUCTION SELECTION\n"; - MachineCodeForMethod::get(&F).dump(); + MachineFunction::get(&F).dump(); } return true; Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.35 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.36 --- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.35 Mon Oct 14 11:30:55 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Sun Oct 27 18:27:19 2002 @@ -10,7 +10,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrAnnot.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/InstrForest.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineRegInfo.h" Index: llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp:1.16 llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp:1.17 --- llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp:1.16 Fri Oct 11 11:10:53 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineCodeForFunction.cpp Sun Oct 27 18:27:19 2002 @@ -6,7 +6,7 @@ // to be stored with each function. //===---------------------------------------------------------------------===// -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstr.h" // For debug output #include "llvm/CodeGen/MachineCodeForBasicBlock.h" #include "llvm/Target/TargetMachine.h" @@ -30,27 +30,27 @@ // This should not be called before "construct()" // for a given Function. // -MachineCodeForMethod& -MachineCodeForMethod::construct(const Function *M, const TargetMachine &Tar) +MachineFunction& +MachineFunction::construct(const Function *M, const TargetMachine &Tar) { assert(M->getAnnotation(MCFM_AID) == 0 && "Object already exists for this function!"); - MachineCodeForMethod* mcInfo = new MachineCodeForMethod(M, Tar); + MachineFunction* mcInfo = new MachineFunction(M, Tar); M->addAnnotation(mcInfo); return *mcInfo; } void -MachineCodeForMethod::destruct(const Function *M) +MachineFunction::destruct(const Function *M) { bool Deleted = M->deleteAnnotation(MCFM_AID); assert(Deleted && "Machine code did not exist for function!"); } -MachineCodeForMethod& -MachineCodeForMethod::get(const Function *F) +MachineFunction& +MachineFunction::get(const Function *F) { - MachineCodeForMethod *mc = (MachineCodeForMethod*)F->getAnnotation(MCFM_AID); + MachineFunction *mc = (MachineFunction*)F->getAnnotation(MCFM_AID); assert(mc && "Call construct() method first to allocate the object"); return *mc; } @@ -122,7 +122,7 @@ /*ctor*/ -MachineCodeForMethod::MachineCodeForMethod(const Function *F, +MachineFunction::MachineFunction(const Function *F, const TargetMachine& target) : Annotation(MCFM_AID), method(F), staticStackSize(0), @@ -138,7 +138,7 @@ } int -MachineCodeForMethod::computeOffsetforLocalVar(const TargetMachine& target, +MachineFunction::computeOffsetforLocalVar(const TargetMachine& target, const Value* val, unsigned int& getPaddedSize, unsigned int sizeToUse) @@ -160,7 +160,7 @@ } int -MachineCodeForMethod::allocateLocalVar(const TargetMachine& target, +MachineFunction::allocateLocalVar(const TargetMachine& target, const Value* val, unsigned int sizeToUse) { @@ -183,7 +183,7 @@ } int -MachineCodeForMethod::allocateSpilledValue(const TargetMachine& target, +MachineFunction::allocateSpilledValue(const TargetMachine& target, const Type* type) { assert(! spillsAreaFrozen && @@ -208,7 +208,7 @@ } int -MachineCodeForMethod::pushTempValue(const TargetMachine& target, +MachineFunction::pushTempValue(const TargetMachine& target, unsigned int size) { unsigned int align = SizeToAlignment(size, target); @@ -228,20 +228,20 @@ } void -MachineCodeForMethod::popAllTempValues(const TargetMachine& target) +MachineFunction::popAllTempValues(const TargetMachine& target) { resetTmpAreaSize(); // clear tmp area to reuse } int -MachineCodeForMethod::getOffset(const Value* val) const +MachineFunction::getOffset(const Value* val) const { hash_map::const_iterator pair = offsets.find(val); return (pair == offsets.end())? INVALID_FRAME_OFFSET : pair->second; } void -MachineCodeForMethod::dump() const +MachineFunction::dump() const { std::cerr << "\n" << method->getReturnType() << " \"" << method->getName() << "\"\n"; From brukman at neo.cs.uiuc.edu Sun Oct 27 18:28:04 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:28:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Mapping/StackSlots.cpp Message-ID: <200210280027.g9S0RtC02984@neo.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/Mapping: StackSlots.cpp updated: 1.2 -> 1.3 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/lib/CodeGen/Mapping/StackSlots.cpp diff -u llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.2 llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.3 --- llvm/lib/CodeGen/Mapping/StackSlots.cpp:1.2 Tue Oct 22 20:12:01 2002 +++ llvm/lib/CodeGen/Mapping/StackSlots.cpp Sun Oct 27 18:27:45 2002 @@ -13,7 +13,7 @@ #include "llvm/Function.h" #include "llvm/DerivedTypes.h" #include "llvm/Pass.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" class StackSlots : public FunctionPass { const TargetMachine &Target; @@ -32,7 +32,7 @@ const Type *PtrInt = PointerType::get(Type::IntTy); unsigned Size = Target.DataLayout.getTypeSize(PtrInt); - MachineCodeForMethod &mcInfo = MachineCodeForMethod::get(&F); + MachineFunction &mcInfo = MachineFunction::get(&F); Value *V = Constant::getNullValue(Type::IntTy); mcInfo.allocateLocalVar(Target, V, 2*Size); return true; From brukman at neo.cs.uiuc.edu Sun Oct 27 18:28:06 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:28:06 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Message-ID: <200210280028.g9S0S5U02992@neo.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: PhyRegAlloc.cpp updated: 1.79 -> 1.80 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.79 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.80 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.79 Tue Oct 22 18:16:19 2002 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Sun Oct 27 18:27:55 2002 @@ -10,7 +10,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrAnnot.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Target/TargetMachine.h" @@ -78,7 +78,7 @@ PhyRegAlloc::PhyRegAlloc(Function *F, const TargetMachine& tm, FunctionLiveVarInfo *Lvi, LoopInfo *LDC) : TM(tm), Meth(F), - mcInfo(MachineCodeForMethod::get(F)), + mcInfo(MachineFunction::get(F)), LVI(Lvi), LRI(F, tm, RegClassList), MRI(tm.getRegInfo()), NumOfRegClasses(MRI.getNumOfRegClasses()), @@ -1194,7 +1194,7 @@ if (DEBUG_RA) { cerr << "\n**** Machine Code After Register Allocation:\n\n"; - MachineCodeForMethod::get(Meth).dump(); + MachineFunction::get(Meth).dump(); } } From brukman at neo.cs.uiuc.edu Sun Oct 27 18:29:01 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:29:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp PrologEpilogCodeInserter.cpp Sparc.cpp SparcInstrInfo.cpp SparcInstrSelection.cpp SparcInternals.h SparcRegInfo.cpp Message-ID: <200210280028.g9S0SgW03024@neo.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.63 -> 1.64 PrologEpilogCodeInserter.cpp updated: 1.14 -> 1.15 Sparc.cpp updated: 1.47 -> 1.48 SparcInstrInfo.cpp updated: 1.30 -> 1.31 SparcInstrSelection.cpp updated: 1.76 -> 1.77 SparcInternals.h updated: 1.67 -> 1.68 SparcRegInfo.cpp updated: 1.75 -> 1.76 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.63 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.64 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.63 Tue Oct 15 14:56:24 2002 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Sun Oct 27 18:28:31 2002 @@ -14,7 +14,7 @@ #include "SparcInternals.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" @@ -865,7 +865,7 @@ for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) { const hash_set &pool = - MachineCodeForMethod::get(I).getConstantPoolValues(); + MachineFunction::get(I).getConstantPoolValues(); MC.insert(pool.begin(), pool.end()); } } Index: llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp diff -u llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.14 llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.15 --- llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.14 Sat Oct 12 19:24:06 2002 +++ llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp Sun Oct 27 18:28:31 2002 @@ -11,7 +11,7 @@ #include "SparcInternals.h" #include "SparcRegClassInfo.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineInstr.h" @@ -28,7 +28,7 @@ const char *getPassName() const { return "Sparc Prolog/Epilog Inserter"; } bool runOnFunction(Function &F) { - MachineCodeForMethod &mcodeInfo = MachineCodeForMethod::get(&F); + MachineFunction &mcodeInfo = MachineFunction::get(&F); if (!mcodeInfo.isCompiledAsLeafMethod()) { InsertPrologCode(F); InsertEpilogCode(F); @@ -60,7 +60,7 @@ // immediate field, we have to use a free register to hold the size. // See the comments below for the choice of this register. // - MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(&F); + MachineFunction& mcInfo = MachineFunction::get(&F); unsigned int staticStackSize = mcInfo.getStaticStackSize(); if (staticStackSize < (unsigned) frameInfo.getMinStackFrameSize()) Index: llvm/lib/Target/Sparc/Sparc.cpp diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.47 llvm/lib/Target/Sparc/Sparc.cpp:1.48 --- llvm/lib/Target/Sparc/Sparc.cpp:1.47 Thu Oct 24 21:01:33 2002 +++ llvm/lib/Target/Sparc/Sparc.cpp Sun Oct 27 18:28:31 2002 @@ -8,7 +8,7 @@ #include "SparcInternals.h" #include "llvm/Target/Sparc.h" #include "llvm/Function.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" using std::cerr; // Build the MachineInstruction Description Array... @@ -39,7 +39,7 @@ //--------------------------------------------------------------------------- int -UltraSparcFrameInfo::getFirstAutomaticVarOffset(MachineCodeForMethod& , +UltraSparcFrameInfo::getFirstAutomaticVarOffset(MachineFunction& , bool& pos) const { pos = false; // static stack area grows downwards @@ -47,7 +47,7 @@ } int -UltraSparcFrameInfo::getRegSpillAreaOffset(MachineCodeForMethod& mcInfo, +UltraSparcFrameInfo::getRegSpillAreaOffset(MachineFunction& mcInfo, bool& pos) const { mcInfo.freezeAutomaticVarsArea(); // ensure no more auto vars are added @@ -58,7 +58,7 @@ } int -UltraSparcFrameInfo::getTmpAreaOffset(MachineCodeForMethod& mcInfo, +UltraSparcFrameInfo::getTmpAreaOffset(MachineFunction& mcInfo, bool& pos) const { mcInfo.freezeAutomaticVarsArea(); // ensure no more auto vars are added @@ -72,7 +72,7 @@ } int -UltraSparcFrameInfo::getDynamicAreaOffset(MachineCodeForMethod& mcInfo, +UltraSparcFrameInfo::getDynamicAreaOffset(MachineFunction& mcInfo, bool& pos) const { // Dynamic stack area grows downwards starting at top of opt-args area. Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.30 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.31 --- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.30 Sun Oct 13 14:39:13 2002 +++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp Sun Oct 27 18:28:31 2002 @@ -6,7 +6,7 @@ #include "SparcInstrSelectionSupport.h" #include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/InstrSelectionSupport.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Function.h" #include "llvm/Constants.h" @@ -361,7 +361,7 @@ // GlobalValue, viz., the constant address of a global variable or function. // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. -// Any stack space required is allocated via MachineCodeForMethod. +// Any stack space required is allocated via MachineFunction. // void UltraSparcInstrInfo::CreateCodeToLoadConst(const TargetMachine& target, @@ -461,7 +461,7 @@ mvec.push_back(MI); // Make sure constant is emitted to constant pool in assembly code. - MachineCodeForMethod::get(F).addToConstantPool(cast(val)); + MachineFunction::get(F).addToConstantPool(cast(val)); } } @@ -471,7 +471,7 @@ // val must be an integral type. dest must be a Float or Double. // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. -// Any stack space required is allocated via MachineCodeForMethod. +// Any stack space required is allocated via MachineFunction. // void UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(const TargetMachine& target, @@ -487,7 +487,7 @@ && "Dest type must be float/double"); // Get a stack slot to use for the copy - int offset = MachineCodeForMethod::get(F).allocateLocalVar(target, val); + int offset = MachineFunction::get(F).allocateLocalVar(target, val); // Get the size of the source value being copied. size_t srcSize = target.DataLayout.getTypeSize(val->getType()); @@ -532,7 +532,7 @@ // `val' to an integer register `dest' by copying to memory and back. // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. -// Any stack space required is allocated via MachineCodeForMethod. +// Any stack space required is allocated via MachineFunction. // void UltraSparcInstrInfo::CreateCodeToCopyFloatToInt(const TargetMachine& target, @@ -549,7 +549,7 @@ assert((destTy->isIntegral() || isa(destTy)) && "Dest type must be integer, bool or pointer"); - int offset = MachineCodeForMethod::get(F).allocateLocalVar(target, val); + int offset = MachineFunction::get(F).allocateLocalVar(target, val); // Store instruction stores `val' to [%fp+offset]. // The store opCode is based only the source value being copied. @@ -579,7 +579,7 @@ // Create instruction(s) to copy src to dest, for arbitrary types // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. -// Any stack space required is allocated via MachineCodeForMethod. +// Any stack space required is allocated via MachineFunction. // void UltraSparcInstrInfo::CreateCopyInstructionsByType(const TargetMachine& target, @@ -675,7 +675,7 @@ // from an arbitrary-sized integer value (sized in bits, not bytes). // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. -// Any stack space required is allocated via MachineCodeForMethod. +// Any stack space required is allocated via MachineFunction. // void UltraSparcInstrInfo::CreateSignExtensionInstructions( @@ -697,7 +697,7 @@ // For SPARC v9, we sign-extend the given operand using SLL; SRL. // The generated instructions are returned in `mvec'. // Any temp. registers (TmpInstruction) created are recorded in mcfi. -// Any stack space required is allocated via MachineCodeForMethod. +// Any stack space required is allocated via MachineFunction. // void UltraSparcInstrInfo::CreateZeroExtensionInstructions( Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.76 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.77 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.76 Mon Oct 14 11:32:24 2002 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Sun Oct 27 18:28:31 2002 @@ -12,7 +12,7 @@ #include "llvm/CodeGen/MachineInstrAnnot.h" #include "llvm/CodeGen/InstrForest.h" #include "llvm/CodeGen/InstrSelection.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/DerivedTypes.h" #include "llvm/iTerminators.h" @@ -843,7 +843,7 @@ // and create a temporary Value to hold it. assert(result && result->getParent() && "Result value is not part of a fn?"); Function *F = result->getParent()->getParent(); - MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(F); + MachineFunction& mcInfo = MachineFunction::get(F); bool growUp; ConstantSInt* dynamicAreaOffset = ConstantSInt::get(Type::IntTy, @@ -885,7 +885,7 @@ assert(result && result->getParent() && "Result value is not part of a function?"); Function *F = result->getParent()->getParent(); - MachineCodeForMethod &mcInfo = MachineCodeForMethod::get(F); + MachineFunction &mcInfo = MachineFunction::get(F); // Check if the offset would small enough to use as an immediate in // load/stores (check LDX because all load/stores have the same-size immediate Index: llvm/lib/Target/Sparc/SparcInternals.h diff -u llvm/lib/Target/Sparc/SparcInternals.h:1.67 llvm/lib/Target/Sparc/SparcInternals.h:1.68 --- llvm/lib/Target/Sparc/SparcInternals.h:1.67 Sat Oct 12 19:06:04 2002 +++ llvm/lib/Target/Sparc/SparcInternals.h Sun Oct 27 18:28:31 2002 @@ -560,32 +560,32 @@ // particular function. The frame contents are obtained from the // MachineCodeInfoForMethod object for the given function. // - int getFirstIncomingArgOffset (MachineCodeForMethod& mcInfo, + int getFirstIncomingArgOffset (MachineFunction& mcInfo, bool& growUp) const { growUp = true; // arguments area grows upwards return FirstIncomingArgOffsetFromFP; } - int getFirstOutgoingArgOffset (MachineCodeForMethod& mcInfo, + int getFirstOutgoingArgOffset (MachineFunction& mcInfo, bool& growUp) const { growUp = true; // arguments area grows upwards return FirstOutgoingArgOffsetFromSP; } - int getFirstOptionalOutgoingArgOffset(MachineCodeForMethod& mcInfo, + int getFirstOptionalOutgoingArgOffset(MachineFunction& mcInfo, bool& growUp)const { growUp = true; // arguments area grows upwards return FirstOptionalOutgoingArgOffsetFromSP; } - int getFirstAutomaticVarOffset (MachineCodeForMethod& mcInfo, + int getFirstAutomaticVarOffset (MachineFunction& mcInfo, bool& growUp) const; - int getRegSpillAreaOffset (MachineCodeForMethod& mcInfo, + int getRegSpillAreaOffset (MachineFunction& mcInfo, bool& growUp) const; - int getTmpAreaOffset (MachineCodeForMethod& mcInfo, + int getTmpAreaOffset (MachineFunction& mcInfo, bool& growUp) const; - int getDynamicAreaOffset (MachineCodeForMethod& mcInfo, + int getDynamicAreaOffset (MachineFunction& mcInfo, bool& growUp) const; // Index: llvm/lib/Target/Sparc/SparcRegInfo.cpp diff -u llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.75 llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.76 --- llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.75 Tue Oct 22 18:16:21 2002 +++ llvm/lib/Target/Sparc/SparcRegInfo.cpp Sun Oct 27 18:28:31 2002 @@ -8,7 +8,7 @@ #include "SparcInternals.h" #include "SparcRegClassInfo.h" #include "llvm/Target/Sparc.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/PhyRegAlloc.h" #include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/InstrSelectionSupport.h" @@ -477,7 +477,7 @@ regClassIDOfArgReg == IntRegClassID && "This should only be an Int register for an FP argument"); - int TmpOff = MachineCodeForMethod::get(Meth).pushTempValue(target, + int TmpOff = MachineFunction::get(Meth).pushTempValue(target, getSpilledRegSize(regType)); cpReg2MemMI(FirstAI->InstrnsBefore, UniArgReg, getFramePointer(), TmpOff, IntRegType); @@ -496,7 +496,7 @@ // const MachineFrameInfo& frameInfo = target.getFrameInfo(); int offsetFromFP = - frameInfo.getIncomingArgOffset(MachineCodeForMethod::get(Meth), + frameInfo.getIncomingArgOffset(MachineFunction::get(Meth), argNo); cpMem2RegMI(FirstAI->InstrnsBefore, @@ -544,7 +544,7 @@ const MachineFrameInfo& frameInfo = target.getFrameInfo(); int offsetFromFP = - frameInfo.getIncomingArgOffset(MachineCodeForMethod::get(Meth), + frameInfo.getIncomingArgOffset(MachineFunction::get(Meth), argNo); LR->modifySpillOffFromFP( offsetFromFP ); From brukman at neo.cs.uiuc.edu Sun Oct 27 18:29:04 2002 From: brukman at neo.cs.uiuc.edu (Misha Brukman) Date: Sun Oct 27 18:29:04 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/MachineFrameInfo.cpp TargetMachine.cpp Message-ID: <200210280029.g9S0T2h03032@neo.cs.uiuc.edu> Changes in directory llvm/lib/Target: MachineFrameInfo.cpp updated: 1.2 -> 1.3 TargetMachine.cpp updated: 1.12 -> 1.13 --- Log message: Changed `MachineCodeForMethod' to `MachineFunction'. --- Diffs of the changes: Index: llvm/lib/Target/MachineFrameInfo.cpp diff -u llvm/lib/Target/MachineFrameInfo.cpp:1.2 llvm/lib/Target/MachineFrameInfo.cpp:1.3 --- llvm/lib/Target/MachineFrameInfo.cpp:1.2 Fri Aug 9 15:08:03 2002 +++ llvm/lib/Target/MachineFrameInfo.cpp Sun Oct 27 18:28:22 2002 @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "llvm/Target/MachineFrameInfo.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" int -MachineFrameInfo::getIncomingArgOffset(MachineCodeForMethod& mcInfo, +MachineFrameInfo::getIncomingArgOffset(MachineFunction& mcInfo, unsigned argNum) const { assert(argsOnStackHaveFixedSize()); @@ -25,7 +25,7 @@ int -MachineFrameInfo::getOutgoingArgOffset(MachineCodeForMethod& mcInfo, +MachineFrameInfo::getOutgoingArgOffset(MachineFunction& mcInfo, unsigned argNum) const { assert(argsOnStackHaveFixedSize()); Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.12 llvm/lib/Target/TargetMachine.cpp:1.13 --- llvm/lib/Target/TargetMachine.cpp:1.12 Sat Oct 12 19:34:10 2002 +++ llvm/lib/Target/TargetMachine.cpp Sun Oct 27 18:28:22 2002 @@ -14,7 +14,7 @@ #include "llvm/CodeGen/InstrScheduling.h" #include "llvm/CodeGen/RegisterAllocation.h" #include "llvm/CodeGen/PeepholeOpts.h" -#include "llvm/CodeGen/MachineCodeForMethod.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Reoptimizer/Mapping/MappingInfo.h" #include "llvm/Reoptimizer/Mapping/FInfo.h" @@ -87,7 +87,7 @@ } bool runOnFunction(Function &F) { - MachineCodeForMethod::construct(&F, Target); + MachineFunction::construct(&F, Target); return false; } }; @@ -117,7 +117,7 @@ void TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) { - // Construct and initialize the MachineCodeForMethod object for this fn. + // Construct and initialize the MachineFunction object for this fn. PM.add(new ConstructMachineCodeForFunction(*this)); //Insert empty stackslots in the stack frame of each function From lattner at cs.uiuc.edu Sun Oct 27 18:39:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 18:39:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/MachineCodeForBasicBlock.cpp Message-ID: <200210280038.SAA12368@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: MachineCodeForBasicBlock.cpp updated: 1.1 -> 1.2 --- Log message: Updates to match misha's changes --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/MachineCodeForBasicBlock.cpp diff -u llvm/lib/CodeGen/InstrSelection/MachineCodeForBasicBlock.cpp:1.1 llvm/lib/CodeGen/InstrSelection/MachineCodeForBasicBlock.cpp:1.2 --- llvm/lib/CodeGen/InstrSelection/MachineCodeForBasicBlock.cpp:1.1 Mon Jul 8 18:01:11 2002 +++ llvm/lib/CodeGen/InstrSelection/MachineCodeForBasicBlock.cpp Sun Oct 27 18:37:53 2002 @@ -7,11 +7,11 @@ #include "llvm/CodeGen/MachineCodeForBasicBlock.h" AnnotationID MCFBB_AID( - AnnotationManager::getID("CodeGen::MachineCodeForBasicBlock")); + AnnotationManager::getID("CodeGen::MachineBasicBlock")); static Annotation *CreateMCFBB(AnnotationID AID, const Annotable *, void *) { assert(AID == MCFBB_AID); - return new MachineCodeForBasicBlock(); // Invoke constructor! + return new MachineBasicBlock(); // Invoke constructor! } // Register the annotation with the annotation factory @@ -22,7 +22,7 @@ } RegisterCreateMCFBB; -MachineCodeForBasicBlock::MachineCodeForBasicBlock() +MachineBasicBlock::MachineBasicBlock() : Annotation(MCFBB_AID) {} From lattner at cs.uiuc.edu Sun Oct 27 18:45:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 18:45:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForMethod.h Message-ID: <200210280044.SAA12891@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForMethod.h updated: 1.9 -> 1.10 --- Log message: We don't need the forwarding typedef --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineCodeForMethod.h diff -u llvm/include/llvm/CodeGen/MachineCodeForMethod.h:1.9 llvm/include/llvm/CodeGen/MachineCodeForMethod.h:1.10 --- llvm/include/llvm/CodeGen/MachineCodeForMethod.h:1.9 Sun Oct 27 18:25:36 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForMethod.h Sun Oct 27 18:44:09 2002 @@ -19,10 +19,6 @@ class Type; class TargetMachine; -// FIXME: this should go away soon -class MachineFunction; -typedef MachineFunction MachineCodeForMethod; - class MachineFunction : private Annotation { hash_set constantsForConstPool; hash_map offsets; From lattner at cs.uiuc.edu Sun Oct 27 18:46:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 18:46:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForMethod.h Message-ID: <200210280045.SAA12924@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForMethod.h (r1.10) removed --- Log message: This header is renamed to MachineFunction.h --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Oct 27 18:56:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 18:56:01 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200210280055.SAA13564@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.28 -> 1.29 --- Log message: Add codegen library --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.28 llvm/tools/llc/Makefile:1.29 --- llvm/tools/llc/Makefile:1.28 Thu Sep 19 19:38:30 2002 +++ llvm/tools/llc/Makefile Sun Oct 27 18:54:57 2002 @@ -1,8 +1,27 @@ LEVEL = ../.. TOOLNAME = llc -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 +USEDLIBS = mapping \ + sparc target.a \ + regalloc \ + sched \ + select \ + codegen \ + 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 From lattner at cs.uiuc.edu Sun Oct 27 18:56:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 18:56:04 2002 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200210280055.SAA13571@apoc.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.33 -> 1.34 --- Log message: Add codegen library --- Diffs of the changes: Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.33 llvm/tools/opt/Makefile:1.34 --- llvm/tools/opt/Makefile:1.33 Tue Oct 1 17:41:01 2002 +++ llvm/tools/opt/Makefile Sun Oct 27 18:54:59 2002 @@ -2,7 +2,8 @@ TOOLNAME = opt USEDLIBS = bcreader bcwriter instrument profpaths \ - sparc target.a mapping regalloc.a sched select preopts postopts.a \ + sparc target.a mapping regalloc.a sched select codegen preopts \ + postopts.a \ livevar scalaropts \ ipo ipa.a datastructure transforms target.a analysis \ transformutils vmcore support From lattner at cs.uiuc.edu Sun Oct 27 19:03:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:03:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200210280102.TAA15776@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.13 -> 1.14 --- Log message: * Doxygenify comments * Move addPassesToEmitAssembly back to Sparc.cpp because it really is sparc specific --- Diffs of the changes: Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.13 llvm/include/llvm/Target/TargetMachine.h:1.14 --- llvm/include/llvm/Target/TargetMachine.h:1.13 Thu Sep 19 19:50:44 2002 +++ llvm/include/llvm/Target/TargetMachine.h Sun Oct 27 19:02:24 2002 @@ -72,30 +72,29 @@ // 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. This provides a default ordering of passes that could - // be overridden for a particular target. - // - virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); + /// addPassesToEmitAssembly - Add passes to the specified pass manager to get + /// assembly langage code emited. Typically this will involve several steps + /// of code generation. + /// + virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) = 0; - // getPrologEpilogCodeInserter - Create pass to insert prolog/epilog code. - // + /// 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. - // + /// 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. - // + /// 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. - // + /// getEmitBytecodeToAsmPass - Create a pass to emit the final LLVM bytecode + /// to the generated assembly file. + /// virtual Pass* getEmitBytecodeToAsmPass(std::ostream &Out) = 0; }; From lattner at cs.uiuc.edu Sun Oct 27 19:04:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:04:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200210280103.TAA15826@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.13 -> 1.14 --- Log message: Move addPassesToEmitAssembly from TargetMachine to UltraSparc because it really is sparc specific. --- Diffs of the changes: Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.13 llvm/lib/Target/TargetMachine.cpp:1.14 --- llvm/lib/Target/TargetMachine.cpp:1.13 Sun Oct 27 18:28:22 2002 +++ llvm/lib/Target/TargetMachine.cpp Sun Oct 27 19:03:41 2002 @@ -8,34 +8,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineInstrInfo.h" #include "llvm/Target/MachineCacheInfo.h" -#include "llvm/CodeGen/PreSelection.h" -#include "llvm/CodeGen/StackSlots.h" -#include "llvm/CodeGen/InstrSelection.h" -#include "llvm/CodeGen/InstrScheduling.h" -#include "llvm/CodeGen/RegisterAllocation.h" -#include "llvm/CodeGen/PeepholeOpts.h" -#include "llvm/CodeGen/MachineFunction.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")); - -static cl::opt DisablePeephole("nopeephole", - cl::desc("Disable peephole optimization pass")); //--------------------------------------------------------------------------- // class TargetMachine @@ -68,101 +41,6 @@ default: return DataLayout.getTypeSize(ty); } -} - - -//===---------------------------------------------------------------------===// -// 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) { - MachineFunction::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 MachineFunction object for this fn. - PM.add(new ConstructMachineCodeForFunction(*this)); - - //Insert empty stackslots in the stack frame of each function - //so %fp+offset-8 and %fp+offset-16 are empty slots now! - PM.add(createStackSlotsPass(*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(createLICMPass()); - PM.add(createGCSEPass()); - } - - PM.add(createInstructionSelectionPass(*this)); - - if (!DisableSched) - PM.add(createInstructionSchedulingWithSSAPass(*this)); - - PM.add(getRegisterAllocator(*this)); - - PM.add(getPrologEpilogInsertionPass()); - - if (!DisablePeephole) - PM.add(createPeepholeOptsPass(*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(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)); } From lattner at cs.uiuc.edu Sun Oct 27 19:04:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:04:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200210280103.TAA15796@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.17 -> 1.18 --- Log message: Prune #includes --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.17 llvm/lib/CodeGen/MachineFunction.cpp:1.18 --- llvm/lib/CodeGen/MachineFunction.cpp:1.17 Sun Oct 27 18:27:19 2002 +++ llvm/lib/CodeGen/MachineFunction.cpp Sun Oct 27 19:02:51 2002 @@ -13,10 +13,8 @@ #include "llvm/Target/MachineFrameInfo.h" #include "llvm/Target/MachineCacheInfo.h" #include "llvm/Function.h" -#include "llvm/BasicBlock.h" #include "llvm/iOther.h" #include -#include const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits::max(); From lattner at cs.uiuc.edu Sun Oct 27 19:04:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:04:07 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.cpp SparcInternals.h Message-ID: <200210280103.TAA15835@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Sparc.cpp updated: 1.48 -> 1.49 SparcInternals.h updated: 1.68 -> 1.69 --- Log message: Move addPassesToEmitAssembly from TargetMachine to UltraSparc because it really is sparc specific. --- Diffs of the changes: Index: llvm/lib/Target/Sparc/Sparc.cpp diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.48 llvm/lib/Target/Sparc/Sparc.cpp:1.49 --- llvm/lib/Target/Sparc/Sparc.cpp:1.48 Sun Oct 27 18:28:31 2002 +++ llvm/lib/Target/Sparc/Sparc.cpp Sun Oct 27 19:03:43 2002 @@ -8,7 +8,19 @@ #include "SparcInternals.h" #include "llvm/Target/Sparc.h" #include "llvm/Function.h" +#include "llvm/PassManager.h" +#include "llvm/Transforms/Scalar.h" #include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/PreSelection.h" +#include "llvm/CodeGen/StackSlots.h" +#include "llvm/CodeGen/PeepholeOpts.h" +#include "llvm/CodeGen/InstrSelection.h" +#include "llvm/CodeGen/InstrScheduling.h" +#include "llvm/CodeGen/RegisterAllocation.h" +#include "llvm/CodeGen/MachineCodeForInstruction.h" +#include "llvm/Reoptimizer/Mapping/MappingInfo.h" +#include "llvm/Reoptimizer/Mapping/FInfo.h" +#include "Support/CommandLine.h" using std::cerr; // Build the MachineInstruction Description Array... @@ -20,6 +32,19 @@ #include "SparcInstr.def" }; +//--------------------------------------------------------------------------- +// 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")); + +static cl::opt DisablePeephole("nopeephole", + cl::desc("Disable peephole optimization pass")); + //---------------------------------------------------------------------------- // allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine // that implements the Sparc backend. (the llvm/CodeGen/Sparc.h interface) @@ -88,6 +113,47 @@ return offset; } +//===---------------------------------------------------------------------===// +// Default code generation passes. +// +// Native code generation for a specified target. +//===---------------------------------------------------------------------===// + +class ConstructMachineCodeForFunction : public FunctionPass { + TargetMachine &Target; +public: + ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {} + + const char *getPassName() const { + return "ConstructMachineCodeForFunction"; + } + + bool runOnFunction(Function &F) { + MachineFunction::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; + } +}; + + //--------------------------------------------------------------------------- // class UltraSparcMachine @@ -114,3 +180,56 @@ maxAtomicMemOpWordSize = 8; } + +// 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 MachineFunction object for this fn. + PM.add(new ConstructMachineCodeForFunction(*this)); + + //Insert empty stackslots in the stack frame of each function + //so %fp+offset-8 and %fp+offset-16 are empty slots now! + PM.add(createStackSlotsPass(*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(createLICMPass()); + PM.add(createGCSEPass()); + } + + PM.add(createInstructionSelectionPass(*this)); + + if (!DisableSched) + PM.add(createInstructionSchedulingWithSSAPass(*this)); + + PM.add(getRegisterAllocator(*this)); + + PM.add(getPrologEpilogInsertionPass()); + + if (!DisablePeephole) + PM.add(createPeepholeOptsPass(*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(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)); +} Index: llvm/lib/Target/Sparc/SparcInternals.h diff -u llvm/lib/Target/Sparc/SparcInternals.h:1.68 llvm/lib/Target/Sparc/SparcInternals.h:1.69 --- llvm/lib/Target/Sparc/SparcInternals.h:1.68 Sun Oct 27 18:28:31 2002 +++ llvm/lib/Target/Sparc/SparcInternals.h Sun Oct 27 19:03:43 2002 @@ -709,7 +709,6 @@ //--------------------------------------------------------------------------- class UltraSparc : public TargetMachine { -private: UltraSparcInstrInfo instrInfo; UltraSparcSchedInfo schedInfo; UltraSparcRegInfo regInfo; @@ -725,6 +724,8 @@ virtual const MachineFrameInfo &getFrameInfo() const { return frameInfo; } virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; } virtual const MachineOptInfo &getOptInfo() const { return optInfo; } + + virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); // getPrologEpilogCodeInserter - Inserts prolog/epilog code. virtual Pass* getPrologEpilogInsertionPass(); From lattner at cs.uiuc.edu Sun Oct 27 19:13:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:13:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h Message-ID: <200210280112.TAA16889@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineFunction.h updated: 1.9 -> 1.10 --- Log message: Add prototypes for creation/destruction passes --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.9 llvm/include/llvm/CodeGen/MachineFunction.h:1.10 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.9 Sun Oct 27 18:25:36 2002 +++ llvm/include/llvm/CodeGen/MachineFunction.h Sun Oct 27 19:11:58 2002 @@ -18,7 +18,10 @@ class Constant; class Type; class TargetMachine; +class Pass; +Pass *createMachineCodeConstructionPass(TargetMachine &Target); +Pass *createMachineCodeDestructionPass(); class MachineFunction : private Annotation { hash_set constantsForConstPool; From lattner at cs.uiuc.edu Sun Oct 27 19:13:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:13:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200210280112.TAA16903@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.18 -> 1.19 --- Log message: Move machine code generation/destruction passes out of Sparc.cpp because they are generic --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.18 llvm/lib/CodeGen/MachineFunction.cpp:1.19 --- llvm/lib/CodeGen/MachineFunction.cpp:1.18 Sun Oct 27 19:02:51 2002 +++ llvm/lib/CodeGen/MachineFunction.cpp Sun Oct 27 19:12:39 2002 @@ -9,17 +9,73 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstr.h" // For debug output #include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineFrameInfo.h" #include "llvm/Target/MachineCacheInfo.h" #include "llvm/Function.h" #include "llvm/iOther.h" +#include "llvm/Pass.h" #include const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits::max(); static AnnotationID MCFM_AID( AnnotationManager::getID("CodeGen::MachineCodeForFunction")); + + +//===---------------------------------------------------------------------===// +// Code generation/destruction passes +//===---------------------------------------------------------------------===// + +namespace { + class ConstructMachineFunction : public FunctionPass { + TargetMachine &Target; + public: + ConstructMachineFunction(TargetMachine &T) : Target(T) {} + + const char *getPassName() const { + return "ConstructMachineFunction"; + } + + bool runOnFunction(Function &F) { + MachineFunction::construct(&F, Target); + return false; + } + }; + + struct DestroyMachineFunction : public FunctionPass { + const char *getPassName() const { return "FreeMachineFunction"; } + + 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; + } + }; +} + +Pass *createMachineCodeConstructionPass(TargetMachine &Target) { + return new ConstructMachineFunction(Target); +} + +Pass *createMachineCodeDestructionPass() { + return new DestroyMachineFunction(); +} + + +//===---------------------------------------------------------------------===// +// MachineFunction implementation +//===---------------------------------------------------------------------===// // The next two methods are used to construct and to retrieve // the MachineCodeForFunction object for the given function. From lattner at cs.uiuc.edu Sun Oct 27 19:13:07 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:13:07 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.cpp Message-ID: <200210280112.TAA16910@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Sparc.cpp updated: 1.49 -> 1.50 --- Log message: Move machine code generation/destruction passes out of Sparc.cpp because they are generic --- Diffs of the changes: Index: llvm/lib/Target/Sparc/Sparc.cpp diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.49 llvm/lib/Target/Sparc/Sparc.cpp:1.50 --- llvm/lib/Target/Sparc/Sparc.cpp:1.49 Sun Oct 27 19:03:43 2002 +++ llvm/lib/Target/Sparc/Sparc.cpp Sun Oct 27 19:12:41 2002 @@ -113,48 +113,6 @@ return offset; } -//===---------------------------------------------------------------------===// -// Default code generation passes. -// -// Native code generation for a specified target. -//===---------------------------------------------------------------------===// - -class ConstructMachineCodeForFunction : public FunctionPass { - TargetMachine &Target; -public: - ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {} - - const char *getPassName() const { - return "ConstructMachineCodeForFunction"; - } - - bool runOnFunction(Function &F) { - MachineFunction::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; - } -}; - - - //--------------------------------------------------------------------------- // class UltraSparcMachine // @@ -187,7 +145,7 @@ void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) { // Construct and initialize the MachineFunction object for this fn. - PM.add(new ConstructMachineCodeForFunction(*this)); + PM.add(createMachineCodeConstructionPass(*this)); //Insert empty stackslots in the stack frame of each function //so %fp+offset-8 and %fp+offset-16 are empty slots now! @@ -224,7 +182,7 @@ // function has been emitted. // PM.add(getFunctionAsmPrinterPass(Out)); - PM.add(new FreeMachineCodeForFunction()); // Free stuff no longer needed + PM.add(createMachineCodeDestructionPass()); // Free stuff no longer needed // Emit Module level assembly after all of the functions have been processed. PM.add(getModuleAsmPrinterPass(Out)); From lattner at cs.uiuc.edu Sun Oct 27 19:14:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:14:01 2002 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200210280113.TAA16921@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.29 -> 1.30 --- Log message: After removing stuff from TargetMachine, we now no longer have to include it twice. --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.29 llvm/tools/llc/Makefile:1.30 --- llvm/tools/llc/Makefile:1.29 Sun Oct 27 18:54:57 2002 +++ llvm/tools/llc/Makefile Sun Oct 27 19:13:07 2002 @@ -1,7 +1,7 @@ LEVEL = ../.. TOOLNAME = llc USEDLIBS = mapping \ - sparc target.a \ + sparc \ regalloc \ sched \ select \ From lattner at cs.uiuc.edu Sun Oct 27 19:17:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:17:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200210280116.TAA16941@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.19 -> 1.20 --- Log message: Minor cleanups --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.19 llvm/lib/CodeGen/MachineFunction.cpp:1.20 --- llvm/lib/CodeGen/MachineFunction.cpp:1.19 Sun Oct 27 19:12:39 2002 +++ llvm/lib/CodeGen/MachineFunction.cpp Sun Oct 27 19:16:38 2002 @@ -1,13 +1,13 @@ -//===-- MachineCodeForMethod.cpp -------------------------------------------=// +//===-- MachineFunction.cpp -----------------------------------------------===// // -// Purpose: -// Collect native machine code information for a function. -// This allows target-specific information about the generated code -// to be stored with each function. -//===---------------------------------------------------------------------===// +// Collect native machine code information for a function. This allows +// target-specific information about the generated code to be stored with each +// function. +// +//===----------------------------------------------------------------------===// -#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstr.h" // For debug output +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineCodeForBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Target/TargetMachine.h" @@ -228,8 +228,7 @@ if (offset == INVALID_FRAME_OFFSET) { unsigned int getPaddedSize; - offset = this->computeOffsetforLocalVar(target, val, getPaddedSize, - sizeToUse); + offset = computeOffsetforLocalVar(target, val, getPaddedSize, sizeToUse); offsets[val] = offset; incrementAutomaticVarsSize(getPaddedSize); } @@ -291,7 +290,7 @@ MachineFunction::getOffset(const Value* val) const { hash_map::const_iterator pair = offsets.find(val); - return (pair == offsets.end())? INVALID_FRAME_OFFSET : pair->second; + return (pair == offsets.end()) ? INVALID_FRAME_OFFSET : pair->second; } void @@ -302,7 +301,8 @@ for (Function::const_iterator BB = method->begin(); BB != method->end(); ++BB) { - std::cerr << std::endl << (*BB).getName() << " (" << (const void*) BB << ")" << ":" << std::endl; + std::cerr << "\n" << BB->getName() << " (" << (const void*)BB + << ")" << ":" << "\n"; MachineCodeForBasicBlock& mvec = MachineCodeForBasicBlock::get(BB); for (unsigned i=0; i < mvec.size(); i++) std::cerr << "\t" << *mvec[i]; From lattner at cs.uiuc.edu Sun Oct 27 19:23:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:23:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h MachineCodeForInstruction.h Message-ID: <200210280122.TAA16964@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForBasicBlock.h updated: 1.4 -> 1.5 MachineCodeForInstruction.h updated: 1.3 -> 1.4 --- Log message: Inline some methods from .cpp files into .h files, minor cleanups --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.4 llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.5 --- llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h:1.4 Sun Oct 27 18:25:36 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Sun Oct 27 19:21:54 2002 @@ -1,8 +1,8 @@ -//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*--=// +//===-- llvm/CodeGen/MachineBasicBlock.h ------------------------*- C++ -*-===// // // Collect the sequence of machine instructions for a basic block. // -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H #define LLVM_CODEGEN_MACHINEBASICBLOCK_H @@ -19,7 +19,7 @@ class MachineBasicBlock: public Annotation { std::vector Insts; public: - MachineBasicBlock(); + MachineBasicBlock() : Annotation(MCFBB_AID) {} ~MachineBasicBlock() {} // Static methods to retrieve or destroy the MachineBasicBlock Index: llvm/include/llvm/CodeGen/MachineCodeForInstruction.h diff -u llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.3 llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.4 --- llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.3 Fri Aug 9 15:04:28 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForInstruction.h Sun Oct 27 19:21:54 2002 @@ -24,15 +24,22 @@ class Instruction; class Value; +extern AnnotationID MCFI_AID; + class MachineCodeForInstruction : public Annotation { std::vector tempVec; // used by m/c instr but not VM instr std::vector Contents; public: - MachineCodeForInstruction(); + MachineCodeForInstruction() : Annotation(MCFI_AID) {} ~MachineCodeForInstruction(); - static MachineCodeForInstruction &get(const Instruction *I); - static void destroy(const Instruction *I); + static MachineCodeForInstruction &get(const Instruction *I) { + assert(I != NULL); + return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID); + } + static void destroy(const Instruction *I) { + I->deleteAnnotation(MCFI_AID); + } // Access to underlying machine instructions... typedef std::vector::iterator iterator; From lattner at cs.uiuc.edu Sun Oct 27 19:23:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:23:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp MachineCodeForInstruction.cpp Message-ID: <200210280122.TAA16973@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineBasicBlock.cpp updated: 1.2 -> 1.3 MachineCodeForInstruction.cpp updated: 1.5 -> 1.6 --- Log message: Inline some methods from .cpp files into .h files, minor cleanups --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.2 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.3 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.2 Sun Oct 27 18:37:53 2002 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Sun Oct 27 19:21:55 2002 @@ -1,8 +1,8 @@ -//===-- llvm/CodeGen/MachineCodeForBasicBlock.cpp ---------------*- C++ -*--=// +//===-- MachineCodeForBasicBlock.cpp --------------------------------------===// // -// Purpose: -// Collect the sequence of machine instructions for a basic block. -//===---------------------------------------------------------------------===// +// Collect the sequence of machine instructions for a basic block. +// +//===----------------------------------------------------------------------===// #include "llvm/CodeGen/MachineCodeForBasicBlock.h" @@ -20,9 +20,4 @@ AnnotationManager::registerAnnotationFactory(MCFBB_AID, &CreateMCFBB); } } RegisterCreateMCFBB; - - -MachineBasicBlock::MachineBasicBlock() - : Annotation(MCFBB_AID) -{} Index: llvm/lib/CodeGen/MachineCodeForInstruction.cpp diff -u llvm/lib/CodeGen/MachineCodeForInstruction.cpp:1.5 llvm/lib/CodeGen/MachineCodeForInstruction.cpp:1.6 --- llvm/lib/CodeGen/MachineCodeForInstruction.cpp:1.5 Mon Sep 16 10:13:59 2002 +++ llvm/lib/CodeGen/MachineCodeForInstruction.cpp Sun Oct 27 19:21:55 2002 @@ -1,18 +1,17 @@ //===-- MachineCodeForInstruction.cpp -------------------------------------===// // -// Representation of the sequence of machine instructions created -// for a single VM instruction. Additionally records information -// about hidden and implicit values used by the machine instructions: -// about hidden values used by the machine instructions: +// Representation of the sequence of machine instructions created for a single +// VM instruction. Additionally records information about hidden and implicit +// values used by the machine instructions: about hidden values used by the +// machine instructions: // -// "Temporary values" are intermediate values used in the machine -// instruction sequence, but not in the VM instruction -// Note that such values should be treated as pure SSA values with -// no interpretation of their operands (i.e., as a TmpInstruction -// object which actually represents such a value). +// "Temporary values" are intermediate values used in the machine instruction +// sequence, but not in the VM instruction Note that such values should be +// treated as pure SSA values with no interpretation of their operands (i.e., as +// a TmpInstruction object which actually represents such a value). // -// (2) "Implicit uses" are values used in the VM instruction but not in -// the machine instruction sequence +// (2) "Implicit uses" are values used in the VM instruction but not in the +// machine instruction sequence // //===----------------------------------------------------------------------===// @@ -20,7 +19,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/InstrSelection.h" -static AnnotationID MCFI_AID( +AnnotationID MCFI_AID( AnnotationManager::getID("CodeGen::MachineCodeForInstruction")); static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) { @@ -36,30 +35,12 @@ } RegisterCreateMCFI; -MachineCodeForInstruction& -MachineCodeForInstruction::get(const Instruction *I){ - assert(I != NULL); - return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID); -} - - -void -MachineCodeForInstruction::destroy(const Instruction *I) { - I->deleteAnnotation(MCFI_AID); -} - - void MachineCodeForInstruction::dropAllReferences() { for (unsigned i=0, N=tempVec.size(); i < N; i++) cast(tempVec[i])->dropAllReferences(); } - - -MachineCodeForInstruction::MachineCodeForInstruction() - : Annotation(MCFI_AID) -{} MachineCodeForInstruction::~MachineCodeForInstruction() From lattner at cs.uiuc.edu Sun Oct 27 19:28:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:28:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForInstruction.h Message-ID: <200210280127.TAA18047@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForInstruction.h updated: 1.4 -> 1.5 --- Log message: Fixes to previous checkin --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineCodeForInstruction.h diff -u llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.4 llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.5 --- llvm/include/llvm/CodeGen/MachineCodeForInstruction.h:1.4 Sun Oct 27 19:21:54 2002 +++ llvm/include/llvm/CodeGen/MachineCodeForInstruction.h Sun Oct 27 19:27:30 2002 @@ -35,10 +35,11 @@ static MachineCodeForInstruction &get(const Instruction *I) { assert(I != NULL); - return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID); + return *(MachineCodeForInstruction*) + ((Annotable*)I)->getOrCreateAnnotation(MCFI_AID); } static void destroy(const Instruction *I) { - I->deleteAnnotation(MCFI_AID); + ((Annotable*)I)->deleteAnnotation(MCFI_AID); } // Access to underlying machine instructions... From lattner at cs.uiuc.edu Sun Oct 27 19:29:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:29:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h Message-ID: <200210280128.TAA18058@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineFunction.h updated: 1.10 -> 1.11 --- Log message: Add note about state that should be removed when time permits --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.10 llvm/include/llvm/CodeGen/MachineFunction.h:1.11 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.10 Sun Oct 27 19:11:58 2002 +++ llvm/include/llvm/CodeGen/MachineFunction.h Sun Oct 27 19:27:51 2002 @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/MachineFunction.h ---------------------------*- C++ -*--=// +//===-- llvm/CodeGen/MachineFunction.h --------------------------*- C++ -*-===// // // Collect native machine code information for a method. This allows // target-specific information about the generated code to be stored with each @@ -27,6 +27,8 @@ hash_set constantsForConstPool; hash_map offsets; const Function* method; + + // FIXME: State should be held elsewhere... unsigned staticStackSize; unsigned automaticVarsSize; unsigned regSpillsSize; @@ -39,8 +41,8 @@ bool automaticVarsAreaFrozen; public: - /*ctor*/ MachineFunction(const Function* function, - const TargetMachine& target); + MachineFunction(const Function* function, + const TargetMachine& target); // The next two methods are used to construct and to retrieve // the MachineFunction object for the given method. @@ -54,6 +56,14 @@ static void destruct(const Function *F); static MachineFunction& get(const Function* function); + + + //===--------------------------------------------------------------------===// + // + // FIXME: Most of the following state should be moved out to passes that use + // it, instead of being put here. + // + // // Accessors for global information about generated code for a method. // From lattner at cs.uiuc.edu Sun Oct 27 19:40:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:40:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeForBasicBlock.h Message-ID: <200210280139.TAA18590@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineCodeForBasicBlock.h (r1.5) removed --- Log message: Rename file to MachineBasicBlock.h --- Diffs of the changes: From lattner at cs.uiuc.edu Sun Oct 27 19:41:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:41:01 2002 Subject: [llvm-commits] CVS: llvm/lib/Analysis/LiveVar/BBLiveVar.cpp FunctionLiveVarInfo.cpp Message-ID: <200210280140.TAA18633@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/LiveVar: BBLiveVar.cpp updated: 1.28 -> 1.29 FunctionLiveVarInfo.cpp updated: 1.39 -> 1.40 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/Analysis/LiveVar/BBLiveVar.cpp diff -u llvm/lib/Analysis/LiveVar/BBLiveVar.cpp:1.28 llvm/lib/Analysis/LiveVar/BBLiveVar.cpp:1.29 --- llvm/lib/Analysis/LiveVar/BBLiveVar.cpp:1.28 Mon Jul 8 17:56:34 2002 +++ llvm/lib/Analysis/LiveVar/BBLiveVar.cpp Sun Oct 27 19:40:34 2002 @@ -7,10 +7,9 @@ #include "BBLiveVar.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/CFG.h" #include "Support/SetOperations.h" -#include /// BROKEN: Should not include sparc stuff directly into here #include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn @@ -51,10 +50,10 @@ void BBLiveVar::calcDefUseSets() { // get the iterator for machine instructions - const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(&BB); + const MachineBasicBlock &MIVec = MachineBasicBlock::get(&BB); // iterate over all the machine instructions in BB - for (MachineCodeForBasicBlock::const_reverse_iterator MII = MIVec.rbegin(), + for (MachineBasicBlock::const_reverse_iterator MII = MIVec.rbegin(), MIE = MIVec.rend(); MII != MIE; ++MII) { const MachineInstr *MI = *MII; Index: llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp diff -u llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.39 llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.40 --- llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp:1.39 Wed Aug 21 12:09:45 2002 +++ llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp Sun Oct 27 19:40:34 2002 @@ -8,12 +8,11 @@ #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" #include "BBLiveVar.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Support/CFG.h" #include "Support/PostOrderIterator.h" #include "Support/SetOperations.h" #include "Support/CommandLine.h" -#include static RegisterAnalysis X("livevar", "Live Variable Analysis"); @@ -241,7 +240,7 @@ //----------------------------------------------------------------------------- void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) { - const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(BB); + const MachineBasicBlock &MIVec = MachineBasicBlock::get(BB); if (DEBUG_LV >= LV_DEBUG_Instr) std::cerr << "\n======For BB " << BB->getName() @@ -252,7 +251,7 @@ set_union(CurSet, *SetAI); // CurSet now contains OutSet // iterate over all the machine instructions in BB - for (MachineCodeForBasicBlock::const_reverse_iterator MII = MIVec.rbegin(), + for (MachineBasicBlock::const_reverse_iterator MII = MIVec.rbegin(), MIE = MIVec.rend(); MII != MIE; ++MII) { // MI is cur machine inst const MachineInstr *MI = *MII; From lattner at cs.uiuc.edu Sun Oct 27 19:42:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:42:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp SchedGraph.cpp Message-ID: <200210280141.TAA18663@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: InstrScheduling.cpp updated: 1.44 -> 1.45 SchedGraph.cpp updated: 1.35 -> 1.36 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp diff -u llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.44 llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.45 --- llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.44 Sun Oct 27 18:26:50 2002 +++ llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Sun Oct 27 19:41:17 2002 @@ -8,7 +8,7 @@ #include "SchedPriorities.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" // FIXME: Remove when modularized better #include "llvm/Target/TargetMachine.h" @@ -631,14 +631,14 @@ static void RecordSchedule(const BasicBlock* bb, const SchedulingManager& S) { - MachineCodeForBasicBlock& mvec = MachineCodeForBasicBlock::get(bb); + MachineBasicBlock& mvec = MachineBasicBlock::get(bb); const MachineInstrInfo& mii = S.schedInfo.getInstrInfo(); #ifndef NDEBUG // Lets make sure we didn't lose any instructions, except possibly // some NOPs from delay slots. Also, PHIs are not included in the schedule. unsigned numInstr = 0; - for (MachineCodeForBasicBlock::iterator I=mvec.begin(); I != mvec.end(); ++I) + for (MachineBasicBlock::iterator I=mvec.begin(); I != mvec.end(); ++I) if (! mii.isNop((*I)->getOpCode()) && ! mii.isDummyPhiInstr((*I)->getOpCode())) ++numInstr; @@ -650,7 +650,7 @@ return; // empty basic block! // First find the dummy instructions at the start of the basic block - MachineCodeForBasicBlock::iterator I = mvec.begin(); + MachineBasicBlock::iterator I = mvec.begin(); for ( ; I != mvec.end(); ++I) if (! mii.isDummyPhiInstr((*I)->getOpCode())) break; @@ -1220,7 +1220,7 @@ // fill delay slots, otherwise, just discard them. // unsigned int firstDelaySlotIdx = node->getOrigIndexInBB() + 1; - MachineCodeForBasicBlock& bbMvec = MachineCodeForBasicBlock::get(node->getBB()); + MachineBasicBlock& bbMvec = MachineBasicBlock::get(node->getBB()); assert(bbMvec[firstDelaySlotIdx - 1] == brInstr && "Incorrect instr. index in basic block for brInstr"); @@ -1325,8 +1325,8 @@ // Simply passing in an empty delayNodeVec will have this effect. // delayNodeVec.clear(); - const MachineCodeForBasicBlock& bbMvec = MachineCodeForBasicBlock::get(bb); - for (unsigned i=0; i < bbMvec.size(); i++) + const MachineBasicBlock& bbMvec = MachineBasicBlock::get(bb); + for (unsigned i=0; i < bbMvec.size(); ++i) if (bbMvec[i] != brInstr && mii.getNumDelaySlots(bbMvec[i]->getOpCode()) > 0) { Index: llvm/lib/CodeGen/InstrSched/SchedGraph.cpp diff -u llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.35 llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.36 --- llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.35 Sat Oct 12 19:39:22 2002 +++ llvm/lib/CodeGen/InstrSched/SchedGraph.cpp Sun Oct 27 19:41:17 2002 @@ -9,7 +9,7 @@ #include "SchedGraph.h" #include "llvm/CodeGen/InstrSelection.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Function.h" @@ -387,7 +387,7 @@ // all preceding instructions in the basic block. Use 0 latency again. // const BasicBlock* bb = firstBrNode->getBB(); - const MachineCodeForBasicBlock& mvec = MachineCodeForBasicBlock::get(bb); + const MachineBasicBlock& mvec = MachineBasicBlock::get(bb); for (unsigned i=0, N=mvec.size(); i < N; i++) { if (mvec[i] == termMvec[first]) // reached the first branch @@ -480,7 +480,7 @@ // void SchedGraph::addCallCCEdges(const vector& memNodeVec, - MachineCodeForBasicBlock& bbMvec, + MachineBasicBlock& bbMvec, const TargetMachine& target) { const MachineInstrInfo& mii = target.getInstrInfo(); @@ -753,7 +753,7 @@ // Build graph nodes for each VM instruction and gather def/use info. // Do both those together in a single pass over all machine instructions. - const MachineCodeForBasicBlock& mvec = MachineCodeForBasicBlock::get(bb); + const MachineBasicBlock& mvec = MachineBasicBlock::get(bb); for (unsigned i=0; i < mvec.size(); i++) if (! mii.isDummyPhiInstr(mvec[i]->getOpCode())) { @@ -789,7 +789,7 @@ // Find the machine instruction that makes a copy of inval to (*PI). // This must be in the current basic block (bb). - const MachineCodeForVMInstr& mvec = MachineCodeForBasicBlock::get(*PI); + const MachineCodeForVMInstr& mvec = MachineBasicBlock::get(*PI); const MachineInstr* theCopy = NULL; for (unsigned i=0; i < mvec.size() && theCopy == NULL; i++) if (! mii.isDummyPhiInstr(mvec[i]->getOpCode())) @@ -882,7 +882,7 @@ // //---------------------------------------------------------------- - MachineCodeForBasicBlock& bbMvec = MachineCodeForBasicBlock::get(bb); + MachineBasicBlock& bbMvec = MachineBasicBlock::get(bb); // First, add edges to the terminator instruction of the basic block. this->addCDEdges(bb->getTerminator(), target); From lattner at cs.uiuc.edu Sun Oct 27 19:42:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:42:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Message-ID: <200210280141.TAA18670@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.49 -> 1.50 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.49 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.50 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.49 Sun Oct 27 18:27:19 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Sun Oct 27 19:41:19 2002 @@ -11,7 +11,7 @@ #include "llvm/CodeGen/InstrSelectionSupport.h" #include "llvm/CodeGen/InstrForest.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" @@ -145,7 +145,7 @@ for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI) for (BasicBlock::iterator II = BI->begin(); II != BI->end(); ++II) { MachineCodeForInstruction &mvec = MachineCodeForInstruction::get(II); - MachineCodeForBasicBlock &MCBB = MachineCodeForBasicBlock::get(BI); + MachineBasicBlock &MCBB = MachineBasicBlock::get(BI); MCBB.insert(MCBB.end(), mvec.begin(), mvec.end()); } @@ -205,7 +205,7 @@ Target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec); // get an iterator to machine instructions in the BB - MachineCodeForBasicBlock& bbMvec = MachineCodeForBasicBlock::get(BB); + MachineBasicBlock& bbMvec = MachineBasicBlock::get(BB); bbMvec.insert(bbMvec.begin(), mvec.begin(), mvec.end()); } // for each Phi Instr in BB @@ -227,11 +227,11 @@ assert (FirstMIOfTerm && "No Machine Instrs for terminator"); - MachineCodeForBasicBlock &bbMvec = MachineCodeForBasicBlock::get(BB); + MachineBasicBlock &bbMvec = MachineBasicBlock::get(BB); // find the position of first machine instruction generated by the // terminator of this BB - MachineCodeForBasicBlock::iterator MCIt = + MachineBasicBlock::iterator MCIt = std::find(bbMvec.begin(), bbMvec.end(), FirstMIOfTerm); assert( MCIt != bbMvec.end() && "Start inst of terminator not found"); From lattner at cs.uiuc.edu Sun Oct 27 19:42:08 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:42:08 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Mapping/MappingInfo.cpp Message-ID: <200210280141.TAA18677@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/Mapping: MappingInfo.cpp updated: 1.2 -> 1.3 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/CodeGen/Mapping/MappingInfo.cpp diff -u llvm/lib/CodeGen/Mapping/MappingInfo.cpp:1.2 llvm/lib/CodeGen/Mapping/MappingInfo.cpp:1.3 --- llvm/lib/CodeGen/Mapping/MappingInfo.cpp:1.2 Tue Sep 17 15:24:46 2002 +++ llvm/lib/CodeGen/Mapping/MappingInfo.cpp Sun Oct 27 19:41:20 2002 @@ -10,7 +10,7 @@ #include "llvm/Pass.h" #include "llvm/Module.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include using std::vector; @@ -126,7 +126,7 @@ unsigned i = 0; for (Function::iterator BI = FI.begin(), BE = FI.end(); BI != BE; ++BI){ - MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI); + MachineBasicBlock &miBB = MachineBasicBlock::get(BI); BBkey[miBB[0]] = i; i = i+(miBB.size()); } @@ -136,9 +136,9 @@ void getMappingInfoForFunction::create_MI_to_number_Key(Function &FI){ for (Function::iterator BI=FI.begin(), BE=FI.end(); BI != BE; ++BI){ - MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI); + MachineBasicBlock &miBB = MachineBasicBlock::get(BI); unsigned j = 0; - for(MachineCodeForBasicBlock::iterator miI=miBB.begin(), miE=miBB.end(); + for(MachineBasicBlock::iterator miI=miBB.begin(), miE=miBB.end(); miI!=miE; ++miI, ++j){ MIkey[*miI]=j; } @@ -151,7 +151,7 @@ unsigned bb=0; for (Function::iterator BI = FI.begin(), BE = FI.end(); BI != BE; ++BI, ++bb){ - MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI); + MachineBasicBlock &miBB = MachineBasicBlock::get(BI); writeNumber(bb); //Out << " BB: "<<(void *)BI<<"\n"; //for(int i=0; i Changes in directory llvm/lib/CodeGen/PostOpts: PeepholeOpts.cpp updated: 1.2 -> 1.3 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp diff -u llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp:1.2 llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp:1.3 --- llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp:1.2 Fri Sep 27 09:27:37 2002 +++ llvm/lib/CodeGen/PostOpts/PeepholeOpts.cpp Sun Oct 27 19:41:22 2002 @@ -1,16 +1,12 @@ -// $Id: PeepholeOpts.cpp,v 1.2 2002/09/27 14:27:37 vadve Exp $ -*-c++-*- -//*************************************************************************** -// File: -// PeepholeOpts.h +//===-- PeepholeOpts.cpp --------------------------------------------------===// // -// Purpose: -// Support for performing several peephole opts in one or a few passes -// over the machine code of a method. -//**************************************************************************/ - +// Support for performing several peephole opts in one or a few passes over the +// machine code of a method. +// +//===----------------------------------------------------------------------===// #include "llvm/CodeGen/PeepholeOpts.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineInstrInfo.h" @@ -18,15 +14,11 @@ #include "llvm/BasicBlock.h" #include "llvm/Pass.h" - -//********************* Internal Class Declarations ************************/ - - //************************* Internal Functions *****************************/ inline void -DeleteInstruction(MachineCodeForBasicBlock& mvec, - MachineCodeForBasicBlock::iterator& BBI, +DeleteInstruction(MachineBasicBlock& mvec, + MachineBasicBlock::iterator& BBI, const TargetMachine& target) { // Check if this instruction is in a delay slot of its predecessor. @@ -55,8 +47,8 @@ inline bool -RemoveUselessCopies(MachineCodeForBasicBlock& mvec, - MachineCodeForBasicBlock::iterator& BBI, +RemoveUselessCopies(MachineBasicBlock& mvec, + MachineBasicBlock::iterator& BBI, const TargetMachine& target) { if (target.getOptInfo().IsUselessCopy(*BBI)) @@ -72,8 +64,8 @@ class PeepholeOpts: public BasicBlockPass { const TargetMachine ⌖ - bool visit(MachineCodeForBasicBlock& mvec, - MachineCodeForBasicBlock::iterator BBI) const; + bool visit(MachineBasicBlock& mvec, + MachineBasicBlock::iterator BBI) const; public: PeepholeOpts(const TargetMachine &T): target(T) { } bool runOnBasicBlock(BasicBlock &BB); // apply this pass to each BB @@ -90,8 +82,8 @@ * instruction before MI, but not */ bool -PeepholeOpts::visit(MachineCodeForBasicBlock& mvec, - MachineCodeForBasicBlock::iterator BBI) const +PeepholeOpts::visit(MachineBasicBlock& mvec, + MachineBasicBlock::iterator BBI) const { bool changed = false; @@ -108,16 +100,16 @@ PeepholeOpts::runOnBasicBlock(BasicBlock &BB) { // Get the machine instructions for this BB - MachineCodeForBasicBlock& mvec = MachineCodeForBasicBlock::get(&BB); + MachineBasicBlock& mvec = MachineBasicBlock::get(&BB); // Iterate over all machine instructions in the BB // Use a reverse iterator to allow deletion of MI or any instruction after it. // Insertions or deletions *before* MI are not safe. // - for (MachineCodeForBasicBlock::reverse_iterator RI=mvec.rbegin(), + for (MachineBasicBlock::reverse_iterator RI=mvec.rbegin(), RE=mvec.rend(); RI != RE; ) { - MachineCodeForBasicBlock::iterator BBI = RI.base()-1; // save before incr + MachineBasicBlock::iterator BBI = RI.base()-1; // save before incr ++RI; // pre-increment to delete MI or after it visit(mvec, BBI); } From lattner at cs.uiuc.edu Sun Oct 27 19:42:15 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:42:15 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp PhyRegAlloc.cpp Message-ID: <200210280141.TAA18695@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: LiveRangeInfo.cpp updated: 1.29 -> 1.30 PhyRegAlloc.cpp updated: 1.80 -> 1.81 --- Log message: (null) --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.29 llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.30 --- llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.29 Sat Sep 28 12:05:22 2002 +++ llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp Sun Oct 27 19:41:26 2002 @@ -8,7 +8,7 @@ #include "llvm/CodeGen/RegAllocCommon.h" #include "llvm/CodeGen/RegClass.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" @@ -148,10 +148,10 @@ // for (Function::const_iterator BBI=Meth->begin(); BBI != Meth->end(); ++BBI){ // get the vector of machine instructions for this basic block. - MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI); + MachineBasicBlock& MIVec = MachineBasicBlock::get(BBI); // iterate over all the machine instructions in BB - for(MachineCodeForBasicBlock::iterator MInstIterator = MIVec.begin(); + for(MachineBasicBlock::iterator MInstIterator = MIVec.begin(); MInstIterator != MIVec.end(); ++MInstIterator) { MachineInstr *MInst = *MInstIterator; @@ -252,12 +252,11 @@ BBI != BBE; ++BBI) { // get the iterator for machine instructions - const MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI); - MachineCodeForBasicBlock::const_iterator MInstIterator = MIVec.begin(); + const MachineBasicBlock& MIVec = MachineBasicBlock::get(BBI); + MachineBasicBlock::const_iterator MInstIterator = MIVec.begin(); // iterate over all the machine instructions in BB for( ; MInstIterator != MIVec.end(); ++MInstIterator) { - const MachineInstr * MInst = *MInstIterator; if( DEBUG_RA >= RA_DEBUG_LiveRanges) { Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.80 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.81 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.80 Sun Oct 27 18:27:55 2002 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Sun Oct 27 19:41:27 2002 @@ -9,7 +9,7 @@ #include "llvm/CodeGen/PhyRegAlloc.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrAnnot.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" #include "llvm/Analysis/LoopInfo.h" @@ -275,8 +275,8 @@ // get the iterator for machine instructions // - const MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI); - MachineCodeForBasicBlock::const_iterator MII = MIVec.begin(); + const MachineBasicBlock& MIVec = MachineBasicBlock::get(BBI); + MachineBasicBlock::const_iterator MII = MIVec.begin(); // iterate over all the machine instructions in BB // @@ -420,8 +420,8 @@ //----------------------------- inline void InsertBefore(MachineInstr* newMI, - MachineCodeForBasicBlock& MIVec, - MachineCodeForBasicBlock::iterator& MII) + MachineBasicBlock& MIVec, + MachineBasicBlock::iterator& MII) { MII = MIVec.insert(MII, newMI); ++MII; @@ -429,8 +429,8 @@ inline void InsertAfter(MachineInstr* newMI, - MachineCodeForBasicBlock& MIVec, - MachineCodeForBasicBlock::iterator& MII) + MachineBasicBlock& MIVec, + MachineBasicBlock::iterator& MII) { ++MII; // insert before the next instruction MII = MIVec.insert(MII, newMI); @@ -438,16 +438,16 @@ inline void SubstituteInPlace(MachineInstr* newMI, - MachineCodeForBasicBlock& MIVec, - MachineCodeForBasicBlock::iterator MII) + MachineBasicBlock& MIVec, + MachineBasicBlock::iterator MII) { *MII = newMI; } inline void PrependInstructions(vector &IBef, - MachineCodeForBasicBlock& MIVec, - MachineCodeForBasicBlock::iterator& MII, + MachineBasicBlock& MIVec, + MachineBasicBlock::iterator& MII, const std::string& msg) { if (!IBef.empty()) @@ -467,8 +467,8 @@ inline void AppendInstructions(std::vector &IAft, - MachineCodeForBasicBlock& MIVec, - MachineCodeForBasicBlock::iterator& MII, + MachineBasicBlock& MIVec, + MachineBasicBlock::iterator& MII, const std::string& msg) { if (!IAft.empty()) @@ -489,10 +489,10 @@ void PhyRegAlloc::updateMachineCode() { - MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(&Meth->getEntryNode()); + MachineBasicBlock& MIVec = MachineBasicBlock::get(&Meth->getEntryNode()); // Insert any instructions needed at method entry - MachineCodeForBasicBlock::iterator MII = MIVec.begin(); + MachineBasicBlock::iterator MII = MIVec.begin(); PrependInstructions(AddedInstrAtEntry.InstrnsBefore, MIVec, MII, "At function entry: \n"); assert(AddedInstrAtEntry.InstrnsAfter.empty() && @@ -503,8 +503,8 @@ BBI != BBE; ++BBI) { // iterate over all the machine instructions in BB - MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(BBI); - for (MachineCodeForBasicBlock::iterator MII = MIVec.begin(); + MachineBasicBlock &MIVec = MachineBasicBlock::get(BBI); + for (MachineBasicBlock::iterator MII = MIVec.begin(); MII != MIVec.end(); ++MII) { MachineInstr *MInst = *MII; @@ -958,8 +958,8 @@ cerr << "\n"; printLabel(BBI); cerr << ": "; // get the iterator for machine instructions - MachineCodeForBasicBlock& MIVec = MachineCodeForBasicBlock::get(BBI); - MachineCodeForBasicBlock::iterator MII = MIVec.begin(); + MachineBasicBlock& MIVec = MachineBasicBlock::get(BBI); + MachineBasicBlock::iterator MII = MIVec.begin(); // iterate over all the machine instructions in BB for ( ; MII != MIVec.end(); ++MII) { @@ -1039,7 +1039,7 @@ void PhyRegAlloc::colorIncomingArgs() { const BasicBlock &FirstBB = Meth->front(); - const MachineInstr *FirstMI = MachineCodeForBasicBlock::get(&FirstBB).front(); + const MachineInstr *FirstMI = MachineBasicBlock::get(&FirstBB).front(); assert(FirstMI && "No machine instruction in entry BB"); MRI.colorMethodArgs(Meth, LRI, &AddedInstrAtEntry); From lattner at cs.uiuc.edu Sun Oct 27 19:42:19 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:42:19 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp MachineFunction.cpp Message-ID: <200210280141.TAA18707@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineBasicBlock.cpp updated: 1.3 -> 1.4 MachineFunction.cpp updated: 1.20 -> 1.21 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.3 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.4 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.3 Sun Oct 27 19:21:55 2002 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Sun Oct 27 19:41:16 2002 @@ -1,10 +1,10 @@ -//===-- MachineCodeForBasicBlock.cpp --------------------------------------===// +//===-- MachineBasicBlock.cpp ---------------------------------------------===// // // Collect the sequence of machine instructions for a basic block. // //===----------------------------------------------------------------------===// -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" AnnotationID MCFBB_AID( AnnotationManager::getID("CodeGen::MachineBasicBlock")); Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.20 llvm/lib/CodeGen/MachineFunction.cpp:1.21 --- llvm/lib/CodeGen/MachineFunction.cpp:1.20 Sun Oct 27 19:16:38 2002 +++ llvm/lib/CodeGen/MachineFunction.cpp Sun Oct 27 19:41:16 2002 @@ -8,7 +8,7 @@ #include "llvm/CodeGen/MachineInstr.h" // For debug output #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineFrameInfo.h" @@ -303,7 +303,7 @@ { std::cerr << "\n" << BB->getName() << " (" << (const void*)BB << ")" << ":" << "\n"; - MachineCodeForBasicBlock& mvec = MachineCodeForBasicBlock::get(BB); + MachineBasicBlock& mvec = MachineBasicBlock::get(BB); for (unsigned i=0; i < mvec.size(); i++) std::cerr << "\t" << *mvec[i]; } From lattner at cs.uiuc.edu Sun Oct 27 19:42:23 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:42:23 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp PrologEpilogCodeInserter.cpp Message-ID: <200210280141.TAA18716@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.64 -> 1.65 PrologEpilogCodeInserter.cpp updated: 1.15 -> 1.16 --- Log message: Rename MachineCodeForBasicBlock to MachineBasicBlock --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.64 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.65 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.64 Sun Oct 27 18:28:31 2002 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Sun Oct 27 19:41:47 2002 @@ -13,7 +13,7 @@ #include "SparcInternals.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -469,11 +469,11 @@ toAsm << getID(BB) << ":\n"; // Get the vector of machine instructions corresponding to this bb. - const MachineCodeForBasicBlock &MIs = MachineCodeForBasicBlock::get(BB); - MachineCodeForBasicBlock::const_iterator MII = MIs.begin(), MIE = MIs.end(); + const MachineBasicBlock &MIs = MachineBasicBlock::get(BB); // Loop over all of the instructions in the basic block... - for (; MII != MIE; ++MII) + for (MachineBasicBlock::const_iterator MII = MIs.begin(), MIE = MIs.end(); + MII != MIE; ++MII) emitMachineInst(*MII); toAsm << "\n"; // Seperate BB's with newlines } Index: llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp diff -u llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.15 llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.16 --- llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.15 Sun Oct 27 18:28:31 2002 +++ llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp Sun Oct 27 19:41:47 2002 @@ -12,7 +12,7 @@ #include "SparcInternals.h" #include "SparcRegClassInfo.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineCodeForBasicBlock.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/InstrSelectionSupport.h" @@ -118,7 +118,7 @@ mvec.push_back(M); } - MachineCodeForBasicBlock& bbMvec = MachineCodeForBasicBlock::get(&F.getEntryNode()); + MachineBasicBlock& bbMvec = MachineBasicBlock::get(&F.getEntryNode()); bbMvec.insert(bbMvec.begin(), mvec.begin(), mvec.end()); } @@ -134,7 +134,7 @@ (int64_t)0); Restore->SetMachineOperandReg(2, Target.getRegInfo().getZeroRegNum()); - MachineCodeForBasicBlock& bbMvec = MachineCodeForBasicBlock::get(I); + MachineBasicBlock& bbMvec = MachineBasicBlock::get(I); MachineCodeForInstruction &termMvec = MachineCodeForInstruction::get(TermInst); From lattner at cs.uiuc.edu Sun Oct 27 19:54:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:54:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h Message-ID: <200210280153.TAA20088@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineBasicBlock.h updated: 1.5 -> 1.6 --- Log message: MachineBasicBlock doesn't need basicblock.h, it needs Annotation.h --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.5 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.6 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.5 Sun Oct 27 19:21:54 2002 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Sun Oct 27 19:53:00 2002 @@ -7,7 +7,9 @@ #ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H #define LLVM_CODEGEN_MACHINEBASICBLOCK_H -#include "llvm/BasicBlock.h" +#include "llvm/Annotation.h" +#include +class BasicBlock; class MachineInstr; extern AnnotationID MCFBB_AID; @@ -16,7 +18,7 @@ class MachineBasicBlock; typedef MachineBasicBlock MachineCodeForBasicBlock; -class MachineBasicBlock: public Annotation { +class MachineBasicBlock : public Annotation { std::vector Insts; public: MachineBasicBlock() : Annotation(MCFBB_AID) {} @@ -24,12 +26,13 @@ // Static methods to retrieve or destroy the MachineBasicBlock // object for a given basic block. - static MachineBasicBlock& get(const BasicBlock *bb) { - return *(MachineBasicBlock*)bb->getOrCreateAnnotation(MCFBB_AID); + static MachineBasicBlock& get(const BasicBlock *BB) { + return *(MachineBasicBlock*) + ((Annotable*)BB)->getOrCreateAnnotation(MCFBB_AID); } - static void destroy(const BasicBlock *bb) { - bb->deleteAnnotation(MCFBB_AID); + static void destroy(const BasicBlock *BB) { + ((Annotable*)BB)->deleteAnnotation(MCFBB_AID); } typedef std::vector::iterator iterator; From lattner at cs.uiuc.edu Sun Oct 27 19:56:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 19:56:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h Message-ID: <200210280155.TAA20506@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineBasicBlock.h updated: 1.6 -> 1.7 --- Log message: Remvoe dead fixme and typedef --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.6 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.7 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.6 Sun Oct 27 19:53:00 2002 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Sun Oct 27 19:55:26 2002 @@ -14,10 +14,6 @@ extern AnnotationID MCFBB_AID; -// FIXME: this should go away soon -class MachineBasicBlock; -typedef MachineBasicBlock MachineCodeForBasicBlock; - class MachineBasicBlock : public Annotation { std::vector Insts; public: From lattner at cs.uiuc.edu Sun Oct 27 20:02:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:02:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFunction.h Message-ID: <200210280201.UAA21172@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineFunction.h updated: 1.11 -> 1.12 --- Log message: MachineFunction.h now includes MachineBasicBlock.h in preparation for list changes. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.11 llvm/include/llvm/CodeGen/MachineFunction.h:1.12 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.11 Sun Oct 27 19:27:51 2002 +++ llvm/include/llvm/CodeGen/MachineFunction.h Sun Oct 27 20:01:06 2002 @@ -9,7 +9,7 @@ #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H #define LLVM_CODEGEN_MACHINEFUNCTION_H -#include "llvm/Annotation.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "Support/NonCopyable.h" #include "Support/HashExtras.h" #include From lattner at cs.uiuc.edu Sun Oct 27 20:02:04 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:02:04 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200210280201.UAA21212@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.21 -> 1.22 --- Log message: MachineFunction now includes MachineBasicBlock so there is no need to reinclude it --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.21 llvm/lib/CodeGen/MachineFunction.cpp:1.22 --- llvm/lib/CodeGen/MachineFunction.cpp:1.21 Sun Oct 27 19:41:16 2002 +++ llvm/lib/CodeGen/MachineFunction.cpp Sun Oct 27 20:01:35 2002 @@ -8,7 +8,6 @@ #include "llvm/CodeGen/MachineInstr.h" // For debug output #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineFrameInfo.h" From lattner at cs.uiuc.edu Sun Oct 27 20:02:08 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:02:08 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp PrologEpilogCodeInserter.cpp Message-ID: <200210280201.UAA21236@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.65 -> 1.66 PrologEpilogCodeInserter.cpp updated: 1.16 -> 1.17 --- Log message: (null) --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.65 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.66 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.65 Sun Oct 27 19:41:47 2002 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Sun Oct 27 20:01:37 2002 @@ -13,7 +13,6 @@ #include "SparcInternals.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" Index: llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp diff -u llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.16 llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.17 --- llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp:1.16 Sun Oct 27 19:41:47 2002 +++ llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp Sun Oct 27 20:01:37 2002 @@ -12,7 +12,6 @@ #include "SparcInternals.h" #include "SparcRegClassInfo.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/InstrSelectionSupport.h" From lattner at cs.uiuc.edu Sun Oct 27 20:02:12 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:02:12 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp PhyRegAlloc.cpp Message-ID: <200210280201.UAA21229@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: LiveRangeInfo.cpp updated: 1.30 -> 1.31 PhyRegAlloc.cpp updated: 1.81 -> 1.82 --- Log message: (null) --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.30 llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.31 --- llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.30 Sun Oct 27 19:41:26 2002 +++ llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp Sun Oct 27 20:01:37 2002 @@ -11,7 +11,6 @@ #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Function.h" -#include "llvm/BasicBlock.h" #include "Support/SetOperations.h" using std::cerr; Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.81 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.82 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.81 Sun Oct 27 19:41:27 2002 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Sun Oct 27 20:01:37 2002 @@ -9,7 +9,6 @@ #include "llvm/CodeGen/PhyRegAlloc.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrAnnot.h" -#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" #include "llvm/Analysis/LoopInfo.h" From lattner at cs.uiuc.edu Sun Oct 27 20:02:16 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:02:16 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Message-ID: <200210280201.UAA21222@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelection.cpp updated: 1.50 -> 1.51 --- Log message: (null) --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.50 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.51 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.50 Sun Oct 27 19:41:19 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp Sun Oct 27 20:01:37 2002 @@ -11,7 +11,6 @@ #include "llvm/CodeGen/InstrSelectionSupport.h" #include "llvm/CodeGen/InstrForest.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" From lattner at cs.uiuc.edu Sun Oct 27 20:02:20 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:02:20 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Message-ID: <200210280201.UAA21217@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: InstrScheduling.cpp updated: 1.45 -> 1.46 --- Log message: (null) --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp diff -u llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.45 llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.46 --- llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.45 Sun Oct 27 19:41:17 2002 +++ llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Sun Oct 27 20:01:37 2002 @@ -8,7 +8,6 @@ #include "SchedPriorities.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineCodeForInstruction.h" -#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h" // FIXME: Remove when modularized better #include "llvm/Target/TargetMachine.h" From lattner at cs.uiuc.edu Sun Oct 27 20:09:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:09:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h MachineFunction.h Message-ID: <200210280208.UAA22445@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineBasicBlock.h updated: 1.7 -> 1.8 MachineFunction.h updated: 1.12 -> 1.13 --- Log message: Add BasicBlock list to MchineFunction that will eventually be the only way to access MachineBasicBlocks. For now, it is never filled. --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.7 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.8 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.7 Sun Oct 27 19:55:26 2002 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Sun Oct 27 20:08:43 2002 @@ -11,11 +11,13 @@ #include class BasicBlock; class MachineInstr; +template struct ilist_traits; extern AnnotationID MCFBB_AID; class MachineBasicBlock : public Annotation { std::vector Insts; + MachineBasicBlock *Prev, *Next; public: MachineBasicBlock() : Annotation(MCFBB_AID) {} ~MachineBasicBlock() {} @@ -70,6 +72,14 @@ Insts.pop_back(); return R; } + +private: // Methods used to maintain doubly linked list of blocks... + friend class ilist_traits; + + MachineBasicBlock *getPrev() const { return Prev; } + MachineBasicBlock *getNext() const { return Next; } + void setPrev(MachineBasicBlock *P) { Prev = P; } + void setNext(MachineBasicBlock *N) { Next = N; } }; Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.12 llvm/include/llvm/CodeGen/MachineFunction.h:1.13 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.12 Sun Oct 27 20:01:06 2002 +++ llvm/include/llvm/CodeGen/MachineFunction.h Sun Oct 27 20:08:43 2002 @@ -12,7 +12,9 @@ #include "llvm/CodeGen/MachineBasicBlock.h" #include "Support/NonCopyable.h" #include "Support/HashExtras.h" -#include +#include "Support/hash_set" +#include "Support/ilist" + class Value; class Function; class Constant; @@ -24,11 +26,14 @@ Pass *createMachineCodeDestructionPass(); class MachineFunction : private Annotation { - hash_set constantsForConstPool; - hash_map offsets; - const Function* method; + const Function *method; + + // List of machine basic blocks in function + iplist BasicBlocks; // FIXME: State should be held elsewhere... + hash_set constantsForConstPool; + hash_map offsets; unsigned staticStackSize; unsigned automaticVarsSize; unsigned regSpillsSize; From lattner at cs.uiuc.edu Sun Oct 27 20:12:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:12:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ConstantsScanner.h Message-ID: <200210280211.UAA22776@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: ConstantsScanner.h updated: 1.8 -> 1.9 --- Log message: Don't #include , #include "Support/*" --- Diffs of the changes: Index: llvm/include/llvm/Analysis/ConstantsScanner.h diff -u llvm/include/llvm/Analysis/ConstantsScanner.h:1.8 llvm/include/llvm/Analysis/ConstantsScanner.h:1.9 --- llvm/include/llvm/Analysis/ConstantsScanner.h:1.8 Wed Jul 24 17:08:43 2002 +++ llvm/include/llvm/Analysis/ConstantsScanner.h Sun Oct 27 20:11:13 2002 @@ -11,7 +11,7 @@ #include "llvm/Support/InstIterator.h" #include "llvm/Instruction.h" -#include +#include "Support/iterator" class Constant; class constant_iterator : public forward_iterator { From lattner at cs.uiuc.edu Sun Oct 27 20:12:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:12:05 2002 Subject: [llvm-commits] CVS: llvm/include/Support/DepthFirstIterator.h HashExtras.h MathExtras.h PostOrderIterator.h Message-ID: <200210280211.UAA22793@apoc.cs.uiuc.edu> Changes in directory llvm/include/Support: DepthFirstIterator.h updated: 1.3 -> 1.4 HashExtras.h updated: 1.4 -> 1.5 MathExtras.h updated: 1.4 -> 1.5 PostOrderIterator.h updated: 1.6 -> 1.7 --- Log message: Don't #include , #include "Support/*" --- Diffs of the changes: Index: llvm/include/Support/DepthFirstIterator.h diff -u llvm/include/Support/DepthFirstIterator.h:1.3 llvm/include/Support/DepthFirstIterator.h:1.4 --- llvm/include/Support/DepthFirstIterator.h:1.3 Wed Jul 24 17:08:36 2002 +++ llvm/include/Support/DepthFirstIterator.h Sun Oct 27 20:11:16 2002 @@ -9,7 +9,7 @@ #define LLVM_SUPPORT_DEPTH_FIRST_ITERATOR_H #include "Support/GraphTraits.h" -#include +#include "Support/iterator" #include #include Index: llvm/include/Support/HashExtras.h diff -u llvm/include/Support/HashExtras.h:1.4 llvm/include/Support/HashExtras.h:1.5 --- llvm/include/Support/HashExtras.h:1.4 Wed Jul 24 17:19:59 2002 +++ llvm/include/Support/HashExtras.h Sun Oct 27 20:11:16 2002 @@ -11,7 +11,7 @@ #define LLVM_SUPPORT_HASHEXTRAS_H #include -#include +#include "Support/hash_map" // Cannot specialize hash template from outside of the std namespace. namespace HASH_NAMESPACE { Index: llvm/include/Support/MathExtras.h diff -u llvm/include/Support/MathExtras.h:1.4 llvm/include/Support/MathExtras.h:1.5 --- llvm/include/Support/MathExtras.h:1.4 Tue Sep 17 18:56:50 2002 +++ llvm/include/Support/MathExtras.h Sun Oct 27 20:11:16 2002 @@ -7,7 +7,7 @@ #ifndef SUPPORT_MATH_EXTRAS_H #define SUPPORT_MATH_EXTRAS_H -#include +#include "Support/DataTypes.h" inline unsigned log2(uint64_t C) { unsigned getPow; Index: llvm/include/Support/PostOrderIterator.h diff -u llvm/include/Support/PostOrderIterator.h:1.6 llvm/include/Support/PostOrderIterator.h:1.7 --- llvm/include/Support/PostOrderIterator.h:1.6 Thu Jul 25 10:00:42 2002 +++ llvm/include/Support/PostOrderIterator.h Sun Oct 27 20:11:16 2002 @@ -10,7 +10,7 @@ #define LLVM_SUPPORT_POSTORDER_ITERATOR_H #include "Support/GraphTraits.h" -#include +#include "Support/iterator" #include #include From lattner at cs.uiuc.edu Sun Oct 27 20:12:09 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:12:09 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210280211.UAA22918@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.68 -> 1.69 --- Log message: Don't #include , #include "Support/*" --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.68 llvm/include/llvm/CodeGen/MachineInstr.h:1.69 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.68 Tue Oct 22 18:16:14 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sun Oct 27 20:11:32 2002 @@ -11,7 +11,7 @@ #include "llvm/Target/MachineInstrInfo.h" #include "llvm/Annotation.h" -#include +#include "Support/iterator" class Instruction; //--------------------------------------------------------------------------- From lattner at cs.uiuc.edu Sun Oct 27 20:12:13 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:12:13 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineRegInfo.h MachineSchedInfo.h Message-ID: <200210280211.UAA22931@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineRegInfo.h updated: 1.27 -> 1.28 MachineSchedInfo.h updated: 1.9 -> 1.10 --- Log message: Don't #include , #include "Support/*" --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineRegInfo.h diff -u llvm/include/llvm/Target/MachineRegInfo.h:1.27 llvm/include/llvm/Target/MachineRegInfo.h:1.28 --- llvm/include/llvm/Target/MachineRegInfo.h:1.27 Sat Sep 28 11:56:59 2002 +++ llvm/include/llvm/Target/MachineRegInfo.h Sun Oct 27 20:11:34 2002 @@ -9,7 +9,7 @@ #define LLVM_TARGET_MACHINEREGINFO_H #include "Support/NonCopyable.h" -#include +#include "Support/hash_map" #include class TargetMachine; Index: llvm/include/llvm/Target/MachineSchedInfo.h diff -u llvm/include/llvm/Target/MachineSchedInfo.h:1.9 llvm/include/llvm/Target/MachineSchedInfo.h:1.10 --- llvm/include/llvm/Target/MachineSchedInfo.h:1.9 Sat Oct 12 19:36:36 2002 +++ llvm/include/llvm/Target/MachineSchedInfo.h Sun Oct 27 20:11:34 2002 @@ -8,7 +8,7 @@ #define LLVM_TARGET_MACHINESCHEDINFO_H #include "llvm/Target/MachineInstrInfo.h" -#include +#include "Support/hash_map" typedef long long cycles_t; static const cycles_t HUGE_LATENCY = ~((long long) 1 << (sizeof(cycles_t)-2)); From lattner at cs.uiuc.edu Sun Oct 27 20:13:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:13:00 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/SchedPriorities.h Message-ID: <200210280212.UAA22997@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: SchedPriorities.h updated: 1.19 -> 1.20 --- Log message: Don't #include , #include "Support/*" --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/SchedPriorities.h diff -u llvm/lib/CodeGen/InstrSched/SchedPriorities.h:1.19 llvm/lib/CodeGen/InstrSched/SchedPriorities.h:1.20 --- llvm/lib/CodeGen/InstrSched/SchedPriorities.h:1.19 Fri Aug 9 15:07:54 2002 +++ llvm/lib/CodeGen/InstrSched/SchedPriorities.h Sun Oct 27 20:11:53 2002 @@ -16,8 +16,8 @@ #include "SchedGraph.h" #include "llvm/CodeGen/InstrScheduling.h" #include "llvm/Target/MachineSchedInfo.h" +#include "Support/hash_set" #include -#include class Function; class MachineInstr; From lattner at cs.uiuc.edu Sun Oct 27 20:28:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:28:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineRegInfo.h Message-ID: <200210280227.UAA26913@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineRegInfo.h updated: 1.28 -> 1.29 --- Log message: Remvoe a bunch of unneeded forward decls --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineRegInfo.h diff -u llvm/include/llvm/Target/MachineRegInfo.h:1.28 llvm/include/llvm/Target/MachineRegInfo.h:1.29 --- llvm/include/llvm/Target/MachineRegInfo.h:1.28 Sun Oct 27 20:11:34 2002 +++ llvm/include/llvm/Target/MachineRegInfo.h Sun Oct 27 20:27:07 2002 @@ -18,13 +18,9 @@ class Value; class LiveRangeInfo; class Function; -class Instruction; class LiveRange; class AddedInstrns; class MachineInstr; -class RegClass; -class CallInst; -class ReturnInst; class PhyRegAlloc; class BasicBlock; From lattner at cs.uiuc.edu Sun Oct 27 20:29:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:29:01 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp MachineInstrAnnot.cpp Message-ID: <200210280228.UAA27168@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineInstr.cpp updated: 1.48 -> 1.49 MachineInstrAnnot.cpp updated: 1.3 -> 1.4 --- Log message: Add #includes now that MachineInstr.h doesn't include llvm/Target/MachineInstrInfo.h --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.48 llvm/lib/CodeGen/MachineInstr.cpp:1.49 --- llvm/lib/CodeGen/MachineInstr.cpp:1.48 Tue Oct 22 18:16:17 2002 +++ llvm/lib/CodeGen/MachineInstr.cpp Sun Oct 27 20:28:34 2002 @@ -4,6 +4,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Value.h" +#include "llvm/Target/MachineInstrInfo.h" // FIXME: shouldn't need this! using std::cerr; Index: llvm/lib/CodeGen/MachineInstrAnnot.cpp diff -u llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.3 llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.4 --- llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.3 Sat Sep 28 12:03:40 2002 +++ llvm/lib/CodeGen/MachineInstrAnnot.cpp Sun Oct 27 20:28:34 2002 @@ -8,6 +8,7 @@ #include "llvm/CodeGen/MachineInstrAnnot.h" #include "llvm/Annotation.h" #include "llvm/iOther.h" +#include "llvm/Type.h" AnnotationID CallArgsDescriptor::AID(AnnotationManager:: getID("CodeGen::CallArgsDescriptor")); From lattner at cs.uiuc.edu Sun Oct 27 20:29:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:29:05 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/SchedGraph.cpp Message-ID: <200210280228.UAA27177@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: SchedGraph.cpp updated: 1.36 -> 1.37 --- Log message: Add #includes now that MachineInstr.h doesn't include llvm/Target/MachineInstrInfo.h --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/SchedGraph.cpp diff -u llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.36 llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.37 --- llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.36 Sun Oct 27 19:41:17 2002 +++ llvm/lib/CodeGen/InstrSched/SchedGraph.cpp Sun Oct 27 20:28:36 2002 @@ -12,6 +12,7 @@ #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/MachineInstrInfo.h" #include "llvm/Function.h" #include "llvm/iOther.h" #include "Support/StringExtras.h" From lattner at cs.uiuc.edu Sun Oct 27 20:29:09 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:29:09 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Message-ID: <200210280228.UAA27184@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelectionSupport.cpp updated: 1.36 -> 1.37 --- Log message: Add #includes now that MachineInstr.h doesn't include llvm/Target/MachineInstrInfo.h --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.36 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.37 --- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.36 Sun Oct 27 18:27:19 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Sun Oct 27 20:28:37 2002 @@ -14,6 +14,7 @@ #include "llvm/CodeGen/InstrForest.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineRegInfo.h" +#include "llvm/Target/MachineInstrInfo.h" #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/Type.h" From lattner at cs.uiuc.edu Sun Oct 27 20:29:13 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:29:13 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp PhyRegAlloc.cpp Message-ID: <200210280228.UAA27193@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: LiveRangeInfo.cpp updated: 1.31 -> 1.32 PhyRegAlloc.cpp updated: 1.82 -> 1.83 --- Log message: Add #includes now that MachineInstr.h doesn't include llvm/Target/MachineInstrInfo.h --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.31 llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.32 --- llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.31 Sun Oct 27 20:01:37 2002 +++ llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp Sun Oct 27 20:28:38 2002 @@ -10,6 +10,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/MachineInstrInfo.h" #include "llvm/Function.h" #include "Support/SetOperations.h" using std::cerr; Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.82 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.83 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.82 Sun Oct 27 20:01:37 2002 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Sun Oct 27 20:28:39 2002 @@ -14,6 +14,7 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/MachineFrameInfo.h" +#include "llvm/Target/MachineInstrInfo.h" #include "llvm/Function.h" #include "llvm/Type.h" #include "llvm/iOther.h" From lattner at cs.uiuc.edu Sun Oct 27 20:31:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 20:31:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/InstrSelectionSupport.h MachineInstr.h Message-ID: <200210280229.UAA27228@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: InstrSelectionSupport.h updated: 1.16 -> 1.17 MachineInstr.h updated: 1.69 -> 1.70 --- Log message: Make MachineInstr.h not #include MachineInstrInfo.h --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/InstrSelectionSupport.h diff -u llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.16 llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.17 --- llvm/include/llvm/CodeGen/InstrSelectionSupport.h:1.16 Mon Oct 21 08:23:42 2002 +++ llvm/include/llvm/CodeGen/InstrSelectionSupport.h Sun Oct 27 20:29:46 2002 @@ -10,6 +10,7 @@ #include "llvm/Instruction.h" #include "llvm/CodeGen/MachineInstr.h" +#include "Support/DataTypes.h" class InstructionNode; class TargetMachine; Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.69 llvm/include/llvm/CodeGen/MachineInstr.h:1.70 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.69 Sun Oct 27 20:11:32 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sun Oct 27 20:29:46 2002 @@ -9,10 +9,16 @@ #ifndef LLVM_CODEGEN_MACHINEINSTR_H #define LLVM_CODEGEN_MACHINEINSTR_H -#include "llvm/Target/MachineInstrInfo.h" #include "llvm/Annotation.h" #include "Support/iterator" -class Instruction; +#include "Support/NonCopyable.h" +#include +class Value; +class Function; + +typedef int MachineOpCode; +typedef int OpCodeMask; +typedef int InstrSchedClass; //--------------------------------------------------------------------------- // class MachineOperand From lattner at cs.uiuc.edu Sun Oct 27 22:25:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:25:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210280424.WAA30035@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.70 -> 1.71 --- Log message: Fairly major overhaul of MachineInstr & Operand classes - Inline methods that are mostly a single line anyway - Eliminate several methods that were never called - Group methods a bit more consistently --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.70 llvm/include/llvm/CodeGen/MachineInstr.h:1.71 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.70 Sun Oct 27 20:29:46 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sun Oct 27 22:24:46 2002 @@ -91,18 +91,18 @@ int regNum; // register number for an explicit register // will be set for a value after reg allocation public: - /*ctor*/ MachineOperand (); - /*ctor*/ MachineOperand (MachineOperandType operandType, - Value* _val); - /*copy ctor*/ MachineOperand (const MachineOperand&); - /*dtor*/ ~MachineOperand () {} + MachineOperand() : immedVal(0), opType(MO_VirtualRegister), + flags(0), regNum(-1) {} + MachineOperand(const MachineOperand &M) + : immedVal(M.immedVal), opType(M.opType), flags(M.flags), regNum(M.regNum) { + } + ~MachineOperand() {} // Accessor methods. Caller is responsible for checking the // operand type before invoking the corresponding accessor. // - inline MachineOperandType getOperandType() const { - return opType; - } + MachineOperandType getOperandType() const { return opType; } + inline Value* getVRegValue () const { assert(opType == MO_VirtualRegister || opType == MO_CCRegister || opType == MO_PCRelativeDisp); @@ -120,24 +120,12 @@ assert(opType == MO_SignExtendedImmed || opType == MO_UnextendedImmed); return immedVal; } - inline bool opIsDef () const { - return flags & DEFFLAG; - } - inline bool opIsDefAndUse () const { - return flags & DEFUSEFLAG; - } - inline bool opHiBits32 () const { - return flags & HIFLAG32; - } - inline bool opLoBits32 () const { - return flags & LOFLAG32; - } - inline bool opHiBits64 () const { - return flags & HIFLAG64; - } - inline bool opLoBits64 () const { - return flags & LOFLAG64; - } + bool opIsDef () const { return flags & DEFFLAG; } + bool opIsDefAndUse () const { return flags & DEFUSEFLAG; } + bool opHiBits32 () const { return flags & HIFLAG32; } + bool opLoBits32 () const { return flags & LOFLAG32; } + bool opHiBits64 () const { return flags & HIFLAG64; } + bool opLoBits64 () const { return flags & LOFLAG64; } // used to check if a machine register has been allocated to this operand inline bool hasAllocatedReg() const { @@ -154,20 +142,9 @@ } -public: friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); private: - // These functions are provided so that a vector of operands can be - // statically allocated and individual ones can be initialized later. - // Give class MachineInstr access to these functions. - // - void Initialize (MachineOperandType operandType, - Value* _val); - void InitializeConst (MachineOperandType operandType, - int64_t intValue); - void InitializeReg (int regNum, - bool isCCReg); // Construction methods needed for fine-grain control. // These must be accessed via coresponding methods in MachineInstr. @@ -190,63 +167,6 @@ }; -inline -MachineOperand::MachineOperand() - : immedVal(0), opType(MO_VirtualRegister), flags(0), regNum(-1) -{} - -inline -MachineOperand::MachineOperand(MachineOperandType operandType, - Value* _val) - : immedVal(0), opType(operandType), flags(0), regNum(-1) -{} - -inline -MachineOperand::MachineOperand(const MachineOperand& mo) - : opType(mo.opType), flags(mo.flags) -{ - switch(opType) { - case MO_VirtualRegister: - case MO_CCRegister: value = mo.value; break; - case MO_MachineRegister: regNum = mo.regNum; break; - case MO_SignExtendedImmed: - case MO_UnextendedImmed: - case MO_PCRelativeDisp: immedVal = mo.immedVal; break; - default: assert(0); - } -} - -inline void -MachineOperand::Initialize(MachineOperandType operandType, - Value* _val) -{ - opType = operandType; - value = _val; - regNum = -1; - flags = 0; -} - -inline void -MachineOperand::InitializeConst(MachineOperandType operandType, - int64_t intValue) -{ - opType = operandType; - value = NULL; - immedVal = intValue; - regNum = -1; - flags = 0; -} - -inline void -MachineOperand::InitializeReg(int _regNum, bool isCCReg) -{ - opType = isCCReg? MO_CCRegister : MO_MachineRegister; - value = NULL; - regNum = (int) _regNum; - flags = 0; -} - - //--------------------------------------------------------------------------- // class MachineInstr // @@ -294,10 +214,10 @@ std::vector regsUsed; public: /*ctor*/ MachineInstr (MachineOpCode _opCode, - OpCodeMask _opCodeMask = 0x0); + OpCodeMask _opCodeMask = 0); /*ctor*/ MachineInstr (MachineOpCode _opCode, unsigned numOperands, - OpCodeMask _opCodeMask = 0x0); + OpCodeMask _opCodeMask = 0); inline ~MachineInstr () {} // @@ -309,36 +229,69 @@ OpCodeMask _opCodeMask = 0x0); // - // The op code. Note that MachineOpCode is a target-specific type. + // The opcode. // - const MachineOpCode getOpCode () const { return opCode; } + const MachineOpCode getOpCode() const { return opCode; } // // Information about explicit operands of the instruction // - unsigned int getNumOperands () const { return operands.size(); } + unsigned getNumOperands() const { return operands.size(); } - bool operandIsDefined(unsigned i) const; - bool operandIsDefinedAndUsed(unsigned i) const; + bool operandIsDefined(unsigned i) const { + return getOperand(i).opIsDef(); + } + + bool operandIsDefinedAndUsed(unsigned i) const { + return getOperand(i).opIsDefAndUse(); + } - const MachineOperand& getOperand (unsigned i) const; - MachineOperand& getOperand (unsigned i); + const MachineOperand& getOperand(unsigned i) const { + assert(i < operands.size() && "getOperand() out of range!"); + return operands[i]; + } + MachineOperand& getOperand(unsigned i) { + assert(i < operands.size() && "getOperand() out of range!"); + return operands[i]; + } // // Information about implicit operands of the instruction // - unsigned getNumImplicitRefs() const{ return implicitRefs.size();} + unsigned getNumImplicitRefs() const{ return implicitRefs.size();} - bool implicitRefIsDefined(unsigned i) const; - bool implicitRefIsDefinedAndUsed(unsigned i) const; + const Value* getImplicitRef(unsigned i) const { + assert(i < implicitRefs.size() && "getImplicitRef() out of range!"); + return implicitRefs[i].Val; + } + Value* getImplicitRef(unsigned i) { + assert(i < implicitRefs.size() && "getImplicitRef() out of range!"); + return implicitRefs[i].Val; + } + + bool implicitRefIsDefined(unsigned i) const { + assert(i < implicitRefs.size() && "implicitRefIsDefined() out of range!"); + return implicitRefs[i].isDef; + } + bool implicitRefIsDefinedAndUsed(unsigned i) const { + assert(i < implicitRefs.size() && "implicitRefIsDef&Used() out of range!"); + return implicitRefs[i].isDefAndUse; + } + + void addImplicitRef(Value* V, bool isDef=false, bool isDefAndUse=false) { + implicitRefs.push_back(ImplicitRef(V, isDef, isDefAndUse)); + } - const Value* getImplicitRef (unsigned i) const; - Value* getImplicitRef (unsigned i); + void setImplicitRef(unsigned i, Value* V, bool isDef=false, + bool isDefAndUse=false) { + assert(i < implicitRefs.size() && "setImplicitRef() out of range!"); + implicitRefs[i] = ImplicitRef(V, isDef, isDefAndUse); + } // // Information about registers used in this instruction // - const std::vector &getRegsUsed () const { return regsUsed; } + const std::vector &getRegsUsed() const { return regsUsed; } // insertUsedReg - Add a register to the Used registers set... void insertUsedReg(unsigned Reg) { @@ -350,9 +303,8 @@ // // Debugging support // - void dump () const; - friend std::ostream& operator<< (std::ostream& os, - const MachineInstr& minstr); + void dump() const; + friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); // // Define iterators to access the Value operands of the Machine Instruction. @@ -365,44 +317,28 @@ // Access to set the operands when building the machine instruction // - void SetMachineOperandVal(unsigned i, - MachineOperand::MachineOperandType - operandType, - Value* _val, - bool isDef=false, - bool isDefAndUse=false); - void SetMachineOperandConst(unsigned i, - MachineOperand::MachineOperandType - operandType, - int64_t intValue); - void SetMachineOperandReg(unsigned i, int regNum, - bool isDef=false, - bool isDefAndUse=false, - bool isCCReg=false); - - void addImplicitRef (Value* val, - bool isDef=false, - bool isDefAndUse=false); - - void setImplicitRef (unsigned i, - Value* val, - bool isDef=false, - bool isDefAndUse=false); - - unsigned substituteValue (const Value* oldVal, - Value* newVal, - bool defsOnly = true); - - void setOperandHi32 (unsigned i); - void setOperandLo32 (unsigned i); - void setOperandHi64 (unsigned i); - void setOperandLo64 (unsigned i); + void SetMachineOperandVal(unsigned i, + MachineOperand::MachineOperandType operandType, + Value* V, bool isDef=false, bool isDefAndUse=false); + void SetMachineOperandConst(unsigned i, + MachineOperand::MachineOperandType operandType, + int64_t intValue); + void SetMachineOperandReg(unsigned i, int regNum, bool isDef=false, + bool isDefAndUse=false, bool isCCReg=false); + + unsigned substituteValue(const Value* oldVal, Value* newVal, + bool defsOnly = true); + + void setOperandHi32(unsigned i) { operands[i].markHi32(); } + void setOperandLo32(unsigned i) { operands[i].markLo32(); } + void setOperandHi64(unsigned i) { operands[i].markHi64(); } + void setOperandLo64(unsigned i) { operands[i].markLo64(); } - // Replaces the Value for the operand with its allocated + // SetRegForOperand - Replaces the Value for the operand with its allocated // physical register after register allocation is complete. // - void SetRegForOperand(unsigned i, int regNum); + void SetRegForOperand(unsigned i, int regNum); // // Iterator to enumerate machine operands. @@ -469,113 +405,14 @@ } }; - -inline MachineOperand& -MachineInstr::getOperand(unsigned int i) -{ - assert(i < operands.size() && "getOperand() out of range!"); - return operands[i]; -} - -inline const MachineOperand& -MachineInstr::getOperand(unsigned int i) const -{ - assert(i < operands.size() && "getOperand() out of range!"); - return operands[i]; -} - -inline bool -MachineInstr::operandIsDefined(unsigned int i) const -{ - return getOperand(i).opIsDef(); -} - -inline bool -MachineInstr::operandIsDefinedAndUsed(unsigned int i) const -{ - return getOperand(i).opIsDefAndUse(); -} - -inline bool -MachineInstr::implicitRefIsDefined(unsigned i) const -{ - assert(i < implicitRefs.size() && "operand out of range!"); - return implicitRefs[i].isDef; -} - -inline bool -MachineInstr::implicitRefIsDefinedAndUsed(unsigned i) const -{ - assert(i < implicitRefs.size() && "operand out of range!"); - return implicitRefs[i].isDefAndUse; -} - -inline const Value* -MachineInstr::getImplicitRef(unsigned i) const -{ - assert(i < implicitRefs.size() && "getImplicitRef() out of range!"); - return implicitRefs[i].Val; -} - -inline Value* -MachineInstr::getImplicitRef(unsigned i) -{ - assert(i < implicitRefs.size() && "getImplicitRef() out of range!"); - return implicitRefs[i].Val; -} - -inline void -MachineInstr::addImplicitRef(Value* val, - bool isDef, - bool isDefAndUse) { - implicitRefs.push_back(ImplicitRef(val, isDef, isDefAndUse)); -} - -inline void -MachineInstr::setImplicitRef(unsigned int i, - Value* val, - bool isDef, - bool isDefAndUse) -{ - assert(i < implicitRefs.size() && "setImplicitRef() out of range!"); - implicitRefs[i].Val = val; - implicitRefs[i].isDef = isDef; - implicitRefs[i].isDefAndUse = isDefAndUse; -} - -inline void -MachineInstr::setOperandHi32(unsigned i) -{ - operands[i].markHi32(); -} - -inline void -MachineInstr::setOperandLo32(unsigned i) -{ - operands[i].markLo32(); -} - -inline void -MachineInstr::setOperandHi64(unsigned i) -{ - operands[i].markHi64(); -} - -inline void -MachineInstr::setOperandLo64(unsigned i) -{ - operands[i].markLo64(); -} - - //--------------------------------------------------------------------------- // Debugging Support //--------------------------------------------------------------------------- -std::ostream& operator<< (std::ostream& os, const MachineInstr& minstr); +std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); -std::ostream& operator<< (std::ostream& os, const MachineOperand& mop); +std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); -void PrintMachineInstructions(const Function *F); +void PrintMachineInstructions(const Function *F); #endif From lattner at cs.uiuc.edu Sun Oct 27 22:25:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:25:06 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp Message-ID: <200210280424.WAA30042@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineInstr.cpp updated: 1.49 -> 1.50 --- Log message: Fairly major overhaul of MachineInstr & Operand classes - Inline methods that are mostly a single line anyway - Eliminate several methods that were never called - Group methods a bit more consistently --- Diffs of the changes: Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.49 llvm/lib/CodeGen/MachineInstr.cpp:1.50 --- llvm/lib/CodeGen/MachineInstr.cpp:1.49 Sun Oct 27 20:28:34 2002 +++ llvm/lib/CodeGen/MachineInstr.cpp Sun Oct 27 22:24:49 2002 @@ -47,12 +47,16 @@ void MachineInstr::SetMachineOperandVal(unsigned int i, MachineOperand::MachineOperandType opType, - Value* _val, + Value* V, bool isdef, bool isDefAndUse) { assert(i < operands.size()); - operands[i].Initialize(opType, _val); + operands[i].opType = opType; + operands[i].value = V; + operands[i].regNum = -1; + operands[i].flags = 0; + if (isdef || TargetInstrDescriptors[opCode].resultPos == (int) i) operands[i].markDef(); if (isDefAndUse) @@ -60,25 +64,36 @@ } void -MachineInstr::SetMachineOperandConst(unsigned int i, +MachineInstr::SetMachineOperandConst(unsigned i, MachineOperand::MachineOperandType operandType, int64_t intValue) { assert(i < operands.size()); assert(TargetInstrDescriptors[opCode].resultPos != (int) i && "immed. constant cannot be defined"); - operands[i].InitializeConst(operandType, intValue); + + operands[i].opType = operandType; + operands[i].value = NULL; + operands[i].immedVal = intValue; + operands[i].regNum = -1; + operands[i].flags = 0; } void -MachineInstr::SetMachineOperandReg(unsigned int i, +MachineInstr::SetMachineOperandReg(unsigned i, int regNum, bool isdef, bool isDefAndUse, bool isCCReg) { assert(i < operands.size()); - operands[i].InitializeReg(regNum, isCCReg); + + operands[i].opType = + isCCReg? MachineOperand::MO_CCRegister : MachineOperand::MO_MachineRegister; + operands[i].value = NULL; + operands[i].regNum = regNum; + operands[i].flags = 0; + if (isdef || TargetInstrDescriptors[opCode].resultPos == (int) i) operands[i].markDef(); if (isDefAndUse) From lattner at cs.uiuc.edu Sun Oct 27 22:31:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:31:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210280430.WAA31360@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.71 -> 1.72 --- Log message: Add new getOperandType(i) method to MachineInstr --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.71 llvm/include/llvm/CodeGen/MachineInstr.h:1.72 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.71 Sun Oct 27 22:24:46 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sun Oct 27 22:30:20 2002 @@ -238,14 +238,6 @@ // unsigned getNumOperands() const { return operands.size(); } - bool operandIsDefined(unsigned i) const { - return getOperand(i).opIsDef(); - } - - bool operandIsDefinedAndUsed(unsigned i) const { - return getOperand(i).opIsDefAndUse(); - } - const MachineOperand& getOperand(unsigned i) const { assert(i < operands.size() && "getOperand() out of range!"); return operands[i]; @@ -254,6 +246,18 @@ assert(i < operands.size() && "getOperand() out of range!"); return operands[i]; } + + MachineOperand::MachineOperandType getOperandType(unsigned i) const { + return getOperand(i).getOperandType(); + } + + bool operandIsDefined(unsigned i) const { + return getOperand(i).opIsDef(); + } + + bool operandIsDefinedAndUsed(unsigned i) const { + return getOperand(i).opIsDefAndUse(); + } // // Information about implicit operands of the instruction @@ -339,7 +343,7 @@ // physical register after register allocation is complete. // void SetRegForOperand(unsigned i, int regNum); - + // // Iterator to enumerate machine operands. // @@ -348,10 +352,10 @@ unsigned i; MITy MI; - inline void skipToNextVal() { + void skipToNextVal() { while (i < MI->getNumOperands() && - !((MI->getOperand(i).getOperandType() == MachineOperand::MO_VirtualRegister || - MI->getOperand(i).getOperandType() == MachineOperand::MO_CCRegister) + !((MI->getOperandType(i) == MachineOperand::MO_VirtualRegister || + MI->getOperandType(i) == MachineOperand::MO_CCRegister) && MI->getOperand(i).getVRegValue() != 0)) ++i; } From lattner at cs.uiuc.edu Sun Oct 27 22:46:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:46:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210280445.WAA31952@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.72 -> 1.73 --- Log message: Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType() --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.72 llvm/include/llvm/CodeGen/MachineInstr.h:1.73 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.72 Sun Oct 27 22:30:20 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sun Oct 27 22:44:59 2002 @@ -101,7 +101,7 @@ // Accessor methods. Caller is responsible for checking the // operand type before invoking the corresponding accessor. // - MachineOperandType getOperandType() const { return opType; } + MachineOperandType getType() const { return opType; } inline Value* getVRegValue () const { assert(opType == MO_VirtualRegister || opType == MO_CCRegister || @@ -248,7 +248,7 @@ } MachineOperand::MachineOperandType getOperandType(unsigned i) const { - return getOperand(i).getOperandType(); + return getOperand(i).getType(); } bool operandIsDefined(unsigned i) const { From lattner at cs.uiuc.edu Sun Oct 27 22:46:06 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:46:06 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/SchedGraph.cpp Message-ID: <200210280445.WAA31972@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: SchedGraph.cpp updated: 1.37 -> 1.38 --- Log message: Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType() --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/SchedGraph.cpp diff -u llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.37 llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.38 --- llvm/lib/CodeGen/InstrSched/SchedGraph.cpp:1.37 Sun Oct 27 20:28:36 2002 +++ llvm/lib/CodeGen/InstrSched/SchedGraph.cpp Sun Oct 27 22:45:24 2002 @@ -623,31 +623,30 @@ void -SchedGraph::addEdgesForInstruction(const MachineInstr& minstr, +SchedGraph::addEdgesForInstruction(const MachineInstr& MI, const ValueToDefVecMap& valueToDefVecMap, const TargetMachine& target) { - SchedGraphNode* node = this->getGraphNodeForInstr(&minstr); + SchedGraphNode* node = getGraphNodeForInstr(&MI); if (node == NULL) return; // Add edges for all operands of the machine instruction. // - for (unsigned i=0, numOps=minstr.getNumOperands(); i < numOps; i++) + for (unsigned i = 0, numOps = MI.getNumOperands(); i != numOps; ++i) { - const MachineOperand& mop = minstr.getOperand(i); - switch(mop.getOperandType()) + switch (MI.getOperandType(i)) { case MachineOperand::MO_VirtualRegister: case MachineOperand::MO_CCRegister: if (const Instruction* srcI = - dyn_cast_or_null(mop.getVRegValue())) + dyn_cast_or_null(MI.getOperand(i).getVRegValue())) { ValueToDefVecMap::const_iterator I = valueToDefVecMap.find(srcI); if (I != valueToDefVecMap.end()) - addEdgesForValue(node, (*I).second, mop.getVRegValue(), - minstr.operandIsDefined(i), - minstr.operandIsDefinedAndUsed(i), target); + addEdgesForValue(node, I->second, srcI, + MI.operandIsDefined(i), + MI.operandIsDefinedAndUsed(i), target); } break; @@ -669,17 +668,17 @@ // Examples include function arguments to a Call instructions or the return // value of a Ret instruction. // - for (unsigned i=0, N=minstr.getNumImplicitRefs(); i < N; ++i) - if (! minstr.implicitRefIsDefined(i) || - minstr.implicitRefIsDefinedAndUsed(i)) - if (const Instruction* srcI = - dyn_cast_or_null(minstr.getImplicitRef(i))) + for (unsigned i=0, N=MI.getNumImplicitRefs(); i < N; ++i) + if (! MI.implicitRefIsDefined(i) || + MI.implicitRefIsDefinedAndUsed(i)) + if (const Instruction *srcI = + dyn_cast_or_null(MI.getImplicitRef(i))) { ValueToDefVecMap::const_iterator I = valueToDefVecMap.find(srcI); if (I != valueToDefVecMap.end()) - addEdgesForValue(node, (*I).second, minstr.getImplicitRef(i), - minstr.implicitRefIsDefined(i), - minstr.implicitRefIsDefinedAndUsed(i), target); + addEdgesForValue(node, I->second, srcI, + MI.implicitRefIsDefined(i), + MI.implicitRefIsDefinedAndUsed(i), target); } } @@ -700,14 +699,14 @@ // Collect the register references and value defs. for explicit operands // - const MachineInstr& minstr = * node->getMachineInstr(); + const MachineInstr& minstr = *node->getMachineInstr(); for (int i=0, numOps = (int) minstr.getNumOperands(); i < numOps; i++) { const MachineOperand& mop = minstr.getOperand(i); // if this references a register other than the hardwired // "zero" register, record the reference. - if (mop.getOperandType() == MachineOperand::MO_MachineRegister) + if (mop.getType() == MachineOperand::MO_MachineRegister) { int regNum = mop.getMachineRegNum(); if (regNum != target.getRegInfo().getZeroRegNum()) @@ -721,8 +720,8 @@ continue; // We must be defining a value. - assert((mop.getOperandType() == MachineOperand::MO_VirtualRegister || - mop.getOperandType() == MachineOperand::MO_CCRegister) + assert((mop.getType() == MachineOperand::MO_VirtualRegister || + mop.getType() == MachineOperand::MO_CCRegister) && "Do not expect any other kind of operand to be defined!"); const Instruction* defInstr = cast(mop.getVRegValue()); From lattner at cs.uiuc.edu Sun Oct 27 22:46:10 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:46:10 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Message-ID: <200210280445.WAA31997@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSelection: InstrSelectionSupport.cpp updated: 1.37 -> 1.38 --- Log message: Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType() --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.37 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.38 --- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.37 Sun Oct 27 20:28:37 2002 +++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp Sun Oct 27 22:45:26 2002 @@ -483,9 +483,9 @@ // 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) + mop.getType() == MachineOperand::MO_MachineRegister || + mop.getType() == MachineOperand::MO_CCRegister || + mop.getType() == MachineOperand::MO_PCRelativeDisp) continue; bool constantThatMustBeLoaded = false; @@ -496,7 +496,7 @@ MachineOperand::MO_VirtualRegister; // Operand may be a virtual register or a compile-time constant - if (mop.getOperandType() == MachineOperand::MO_VirtualRegister) + if (mop.getType() == MachineOperand::MO_VirtualRegister) { assert(mop.getVRegValue() != NULL); opValue = mop.getVRegValue(); @@ -510,10 +510,10 @@ } else { - assert(mop.getOperandType() == MachineOperand::MO_SignExtendedImmed || - mop.getOperandType() == MachineOperand::MO_UnextendedImmed); + assert(mop.getType() == MachineOperand::MO_SignExtendedImmed || + mop.getType() == MachineOperand::MO_UnextendedImmed); - bool isSigned = (mop.getOperandType() == + bool isSigned = (mop.getType() == MachineOperand::MO_SignExtendedImmed); // Bit-selection flags indicate an instruction that is extracting @@ -526,7 +526,7 @@ opCode, target, (immedPos == (int)op), machineRegNum, immedValue); - if (opType == mop.getOperandType()) + if (opType == mop.getType()) continue; // no change: this is the most common case if (opType == MachineOperand::MO_VirtualRegister) From lattner at cs.uiuc.edu Sun Oct 27 22:46:15 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:46:15 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp PhyRegAlloc.cpp Message-ID: <200210280445.WAA32026@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/RegAlloc: LiveRangeInfo.cpp updated: 1.32 -> 1.33 PhyRegAlloc.cpp updated: 1.83 -> 1.84 --- Log message: Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType() --- Diffs of the changes: Index: llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp diff -u llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.32 llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.33 --- llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp:1.32 Sun Oct 27 20:28:38 2002 +++ llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp Sun Oct 27 22:45:27 2002 @@ -110,7 +110,7 @@ // check if the LR is already there (because of multiple defs) if (!DefRange) { - DefRange = this->createNewLiveRange(Def, isCC); + DefRange = createNewLiveRange(Def, isCC); } else { // live range already exists DefRange->insert(Def); // add the operand to the range LiveRangeMap[Def] = DefRange; // make operand point to merged set @@ -134,7 +134,7 @@ // first find the live ranges for all incoming args of the function since // those LRs start from the start of the function for (Function::const_aiterator AI = Meth->abegin(); AI != Meth->aend(); ++AI) - this->createNewLiveRange(AI, /*isCC*/ false); + createNewLiveRange(AI, /*isCC*/ false); // Now suggest hardware registers for these function args MRI.suggestRegs4MethodArgs(Meth, *this); @@ -160,7 +160,7 @@ // if(TM.getInstrInfo().isReturn(MInst->getOpCode()) || TM.getInstrInfo().isCall(MInst->getOpCode())) - CallRetInstrList.push_back( MInst ); + CallRetInstrList.push_back(MInst); // iterate over explicit MI operands and create a new LR // for each operand that is defined by the instruction @@ -168,9 +168,9 @@ OpE = MInst->end(); OpI != OpE; ++OpI) if (OpI.isDef()) { const Value *Def = *OpI; - bool isCC = (OpI.getMachineOperand().getOperandType() + bool isCC = (OpI.getMachineOperand().getType() == MachineOperand::MO_CCRegister); - this->createOrAddToLiveRange(Def, isCC); + createOrAddToLiveRange(Def, isCC); } // iterate over implicit MI operands and create a new LR @@ -178,7 +178,7 @@ for (unsigned i = 0; i < MInst->getNumImplicitRefs(); ++i) if (MInst->implicitRefIsDefined(i)) { const Value *Def = MInst->getImplicitRef(i); - this->createOrAddToLiveRange(Def, /*isCC*/ false); + createOrAddToLiveRange(Def, /*isCC*/ false); } } // for all machine instructions in the BB Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.83 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.84 --- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.83 Sun Oct 27 20:28:39 2002 +++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Sun Oct 27 22:45:27 2002 @@ -539,8 +539,8 @@ for (unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) { MachineOperand& Op = MInst->getOperand(OpNum); - if (Op.getOperandType() == MachineOperand::MO_VirtualRegister || - Op.getOperandType() == MachineOperand::MO_CCRegister) + if (Op.getType() == MachineOperand::MO_VirtualRegister || + Op.getType() == MachineOperand::MO_CCRegister) { const Value *const Val = Op.getVRegValue(); @@ -750,7 +750,7 @@ std::vector& MIBef, std::vector& MIAft) { - RegClass* RC = this->getRegClassByID(MRI.getRegClassIDOfRegType(RegType)); + RegClass* RC = getRegClassByID(MRI.getRegClassIDOfRegType(RegType)); int RegU = getUnusedUniRegAtMI(RC, MInst, LVSetBef); @@ -766,8 +766,8 @@ int scratchRegType = -1; if (MRI.regTypeNeedsScratchReg(RegType, scratchRegType)) { - int scratchReg = this->getUsableUniRegAtMI(scratchRegType, LVSetBef, - MInst, MIBef, MIAft); + int scratchReg = getUsableUniRegAtMI(scratchRegType, LVSetBef, + MInst, MIBef, MIAft); assert(scratchReg != MRI.getInvalidRegNum()); // We may as well hold the value in the scratch register instead @@ -893,8 +893,8 @@ { const MachineOperand& Op = MInst->getOperand(OpNum); - if (Op.getOperandType() == MachineOperand::MO_VirtualRegister || - Op.getOperandType() == MachineOperand::MO_CCRegister) + if (MInst->getOperandType(OpNum) == MachineOperand::MO_VirtualRegister || + MInst->getOperandType(OpNum) == MachineOperand::MO_CCRegister) if (const Value* Val = Op.getVRegValue()) if (MRI.getRegClassIDOfValue(Val) == RC->getID()) if (Op.getAllocatedRegNum() == -1) @@ -971,9 +971,9 @@ for (unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) { MachineOperand& Op = MInst->getOperand(OpNum); - if (Op.getOperandType() == MachineOperand::MO_VirtualRegister || - Op.getOperandType() == MachineOperand::MO_CCRegister /*|| - Op.getOperandType() == MachineOperand::MO_PCRelativeDisp*/ ) { + if (Op.getType() == MachineOperand::MO_VirtualRegister || + Op.getType() == MachineOperand::MO_CCRegister /*|| + Op.getType() == MachineOperand::MO_PCRelativeDisp*/ ) { const Value *const Val = Op.getVRegValue () ; // ****this code is temporary till NULL Values are fixed @@ -1005,7 +1005,7 @@ } } - else if (Op.getOperandType() == MachineOperand::MO_MachineRegister) { + else if (Op.getType() == MachineOperand::MO_MachineRegister) { cerr << "\t" << "%" << MRI.getUnifiedRegName(Op.getMachineRegNum()); } From lattner at cs.uiuc.edu Sun Oct 27 22:46:20 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:46:20 2002 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp SparcInstrSelection.cpp SparcOptInfo.cpp SparcRegInfo.cpp Message-ID: <200210280445.WAA32071@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: EmitAssembly.cpp updated: 1.66 -> 1.67 SparcInstrSelection.cpp updated: 1.77 -> 1.78 SparcOptInfo.cpp updated: 1.3 -> 1.4 SparcRegInfo.cpp updated: 1.76 -> 1.77 --- Log message: Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType() --- Diffs of the changes: Index: llvm/lib/Target/Sparc/EmitAssembly.cpp diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.66 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.67 --- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.66 Sun Oct 27 20:01:37 2002 +++ llvm/lib/Target/Sparc/EmitAssembly.cpp Sun Oct 27 22:45:29 2002 @@ -382,7 +382,7 @@ else needBitsFlag = false; - switch (mop.getOperandType()) + switch (mop.getType()) { case MachineOperand::MO_VirtualRegister: case MachineOperand::MO_CCRegister: Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.77 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.78 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.77 Sun Oct 27 18:28:31 2002 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Sun Oct 27 22:45:29 2002 @@ -1106,7 +1106,7 @@ for (unsigned i=0, numOps=minstr->getNumOperands(); i < numOps; ++i) { const MachineOperand& mop = minstr->getOperand(i); - if (mop.getOperandType() == MachineOperand::MO_VirtualRegister && + if (mop.getType() == MachineOperand::MO_VirtualRegister && mop.getVRegValue() == unusedOp) minstr->SetMachineOperandVal(i, MachineOperand::MO_VirtualRegister, fwdOp); Index: llvm/lib/Target/Sparc/SparcOptInfo.cpp diff -u llvm/lib/Target/Sparc/SparcOptInfo.cpp:1.3 llvm/lib/Target/Sparc/SparcOptInfo.cpp:1.4 --- llvm/lib/Target/Sparc/SparcOptInfo.cpp:1.3 Sat Oct 12 19:20:15 2002 +++ llvm/lib/Target/Sparc/SparcOptInfo.cpp Sun Oct 27 22:45:29 2002 @@ -1,5 +1,7 @@ //===-- SparcOptInfo.cpp --------------------------------------------------===// // +// FIXME: Describe +// //===----------------------------------------------------------------------===// #include "SparcInternals.h" @@ -7,7 +9,6 @@ #include "llvm/CodeGen/MachineInstr.h" #include - //---------------------------------------------------------------------------- // Function: IsUselessCopy // Decide whether a machine instruction is a redundant copy: @@ -48,7 +49,7 @@ target.getRegInfo().getZeroRegNum()) || /* or operand otherOp == 0 */ - (MI->getOperand(otherOp).getOperandType() + (MI->getOperandType(otherOp) == MachineOperand::MO_SignExtendedImmed && MI->getOperand(otherOp).getImmedValue() == 0)); } Index: llvm/lib/Target/Sparc/SparcRegInfo.cpp diff -u llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.76 llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.77 --- llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.76 Sun Oct 27 18:28:31 2002 +++ llvm/lib/Target/Sparc/SparcRegInfo.cpp Sun Oct 27 22:45:29 2002 @@ -1599,11 +1599,10 @@ // last operand is the def (unless for a store which has no def reg) MachineOperand& DefOp = DefInst->getOperand(DefInst->getNumOperands()-1); - if( DefOp.opIsDef() && - DefOp.getOperandType() == MachineOperand::MO_MachineRegister) { + if (DefOp.opIsDef() && + DefOp.getType() == MachineOperand::MO_MachineRegister) { // If the operand in DefInst is a def ... - bool DefEqUse = false; std::vector::iterator UseIt = DefIt; @@ -1617,8 +1616,8 @@ // for each inst (UseInst) that is below the DefInst do ... MachineOperand& UseOp = UseInst->getOperand(0); - if( ! UseOp.opIsDef() && - UseOp.getOperandType() == MachineOperand::MO_MachineRegister) { + if (!UseOp.opIsDef() && + UseOp.getType() == MachineOperand::MO_MachineRegister) { // if use is a register ... @@ -1678,8 +1677,8 @@ PhyRegAlloc &PRA) const { MachineOperand& UseOp = UnordInst->getOperand(0); - if( ! UseOp.opIsDef() && - UseOp.getOperandType() == MachineOperand::MO_MachineRegister) { + if (!UseOp.opIsDef() && + UseOp.getType() == MachineOperand::MO_MachineRegister) { // for the use of UnordInst, see whether there is a defining instr // before in the OrdVec @@ -1695,7 +1694,7 @@ OrdInst->getOperand(OrdInst->getNumOperands()-1); if( DefOp.opIsDef() && - DefOp.getOperandType() == MachineOperand::MO_MachineRegister) { + DefOp.getType() == MachineOperand::MO_MachineRegister) { //cerr << "\nDefining Ord Inst: " << *OrdInst; From lattner at cs.uiuc.edu Sun Oct 27 22:51:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:51:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200210280450.WAA00597@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.73 -> 1.74 --- Log message: Remove typedef that is unneccesary --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.73 llvm/include/llvm/CodeGen/MachineInstr.h:1.74 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.73 Sun Oct 27 22:44:59 2002 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sun Oct 27 22:50:01 2002 @@ -18,7 +18,6 @@ typedef int MachineOpCode; typedef int OpCodeMask; -typedef int InstrSchedClass; //--------------------------------------------------------------------------- // class MachineOperand From lattner at cs.uiuc.edu Sun Oct 27 22:54:00 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:54:00 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineInstrInfo.h MachineSchedInfo.h Message-ID: <200210280453.WAA01440@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineInstrInfo.h updated: 1.24 -> 1.25 MachineSchedInfo.h updated: 1.10 -> 1.11 --- Log message: Make scheduling class variables be 'unsigned' instead of 'int' --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineInstrInfo.h diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.24 llvm/include/llvm/Target/MachineInstrInfo.h:1.25 --- llvm/include/llvm/Target/MachineInstrInfo.h:1.24 Sun Oct 27 18:26:17 2002 +++ llvm/include/llvm/Target/MachineInstrInfo.h Sun Oct 27 22:53:18 2002 @@ -13,7 +13,6 @@ #include "llvm/DerivedTypes.h" class MachineInstrDescriptor; -class TmpInstruction; class MachineInstr; class TargetMachine; class Value; @@ -27,7 +26,7 @@ typedef int MachineOpCode; typedef int OpCodeMask; -typedef int InstrSchedClass; +typedef unsigned InstrSchedClass; const MachineOpCode INVALID_MACHINE_OPCODE = -1; Index: llvm/include/llvm/Target/MachineSchedInfo.h diff -u llvm/include/llvm/Target/MachineSchedInfo.h:1.10 llvm/include/llvm/Target/MachineSchedInfo.h:1.11 --- llvm/include/llvm/Target/MachineSchedInfo.h:1.10 Sun Oct 27 20:11:34 2002 +++ llvm/include/llvm/Target/MachineSchedInfo.h Sun Oct 27 22:53:18 2002 @@ -196,9 +196,8 @@ assert(opCode >= 0 && opCode < (int) instrRUsages.size()); return instrRUsages[opCode]; } - inline const InstrClassRUsage& - getClassRUsage(const InstrSchedClass& sc) const { - assert(sc >= 0 && sc < numSchedClasses); + const InstrClassRUsage& getClassRUsage(const InstrSchedClass& sc) const { + assert(sc < numSchedClasses); return classRUsages[sc]; } @@ -225,7 +224,7 @@ } inline unsigned getMaxIssueForClass(const InstrSchedClass& sc) const { - assert(sc >= 0 && sc < numSchedClasses); + assert(sc < numSchedClasses); return classRUsages[sc].maxNumIssue; } @@ -283,7 +282,7 @@ } protected: - int numSchedClasses; + unsigned numSchedClasses; const MachineInstrInfo* mii; const InstrClassRUsage* classRUsages; // raw array by sclass const InstrRUsageDelta* usageDeltas; // raw array [1:numUsageDeltas] From lattner at cs.uiuc.edu Sun Oct 27 22:54:05 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:54:05 2002 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Message-ID: <200210280453.WAA01447@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/InstrSched: InstrScheduling.cpp updated: 1.46 -> 1.47 --- Log message: Make Scheduling Class variables be 'unsigned' instead of 'int' --- Diffs of the changes: Index: llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp diff -u llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.46 llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.47 --- llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp:1.46 Sun Oct 27 20:01:37 2002 +++ llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp Sun Oct 27 22:53:02 2002 @@ -410,7 +410,7 @@ } inline unsigned getNumChoicesInClass (const InstrSchedClass& sc) const { - assert(sc < (int) numInClass.size() && "Invalid op code or sched class!"); + assert(sc < numInClass.size() && "Invalid op code or sched class!"); return numInClass[sc]; } @@ -429,7 +429,7 @@ // Increment numInClass[c] for the sched class to which the instr belongs. choiceVec.push_back(node); const InstrSchedClass& sc = schedInfo.getSchedClass(node->getOpCode()); - assert(sc < (int) numInClass.size()); + assert(sc < numInClass.size()); numInClass[sc]++; } @@ -483,7 +483,7 @@ // and decrement the instr count for the sched class to which it belongs const InstrSchedClass& sc = schedInfo.getSchedClass(node->getOpCode()); - assert(sc < (int) numInClass.size()); + assert(sc < numInClass.size()); numInClass[sc]--; } From lattner at cs.uiuc.edu Sun Oct 27 22:57:01 2002 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Oct 27 22:57:01 2002 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MachineInstrInfo.h Message-ID: <200210280456.WAA01939@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MachineInstrInfo.h updated: 1.25 -> 1.26 --- Log message: * s/unsigned int/unsigned * Make MachineInstrDescriptor only keep a const char * instead of a string for the opcode name. --- Diffs of the changes: Index: llvm/include/llvm/Target/MachineInstrInfo.h diff -u llvm/include/llvm/Target/MachineInstrInfo.h:1.25 llvm/include/llvm/Target/MachineInstrInfo.h:1.26 --- llvm/include/llvm/Target/MachineInstrInfo.h:1.25 Sun Oct 27 22:53:18 2002 +++ llvm/include/llvm/Target/MachineInstrInfo.h Sun Oct 27 22:55:56 2002 @@ -52,34 +52,34 @@ //--------------------------------------------------------------------------- -const unsigned int M_NOP_FLAG = 1 << 0; -const unsigned int M_BRANCH_FLAG = 1 << 1; -const unsigned int M_CALL_FLAG = 1 << 2; -const unsigned int M_RET_FLAG = 1 << 3; -const unsigned int M_ARITH_FLAG = 1 << 4; -const unsigned int M_CC_FLAG = 1 << 6; -const unsigned int M_LOGICAL_FLAG = 1 << 6; -const unsigned int M_INT_FLAG = 1 << 7; -const unsigned int M_FLOAT_FLAG = 1 << 8; -const unsigned int M_CONDL_FLAG = 1 << 9; -const unsigned int M_LOAD_FLAG = 1 << 10; -const unsigned int M_PREFETCH_FLAG = 1 << 11; -const unsigned int M_STORE_FLAG = 1 << 12; -const unsigned int M_DUMMY_PHI_FLAG = 1 << 13; -const unsigned int M_PSEUDO_FLAG = 1 << 14; +const unsigned M_NOP_FLAG = 1 << 0; +const unsigned M_BRANCH_FLAG = 1 << 1; +const unsigned M_CALL_FLAG = 1 << 2; +const unsigned M_RET_FLAG = 1 << 3; +const unsigned M_ARITH_FLAG = 1 << 4; +const unsigned M_CC_FLAG = 1 << 6; +const unsigned M_LOGICAL_FLAG = 1 << 6; +const unsigned M_INT_FLAG = 1 << 7; +const unsigned M_FLOAT_FLAG = 1 << 8; +const unsigned M_CONDL_FLAG = 1 << 9; +const unsigned M_LOAD_FLAG = 1 << 10; +const unsigned M_PREFETCH_FLAG = 1 << 11; +const unsigned M_STORE_FLAG = 1 << 12; +const unsigned M_DUMMY_PHI_FLAG = 1 << 13; +const unsigned M_PSEUDO_FLAG = 1 << 14; struct MachineInstrDescriptor { - std::string opCodeString; // Assembly language mnemonic for the opcode. - int numOperands; // Number of args; -1 if variable #args - int resultPos; // Position of the result; -1 if no result - unsigned int maxImmedConst; // Largest +ve constant in IMMMED field or 0. + const char * opCodeString; // Assembly language mnemonic for the opcode. + int numOperands; // Number of args; -1 if variable #args + int resultPos; // Position of the result; -1 if no result + unsigned maxImmedConst; // Largest +ve constant in IMMMED field or 0. bool immedIsSignExtended; // Is IMMED field sign-extended? If so, // smallest -ve value is -(maxImmedConst+1). - unsigned int numDelaySlots; // Number of delay slots after instruction - unsigned int latency; // Latency in machine cycles + unsigned numDelaySlots; // Number of delay slots after instruction + unsigned latency; // Latency in machine cycles InstrSchedClass schedClass; // enum identifying instr sched class - unsigned int iclass; // flags identifying machine instr class + unsigned iclass; // flags identifying machine instr class }; @@ -89,8 +89,8 @@ protected: const MachineInstrDescriptor* desc; // raw array to allow static init'n - unsigned int descSize; // number of entries in the desc array - unsigned int numRealOpCodes; // number of non-dummy op codes + unsigned descSize; // number of entries in the desc array + unsigned numRealOpCodes; // number of non-dummy op codes public: MachineInstrInfo(const TargetMachine& tgt, @@ -126,7 +126,7 @@ // Query instruction class flags according to the machine-independent // flags listed above. // - unsigned int getIClass(MachineOpCode opCode) const { + unsigned getIClass(MachineOpCode opCode) const { return getDescriptor(opCode).iclass; } bool isNop(MachineOpCode opCode) const { @@ -332,7 +332,7 @@ Function* F, Value* srcVal, Value* destVal, - unsigned int numLowBits, + unsigned numLowBits, std::vector& mvec, MachineCodeForInstruction& mcfi) const=0; @@ -346,7 +346,7 @@ Function* F, Value* srcVal, Value* destVal, - unsigned int srcSizeInBits, + unsigned srcSizeInBits, std::vector& mvec, MachineCodeForInstruction& mcfi) const=0; };
Test NameCBE Compiles?CBE Links?CBE Diff MatchLLI Diff MatchNotes
BurgXXO
BurgXXOBytecode problem
FhourstonesXXOSeg Fault
Olden-bhXXX
Olden-bisortXXX
Olden-em3dXXXX
Olden-healthXXOX
Olden-healthXXOO
Olden-mstXXX
Olden-perimeterXXX
Olden-powerXXOpercision error