From lattner at cs.uiuc.edu Mon Aug 11 09:57:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 09:57:01 2003 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200308111456.JAA04440@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h added (r1.1) --- Log message: Initial checkin of SelectionDAG header file --- Diffs of the changes: Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -c /dev/null llvm/include/llvm/CodeGen/SelectionDAG.h:1.1 *** /dev/null Mon Aug 11 09:56:36 2003 --- llvm/include/llvm/CodeGen/SelectionDAG.h Mon Aug 11 09:56:26 2003 *************** *** 0 **** --- 1,334 ---- + //===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG Rep. ----*- C++ -*-===// + // + // This file declares the SelectionDAG class, which is used to represent an LLVM + // function in a low-level representation suitable for instruction selection. + // This DAG is constructed as the first step of instruction selection in order + // to allow implementation of machine specific optimizations and code + // simplifications. + // + // The representation used by the SelectionDAG is a target-independent + // representation, which is loosly modeled after the GCC RTL representation, but + // is significantly simpler. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_CODEGEN_SELECTIONDAG_H + #define LLVM_CODEGEN_SELECTIONDAG_H + + #include "llvm/CodeGen/ValueTypes.h" + #include "Support/DataTypes.h" + #include + #include + class Value; + class Type; + class Instruction; + class BasicBlock; + class MachineBasicBlock; + class MachineFunction; + class TargetMachine; + class SelectionDAGNode; + class SelectionDAGBlock; + class SelectionDAGBuilder; + class SelectionDAGTargetBuilder; + + /// ISD namespace - This namespace contains an enum which represents all of the + /// SelectionDAG node types and value types. + /// + namespace ISD { + enum NodeType { + // ChainNode nodes are used to sequence operations within a basic block + // which cannot be reordered (such as loads, stores, calls, etc). + // BlockChainNodes are used to connect the DAG's for different basic blocks + // into one big DAG. + ChainNode, BlockChainNode, + + // ProtoNodes are nodes that are only half way constructed. + ProtoNode, + + // Leaf nodes. + Constant, FrameIndex, + + // Simple binary arithmetic operators + Plus, Minus, Times, SDiv, UDiv, SRem, URem, + + // Bitwise operators + And, Or, Xor, + + // Control flow instructions + Br, Switch, Ret, RetVoid, + + // Other operators + Load, Store, PHI, Call, + }; + } + + class SelectionDAG { + friend class SelectionDAGBuilder; + MachineFunction &F; + const TargetMachine &TM; + MVT::ValueType PointerType; // The ValueType the target uses for pointers + + // ValueMap - The SelectionDAGNode for each LLVM value in the function. + std::map ValueMap; + + // BlockMap - The MachineBasicBlock created for each LLVM BasicBlock + std::map BlockMap; + + // Root - The root of the entire DAG + SelectionDAGNode *Root; + + // AllNodes - All of the nodes in the DAG + std::vector AllNodes; + public: + /// SelectionDAG constructor - Build a SelectionDAG for the specified + /// function. Implemented in DAGBuilder.cpp + /// + SelectionDAG(MachineFunction &F, const TargetMachine &TM, + SelectionDAGTargetBuilder &SDTB); + ~SelectionDAG(); + + /// getValueType - Return the ValueType for the specified LLVM type. This + /// method works on all scalar LLVM types. + /// + MVT::ValueType getValueType(const Type *Ty) const; + + /// getRoot - Return the root of the current SelectionDAG. + /// + SelectionDAGNode *getRoot() const { return Root; } + + /// getMachineFunction - Return the MachineFunction object that this + /// SelectionDAG corresponds to. + /// + MachineFunction &getMachineFunction() const { return F; } + + //===--------------------------------------------------------------------===// + // Addition and updating methods + // + + /// addNode - Add the specified node to the SelectionDAG so that it will be + /// deleted when the DAG is... + /// + SelectionDAGNode *addNode(SelectionDAGNode *N) { + AllNodes.push_back(N); + return N; + } + + /// addNodeForValue - Add the specified node to the SelectionDAG so that it + /// will be deleted when the DAG is... and update the value map to indicate + /// that the specified DAG node computes the value. Note that it is an error + /// to specify multiple DAG nodes that compute the same value. + /// + SelectionDAGNode *addNodeForValue(SelectionDAGNode *N, const Value *V) { + assert(ValueMap.count(V) == 0 && "Value already has a DAG node!"); + return addNode(ValueMap[V] = N); + } + + void dump() const; + private: + void addInstructionToDAG(const Instruction &I, const BasicBlock &BB); + }; + + + /// SelectionDAGReducedValue - During the reducer pass we need the ability to + /// add an arbitrary (but usually 1 or 0) number of arbitrarily sized values to + /// the selection DAG. Because of this, we represent these values as a singly + /// linked list of values attached to the DAGNode. We end up putting the + /// arbitrary state for the value in subclasses of this node. + /// + /// Note that this class does not have a virtual dtor, this is because we know + /// that the subclasses will not hold state that needs to be destroyed. + /// + class SelectionDAGReducedValue { + unsigned Code; + SelectionDAGReducedValue *Next; + public: + SelectionDAGReducedValue(unsigned C) : Code(C), Next(0) {} + + /// getValueCode - Return the code for this reducer value... + /// + unsigned getValueCode() const { return Code; } + + /// getNext - Return the next value in the list + /// + const SelectionDAGReducedValue *getNext() const { return Next; } + void setNext(SelectionDAGReducedValue *N) { Next = N; } + + SelectionDAGReducedValue *getNext() { return Next; } + }; + + + + /// SelectionDAGNode - Represents one node in the selection DAG. + /// + class SelectionDAGNode { + std::vector Uses; + ISD::NodeType NodeType; + MVT::ValueType ValueType; + MachineBasicBlock *BB; + SelectionDAGReducedValue *ValList; + + /// Costs - Each pair of elements of 'Costs' contains the cost of producing + /// the value with the target specific slot number and the production number + /// to use to produce it. A zero value for the production number indicates + /// that the cost has not yet been computed. + unsigned *Costs; + public: + SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, + MachineBasicBlock *bb = 0) + : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) {} + + SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, MachineBasicBlock *bb, + SelectionDAGNode *N) + : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) { + assert(NT != ISD::ProtoNode && "Cannot specify uses for a protonode!"); + Uses.reserve(1); Uses.push_back(N); + } + SelectionDAGNode(ISD::NodeType NT, MVT::ValueType VT, MachineBasicBlock *bb, + SelectionDAGNode *N1, SelectionDAGNode *N2) + : NodeType(NT), ValueType(VT), BB(bb), ValList(0), Costs(0) { + assert(NT != ISD::ProtoNode && "Cannot specify uses for a protonode!"); + Uses.reserve(2); Uses.push_back(N1); Uses.push_back(N2); + } + + ~SelectionDAGNode() { delete [] Costs; delete ValList; } + + void setNode(ISD::NodeType NT, MachineBasicBlock *bb) { + assert(NodeType == ISD::ProtoNode && NT != ISD::ProtoNode); + NodeType = NT; BB = bb; + } + void setNode(ISD::NodeType NT, MachineBasicBlock *bb, SelectionDAGNode *N) { + assert(NodeType == ISD::ProtoNode && NT != ISD::ProtoNode); + NodeType = NT; BB = bb; Uses.reserve(1); Uses.push_back(N); + } + void setNode(ISD::NodeType NT, MachineBasicBlock *bb, + SelectionDAGNode *N1, SelectionDAGNode *N2) { + assert(NodeType == ISD::ProtoNode && NT != ISD::ProtoNode); + NodeType = NT; BB = bb; + Uses.reserve(1); Uses.push_back(N1); Uses.push_back(N2); + } + + //===--------------------------------------------------------------------===// + // Accessors + // + ISD::NodeType getNodeType() const { return NodeType; } + MVT::ValueType getValueType() const { return ValueType; } + MachineBasicBlock *getBB() const { return BB; } + + SelectionDAGNode *getUse(unsigned Num) { + assert(Num < Uses.size() && "Invalid child # of SelectionDAGNode!"); + return Uses[Num]; + } + + template + Type *getValue(unsigned Code) const { + SelectionDAGReducedValue *Vals = ValList; + while (1) { + assert(Vals && "Code does not exist in this list!"); + if (Vals->getValueCode() == Code) + return (Type*)Vals; + Vals = Vals->getNext(); + } + } + + template + Type *hasValue(unsigned Code) const { + SelectionDAGReducedValue *Vals = ValList; + while (Vals) { + if (Vals->getValueCode() == Code) + return (Type*)Vals; + Vals = Vals->getNext(); + } + return false; + } + + void addValue(SelectionDAGReducedValue *New) { + assert(New->getNext() == 0); + New->setNext(ValList); + ValList = New; + } + + //===--------------------------------------------------------------------===// + // Utility methods used by the pattern matching instruction selector + // + + /// getPatternFor - Return the pattern selected to compute the specified slot, + /// or zero if there is no pattern yet. + /// + unsigned getPatternFor(unsigned Slot) const { + return Costs ? Costs[Slot*2] : 0; + } + + /// getCostFor - Return the cost to compute the value corresponding to Slot. + /// + unsigned getCostFor(unsigned Slot) const { + return Costs ? Costs[Slot*2+1] : 0; + } + + /// setPatternCostFor - Sets the pattern and the cost for the specified slot + /// to the specified values. This allocates the Costs vector if necessary, so + /// you must specify the maximum number of slots that may be used. + /// + void setPatternCostFor(unsigned Slot, unsigned Pattern, unsigned Cost, + unsigned NumSlots) { + if (Costs == 0) { + Costs = new unsigned[NumSlots*2]; + for (unsigned i = 0; i != NumSlots*2; ++i) Costs[i] = 0; + } + Costs[Slot*2] = Pattern; + Costs[Slot*2+1] = Cost; + } + + void dump() const; + private: + void printit(unsigned Offset, unsigned &LastID, + std::map &NodeIDs) const; + }; + + + /// SelectionDAGTargetBuilder - This class must be implemented by the target, to + /// indicate how to perform the extremely target-specific tasks of building DAG + /// nodes to represent the calling convention used by the target. + /// + struct SelectionDAGTargetBuilder { + /// expandArguments - This method is called once by the SelectionDAG + /// construction mechanisms to add DAG nodes for each formal argument to the + /// current function. If any of the incoming arguments lives on the stack, + /// this method should also create the stack slots for the arguments as + /// necessary. + virtual void expandArguments(SelectionDAG &SD, MachineFunction &MF) = 0; + }; + + namespace ISD { + enum { // Builtin Slot numbers + Constant_i1_Slot, + Constant_i8_Slot, + Constant_i16_Slot, + Constant_i32_Slot, + Constant_i64_Slot, + Constant_f32_Slot, + Constant_f64_Slot, + + FrameIndex_i32_Slot, + FrameIndex_i64_Slot, + NumBuiltinSlots + }; + } + + template + struct ReducedValue : public SelectionDAGReducedValue { + ReducedValue(const ValType &V) : SelectionDAGReducedValue(NodeCode), Val(V) {} + ValType Val; + }; + + typedef ReducedValue ReducedValue_FrameIndex_i32; + typedef ReducedValue ReducedValue_FrameIndex_i64; + + typedef ReducedValue ReducedValue_Constant_i1; + typedef ReducedValue ReducedValue_Constant_i8; + typedef ReducedValue ReducedValue_Constant_i16; + typedef ReducedValue ReducedValue_Constant_i32; + typedef ReducedValue ReducedValue_Constant_i64; + typedef ReducedValue ReducedValue_Constant_f32; + typedef ReducedValue ReducedValue_Constant_f64; + + #endif From lattner at cs.uiuc.edu Mon Aug 11 09:57:07 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 09:57:07 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Selection/ Message-ID: <200308111456.JAA04414@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/Selection: --- Log message: Directory /home/vadve/vadve/Research/DynOpt/CVSRepository/llvm/lib/CodeGen/Selection added to the repository --- Diffs of the changes: From lattner at cs.uiuc.edu Mon Aug 11 09:58:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 09:58:01 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Makefile Message-ID: <200308111457.JAA04517@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: Makefile updated: 1.10 -> 1.11 --- Log message: Build the SelectionDAG library --- Diffs of the changes: Index: llvm/lib/CodeGen/Makefile diff -u llvm/lib/CodeGen/Makefile:1.10 llvm/lib/CodeGen/Makefile:1.11 --- llvm/lib/CodeGen/Makefile:1.10 Fri Oct 25 17:54:41 2002 +++ llvm/lib/CodeGen/Makefile Mon Aug 11 09:57:48 2003 @@ -1,5 +1,5 @@ LEVEL = ../.. -PARALLEL_DIRS = PreOpts InstrSelection InstrSched RegAlloc PostOpts Mapping +PARALLEL_DIRS = PreOpts InstrSelection InstrSched RegAlloc PostOpts Mapping Selection LIBRARYNAME = codegen include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Mon Aug 11 09:58:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 09:58:02 2003 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/Selection/DAGBuilder.cpp Makefile SelectionDAG.cpp Message-ID: <200308111457.JAA04496@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/Selection: DAGBuilder.cpp added (r1.1) Makefile added (r1.1) SelectionDAG.cpp added (r1.1) --- Log message: Initial checkin of SelectionDAG implementation. This is still rough and unfinished --- Diffs of the changes: Index: llvm/lib/CodeGen/Selection/DAGBuilder.cpp diff -c /dev/null llvm/lib/CodeGen/Selection/DAGBuilder.cpp:1.1 *** /dev/null Mon Aug 11 09:57:43 2003 --- llvm/lib/CodeGen/Selection/DAGBuilder.cpp Mon Aug 11 09:57:33 2003 *************** *** 0 **** --- 1,222 ---- + //===-- DAGBuilder.cpp - Turn an LLVM BasicBlock into a DAG for selection -===// + // + // This file turns an LLVM BasicBlock into a target independent SelectionDAG in + // preparation for target specific optimizations and instruction selection. + // + //===----------------------------------------------------------------------===// + + #include "llvm/CodeGen/SelectionDAG.h" + #include "llvm/Function.h" + #include "llvm/Instructions.h" + #include "llvm/Support/InstVisitor.h" + #include "llvm/CodeGen/MachineFunction.h" + #include "llvm/Target/TargetMachine.h" + #include "llvm/Type.h" + #include "llvm/Constants.h" + + struct SelectionDAGBuilder : public InstVisitor { + // DAG - the current dag we are building. + SelectionDAG &DAG; + + // BB - The current machine basic block we are working on. + MachineBasicBlock *BB; + + // CurRoot - The root built for the current basic block. + SelectionDAGNode *CurRoot; + + SelectionDAGBuilder(SelectionDAG &dag) : DAG(dag), BB(0), CurRoot(0) {} + + void visitBB(BasicBlock &bb); + + // Visitation methods for instructions: Create the appropriate DAG nodes for + // the instruction. + void visitAdd(BinaryOperator &BO); + void visitSub(BinaryOperator &BO); + void visitMul(BinaryOperator &BO); + void visitRet(ReturnInst &RI); + + void visitAnd(BinaryOperator &BO); + void visitOr (BinaryOperator &BO); + void visitXor(BinaryOperator &BO); + + void visitInstruction(Instruction &I) { + std::cerr << "Instruction Selection cannot select: " << I; + abort(); + } + + private: + SelectionDAGNode *getNodeFor(Value *V); + SelectionDAGNode *getNodeFor(Value &V) { return getNodeFor(&V); } + + SelectionDAGNode *addSeqNode(SelectionDAGNode *N); + }; + + /// addSeqNode - The same as addNode, but the node is also included in the + /// sequence nodes for this block. This method should be called for any + /// instructions which have a specified sequence they must be evaluated in. + /// + SelectionDAGNode *SelectionDAGBuilder::addSeqNode(SelectionDAGNode *N) { + DAG.addNode(N); // First, add the node to the selection DAG + + if (!CurRoot) + CurRoot = N; + else { + // Create and add a new chain node for the existing root and this node... + CurRoot = DAG.addNode(new SelectionDAGNode(ISD::ChainNode, MVT::isVoid, + BB, CurRoot, N)); + } + return N; + } + + /// getNodeFor - This method returns the SelectionDAGNode for the specified LLVM + /// value, creating a node as necessary. + /// + SelectionDAGNode *SelectionDAGBuilder::getNodeFor(Value *V) { + // If we already have the entry, return it. + SelectionDAGNode*& Entry = DAG.ValueMap[V]; + if (Entry) return Entry; + + // Otherwise, we need to create a node to return now... start by figuring out + // which type the node will be... + MVT::ValueType ValueType = DAG.getValueType(V->getType()); + + if (Instruction *I = dyn_cast(V)) + // Instructions will be filled in later. For now, just create and return a + // dummy node. + return Entry = new SelectionDAGNode(ISD::ProtoNode, ValueType); + + if (Constant *C = dyn_cast(V)) { + if (ConstantBool *CB = dyn_cast(C)) { + Entry = new SelectionDAGNode(ISD::Constant, ValueType); + Entry->addValue(new ReducedValue_Constant_i1(CB->getValue())); + } else if (ConstantInt *CI = dyn_cast(C)) { + Entry = new SelectionDAGNode(ISD::Constant, ValueType); + switch (ValueType) { + case MVT::i8: + Entry->addValue(new ReducedValue_Constant_i8(CI->getRawValue())); + break; + case MVT::i16: + Entry->addValue(new ReducedValue_Constant_i16(CI->getRawValue())); + break; + case MVT::i32: + Entry->addValue(new ReducedValue_Constant_i32(CI->getRawValue())); + break; + case MVT::i64: + Entry->addValue(new ReducedValue_Constant_i64(CI->getRawValue())); + break; + default: + assert(0 && "Invalid ValueType for an integer constant!"); + } + + } else if (ConstantFP *CFP = dyn_cast(C)) { + Entry = new SelectionDAGNode(ISD::Constant, ValueType); + if (ValueType == MVT::f32) + Entry->addValue(new ReducedValue_Constant_f32(CFP->getValue())); + else + Entry->addValue(new ReducedValue_Constant_f64(CFP->getValue())); + } + if (Entry) return Entry; + } + + std::cerr << "Unhandled LLVM value in DAG Builder!: " << *V << "\n"; + abort(); + return 0; + } + + + // visitBB - This method is used to visit a basic block in the program. It + // manages the CurRoot instance variable so that all of the visit(Instruction) + // methods can be written to assume that there is only one basic block being + // constructed. + // + void SelectionDAGBuilder::visitBB(BasicBlock &bb) { + BB = DAG.BlockMap[&bb]; // Update BB instance var + + // Save the current global DAG... + SelectionDAGNode *OldRoot = CurRoot; + CurRoot = 0; + + visit(bb.begin(), bb.end()); // Visit all of the instructions... + + if (OldRoot) { + if (!CurRoot) + CurRoot = OldRoot; // This block had no root of its own.. + else { + // The previous basic block AND this basic block had roots, insert a + // block chain node now... + CurRoot = DAG.addNode(new SelectionDAGNode(ISD::BlockChainNode, + MVT::isVoid, + BB, OldRoot, CurRoot)); + } + } + } + + //===----------------------------------------------------------------------===// + // ...Visitation Methods... + //===----------------------------------------------------------------------===// + + void SelectionDAGBuilder::visitAdd(BinaryOperator &BO) { + getNodeFor(BO)->setNode(ISD::Plus, BB, getNodeFor(BO.getOperand(0)), + getNodeFor(BO.getOperand(1))); + } + void SelectionDAGBuilder::visitSub(BinaryOperator &BO) { + getNodeFor(BO)->setNode(ISD::Minus, BB, getNodeFor(BO.getOperand(0)), + getNodeFor(BO.getOperand(1))); + } + void SelectionDAGBuilder::visitMul(BinaryOperator &BO) { + getNodeFor(BO)->setNode(ISD::Times, BB, getNodeFor(BO.getOperand(0)), + getNodeFor(BO.getOperand(1))); + } + + void SelectionDAGBuilder::visitAnd(BinaryOperator &BO) { + getNodeFor(BO)->setNode(ISD::And, BB, getNodeFor(BO.getOperand(0)), + getNodeFor(BO.getOperand(1))); + } + void SelectionDAGBuilder::visitOr(BinaryOperator &BO) { + getNodeFor(BO)->setNode(ISD::Or, BB, getNodeFor(BO.getOperand(0)), + getNodeFor(BO.getOperand(1))); + } + void SelectionDAGBuilder::visitXor(BinaryOperator &BO) { + getNodeFor(BO)->setNode(ISD::Xor, BB, getNodeFor(BO.getOperand(0)), + getNodeFor(BO.getOperand(1))); + } + + void SelectionDAGBuilder::visitRet(ReturnInst &RI) { + if (RI.getNumOperands()) { // Value return + addSeqNode(new SelectionDAGNode(ISD::Ret, MVT::isVoid, BB, + getNodeFor(RI.getOperand(0)))); + } else { // Void return + addSeqNode(new SelectionDAGNode(ISD::RetVoid, MVT::isVoid, BB)); + } + } + + + + + // SelectionDAG constructor - Just use the SeelectionDAGBuilder to do all of the + // dirty work... + SelectionDAG::SelectionDAG(MachineFunction &f, const TargetMachine &tm, + SelectionDAGTargetBuilder &SDTB) + : F(f), TM(tm) { + + switch (TM.getTargetData().getPointerSize()) { + default: assert(0 && "Unknown pointer size!"); abort(); + case 8: PointerType = MVT::i8; break; + case 16: PointerType = MVT::i16; break; + case 32: PointerType = MVT::i32; break; + case 64: PointerType = MVT::i64; break; + } + + // Create all of the machine basic blocks for the function... building the + // BlockMap. This map is used for PHI node conversion. + const Function &Fn = *F.getFunction(); + for (Function::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) + F.getBasicBlockList().push_back(BlockMap[I] = new MachineBasicBlock(I)); + + SDTB.expandArguments(*this, f); + + SelectionDAGBuilder SDB(*this); + for (Function::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) + SDB.visitBB(const_cast(*I)); + Root = SDB.CurRoot; + } Index: llvm/lib/CodeGen/Selection/Makefile diff -c /dev/null llvm/lib/CodeGen/Selection/Makefile:1.1 *** /dev/null Mon Aug 11 09:57:43 2003 --- llvm/lib/CodeGen/Selection/Makefile Mon Aug 11 09:57:33 2003 *************** *** 0 **** --- 1,5 ---- + LEVEL = ../../.. + PARALLEL_DIRS = + LIBRARYNAME = selection + + include $(LEVEL)/Makefile.common Index: llvm/lib/CodeGen/Selection/SelectionDAG.cpp diff -c /dev/null llvm/lib/CodeGen/Selection/SelectionDAG.cpp:1.1 *** /dev/null Mon Aug 11 09:57:43 2003 --- llvm/lib/CodeGen/Selection/SelectionDAG.cpp Mon Aug 11 09:57:33 2003 *************** *** 0 **** --- 1,105 ---- + //===-- SelectionDAG.cpp - Implement the SelectionDAG* classes ------------===// + // + // This file implements the SelectionDAG* classes, which are used to perform + // DAG-based instruction selection in a target-specific manner. + // + //===----------------------------------------------------------------------===// + + #include "llvm/CodeGen/SelectionDAG.h" + #include "llvm/Type.h" + + SelectionDAG::~SelectionDAG() { + for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) + delete AllNodes[i]; + } + + + /// dump - Print out the current Selection DAG... + void SelectionDAG::dump() const { + Root->dump(); // Print from the root... + } + + /// getValueType - Return the ValueType for the specified LLVM type. This + /// method works on all scalar LLVM types. + /// + MVT::ValueType SelectionDAG::getValueType(const Type *Ty) const { + switch (Ty->getPrimitiveID()) { + case Type::VoidTyID: assert(0 && "Void type object in getValueType!"); + default: assert(0 && "Unknown type in DAGBuilder!\n"); + case Type::BoolTyID: return MVT::i1; + case Type::SByteTyID: + case Type::UByteTyID: return MVT::i8; + case Type::ShortTyID: + case Type::UShortTyID: return MVT::i16; + case Type::IntTyID: + case Type::UIntTyID: return MVT::i32; + case Type::LongTyID: + case Type::ULongTyID: return MVT::i64; + case Type::FloatTyID: return MVT::f32; + case Type::DoubleTyID: return MVT::f64; + case Type::PointerTyID: return PointerType; + } + } + + void SelectionDAGNode::dump() const { + // Print out the DAG in post-order + std::map NodeIDs; + unsigned ID = 0; + printit(0, ID, NodeIDs); + } + + void SelectionDAGNode::printit(unsigned Offset, unsigned &LastID, + std::map &NodeIDs) const { + if (!NodeIDs.count(this)) { + // Emit all of the uses first... + for (unsigned i = 0, e = Uses.size(); i != e; ++i) + Uses[i]->printit(Offset+1, LastID, NodeIDs); + + NodeIDs[this] = LastID++; + + std::cerr << std::string(Offset, ' ') << "#" << LastID-1 << " "; + } else { + // Node has already been emitted... + std::cerr << std::string(Offset, ' ') << "#" << NodeIDs[this] << " "; + } + + switch (ValueType) { + case MVT::isVoid: std::cerr << "V:"; break; + case MVT::i1: std::cerr << "i1:"; break; + case MVT::i8: std::cerr << "i8:"; break; + case MVT::i16: std::cerr << "i16:"; break; + case MVT::i32: std::cerr << "i32:"; break; + case MVT::i64: std::cerr << "i64:"; break; + case MVT::f32: std::cerr << "f32:"; break; + case MVT::f64: std::cerr << "f64:"; break; + default: assert(0 && "Invalid node ValueType!"); + } + switch (NodeType) { + case ISD::ChainNode: std::cerr << "ChainNode"; break; + case ISD::BlockChainNode: std::cerr << "BlockChainNode"; break; + case ISD::ProtoNode: std::cerr << "ProtoNode"; break; + case ISD::Constant: std::cerr << "Constant"; break; + case ISD::FrameIndex: std::cerr << "FrameIndex"; break; + case ISD::Plus: std::cerr << "Plus"; break; + case ISD::Minus: std::cerr << "Minus"; break; + case ISD::Times: std::cerr << "Times"; break; + case ISD::SDiv: std::cerr << "SDiv"; break; + case ISD::UDiv: std::cerr << "UDiv"; break; + case ISD::SRem: std::cerr << "SRem"; break; + case ISD::URem: std::cerr << "URem"; break; + case ISD::And: std::cerr << "And"; break; + case ISD::Or: std::cerr << "Or"; break; + case ISD::Xor: std::cerr << "Xor"; break; + case ISD::Br: std::cerr << "Br"; break; + case ISD::Switch: std::cerr << "Switch"; break; + case ISD::Ret: std::cerr << "Ret"; break; + case ISD::RetVoid: std::cerr << "RetVoid"; break; + case ISD::Load: std::cerr << "Load"; break; + case ISD::Store: std::cerr << "Store"; break; + case ISD::PHI: std::cerr << "PHI"; break; + case ISD::Call: std::cerr << "Call"; break; + } + + std::cerr << "\n"; + } From lattner at cs.uiuc.edu Mon Aug 11 10:00:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:00:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/InstSelectPattern.cpp Makefile X86.h X86TargetMachine.cpp Message-ID: <200308111459.JAA04562@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: InstSelectPattern.cpp added (r1.1) Makefile updated: 1.3 -> 1.4 X86.h updated: 1.17 -> 1.18 X86TargetMachine.cpp updated: 1.21 -> 1.22 --- Log message: Add support for a pattern matching instruction selector. This is still in the early implementation phases, so it is disabled by default --- Diffs of the changes: Index: llvm/lib/Target/X86/InstSelectPattern.cpp diff -c /dev/null llvm/lib/Target/X86/InstSelectPattern.cpp:1.1 *** /dev/null Mon Aug 11 09:59:32 2003 --- llvm/lib/Target/X86/InstSelectPattern.cpp Mon Aug 11 09:59:22 2003 *************** *** 0 **** --- 1,117 ---- + //===-- InstSelectPattern.cpp - A pattern matching inst selector for X86 --===// + // + // This file defines a pattern matching instruction selector for X86. + // + // FIXME: we could allocate one big array of unsigneds to use as the backing + // store for all of the nodes costs arrays. + // + //===----------------------------------------------------------------------===// + + #include "X86.h" + #include "llvm/Pass.h" + #include "llvm/Function.h" + #include "llvm/DerivedTypes.h" + #include "llvm/CodeGen/SelectionDAG.h" + #include "llvm/CodeGen/MachineFunction.h" + #include "llvm/CodeGen/MachineFrameInfo.h" + #include "llvm/CodeGen/SSARegMap.h" + + #include "X86RegisterInfo.h" + + // Include the generated instruction selector... + #include "X86GenInstrSelector.inc" + + + //===----------------------------------------------------------------------===// + // User code + // + + + namespace { + struct ISel : public FunctionPass, SelectionDAGTargetBuilder { + TargetMachine &TM; + ISel(TargetMachine &tm) : TM(tm) {} + int VarArgsFrameIndex; // FrameIndex for start of varargs area + + bool runOnFunction(Function &Fn) { + MachineFunction &MF = MachineFunction::construct(&Fn, TM); + SelectionDAG DAG(MF, TM, *this); + + std::cerr << "\n\n\n=== " + << DAG.getMachineFunction().getFunction()->getName() << "\n"; + + DAG.dump(); + X86ISel(DAG).generateCode(); + std::cerr << "\n\n\n"; + return true; + } + + public: // Implementation of the SelectionDAGTargetBuilder class... + /// expandArguments - Add nodes to the DAG to indicate how to load arguments + /// off of the X86 stack. + void expandArguments(SelectionDAG &SD, MachineFunction &MF); + }; + } + + + void ISel::expandArguments(SelectionDAG &SD, MachineFunction &F) { + // Add DAG nodes to load the arguments... On entry to a function on the X86, + // the stack frame looks like this: + // + // [ESP] -- return address + // [ESP + 4] -- first argument (leftmost lexically) + // [ESP + 8] -- second argument, if first argument is four bytes in size + // ... + // + unsigned ArgOffset = 0; // Frame mechanisms handle retaddr slot + MachineFrameInfo *MFI = F.getFrameInfo(); + const Function &Fn = *F.getFunction(); + + for (Function::const_aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) { + MVT::ValueType ObjectVT = SD.getValueType(I->getType()); + unsigned ArgIncrement = 4; + unsigned ObjSize; + switch (ObjectVT) { + default: assert(0 && "Unhandled argument type!"); + case MVT::i8: ObjSize = 1; break; + case MVT::i16: ObjSize = 2; break; + case MVT::i32: ObjSize = 4; break; + case MVT::i64: ObjSize = ArgIncrement = 8; break; + case MVT::f32: ObjSize = 4; break; + case MVT::f64: ObjSize = ArgIncrement = 8; break; + } + // Create the frame index object for this incoming parameter... + int FI = MFI->CreateFixedObject(ObjSize, ArgOffset); + + // Create the SelectionDAG nodes corresponding to a load from this parameter + // FIXME: + SelectionDAGNode *FIN = new SelectionDAGNode(ISD::FrameIndex, MVT::i32); + FIN->addValue(new ReducedValue_FrameIndex_i32(FI)); + + SelectionDAGNode *Arg + = new SelectionDAGNode(ISD::Load, ObjectVT, F.begin(), FIN); + + // Add the SelectionDAGNodes to the SelectionDAG... note that there is no + // reason to add chain nodes here. We know that no loads ore stores will + // ever alias these loads, so we are free to perform the load at any time in + // the function + SD.addNode(FIN); + SD.addNodeForValue(Arg, I); + + ArgOffset += ArgIncrement; // Move on to the next argument... + } + + // If the function takes variable number of arguments, make a frame index for + // the start of the first vararg value... for expansion of llvm.va_start. + if (Fn.getFunctionType()->isVarArg()) + VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset); + } + + + /// createX86PatternInstructionSelector - This pass converts an LLVM function + /// into a machine code representation using pattern matching and a machine + /// description file. + /// + Pass *createX86PatternInstructionSelector(TargetMachine &TM) { + return new ISel(TM); + } Index: llvm/lib/Target/X86/Makefile diff -u llvm/lib/Target/X86/Makefile:1.3 llvm/lib/Target/X86/Makefile:1.4 --- llvm/lib/Target/X86/Makefile:1.3 Sun Aug 3 16:54:59 2003 +++ llvm/lib/Target/X86/Makefile Mon Aug 11 09:59:22 2003 @@ -5,22 +5,25 @@ # Make sure that tblgen is run, first thing. $(SourceDepend): X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \ X86GenRegisterInfo.inc X86GenInstrNames.inc \ - X86GenInstrInfo.inc + X86GenInstrInfo.inc X86GenInstrSelector.inc -X86GenRegisterNames.inc: X86.td X86RegisterInfo.td $(TBLGEN) - $(TBLGEN) X86.td -gen-register-enums -o $@ +X86GenRegisterNames.inc: X86.td X86RegisterInfo.td ../Target.td $(TBLGEN) + $(TBLGEN) $< -gen-register-enums -o $@ -X86GenRegisterInfo.h.inc: X86.td X86RegisterInfo.td $(TBLGEN) - $(TBLGEN) X86.td -gen-register-desc-header -o $@ +X86GenRegisterInfo.h.inc: X86.td X86RegisterInfo.td ../Target.td $(TBLGEN) + $(TBLGEN) $< -gen-register-desc-header -o $@ -X86GenRegisterInfo.inc: X86.td X86RegisterInfo.td $(TBLGEN) - $(TBLGEN) X86.td -gen-register-desc -o $@ +X86GenRegisterInfo.inc: X86.td X86RegisterInfo.td ../Target.td $(TBLGEN) + $(TBLGEN) $< -gen-register-desc -o $@ -X86GenInstrNames.inc: X86.td X86InstrInfo.td $(TBLGEN) - $(TBLGEN) X86.td -gen-instr-enums -o $@ +X86GenInstrNames.inc: X86.td X86InstrInfo.td ../Target.td $(TBLGEN) + $(TBLGEN) $< -gen-instr-enums -o $@ -X86GenInstrInfo.inc: X86.td X86InstrInfo.td $(TBLGEN) - $(TBLGEN) X86.td -gen-instr-desc -o $@ +X86GenInstrInfo.inc: X86.td X86InstrInfo.td ../Target.td $(TBLGEN) + $(TBLGEN) $< -gen-instr-desc -o $@ + +X86GenInstrSelector.inc: X86.td X86InstrInfo.td ../Target.td $(TBLGEN) + $(TBLGEN) $< -gen-instr-selector -o $@ clean:: $(VERB) rm -f *.inc Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.17 llvm/lib/Target/X86/X86.h:1.18 --- llvm/lib/Target/X86/X86.h:1.17 Sun Aug 3 16:57:05 2003 +++ llvm/lib/Target/X86/X86.h Mon Aug 11 09:59:22 2003 @@ -18,6 +18,12 @@ /// Pass *createX86SimpleInstructionSelector(TargetMachine &TM); +/// createX86PatternInstructionSelector - This pass converts an LLVM function +/// into a machine code representation using pattern matching and a machine +/// description file. +/// +Pass *createX86PatternInstructionSelector(TargetMachine &TM); + /// createX86PeepholeOptimizer - Create a pass to perform X86 specific peephole /// optimizations. /// Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.21 llvm/lib/Target/X86/X86TargetMachine.cpp:1.22 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.21 Tue Aug 5 11:34:44 2003 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Mon Aug 11 09:59:22 2003 @@ -20,6 +20,8 @@ cl::desc("Use Simple RA instead of Local RegAlloc")); cl::opt PrintCode("print-machineinstrs", cl::desc("Print generated machine code")); + cl::opt NoPatternISel("disable-pattern-isel", cl::init(true), + cl::desc("Use the 'simple' X86 instruction selector")); } // allocateX86TargetMachine - Allocate and return a subclass of TargetMachine @@ -59,7 +61,10 @@ // FIXME: Implement the switch instruction in the instruction selector! PM.add(createLowerSwitchPass()); - PM.add(createX86SimpleInstructionSelector(*this)); + if (NoPatternISel) + PM.add(createX86SimpleInstructionSelector(*this)); + else + PM.add(createX86PatternInstructionSelector(*this)); // TODO: optional optimizations go here From lattner at cs.uiuc.edu Mon Aug 11 10:01:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:01:00 2003 Subject: [llvm-commits] CVS: llvm/tools/lli/Makefile Message-ID: <200308111500.KAA04616@apoc.cs.uiuc.edu> Changes in directory llvm/tools/lli: Makefile updated: 1.34 -> 1.35 --- Log message: Include the new selection library for the X86 target --- Diffs of the changes: Index: llvm/tools/lli/Makefile diff -u llvm/tools/lli/Makefile:1.34 llvm/tools/lli/Makefile:1.35 --- llvm/tools/lli/Makefile:1.34 Mon Jul 28 14:06:19 2003 +++ llvm/tools/lli/Makefile Mon Aug 11 09:59:53 2003 @@ -19,7 +19,7 @@ # What the X86 JIT requires ifdef ENABLE_X86_JIT CPPFLAGS += -DENABLE_X86_JIT - JITLIBS += x86 + JITLIBS += x86 selection # X86 doesn't require any ARCHLIBS endif From lattner at cs.uiuc.edu Mon Aug 11 10:01:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:01:02 2003 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200308111500.KAA04609@apoc.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.37 -> 1.38 --- Log message: Include the new selection library for the X86 target --- Diffs of the changes: Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.37 llvm/tools/llc/Makefile:1.38 --- llvm/tools/llc/Makefile:1.37 Wed Jun 18 16:14:23 2003 +++ llvm/tools/llc/Makefile Mon Aug 11 09:59:51 2003 @@ -3,6 +3,7 @@ USEDLIBS = mapping \ sparc \ x86 \ + selection \ regalloc \ sched \ select \ From lattner at cs.uiuc.edu Mon Aug 11 10:06:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:06:03 2003 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/RaiseAllocations.cpp Message-ID: <200308111505.KAA08298@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: RaiseAllocations.cpp updated: 1.14 -> 1.15 --- Log message: Fix handling of 'free' if it has absolutely no prototype --- Diffs of the changes: Index: llvm/lib/Transforms/Scalar/RaiseAllocations.cpp diff -u llvm/lib/Transforms/Scalar/RaiseAllocations.cpp:1.14 llvm/lib/Transforms/Scalar/RaiseAllocations.cpp:1.15 --- llvm/lib/Transforms/Scalar/RaiseAllocations.cpp:1.14 Tue Oct 1 17:38:41 2002 +++ llvm/lib/Transforms/Scalar/RaiseAllocations.cpp Mon Aug 11 10:05:08 2003 @@ -93,6 +93,13 @@ FreeFunc = M.getFunction("free", FreeType); } + // One last try, check to see if we can find free as 'int (...)* free'. This + // handles the case where NOTHING was declared. + if (FreeFunc == 0) { + FreeType = FunctionType::get(Type::IntTy, std::vector(),true); + FreeFunc = M.getFunction("free", FreeType); + } + // Don't mess with locally defined versions of these functions... if (MallocFunc && !MallocFunc->isExternal()) MallocFunc = 0; From lattner at cs.uiuc.edu Mon Aug 11 10:12:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:12:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Makefile Message-ID: <200308111511.KAA11186@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: Makefile updated: 1.4 -> 1.5 --- Log message: Until the pattern matching instruction selector is finished, enable debug output from it --- Diffs of the changes: Index: llvm/lib/Target/X86/Makefile diff -u llvm/lib/Target/X86/Makefile:1.4 llvm/lib/Target/X86/Makefile:1.5 --- llvm/lib/Target/X86/Makefile:1.4 Mon Aug 11 09:59:22 2003 +++ llvm/lib/Target/X86/Makefile Mon Aug 11 10:11:01 2003 @@ -23,7 +23,7 @@ $(TBLGEN) $< -gen-instr-desc -o $@ X86GenInstrSelector.inc: X86.td X86InstrInfo.td ../Target.td $(TBLGEN) - $(TBLGEN) $< -gen-instr-selector -o $@ + $(TBLGEN) $< -debug -gen-instr-selector -o $@ clean:: $(VERB) rm -f *.inc From brukman at cs.uiuc.edu Mon Aug 11 10:17:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Aug 11 10:17:01 2003 Subject: [llvm-commits] CVS: llvm/utils/TableGen/InstrSelectorEmitter.cpp Message-ID: <200308111516.KAA04927@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: InstrSelectorEmitter.cpp updated: 1.21 -> 1.22 --- Log message: Put printouts of acquired patterns under the DEBUG() guard, fixed spelling. --- Diffs of the changes: Index: llvm/utils/TableGen/InstrSelectorEmitter.cpp diff -u llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.21 llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.22 --- llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.21 Sun Aug 10 18:51:52 2003 +++ llvm/utils/TableGen/InstrSelectorEmitter.cpp Mon Aug 11 10:16:12 2003 @@ -905,11 +905,11 @@ // Clear InstantiatedNTs, we don't need it anymore... InstantiatedNTs.clear(); - std::cerr << "Patterns aquired:\n"; + DEBUG(std::cerr << "Patterns acquired:\n"); for (std::map::iterator I = Patterns.begin(), E = Patterns.end(); I != E; ++I) if (I->second->isResolved()) - std::cerr << " " << *I->second << "\n"; + DEBUG(std::cerr << " " << *I->second << "\n"); CalculateComputableValues(); From lattner at cs.uiuc.edu Mon Aug 11 10:24:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:24:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Target.td Message-ID: <200308111523.KAA16185@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target: Target.td updated: 1.17 -> 1.18 --- Log message: add support for more nodes --- Diffs of the changes: Index: llvm/lib/Target/Target.td diff -u llvm/lib/Target/Target.td:1.17 llvm/lib/Target/Target.td:1.18 --- llvm/lib/Target/Target.td:1.17 Sun Aug 10 14:51:16 2003 +++ llvm/lib/Target/Target.td Mon Aug 11 10:23:05 2003 @@ -184,11 +184,15 @@ // Arithmetic... def plus : BuiltinDagNode; def minus : BuiltinDagNode; -//def mult : DagNode<2, DNVT_arg0>; -//def div : DagNode<2, DNVT_arg0>; -//def udiv : DagNode<2, DNVT_arg0>; -//def mod : DagNode<2, DNVT_arg0>; -//def umod : DagNode<2, DNVT_arg0>; +def times : BuiltinDagNode; +def sdiv : BuiltinDagNode; +def udiv : BuiltinDagNode; +def srem : BuiltinDagNode; +def urem : BuiltinDagNode; +def and : BuiltinDagNode; +def or : BuiltinDagNode; +def xor : BuiltinDagNode; + def load : DagNode; //def store : DagNode<2, DNVT_Void>; From lattner at cs.uiuc.edu Mon Aug 11 10:24:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:24:03 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200308111523.KAA16207@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.6 -> 1.7 --- Log message: Add patterns for multiply, and, or, and xor --- Diffs of the changes: Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.6 llvm/lib/Target/X86/X86InstrInfo.td:1.7 --- llvm/lib/Target/X86/X86InstrInfo.td:1.6 Wed Aug 6 10:31:35 2003 +++ llvm/lib/Target/X86/X86InstrInfo.td Mon Aug 11 10:23:25 2003 @@ -235,30 +235,30 @@ def SBBrr32 : I2A32<"sbb", 0x19, MRMDestReg>; // R32 -= R32+Carry -def IMULr16 : I2A16<"imul", 0xAF, MRMSrcReg>, TB, OpSize; // R16 *= R16 -def IMULr32 : I2A32<"imul", 0xAF, MRMSrcReg>, TB; // R32 *= R32 +def IMULr16 : I2A16<"imul", 0xAF, MRMSrcReg>, TB, OpSize, Pattern<(set R16, (times R16, R16))>; +def IMULr32 : I2A32<"imul", 0xAF, MRMSrcReg>, TB , Pattern<(set R32, (times R32, R32))>; // Logical operators... -def ANDrr8 : I2A8 <"and", 0x20, MRMDestReg>; // R8 &= R8 -def ANDrr16 : I2A16<"and", 0x21, MRMDestReg>, OpSize; // R16 &= R16 -def ANDrr32 : I2A32<"and", 0x21, MRMDestReg>; // R32 &= R32 -def ANDri8 : I2A8 <"and", 0x80, MRMS4r >; // R8 &= imm8 -def ANDri16 : I2A16<"and", 0x81, MRMS4r >, OpSize; // R16 &= imm16 -def ANDri32 : I2A32<"and", 0x81, MRMS4r >; // R32 &= imm32 +def ANDrr8 : I2A8 <"and", 0x20, MRMDestReg>, Pattern<(set R8 , (and R8 , R8 ))>; +def ANDrr16 : I2A16<"and", 0x21, MRMDestReg>, OpSize, Pattern<(set R16, (and R16, R16))>; +def ANDrr32 : I2A32<"and", 0x21, MRMDestReg>, Pattern<(set R32, (and R32, R32))>; +def ANDri8 : I2A8 <"and", 0x80, MRMS4r >, Pattern<(set R8 , (and R8 , imm))>; +def ANDri16 : I2A16<"and", 0x81, MRMS4r >, OpSize, Pattern<(set R16, (and R16, imm))>; +def ANDri32 : I2A32<"and", 0x81, MRMS4r >, Pattern<(set R32, (and R32, imm))>; -def ORrr8 : I2A8 <"or" , 0x08, MRMDestReg>; // R8 |= R8 -def ORrr16 : I2A16<"or" , 0x09, MRMDestReg>, OpSize; // R16 |= R16 -def ORrr32 : I2A32<"or" , 0x09, MRMDestReg>; // R32 |= R32 -def ORri8 : I2A8 <"or" , 0x80, MRMS1r >; // R8 |= imm8 -def ORri16 : I2A16<"or" , 0x81, MRMS1r >, OpSize; // R16 |= imm16 -def ORri32 : I2A32<"or" , 0x81, MRMS1r >; // R32 |= imm32 +def ORrr8 : I2A8 <"or" , 0x08, MRMDestReg>, Pattern<(set R8 , (or R8 , R8 ))>; +def ORrr16 : I2A16<"or" , 0x09, MRMDestReg>, OpSize, Pattern<(set R16, (or R16, R16))>; +def ORrr32 : I2A32<"or" , 0x09, MRMDestReg>, Pattern<(set R32, (or R32, R32))>; +def ORri8 : I2A8 <"or" , 0x80, MRMS1r >, Pattern<(set R8 , (or R8 , imm))>; +def ORri16 : I2A16<"or" , 0x81, MRMS1r >, OpSize, Pattern<(set R16, (or R16, imm))>; +def ORri32 : I2A32<"or" , 0x81, MRMS1r >, Pattern<(set R32, (or R32, imm))>; -def XORrr8 : I2A8 <"xor", 0x30, MRMDestReg>; // R8 ^= R8 -def XORrr16 : I2A16<"xor", 0x31, MRMDestReg>, OpSize; // R16 ^= R16 -def XORrr32 : I2A32<"xor", 0x31, MRMDestReg>; // R32 ^= R32 -def XORri8 : I2A8 <"xor", 0x80, MRMS6r >; // R8 ^= imm8 -def XORri16 : I2A16<"xor", 0x81, MRMS6r >, OpSize; // R16 ^= imm16 -def XORri32 : I2A32<"xor", 0x81, MRMS6r >; // R32 ^= imm32 +def XORrr8 : I2A8 <"xor", 0x30, MRMDestReg>, Pattern<(set R8 , (xor R8 , R8 ))>; +def XORrr16 : I2A16<"xor", 0x31, MRMDestReg>, OpSize, Pattern<(set R16, (xor R16, R16))>; +def XORrr32 : I2A32<"xor", 0x31, MRMDestReg>, Pattern<(set R32, (xor R32, R32))>; +def XORri8 : I2A8 <"xor", 0x80, MRMS6r >, Pattern<(set R8 , (xor R8 , imm))>; +def XORri16 : I2A16<"xor", 0x81, MRMS6r >, OpSize, Pattern<(set R16, (xor R16, imm))>; +def XORri32 : I2A32<"xor", 0x81, MRMS6r >, Pattern<(set R32, (xor R32, imm))>; // Test instructions are just like AND, except they don't generate a result. def TESTrr8 : X86Inst<"test", 0x84, MRMDestReg, Arg8 >; // flags = R8 & R8 From lattner at cs.uiuc.edu Mon Aug 11 10:25:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:25:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Target.td Message-ID: <200308111524.KAA16255@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target: Target.td updated: 1.18 -> 1.19 --- Log message: Remove dead code --- Diffs of the changes: Index: llvm/lib/Target/Target.td diff -u llvm/lib/Target/Target.td:1.18 llvm/lib/Target/Target.td:1.19 --- llvm/lib/Target/Target.td:1.18 Mon Aug 11 10:23:05 2003 +++ llvm/lib/Target/Target.td Mon Aug 11 10:24:02 2003 @@ -209,6 +209,3 @@ bit BuiltIn = 0; } -// imm - Immediate value... -//def imm : Nonterminal<(Constant)> { let BuiltIn = 1; } - From brukman at cs.uiuc.edu Mon Aug 11 10:31:00 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Aug 11 10:31:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Makefile Message-ID: <200308111530.KAA06698@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: Makefile updated: 1.5 -> 1.6 --- Log message: Removed `-debug' so that spurious printouts of patterns are not seen at compilation time. --- Diffs of the changes: Index: llvm/lib/Target/X86/Makefile diff -u llvm/lib/Target/X86/Makefile:1.5 llvm/lib/Target/X86/Makefile:1.6 --- llvm/lib/Target/X86/Makefile:1.5 Mon Aug 11 10:11:01 2003 +++ llvm/lib/Target/X86/Makefile Mon Aug 11 10:30:20 2003 @@ -23,7 +23,7 @@ $(TBLGEN) $< -gen-instr-desc -o $@ X86GenInstrSelector.inc: X86.td X86InstrInfo.td ../Target.td $(TBLGEN) - $(TBLGEN) $< -debug -gen-instr-selector -o $@ + $(TBLGEN) $< -gen-instr-selector -o $@ clean:: $(VERB) rm -f *.inc From brukman at cs.uiuc.edu Mon Aug 11 10:40:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Aug 11 10:40:02 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.td Message-ID: <200308111539.KAA06757@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.td updated: 1.6 -> 1.7 --- Log message: Converted tabs to spaces. --- Diffs of the changes: Index: llvm/lib/Target/X86/X86RegisterInfo.td diff -u llvm/lib/Target/X86/X86RegisterInfo.td:1.6 llvm/lib/Target/X86/X86RegisterInfo.td:1.7 --- llvm/lib/Target/X86/X86RegisterInfo.td:1.6 Wed Aug 6 23:49:16 2003 +++ llvm/lib/Target/X86/X86RegisterInfo.td Mon Aug 11 10:38:50 2003 @@ -74,9 +74,9 @@ let Methods = [{ iterator allocation_order_end(MachineFunction &MF) const { if (hasFP(MF)) // Does the function dedicate EBP to being a frame ptr? - return end()-2; // If so, don't allocate SP or BP + return end()-2; // If so, don't allocate SP or BP else - return end()-1; // If not, just don't allocate SP + return end()-1; // If not, just don't allocate SP } }]; } From lattner at cs.uiuc.edu Mon Aug 11 10:48:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:48:01 2003 Subject: [llvm-commits] CVS: llvm/utils/TableGen/InstrSelectorEmitter.cpp Message-ID: <200308111547.KAA26099@apoc.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: InstrSelectorEmitter.cpp updated: 1.22 -> 1.23 --- Log message: Don't forget to initializer result field to 0! --- Diffs of the changes: Index: llvm/utils/TableGen/InstrSelectorEmitter.cpp diff -u llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.22 llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.23 --- llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.22 Mon Aug 11 10:16:12 2003 +++ llvm/utils/TableGen/InstrSelectorEmitter.cpp Mon Aug 11 10:47:35 2003 @@ -116,7 +116,7 @@ // Pattern::Pattern(PatternType pty, DagInit *RawPat, Record *TheRec, InstrSelectorEmitter &ise) - : PTy(pty), TheRecord(TheRec), ISE(ise) { + : PTy(pty), Result(0), TheRecord(TheRec), ISE(ise) { // First, parse the pattern... Tree = ParseTreePattern(RawPat); From lattner at cs.uiuc.edu Mon Aug 11 10:49:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 10:49:00 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200308111548.KAA26117@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.7 -> 1.8 --- Log message: Add (ret int) expander so that we can at least write testcases --- Diffs of the changes: Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.7 llvm/lib/Target/X86/X86InstrInfo.td:1.8 --- llvm/lib/Target/X86/X86InstrInfo.td:1.7 Mon Aug 11 10:23:25 2003 +++ llvm/lib/Target/X86/X86InstrInfo.td Mon Aug 11 10:48:00 2003 @@ -430,3 +430,12 @@ def FNSTSWr8 : X86Inst<"fnstsw" , 0xE0, RawFrm , ArgF80>, DF, Imp<[],[AX]>; // AX = fp flags def FNSTCWm16 : X86Inst<"fnstcw" , 0xD9, MRMS7m , Arg16 >; // [mem16] = X87 control world def FLDCWm16 : X86Inst<"fldcw" , 0xD9, MRMS5m , Arg16 >; // X87 control world = [mem16] + + +//===----------------------------------------------------------------------===// +// Instruction Expanders +// + +def RET_R32 : Expander<(ret R32:$reg), + [(MOVrr32 EAX, R32:$reg), + (RET)]>; From gaeke at niobe.cs.uiuc.edu Mon Aug 11 12:07:04 2003 From: gaeke at niobe.cs.uiuc.edu (Brian Gaeke) Date: Mon Aug 11 12:07:04 2003 Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/README Message-ID: <200308111706.h7BH6FY17691@niobe.cs.uiuc.edu> Changes in directory llvm/lib/Reoptimizer: README updated: 1.1 -> 1.2 --- Log message: Update description of newer reoptimizer. --- Diffs of the changes: Index: llvm/lib/Reoptimizer/README diff -u llvm/lib/Reoptimizer/README:1.1 llvm/lib/Reoptimizer/README:1.2 --- llvm/lib/Reoptimizer/README:1.1 Tue Aug 5 14:37:15 2003 +++ llvm/lib/Reoptimizer/README Mon Aug 11 12:06:04 2003 @@ -18,7 +18,8 @@ assembly by LLC. LightWtProfiling/Trigger - - Anand's redesigned reoptimizer. + - Anand's redesigned reoptimizer. Uses first-level and second-level + instrumentation. TraceCache - Manages traces for the reoptimizers. From brukman at cs.uiuc.edu Mon Aug 11 12:57:01 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Aug 11 12:57:01 2003 Subject: [llvm-commits] CVS: llvm/utils/vim/README tablegen.vim Message-ID: <200308111756.MAA07113@zion.cs.uiuc.edu> Changes in directory llvm/utils/vim: README added (r1.1) tablegen.vim added (r1.1) --- Log message: Added a TableGen syntax highlighting mode for VIM and a README that describes how to add the functionality to the user's VIM installation. --- Diffs of the changes: Index: llvm/utils/vim/README diff -c /dev/null llvm/utils/vim/README:1.1 *** /dev/null Mon Aug 11 12:56:18 2003 --- llvm/utils/vim/README Mon Aug 11 12:56:08 2003 *************** *** 0 **** --- 1,29 ---- + -*- llvm/utils/vim/README -*- + + These are syntax highlighting files for the VIM editor. Included are: + + * llvm.vim + + Syntax highlighting mode for LLVM assembly files. To use, COPY `llvm.vim' to + ~/.vim/syntax and add this code to your ~/.vimrc : + + augroup filetype + au! BufRead,BufNewFile *.ll set filetype=llvm + augroup END + + * tablegen.vim + + Syntax highlighting mode for TableGen description files. To use, COPY + `tablegen.vim' to ~/.vim/syntax and add this code to your ~/.vimrc : + + augroup filetype + au! BufRead,BufNewFile *.td set filetype=tablegen + augroup END + + + IMPORTANT: Making symlinks from ~/.vim/syntax/... to the syntax files in your + LLVM source tree does not work, you DO need to copy the files directly. + + Note: If you notice missing or incorrect syntax highlighting, please contact + ; if you wish to provide a patch to improve the + functionality, it will be most appreciated. Thank you. Index: llvm/utils/vim/tablegen.vim diff -c /dev/null llvm/utils/vim/tablegen.vim:1.1 *** /dev/null Mon Aug 11 12:56:18 2003 --- llvm/utils/vim/tablegen.vim Mon Aug 11 12:56:08 2003 *************** *** 0 **** --- 1,39 ---- + " Vim syntax file + " Language: TableGen + " Maintainer: The LLVM team, http://llvm.cs.uiuc.edu/ + " Updated: 2003-08-11 + + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + + syn case match + + syn keyword tgKeyword def let in code dag + syn keyword tgType class int string list bit bits + syn match tgNumber /\<\d\+\>/ + syn match tgNumber /\<\d\+\.\d*\>/ + syn match tgComment /\/\/.*$/ + syn region tgString start=/"/ skip=/\\"/ end=/"/ + + if version >= 508 || !exists("did_c_syn_inits") + if version < 508 + let did_c_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink tgKeyword Type + HiLink tgType Type + "HiLink llvmStatement Statement + HiLink tgNumber Number + HiLink tgComment Comment + HiLink tgString String + + delcommand HiLink + endif + + let b:current_syntax = "tablegen" From lattner at cs.uiuc.edu Mon Aug 11 13:02:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon Aug 11 13:02:01 2003 Subject: [llvm-commits] CVS: llvm/utils/vim/README Message-ID: <200308111801.NAA27056@apoc.cs.uiuc.edu> Changes in directory llvm/utils/vim: README updated: 1.1 -> 1.2 --- Log message: Add .llx --- Diffs of the changes: Index: llvm/utils/vim/README diff -u llvm/utils/vim/README:1.1 llvm/utils/vim/README:1.2 --- llvm/utils/vim/README:1.1 Mon Aug 11 12:56:08 2003 +++ llvm/utils/vim/README Mon Aug 11 13:01:39 2003 @@ -9,6 +9,7 @@ augroup filetype au! BufRead,BufNewFile *.ll set filetype=llvm + au! BufRead,BufNewFile *.llx set filetype=llvm augroup END * tablegen.vim From brukman at cs.uiuc.edu Mon Aug 11 13:06:02 2003 From: brukman at cs.uiuc.edu (Misha Brukman) Date: Mon Aug 11 13:06:02 2003 Subject: [llvm-commits] CVS: llvm/utils/vim/README tablegen.vim Message-ID: <200308111805.NAA07236@zion.cs.uiuc.edu> Changes in directory llvm/utils/vim: README updated: 1.2 -> 1.3 tablegen.vim updated: 1.1 -> 1.2 --- Log message: tablegen.vim: * Added keyword `field' * Keywords get different highlighting than types * Added a simple attempt at multi-line C-style comments with FIXME README: * Added note about symlinking an entire directory ~/.vim/syntax --- Diffs of the changes: Index: llvm/utils/vim/README diff -u llvm/utils/vim/README:1.2 llvm/utils/vim/README:1.3 --- llvm/utils/vim/README:1.2 Mon Aug 11 13:01:39 2003 +++ llvm/utils/vim/README Mon Aug 11 13:05:19 2003 @@ -25,6 +25,10 @@ IMPORTANT: Making symlinks from ~/.vim/syntax/... to the syntax files in your LLVM source tree does not work, you DO need to copy the files directly. +However, if you do not already have a ~/.vim/syntax/ directory, simply +symlinking it to llvm/utils/vim will do the trick nicely, and you can stay +up-to-date with CVS. + Note: If you notice missing or incorrect syntax highlighting, please contact ; if you wish to provide a patch to improve the functionality, it will be most appreciated. Thank you. Index: llvm/utils/vim/tablegen.vim diff -u llvm/utils/vim/tablegen.vim:1.1 llvm/utils/vim/tablegen.vim:1.2 --- llvm/utils/vim/tablegen.vim:1.1 Mon Aug 11 12:56:08 2003 +++ llvm/utils/vim/tablegen.vim Mon Aug 11 13:05:19 2003 @@ -11,11 +11,13 @@ syn case match -syn keyword tgKeyword def let in code dag -syn keyword tgType class int string list bit bits +syn keyword tgKeyword def let in code dag field +syn keyword tgType class int string list bit bits syn match tgNumber /\<\d\+\>/ syn match tgNumber /\<\d\+\.\d*\>/ syn match tgComment /\/\/.*$/ +" FIXME: this does not capture multi-line C-style comments +syn match tgComment /\/\*.*\*\// syn region tgString start=/"/ skip=/\\"/ end=/"/ if version >= 508 || !exists("did_c_syn_inits") @@ -26,9 +28,8 @@ command -nargs=+ HiLink hi def link endif - HiLink tgKeyword Type + HiLink tgKeyword Statement HiLink tgType Type - "HiLink llvmStatement Statement HiLink tgNumber Number HiLink tgComment Comment HiLink tgString String From vadve at cs.uiuc.edu Mon Aug 11 13:43:01 2003 From: vadve at cs.uiuc.edu (Vikram Adve) Date: Mon Aug 11 13:43:01 2003 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp Message-ID: <200308111842.NAA28723@psmith.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrSelection.cpp updated: 1.114 -> 1.115 --- Log message: Register argument to va_start must be marked as defined! --- Diffs of the changes: Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.114 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.115 --- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.114 Thu Aug 7 10:43:46 2003 +++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Mon Aug 11 13:42:47 2003 @@ -1418,7 +1418,7 @@ int firstVarArgOff = numFixedArgs * argSize + target.getFrameInfo(). getFirstIncomingArgOffset(MachineFunction::get(func), ignore); mvec.push_back(BuildMI(V9::ADDi, 3).addMReg(fpReg).addSImm(firstVarArgOff). - addReg(callInstr.getOperand(1))); + addRegDef(callInstr.getOperand(1))); return true; } From brukman at cs.uiuc.edu Mon Aug 11 13:47:01 2003 From: brukman at cs.uiuc.edu (Michael Brukman) Date: Mon Aug 11 13:47:01 2003 Subject: [llvm-commits] CVS: llvm/www/docs/GettingStarted.html Message-ID: <200308111845.NAA24888@tank.cs.uiuc.edu> Changes in directory llvm/www/docs: GettingStarted.html updated: 1.29 -> 1.30 --- Log message: * Added a section describing the hidden gems in llvm/utils * Converted some tabs to spaces * Made lines fit within 80 columns --- Diffs of the changes: Index: llvm/www/docs/GettingStarted.html diff -u llvm/www/docs/GettingStarted.html:1.29 llvm/www/docs/GettingStarted.html:1.30 --- llvm/www/docs/GettingStarted.html:1.29 Fri Aug 8 17:46:30 2003 +++ llvm/www/docs/GettingStarted.html Mon Aug 11 13:45:46 2003 @@ -8,7 +8,8 @@

Getting Started with the LLVM System
By: Guochun Shi, Chris Lattner, - John Criswell, and + John Criswell, + Misha Brukman, and Vikram Adve

@@ -38,13 +39,14 @@
  • The Location of LLVM Object Files
  • Program layout -
      -
    1. CVS directories -
    2. llvm/include -
    3. llvm/lib -
    4. llvm/test -
    5. llvm/tools -
    +
      +
    1. CVS directories +
    2. llvm/include +
    3. llvm/lib +
    4. llvm/test +
    5. llvm/tools +
    6. llvm/utils +
  • Compiling the LLVM C Front End
  • An Example Using the LLVM Tool Chain
  • Common Problems @@ -247,7 +249,8 @@
    1. cd where-you-want-llvm-to-live
    2. gunzip --stdout llvm.tar.gz | tar -xvf - -
    3. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf - +
    4. gunzip --stdout cfrontend.platform.tar.gz | tar + -xvf -
    5. cd llvm
    @@ -255,7 +258,8 @@
  • With anonymous CVS access:
      -
    1. Find the path to the CVS repository containing LLVM (we'll call this CVSROOTDIR). +
    2. Find the path to the CVS repository containing LLVM (we'll + call this CVSROOTDIR).
    3. cd where-you-want-llvm-to-live
    4. cvs -d CVSROOTDIR checkout llvm
    5. cd llvm @@ -273,7 +277,8 @@

    A complete log of testing is available From lattner at cs.uiuc.edu Sun Aug 17 23:34:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Aug 17 23:34:01 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Makefile.singlesrc Message-ID: <200308180433.XAA28435@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/SingleSource: Makefile.singlesrc updated: 1.20 -> 1.21 --- Log message: Compile native program with GCC -O2 --- Diffs of the changes: Index: llvm/test/Programs/SingleSource/Makefile.singlesrc diff -u llvm/test/Programs/SingleSource/Makefile.singlesrc:1.20 llvm/test/Programs/SingleSource/Makefile.singlesrc:1.21 --- llvm/test/Programs/SingleSource/Makefile.singlesrc:1.20 Mon Jun 16 10:50:51 2003 +++ llvm/test/Programs/SingleSource/Makefile.singlesrc Sun Aug 17 23:33:18 2003 @@ -33,6 +33,6 @@ # FIXME: LIBS should be specified, not hardcoded to -lm Output/%.native: %.c Output/.dir - $(CC) $(CFLAGS) $< -lm -o $@ + $(CC) $(CFLAGS) -O2 $< -lm -o $@ Output/%.native: %.cpp Output/.dir - $(CXX) $(CXXFLAGS) $< -lm -o $@ + $(CXX) $(CXXFLAGS) -O2 $< -lm -o $@ From lattner at cs.uiuc.edu Sun Aug 17 23:34:02 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Aug 17 23:34:02 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Makefile.multisrc Message-ID: <200308180433.XAA28428@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs/MultiSource: Makefile.multisrc updated: 1.34 -> 1.35 --- Log message: Compile native program with GCC -O2 --- Diffs of the changes: Index: llvm/test/Programs/MultiSource/Makefile.multisrc diff -u llvm/test/Programs/MultiSource/Makefile.multisrc:1.34 llvm/test/Programs/MultiSource/Makefile.multisrc:1.35 --- llvm/test/Programs/MultiSource/Makefile.multisrc:1.34 Wed Jul 30 12:56:11 2003 +++ llvm/test/Programs/MultiSource/Makefile.multisrc Sun Aug 17 23:33:15 2003 @@ -32,13 +32,13 @@ .PRECIOUS: $(LObjects) $(NObjects) Output/%.linked.rll Output/%.o: $(SourceDir)%.c Output/.dir - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CFLAGS) -O2 -c $< -o $@ Output/%.o: $(SourceDir)%.cpp Output/.dir - $(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@ Output/%.o: $(SourceDir)%.cc Output/.dir - $(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@ bugpoint-gccas: Output/$(PROG).bugpoint-gccas bugpoint-gccld: Output/$(PROG).bugpoint-gccld From lattner at cs.uiuc.edu Sun Aug 17 23:40:01 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Aug 17 23:40:01 2003 Subject: [llvm-commits] CVS: llvm/utils/NightlyTestTemplate.html Message-ID: <200308180439.XAA28465@apoc.cs.uiuc.edu> Changes in directory llvm/utils: NightlyTestTemplate.html updated: 1.11 -> 1.12 --- Log message: The CBE output is compiled at -O2 --- Diffs of the changes: Index: llvm/utils/NightlyTestTemplate.html diff -u llvm/utils/NightlyTestTemplate.html:1.11 llvm/utils/NightlyTestTemplate.html:1.12 --- llvm/utils/NightlyTestTemplate.html:1.11 Sun Aug 17 23:32:34 2003 +++ llvm/utils/NightlyTestTemplate.html Sun Aug 17 23:39:41 2003 @@ -137,7 +137,7 @@

  • GCC - The time taken to execute the program when compiled with GCC -O2.
  • CBE - The time taken to execute the program after - compilation through the C Backend.
  • + compilation through the C backend, compiled with -O2.
  • LLC - How long does the program generated by the static backend LLC take to execute
  • JIT - The amount of time spent running the From lattner at cs.uiuc.edu Sun Aug 17 23:40:03 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Aug 17 23:40:03 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs Message-ID: <200308180439.XAA28456@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs: Makefile.programs updated: 1.85 -> 1.86 --- Log message: Compile the CBE output at -O2 --- Diffs of the changes: Index: llvm/test/Programs/Makefile.programs diff -u llvm/test/Programs/Makefile.programs:1.85 llvm/test/Programs/Makefile.programs:1.86 --- llvm/test/Programs/Makefile.programs:1.85 Fri Aug 15 14:24:38 2003 +++ llvm/test/Programs/Makefile.programs Sun Aug 17 23:39:29 2003 @@ -251,7 +251,7 @@ $(PROGRAMS_TO_TEST:%=Output/%.cbe): \ Output/%.cbe: Output/%.cbe.c - -$(CC) $< $(LDFLAGS) $(CFLAGS) -o $@ + -$(CC) $< $(LDFLAGS) $(CFLAGS) -O2 -o $@ # # Compile a linked program to machine code with LLC. From lattner at cs.uiuc.edu Sun Aug 17 23:47:00 2003 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun Aug 17 23:47:00 2003 Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile Message-ID: <200308180446.XAA29376@apoc.cs.uiuc.edu> Changes in directory llvm/test/Programs: Makefile updated: 1.19 -> 1.20 --- Log message: Include Makefile.programs instead of Makefile.tests, for now it's the same Fix spelling. Geeze, I would have thought that Misha would have got all of these by now. :) --- Diffs of the changes: Index: llvm/test/Programs/Makefile diff -u llvm/test/Programs/Makefile:1.19 llvm/test/Programs/Makefile:1.20 --- llvm/test/Programs/Makefile:1.19 Sun Aug 17 22:45:37 2003 +++ llvm/test/Programs/Makefile Sun Aug 17 23:46:26 2003 @@ -1,6 +1,6 @@ ##===- test/Programs/Makefile ------------------------------*- Makefile -*-===## # -# This recursively traverses the programs, building them as neccesary. This +# This recursively traverses the programs, building them as necessary. This # makefile also implements 'make report TEST='. # ##===----------------------------------------------------------------------===## @@ -9,7 +9,7 @@ PARALLEL_DIRS = SingleSource MultiSource External #LLVMSource -include ${LEVEL}/test/Makefile.tests +include ${LEVEL}/test/Programs/Makefile.programs # Include all makefiles which define tests... These makefiles must define # test..% given input from Output/%.llvm.bc