From sabre at nondot.org Mon Oct 15 00:30:28 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 05:30:28 -0000 Subject: [llvm-commits] [llvm] r42976 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200710150530.l9F5USJ9028995@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 00:30:27 2007 New Revision: 42976 URL: http://llvm.org/viewvc/llvm-project?rev=42976&view=rev Log: Fix 80 col violation Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=42976&r1=42975&r2=42976&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Oct 15 00:30:27 2007 @@ -538,9 +538,9 @@ } /// ShrinkDemandedConstant - Check to see if the specified operand of the - /// specified instruction is a constant integer. If so, check to see if there - /// are any bits set in the constant that are not demanded. If so, shrink the - /// constant and return true. + /// specified instruction is a constant integer. If so, check to see if + /// there are any bits set in the constant that are not demanded. If so, + /// shrink the constant and return true. bool ShrinkDemandedConstant(SDOperand Op, uint64_t Demanded); }; From sabre at nondot.org Mon Oct 15 00:30:55 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 05:30:55 -0000 Subject: [llvm-commits] [llvm] r42977 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200710150530.l9F5UunS029021@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 00:30:55 2007 New Revision: 42977 URL: http://llvm.org/viewvc/llvm-project?rev=42977&view=rev Log: remove dead enum, make setNodeId public. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=42977&r1=42976&r2=42977&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Oct 15 00:30:55 2007 @@ -419,13 +419,6 @@ // indexed memory ops). LOAD, STORE, - // TRUNCSTORE - This operators truncates (for integer) or rounds (for FP) a - // value and stores it to memory in one operation. This can be used for - // either integer or floating point operands. The first four operands of - // this are the same as a standard store. The fifth is the ValueType to - // store it as (which will be smaller than the source value). - TRUNCSTORE, - // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned // to a specified boundary. This node always has two return values: a new // stack pointer value and a chain. The first operand is the token chain, @@ -950,6 +943,10 @@ /// void Profile(FoldingSetNodeID &ID); + void setNodeId(int Id) { + NodeId = Id; + } + protected: friend class SelectionDAG; @@ -1018,10 +1015,6 @@ } } } - - void setNodeId(int Id) { - NodeId = Id; - } }; From sabre at nondot.org Mon Oct 15 00:32:43 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 05:32:43 -0000 Subject: [llvm-commits] [llvm] r42978 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200710150532.l9F5Wh6Q029071@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 00:32:43 2007 New Revision: 42978 URL: http://llvm.org/viewvc/llvm-project?rev=42978&view=rev Log: Add a (disabled by default) way to view the ID of a node. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=42978&r1=42977&r2=42978&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Oct 15 00:32:43 2007 @@ -172,6 +172,10 @@ Op = Op + "getStoredVT()) + ">"; Op += ST->getIndexedModeName(ST->getAddressingMode()); } + +#if 0 + Op += " Id=" + itostr(Node->getNodeId()); +#endif return Op; } From sabre at nondot.org Mon Oct 15 00:34:10 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 05:34:10 -0000 Subject: [llvm-commits] [llvm] r42979 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200710150534.l9F5YA97029115@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 00:34:10 2007 New Revision: 42979 URL: http://llvm.org/viewvc/llvm-project?rev=42979&view=rev Log: avoid an APFloat copy. Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=42979&r1=42978&r2=42979&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Oct 15 00:34:10 2007 @@ -194,7 +194,7 @@ case Instruction::FPToUI: case Instruction::FPToSI: if (const ConstantFP *FPC = dyn_cast(V)) { - APFloat V = FPC->getValueAPF(); + const APFloat &V = FPC->getValueAPF(); uint64_t x[2]; uint32_t DestBitWidth = cast(DestTy)->getBitWidth(); (void) V.convertToInteger(x, DestBitWidth, opc==Instruction::FPToSI, From sabre at nondot.org Mon Oct 15 00:46:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 05:46:06 -0000 Subject: [llvm-commits] [llvm] r42980 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200710150546.l9F5k6g1029578@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 00:46:06 2007 New Revision: 42980 URL: http://llvm.org/viewvc/llvm-project?rev=42980&view=rev Log: One xform performed by LegalizeDAG is transformation of "store of fp" to "store of int". Make two changes: 1) only xform "store of f32" if i32 is a legal type for the target. 2) only xform "store of f64" if either i64 or i32 are legal for the target. 3) if i64 isn't legal, manually lower to 2 stores of i32 instead of letting a later pass of legalize do it. This is ugly, but helps future changes I'm about to commit. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42980&r1=42979&r2=42980&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Oct 15 00:46:06 2007 @@ -2026,7 +2026,8 @@ // together. // We generally can't do this one for long doubles. if (ConstantFPSDNode *CFP = dyn_cast(ST->getValue())) { - if (CFP->getValueType(0) == MVT::f32) { + if (CFP->getValueType(0) == MVT::f32 && + getTypeAction(MVT::i32) == Legal) { Tmp3 = DAG.getConstant((uint32_t)CFP->getValueAPF(). convertToAPInt().getZExtValue(), MVT::i32); @@ -2034,11 +2035,32 @@ SVOffset, isVolatile, Alignment); break; } else if (CFP->getValueType(0) == MVT::f64) { - Tmp3 = DAG.getConstant(CFP->getValueAPF().convertToAPInt(). - getZExtValue(), MVT::i64); - Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); - break; + // If this target supports 64-bit registers, do a single 64-bit store. + if (getTypeAction(MVT::i64) == Legal) { + Tmp3 = DAG.getConstant(CFP->getValueAPF().convertToAPInt(). + getZExtValue(), MVT::i64); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + break; + } else if (getTypeAction(MVT::i32) == Legal) { + // Otherwise, if the target supports 32-bit registers, use 2 32-bit + // stores. If the target supports neither 32- nor 64-bits, this + // xform is certainly not worth it. + uint64_t IntVal =CFP->getValueAPF().convertToAPInt().getZExtValue(); + SDOperand Lo = DAG.getConstant(uint32_t(IntVal), MVT::i32); + SDOperand Hi = DAG.getConstant(uint32_t(IntVal >>32), MVT::i32); + if (!TLI.isLittleEndian()) std::swap(Lo, Hi); + + Lo = DAG.getStore(Tmp1, Lo, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2, + getIntPtrConstant(4)); + Hi = DAG.getStore(Tmp1, Hi, Tmp2, ST->getSrcValue(), SVOffset+4, + isVolatile, std::max(Alignment, 4U)); + + Result = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); + break; + } } } From sabre at nondot.org Mon Oct 15 01:10:22 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 06:10:22 -0000 Subject: [llvm-commits] [llvm] r42981 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp utils/TableGen/DAGISelEmitter.cpp Message-ID: <200710150610.l9F6ANV3030436@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 01:10:22 2007 New Revision: 42981 URL: http://llvm.org/viewvc/llvm-project?rev=42981&view=rev Log: One mundane change: Change ReplaceAllUsesOfValueWith to *optionally* take a deleted nodes vector, instead of requiring it. One more significant change: Implement the start of a legalizer that just works on types. This legalizer is designed to run before the operation legalizer and ensure just that the input dag is transformed into an output dag whose operand and result types are all legal, even if the operations on those types are not. This design/impl has the following advantages: 1. When finished, this will *significantly* reduce the amount of code in LegalizeDAG.cpp. It will remove all the code related to promotion and expansion as well as splitting and scalarizing vectors. 2. The new code is very simple, idiomatic, and modular: unlike LegalizeDAG.cpp, it has no 3000 line long functions. :) 3. The implementation is completely iterative instead of recursive, good for hacking on large dags without blowing out your stack. 4. The implementation updates nodes in place when possible instead of deallocating and reallocating the entire graph that points to some mutated node. 5. The code nicely separates out handling of operations with invalid results from operations with invalid operands, making some cases simpler and easier to understand. 6. The new -debug-only=legalize-types option is very very handy :), allowing you to easily understand what legalize types is doing. This is not yet done. Until the ifdef added to SelectionDAGISel.cpp is enabled, this does nothing. However, this code is sufficient to legalize all of the code in 186.crafty, olden and freebench on an x86 machine. The biggest issues are: 1. Vectors aren't implemented at all yet 2. SoftFP is a mess, I need to talk to Evan about it. 3. No lowering to libcalls is implemented yet. 4. Various operations are missing etc. 5. There are FIXME's for stuff I hax0r'd out, like softfp. Hey, at least it is a step in the right direction :). If you'd like to help, just enable the #ifdef in SelectionDAGISel.cpp and compile code with it. If this explodes it will tell you what needs to be implemented. Help is certainly appreciated. Once this goes in, we can do three things: 1. Add a new pass of dag combine between the "type legalizer" and "operation legalizer" passes. This will let us catch some long-standing isel issues that we miss because operation legalization often obfuscates the dag with target-specific nodes. 2. We can rip out all of the type legalization code from LegalizeDAG.cpp, making it much smaller and simpler. When that happens we can then reimplement the core functionality left in it in a much more efficient and non-recursive way. 3. Once the whole legalizer is non-recursive, we can implement whole-function selectiondags maybe... Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=42981&r1=42980&r2=42981&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Oct 15 01:10:22 2007 @@ -120,6 +120,13 @@ /// generate any nodes that will be illegal on the target. void Combine(bool AfterLegalize, AliasAnalysis &AA); + /// LegalizeTypes - This transforms the SelectionDAG into a SelectionDAG that + /// only uses types natively supported by the target. + /// + /// Note that this is an involved process that may invalidate pointers into + /// the graph. + void LegalizeTypes(); + /// Legalize - This transforms the SelectionDAG into a SelectionDAG that is /// compatible with the target instruction selector, as indicated by the /// TargetLowering object. @@ -451,7 +458,7 @@ /// handled the same was as for ReplaceAllUsesWith, but it is required for /// this method. void ReplaceAllUsesOfValueWith(SDOperand From, SDOperand To, - std::vector &Deleted); + std::vector *Deleted = 0); /// AssignNodeIds - Assign a unique node id for each node in the DAG based on /// their allnodes order. It returns the maximum id. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=42981&r1=42980&r2=42981&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Oct 15 01:10:22 2007 @@ -173,7 +173,7 @@ DOUT << '\n'; std::vector NowDead; - DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead); + DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, &NowDead); // Push the new node and any (possibly new) users onto the worklist. AddToWorkList(TLO.New.Val); @@ -1414,8 +1414,6 @@ /// bool DAGCombiner::SimplifyNodeWithTwoResults(SDNode *N, unsigned LoOp, unsigned HiOp) { - std::vector NowDead; - // If the high half is not needed, just compute the low half. if (!N->hasAnyUseOfValue(1) && (!AfterLegalize || @@ -1423,8 +1421,7 @@ DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), DAG.getNode(LoOp, N->getValueType(0), N->op_begin(), - N->getNumOperands()), - NowDead); + N->getNumOperands())); return true; } @@ -1435,8 +1432,7 @@ DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), DAG.getNode(HiOp, N->getValueType(1), N->op_begin(), - N->getNumOperands()), - NowDead); + N->getNumOperands())); return true; } @@ -1464,8 +1460,8 @@ (HiExists || HiOpt != Hi) && TLI.isOperationLegal(LoOpt.getOpcode(), LoOpt.getValueType()) && TLI.isOperationLegal(HiOpt.getOpcode(), HiOpt.getValueType())) { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), LoOpt, NowDead); - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), HiOpt, NowDead); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), LoOpt); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), HiOpt); return true; } @@ -2891,8 +2887,7 @@ LN0->isVolatile(), LN0->getAlignment()); AddToWorkList(N); if (CombineSRL) { - std::vector NowDead; - DAG.ReplaceAllUsesOfValueWith(N0.getValue(1), Load.getValue(1), NowDead); + DAG.ReplaceAllUsesOfValueWith(N0.getValue(1), Load.getValue(1)); CombineTo(N->getOperand(0).Val, Load); } else CombineTo(N0.Val, Load, Load.getValue(1)); @@ -3694,12 +3689,12 @@ std::vector NowDead; if (isLoad) { DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), - NowDead); + &NowDead); DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), - NowDead); + &NowDead); } else { DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), - NowDead); + &NowDead); } // Nodes can end up on the worklist more than once. Make sure we do @@ -3711,7 +3706,7 @@ // Replace the uses of Ptr with uses of the updated base value. DAG.ReplaceAllUsesOfValueWith(Ptr, Result.getValue(isLoad ? 1 : 0), - NowDead); + &NowDead); removeFromWorkList(Ptr.Val); for (unsigned i = 0, e = NowDead.size(); i != e; ++i) removeFromWorkList(NowDead[i]); @@ -3825,12 +3820,12 @@ std::vector NowDead; if (isLoad) { DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), - NowDead); + &NowDead); DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), - NowDead); + &NowDead); } else { DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), - NowDead); + &NowDead); } // Nodes can end up on the worklist more than once. Make sure we do @@ -3843,7 +3838,7 @@ // Replace the uses of Use with uses of the updated base value. DAG.ReplaceAllUsesOfValueWith(SDOperand(Op, 0), Result.getValue(isLoad ? 1 : 0), - NowDead); + &NowDead); removeFromWorkList(Op); for (unsigned i = 0, e = NowDead.size(); i != e; ++i) removeFromWorkList(NowDead[i]); Added: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=42981&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (added) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Mon Oct 15 01:10:22 2007 @@ -0,0 +1,1522 @@ +//===-- LegalizeDAGTypes.cpp - Implement SelectionDAG::LegalizeTypes ------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Chris Lattner and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the SelectionDAG::LegalizeTypes method. It transforms +// an arbitrary well-formed SelectionDAG to only consist of legal types. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "legalize-types" +#include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/Target/TargetLowering.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +using namespace llvm; + +//===----------------------------------------------------------------------===// +/// DAGTypeLegalizer - This takes an arbitrary SelectionDAG as input and +/// hacks on it until the target machine can handle it. This involves +/// eliminating value sizes the machine cannot handle (promoting small sizes to +/// large sizes or splitting up large values into small values) as well as +/// eliminating operations the machine cannot handle. +/// +/// This code also does a small amount of optimization and recognition of idioms +/// as part of its processing. For example, if a target does not support a +/// 'setcc' instruction efficiently, but does support 'brcc' instruction, this +/// will attempt merge setcc and brc instructions into brcc's. +/// +namespace { +class VISIBILITY_HIDDEN DAGTypeLegalizer { + TargetLowering &TLI; + SelectionDAG &DAG; + + // NodeIDFlags - This pass uses the NodeID on the SDNodes to hold information + // about the state of the node. The enum has all the values. + enum NodeIDFlags { + /// ReadyToProcess - All operands have been processed, so this node is ready + /// to be handled. + ReadyToProcess = 0, + + /// NewNode - This is a new node that was created in the process of + /// legalizing some other node. + NewNode = -1, + + /// Processed - This is a node that has already been processed. + Processed = -2 + + // 1+ - This is a node which has this many unlegalized operands. + }; + + enum LegalizeAction { + Legal, // The target natively supports this operation. + Promote, // This operation should be executed in a larger type. + Expand // Try to expand this to other ops, otherwise use a libcall. + }; + + /// ValueTypeActions - This is a bitvector that contains two bits for each + /// value type, where the two bits correspond to the LegalizeAction enum. + /// This can be queried with "getTypeAction(VT)". + TargetLowering::ValueTypeActionImpl ValueTypeActions; + + /// getTypeAction - Return how we should legalize values of this type, either + /// it is already legal or we need to expand it into multiple registers of + /// smaller integer type, or we need to promote it to a larger type. + LegalizeAction getTypeAction(MVT::ValueType VT) const { + return (LegalizeAction)ValueTypeActions.getTypeAction(VT); + } + + /// isTypeLegal - Return true if this type is legal on this target. + /// + bool isTypeLegal(MVT::ValueType VT) const { + return getTypeAction(VT) == Legal; + } + + SDOperand getIntPtrConstant(uint64_t Val) { + return DAG.getConstant(Val, TLI.getPointerTy()); + } + + /// PromotedNodes - For nodes that are below legal width, and that have more + /// than one use, this map indicates what promoted value to use. + DenseMap PromotedNodes; + + /// ExpandedNodes - For nodes that need to be expanded this map indicates + /// which which operands are the expanded version of the input. + DenseMap > ExpandedNodes; + + /// Worklist - This defines a worklist of nodes to process. In order to be + /// pushed onto this worklist, all operands of a node must have already been + /// processed. + SmallVector Worklist; + +public: + DAGTypeLegalizer(SelectionDAG &dag) + : TLI(dag.getTargetLoweringInfo()), DAG(dag), + ValueTypeActions(TLI.getValueTypeActions()) { + assert(MVT::LAST_VALUETYPE <= 32 && + "Too many value types for ValueTypeActions to hold!"); + } + + void run(); + +private: + void MarkNewNodes(SDNode *N); + + void ReplaceLegalValueWith(SDOperand From, SDOperand To); + + SDOperand GetPromotedOp(SDOperand Op) { + Op = PromotedNodes[Op]; + assert(Op.Val && "Operand wasn't promoted?"); + return Op; + } + void SetPromotedOp(SDOperand Op, SDOperand Result); + + void GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); + void SetExpandedOp(SDOperand Op, SDOperand Lo, SDOperand Hi); + + // Result Promotion. + void PromoteResult(SDNode *N, unsigned ResNo); + SDOperand PromoteResult_UNDEF(SDNode *N); + SDOperand PromoteResult_Constant(SDNode *N); + SDOperand PromoteResult_TRUNCATE(SDNode *N); + SDOperand PromoteResult_INT_EXTEND(SDNode *N); + SDOperand PromoteResult_FP_ROUND(SDNode *N); + SDOperand PromoteResult_SETCC(SDNode *N); + SDOperand PromoteResult_LOAD(LoadSDNode *N); + SDOperand PromoteResult_SimpleIntBinOp(SDNode *N); + + // Result Expansion. + void ExpandResult(SDNode *N, unsigned ResNo); + void ExpandResult_UNDEF (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_Constant (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_BUILD_PAIR (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_ANY_EXTEND (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_ZERO_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_SIGN_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_LOAD (LoadSDNode *N, SDOperand &Lo, SDOperand &Hi); + + void ExpandResult_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_SELECT (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_SELECT_CC (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_MUL (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_Shift (SDNode *N, SDOperand &Lo, SDOperand &Hi); + + void ExpandShiftByConstant(SDNode *N, unsigned Amt, + SDOperand &Lo, SDOperand &Hi); + bool ExpandShiftWithKnownAmountBit(SDNode *N, SDOperand &Lo, SDOperand &Hi); + + // Operand Promotion. + bool PromoteOperand(SDNode *N, unsigned OperandNo); + SDOperand PromoteOperand_ANY_EXTEND(SDNode *N); + SDOperand PromoteOperand_ZERO_EXTEND(SDNode *N); + SDOperand PromoteOperand_SIGN_EXTEND(SDNode *N); + SDOperand PromoteOperand_FP_EXTEND(SDNode *N); + SDOperand PromoteOperand_FP_ROUND(SDNode *N); + SDOperand PromoteOperand_SELECT(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_BRCOND(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_STORE(StoreSDNode *N, unsigned OpNo); + + // Operand Expansion. + bool ExpandOperand(SDNode *N, unsigned OperandNo); + SDOperand ExpandOperand_TRUNCATE(SDNode *N); + SDOperand ExpandOperand_EXTRACT_ELEMENT(SDNode *N); + SDOperand ExpandOperand_SETCC(SDNode *N); + SDOperand ExpandOperand_STORE(StoreSDNode *N, unsigned OpNo); + + void ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, + ISD::CondCode &CCCode); +}; +} // end anonymous namespace + + + +/// run - This is the main entry point for the type legalizer. This does a +/// top-down traversal of the dag, legalizing types as it goes. +void DAGTypeLegalizer::run() { + // Create a dummy node (which is not added to allnodes), that adds a reference + // to the root node, preventing it from being deleted, and tracking any + // changes of the root. + HandleSDNode Dummy(DAG.getRoot()); + + // The root of the dag may dangle to deleted nodes until the type legalizer is + // done. Set it to null to avoid confusion. + DAG.setRoot(SDOperand()); + + // Walk all nodes in the graph, assigning them a NodeID of 'ReadyToProcess' + // (and remembering them) if they are leafs and assigning 'NewNode' if + // non-leaves. + for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), + E = DAG.allnodes_end(); I != E; ++I) { + if (I->getNumOperands() == 0) { + I->setNodeId(ReadyToProcess); + Worklist.push_back(I); + } else { + I->setNodeId(NewNode); + } + } + + // Now that we have a set of nodes to process, handle them all. + while (!Worklist.empty()) { + SDNode *N = Worklist.back(); + Worklist.pop_back(); + assert(N->getNodeId() == ReadyToProcess && + "Node should be ready if on worklist!"); + + // Scan the values produced by the node, checking to see if any result + // types are illegal. + unsigned i = 0; + unsigned NumResults = N->getNumValues(); + do { + LegalizeAction Action = getTypeAction(N->getValueType(i)); + if (Action == Promote) { + PromoteResult(N, i); + goto NodeDone; + } else if (Action == Expand) { + ExpandResult(N, i); + goto NodeDone; + } else { + assert(Action == Legal && "Unknown action!"); + } + } while (++i < NumResults); + + // Scan the operand list for the node, handling any nodes with operands that + // are illegal. + { + unsigned NumOperands = N->getNumOperands(); + bool NeedsRevisit = false; + for (i = 0; i != NumOperands; ++i) { + LegalizeAction Action = getTypeAction(N->getOperand(i).getValueType()); + if (Action == Promote) { + NeedsRevisit = PromoteOperand(N, i); + break; + } else if (Action == Expand) { + NeedsRevisit = ExpandOperand(N, i); + break; + } else { + assert(Action == Legal && "Unknown action!"); + } + } + + // If the node needs revisitation, don't add all users to the worklist etc. + if (NeedsRevisit) + continue; + + if (i == NumOperands) + DEBUG(cerr << "Legally typed node: "; N->dump(&DAG); cerr << "\n"); + } +NodeDone: + + // If we reach here, the node was processed, potentially creating new nodes. + // Mark it as processed and add its users to the worklist as appropriate. + N->setNodeId(Processed); + + for (SDNode::use_iterator UI = N->use_begin(), E = N->use_end(); + UI != E; ++UI) { + SDNode *User = *UI; + int NodeID = User->getNodeId(); + assert(NodeID != ReadyToProcess && NodeID != Processed && + "Invalid node id for user of unprocessed node!"); + + // This node has two options: it can either be a new node or its Node ID + // may be a count of the number of operands it has that are not ready. + if (NodeID > 0) { + User->setNodeId(NodeID-1); + + // If this was the last use it was waiting on, add it to the ready list. + if (NodeID-1 == ReadyToProcess) + Worklist.push_back(User); + continue; + } + + // Otherwise, this node is new: this is the first operand of it that + // became ready. Its new NodeID is the number of operands it has minus 1 + // (as this node is now processed). + assert(NodeID == NewNode && "Unknown node ID!"); + User->setNodeId(User->getNumOperands()-1); + + // If the node only has a single operand, it is now ready. + if (User->getNumOperands() == 1) + Worklist.push_back(User); + } + } + + // If the root changed (e.g. it was a dead load, update the root). + DAG.setRoot(Dummy.getValue()); + + //DAG.viewGraph(); + + // Remove dead nodes. This is important to do for cleanliness but also before + // the checking loop below. Implicit folding by the DAG.getNode operators can + // cause unreachable nodes to be around with their flags set to new. + DAG.RemoveDeadNodes(); + + // In a debug build, scan all the nodes to make sure we found them all. This + // ensures that there are no cycles and that everything got processed. +#ifndef NDEBUG + for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), + E = DAG.allnodes_end(); I != E; ++I) { + if (I->getNodeId() == Processed) + continue; + cerr << "Unprocessed node: "; + I->dump(&DAG); cerr << "\n"; + + if (I->getNodeId() == NewNode) + cerr << "New node not 'noticed'?\n"; + else if (I->getNodeId() > 0) + cerr << "Operand not processed?\n"; + else if (I->getNodeId() == ReadyToProcess) + cerr << "Not added to worklist?\n"; + abort(); + } +#endif +} + +/// MarkNewNodes - The specified node is the root of a subtree of potentially +/// new nodes. Add the correct NodeId to mark it. +void DAGTypeLegalizer::MarkNewNodes(SDNode *N) { + // If this was an existing node that is already done, we're done. + if (N->getNodeId() != NewNode) + return; + + // Okay, we know that this node is new. Recursively walk all of its operands + // to see if they are new also. The depth of this walk is bounded by the size + // of the new tree that was constructed (usually 2-3 nodes), so we don't worry + // about revisitation of nodes. + // + // As we walk the operands, keep track of the number of nodes that are + // processed. If non-zero, this will become the new nodeid of this node. + unsigned NumProcessed = 0; + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { + int OpId = N->getOperand(i).Val->getNodeId(); + if (OpId == NewNode) + MarkNewNodes(N->getOperand(i).Val); + else if (OpId == Processed) + ++NumProcessed; + } + + N->setNodeId(N->getNumOperands()-NumProcessed); + if (N->getNodeId() == ReadyToProcess) + Worklist.push_back(N); +} + +/// ReplaceLegalValueWith - The specified value with a legal type was legalized +/// to the specified other value. If they are different, update the DAG and +/// NodeIDs replacing any uses of From to use To instead. +void DAGTypeLegalizer::ReplaceLegalValueWith(SDOperand From, SDOperand To) { + if (From == To) return; + + // If expansion produced new nodes, make sure they are properly marked. + if (To.Val->getNodeId() == NewNode) + MarkNewNodes(To.Val); + + // Anything that used the old node should now use the new one. Note that this + // can potentially cause recursive merging. + DAG.ReplaceAllUsesOfValueWith(From, To); + + // Since we just made an unstructured update to the DAG, which could wreak + // general havoc on anything that once used N and now uses Res, walk all users + // of the result, updating their flags. + for (SDNode::use_iterator I = To.Val->use_begin(), E = To.Val->use_end(); + I != E; ++I) { + SDNode *User = *I; + // If the node isn't already processed or in the worklist, mark it as new, + // then use MarkNewNodes to recompute its ID. + int NodeId = User->getNodeId(); + if (NodeId != ReadyToProcess && NodeId != Processed) { + User->setNodeId(NewNode); + MarkNewNodes(User); + } + } +} + +void DAGTypeLegalizer::SetPromotedOp(SDOperand Op, SDOperand Result) { + if (Result.Val->getNodeId() == NewNode) + MarkNewNodes(Result.Val); + + SDOperand &OpEntry = PromotedNodes[Op]; + assert(OpEntry.Val == 0 && "Node is already promoted!"); + OpEntry = Result; +} + + +void DAGTypeLegalizer::GetExpandedOp(SDOperand Op, SDOperand &Lo, + SDOperand &Hi) { + std::pair &Entry = ExpandedNodes[Op]; + assert(Entry.first.Val && "Operand isn't expanded"); + Lo = Entry.first; + Hi = Entry.second; +} + +void DAGTypeLegalizer::SetExpandedOp(SDOperand Op, SDOperand Lo, + SDOperand Hi) { + // Remember that this is the result of the node. + std::pair &Entry = ExpandedNodes[Op]; + assert(Entry.first.Val == 0 && "Node already expanded"); + Entry.first = Lo; + Entry.second = Hi; + + // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. + if (Lo.Val->getNodeId() == NewNode) + MarkNewNodes(Lo.Val); + if (Hi.Val->getNodeId() == NewNode) + MarkNewNodes(Hi.Val); +} + +//===----------------------------------------------------------------------===// +// Result Promotion +//===----------------------------------------------------------------------===// + +/// PromoteResult - This method is called when a result of a node is found to be +/// in need of promotion to a larger type. At this point, the node may also +/// have invalid operands or may have other results that need expansion, we just +/// know that (at least) the one result needs promotion. +void DAGTypeLegalizer::PromoteResult(SDNode *N, unsigned ResNo) { + DEBUG(cerr << "Promote node result: "; N->dump(&DAG); cerr << "\n"); + SDOperand Result = SDOperand(); + + switch (N->getOpcode()) { + default: +#ifndef NDEBUG + cerr << "PromoteResult #" << ResNo << ": "; + N->dump(&DAG); cerr << "\n"; +#endif + assert(0 && "Do not know how to promote this operator!"); + abort(); + case ISD::UNDEF: Result = PromoteResult_UNDEF(N); break; + case ISD::Constant: Result = PromoteResult_Constant(N); break; + + case ISD::TRUNCATE: Result = PromoteResult_TRUNCATE(N); break; + case ISD::SIGN_EXTEND: + case ISD::ZERO_EXTEND: + case ISD::ANY_EXTEND: Result = PromoteResult_INT_EXTEND(N); break; + case ISD::FP_ROUND: Result = PromoteResult_FP_ROUND(N); break; + + case ISD::SETCC: Result = PromoteResult_SETCC(N); break; + case ISD::LOAD: Result = PromoteResult_LOAD(cast(N)); break; + + case ISD::AND: + case ISD::OR: + case ISD::XOR: + case ISD::ADD: + case ISD::SUB: + case ISD::MUL: Result = PromoteResult_SimpleIntBinOp(N); break; + } + + // If Result is null, the sub-method took care of registering the result. + if (Result.Val) + SetPromotedOp(SDOperand(N, ResNo), Result); +} + +SDOperand DAGTypeLegalizer::PromoteResult_UNDEF(SDNode *N) { + return DAG.getNode(ISD::UNDEF, TLI.getTypeToTransformTo(N->getValueType(0))); +} + +SDOperand DAGTypeLegalizer::PromoteResult_Constant(SDNode *N) { + MVT::ValueType VT = N->getValueType(0); + // Zero extend things like i1, sign extend everything else. It shouldn't + // matter in theory which one we pick, but this tends to give better code? + unsigned Opc = VT != MVT::i1 ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; + SDOperand Result = DAG.getNode(Opc, TLI.getTypeToTransformTo(VT), + SDOperand(N, 0)); + assert(isa(Result) && "Didn't constant fold ext?"); + return Result; +} + +SDOperand DAGTypeLegalizer::PromoteResult_TRUNCATE(SDNode *N) { + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + switch (getTypeAction(N->getOperand(0).getValueType())) { + default: assert(0 && "Unknown type action!"); + case Legal: { + SDOperand Res = N->getOperand(0); + assert(Res.getValueType() >= NVT && "Truncation doesn't make sense!"); + if (Res.getValueType() > NVT) // Truncate to NVT instead of VT + return DAG.getNode(ISD::TRUNCATE, NVT, Res); + return Res; + } + case Promote: + // The truncation is not required, because we don't guarantee anything + // about high bits anyway. + return GetPromotedOp(N->getOperand(0)); + case Expand: + // Truncate the low part of the expanded value to the result type + SDOperand Lo, Hi; + GetExpandedOp(N->getOperand(0), Lo, Hi); + return DAG.getNode(ISD::TRUNCATE, NVT, Lo); + } +} +SDOperand DAGTypeLegalizer::PromoteResult_INT_EXTEND(SDNode *N) { + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + switch (getTypeAction(N->getOperand(0).getValueType())) { + default: assert(0 && "BUG: Smaller reg should have been promoted!"); + case Legal: + // Input is legal? Just do extend all the way to the larger type. + return DAG.getNode(N->getOpcode(), NVT, N->getOperand(0)); + case Promote: + // Get promoted operand if it is smaller. + SDOperand Res = GetPromotedOp(N->getOperand(0)); + // The high bits are not guaranteed to be anything. Insert an extend. + if (N->getOpcode() == ISD::SIGN_EXTEND) + return DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Res, + DAG.getValueType(N->getOperand(0).getValueType())); + if (N->getOpcode() == ISD::ZERO_EXTEND) + return DAG.getZeroExtendInReg(Res, N->getOperand(0).getValueType()); + assert(N->getOpcode() == ISD::ANY_EXTEND && "Unknown integer extension!"); + return Res; + } +} + +SDOperand DAGTypeLegalizer::PromoteResult_FP_ROUND(SDNode *N) { + // NOTE: Assumes input is legal. + return DAG.getNode(ISD::FP_ROUND_INREG, N->getOperand(0).getValueType(), + N->getOperand(0), DAG.getValueType(N->getValueType(0))); +} + + +SDOperand DAGTypeLegalizer::PromoteResult_SETCC(SDNode *N) { + assert(isTypeLegal(TLI.getSetCCResultTy()) && "SetCC type is not legal??"); + return DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), N->getOperand(0), + N->getOperand(1), N->getOperand(2)); +} + +SDOperand DAGTypeLegalizer::PromoteResult_LOAD(LoadSDNode *N) { + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + ISD::LoadExtType ExtType = + ISD::isNON_EXTLoad(N) ? ISD::EXTLOAD : N->getExtensionType(); + SDOperand Res = DAG.getExtLoad(ExtType, NVT, N->getChain(), N->getBasePtr(), + N->getSrcValue(), N->getSrcValueOffset(), + N->getLoadedVT(), N->isVolatile(), + N->getAlignment()); + + // Legalized the chain result, switching anything that used the old chain to + // use the new one. + ReplaceLegalValueWith(SDOperand(N, 1), Res.getValue(1)); + return Res; +} + +SDOperand DAGTypeLegalizer::PromoteResult_SimpleIntBinOp(SDNode *N) { + // The input may have strange things in the top bits of the registers, but + // these operations don't care. They may have weird bits going out, but + // that too is okay if they are integer operations. + SDOperand LHS = GetPromotedOp(N->getOperand(0)); + SDOperand RHS = GetPromotedOp(N->getOperand(1)); + return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS); +} + +//===----------------------------------------------------------------------===// +// Result Expansion +//===----------------------------------------------------------------------===// + +/// ExpandResult - This method is called when the specified result of the +/// specified node is found to need expansion. At this point, the node may also +/// have invalid operands or may have other results that need promotion, we just +/// know that (at least) the one result needs expansion. +void DAGTypeLegalizer::ExpandResult(SDNode *N, unsigned ResNo) { + DEBUG(cerr << "Expand node result: "; N->dump(&DAG); cerr << "\n"); + SDOperand Lo, Hi; + Lo = Hi = SDOperand(); + switch (N->getOpcode()) { + default: +#ifndef NDEBUG + cerr << "ExpandResult #" << ResNo << ": "; + N->dump(&DAG); cerr << "\n"; +#endif + assert(0 && "Do not know how to expand this operator!"); + abort(); + + case ISD::UNDEF: ExpandResult_UNDEF(N, Lo, Hi); break; + case ISD::Constant: ExpandResult_Constant(N, Lo, Hi); break; + case ISD::BUILD_PAIR: ExpandResult_BUILD_PAIR(N, Lo, Hi); break; + case ISD::ANY_EXTEND: ExpandResult_ANY_EXTEND(N, Lo, Hi); break; + case ISD::ZERO_EXTEND: ExpandResult_ZERO_EXTEND(N, Lo, Hi); break; + case ISD::SIGN_EXTEND: ExpandResult_SIGN_EXTEND(N, Lo, Hi); break; + case ISD::LOAD: ExpandResult_LOAD(cast(N), Lo, Hi); break; + + case ISD::AND: + case ISD::OR: + case ISD::XOR: ExpandResult_Logical(N, Lo, Hi); break; + case ISD::ADD: + case ISD::SUB: ExpandResult_ADDSUB(N, Lo, Hi); break; + case ISD::SELECT: ExpandResult_SELECT(N, Lo, Hi); break; + case ISD::SELECT_CC: ExpandResult_SELECT_CC(N, Lo, Hi); break; + case ISD::MUL: ExpandResult_MUL(N, Lo, Hi); break; + case ISD::SHL: + case ISD::SRA: + case ISD::SRL: ExpandResult_Shift(N, Lo, Hi); break; + + } + + // If Lo/Hi is null, the sub-method took care of registering results etc. + if (Lo.Val) + SetExpandedOp(SDOperand(N, ResNo), Lo, Hi); +} + +void DAGTypeLegalizer::ExpandResult_UNDEF(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + Lo = Hi = DAG.getNode(ISD::UNDEF, NVT); +} + +void DAGTypeLegalizer::ExpandResult_Constant(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + uint64_t Cst = cast(N)->getValue(); + Lo = DAG.getConstant(Cst, NVT); + Hi = DAG.getConstant(Cst >> MVT::getSizeInBits(NVT), NVT); +} + +void DAGTypeLegalizer::ExpandResult_BUILD_PAIR(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + // Return the operands. + Lo = N->getOperand(0); + Hi = N->getOperand(1); +} + +void DAGTypeLegalizer::ExpandResult_ANY_EXTEND(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + + MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + // The low part is any extension of the input (which degenerates to a copy). + Lo = DAG.getNode(ISD::ANY_EXTEND, NVT, N->getOperand(0)); + Hi = DAG.getNode(ISD::UNDEF, NVT); // The high part is undefined. +} + +void DAGTypeLegalizer::ExpandResult_ZERO_EXTEND(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + // The low part is zero extension of the input (which degenerates to a copy). + Lo = DAG.getNode(ISD::ZERO_EXTEND, NVT, N->getOperand(0)); + Hi = DAG.getConstant(0, NVT); // The high part is just a zero. +} + +void DAGTypeLegalizer::ExpandResult_SIGN_EXTEND(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + // The low part is sign extension of the input (which degenerates to a copy). + Lo = DAG.getNode(ISD::SIGN_EXTEND, NVT, N->getOperand(0)); + + // The high part is obtained by SRA'ing all but one of the bits of low part. + unsigned LoSize = MVT::getSizeInBits(NVT); + Hi = DAG.getNode(ISD::SRA, NVT, Lo, + DAG.getConstant(LoSize-1, TLI.getShiftAmountTy())); +} + + +void DAGTypeLegalizer::ExpandResult_LOAD(LoadSDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType VT = N->getValueType(0); + MVT::ValueType NVT = TLI.getTypeToExpandTo(VT); + SDOperand Ch = N->getChain(); // Legalize the chain. + SDOperand Ptr = N->getBasePtr(); // Legalize the pointer. + ISD::LoadExtType ExtType = N->getExtensionType(); + int SVOffset = N->getSrcValueOffset(); + unsigned Alignment = N->getAlignment(); + bool isVolatile = N->isVolatile(); + + if (ExtType == ISD::NON_EXTLOAD) { + Lo = DAG.getLoad(NVT, Ch, Ptr, N->getSrcValue(), SVOffset, + isVolatile, Alignment); + if (VT == MVT::f32 || VT == MVT::f64) { + assert(0 && "FIXME: softfp should use promotion!"); +#if 0 + // f32->i32 or f64->i64 one to one expansion. + // Remember that we legalized the chain. + AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Lo.getValue(1))); + // Recursively expand the new load. + if (getTypeAction(NVT) == Expand) + ExpandOp(Lo, Lo, Hi); + break; +#endif + } + + // Increment the pointer to the other half. + unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8; + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + getIntPtrConstant(IncrementSize)); + Hi = DAG.getLoad(NVT, Ch, Ptr, N->getSrcValue(), SVOffset+IncrementSize, + isVolatile, std::max(Alignment, IncrementSize)); + + // Build a factor node to remember that this load is independent of the + // other one. + Ch = DAG.getNode(ISD::TokenFactor, MVT::Other, Lo.getValue(1), + Hi.getValue(1)); + + // Handle endianness of the load. + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); + } else { + MVT::ValueType EVT = N->getLoadedVT(); + + if (VT == MVT::f64 && EVT == MVT::f32) { + assert(0 && "FIXME: softfp should use promotion!"); +#if 0 + // f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND + SDOperand Load = DAG.getLoad(EVT, Ch, Ptr, N->getSrcValue(), + SVOffset, isVolatile, Alignment); + // Remember that we legalized the chain. + AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Load.getValue(1))); + ExpandOp(DAG.getNode(ISD::FP_EXTEND, VT, Load), Lo, Hi); + break; +#endif + } + + if (EVT == NVT) + Lo = DAG.getLoad(NVT, Ch, Ptr, N->getSrcValue(), + SVOffset, isVolatile, Alignment); + else + Lo = DAG.getExtLoad(ExtType, NVT, Ch, Ptr, N->getSrcValue(), + SVOffset, EVT, isVolatile, + Alignment); + // Remember the chain. + Ch = Lo.getValue(1); + + if (ExtType == ISD::SEXTLOAD) { + // The high part is obtained by SRA'ing all but one of the bits of the + // lo part. + unsigned LoSize = MVT::getSizeInBits(Lo.getValueType()); + Hi = DAG.getNode(ISD::SRA, NVT, Lo, + DAG.getConstant(LoSize-1, TLI.getShiftAmountTy())); + } else if (ExtType == ISD::ZEXTLOAD) { + // The high part is just a zero. + Hi = DAG.getConstant(0, NVT); + } else { + assert(ExtType == ISD::EXTLOAD && "Unknown extload!"); + // The high part is undefined. + Hi = DAG.getNode(ISD::UNDEF, NVT); + } + } + + // Legalized the chain result, switching anything that used the old chain to + // use the new one. + ReplaceLegalValueWith(SDOperand(N, 1), Ch); +} + + +void DAGTypeLegalizer::ExpandResult_Logical(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + SDOperand LL, LH, RL, RH; + GetExpandedOp(N->getOperand(0), LL, LH); + GetExpandedOp(N->getOperand(1), RL, RH); + Lo = DAG.getNode(N->getOpcode(), LL.getValueType(), LL, RL); + Hi = DAG.getNode(N->getOpcode(), LL.getValueType(), LH, RH); +} + +void DAGTypeLegalizer::ExpandResult_SELECT(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + SDOperand LL, LH, RL, RH; + GetExpandedOp(N->getOperand(1), LL, LH); + GetExpandedOp(N->getOperand(2), RL, RH); + Lo = DAG.getNode(ISD::SELECT, LL.getValueType(), N->getOperand(0), LL, RL); + + assert(N->getOperand(0).getValueType() != MVT::f32 && + "FIXME: softfp shouldn't use expand!"); + Hi = DAG.getNode(ISD::SELECT, LL.getValueType(), N->getOperand(0), LH, RH); +} + +void DAGTypeLegalizer::ExpandResult_SELECT_CC(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + SDOperand LL, LH, RL, RH; + GetExpandedOp(N->getOperand(2), LL, LH); + GetExpandedOp(N->getOperand(3), RL, RH); + Lo = DAG.getNode(ISD::SELECT_CC, LL.getValueType(), N->getOperand(0), + N->getOperand(1), LL, RL, N->getOperand(4)); + + assert(N->getOperand(0).getValueType() != MVT::f32 && + "FIXME: softfp shouldn't use expand!"); + Hi = DAG.getNode(ISD::SELECT_CC, LL.getValueType(), N->getOperand(0), + N->getOperand(1), LH, RH, N->getOperand(4)); +} + +void DAGTypeLegalizer::ExpandResult_ADDSUB(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType VT = N->getValueType(0); + + // If the target wants to custom expand this, let them. + if (TLI.getOperationAction(N->getOpcode(), VT) == + TargetLowering::Custom) { + SDOperand Op = TLI.LowerOperation(SDOperand(N, 0), DAG); + // FIXME: Do a replace all uses with here! + assert(0 && "Custom not impl yet!"); + if (Op.Val) { +#if 0 + ExpandOp(Op, Lo, Hi); +#endif + return; + } + } + + // Expand the subcomponents. + SDOperand LHSL, LHSH, RHSL, RHSH; + GetExpandedOp(N->getOperand(0), LHSL, LHSH); + GetExpandedOp(N->getOperand(1), RHSL, RHSH); + SDVTList VTList = DAG.getVTList(LHSL.getValueType(), MVT::Flag); + SDOperand LoOps[2], HiOps[3]; + LoOps[0] = LHSL; + LoOps[1] = RHSL; + HiOps[0] = LHSH; + HiOps[1] = RHSH; + if (N->getOpcode() == ISD::ADD) { + Lo = DAG.getNode(ISD::ADDC, VTList, LoOps, 2); + HiOps[2] = Lo.getValue(1); + Hi = DAG.getNode(ISD::ADDE, VTList, HiOps, 3); + } else { + Lo = DAG.getNode(ISD::SUBC, VTList, LoOps, 2); + HiOps[2] = Lo.getValue(1); + Hi = DAG.getNode(ISD::SUBE, VTList, HiOps, 3); + } +} + + +void DAGTypeLegalizer::ExpandResult_MUL(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType VT = N->getValueType(0); + MVT::ValueType NVT = TLI.getTypeToExpandTo(VT); + + // If the target wants to custom expand this, let them. + if (TLI.getOperationAction(ISD::MUL, VT) == TargetLowering::Custom) { + SDOperand New = TLI.LowerOperation(SDOperand(N, 0), DAG); + if (New.Val) { + // FIXME: Do a replace all uses with here! + assert(0 && "Custom not impl yet!"); +#if 0 + ExpandOp(New, Lo, Hi); +#endif + return; + } + } + + bool HasMULHS = TLI.isOperationLegal(ISD::MULHS, NVT); + bool HasMULHU = TLI.isOperationLegal(ISD::MULHU, NVT); + bool HasSMUL_LOHI = TLI.isOperationLegal(ISD::SMUL_LOHI, NVT); + bool HasUMUL_LOHI = TLI.isOperationLegal(ISD::UMUL_LOHI, NVT); + if (HasMULHU || HasMULHS || HasUMUL_LOHI || HasSMUL_LOHI) { + SDOperand LL, LH, RL, RH; + GetExpandedOp(N->getOperand(0), LL, LH); + GetExpandedOp(N->getOperand(1), RL, RH); + unsigned BitSize = MVT::getSizeInBits(RH.getValueType()); + unsigned LHSSB = DAG.ComputeNumSignBits(N->getOperand(0)); + unsigned RHSSB = DAG.ComputeNumSignBits(N->getOperand(1)); + + // FIXME: generalize this to handle other bit sizes + if (LHSSB == 32 && RHSSB == 32 && + DAG.MaskedValueIsZero(N->getOperand(0), 0xFFFFFFFF00000000ULL) && + DAG.MaskedValueIsZero(N->getOperand(1), 0xFFFFFFFF00000000ULL)) { + // The inputs are both zero-extended. + if (HasUMUL_LOHI) { + // We can emit a umul_lohi. + Lo = DAG.getNode(ISD::UMUL_LOHI, DAG.getVTList(NVT, NVT), LL, RL); + Hi = SDOperand(Lo.Val, 1); + return; + } + if (HasMULHU) { + // We can emit a mulhu+mul. + Lo = DAG.getNode(ISD::MUL, NVT, LL, RL); + Hi = DAG.getNode(ISD::MULHU, NVT, LL, RL); + return; + } + } + if (LHSSB > BitSize && RHSSB > BitSize) { + // The input values are both sign-extended. + if (HasSMUL_LOHI) { + // We can emit a smul_lohi. + Lo = DAG.getNode(ISD::SMUL_LOHI, DAG.getVTList(NVT, NVT), LL, RL); + Hi = SDOperand(Lo.Val, 1); + return; + } + if (HasMULHS) { + // We can emit a mulhs+mul. + Lo = DAG.getNode(ISD::MUL, NVT, LL, RL); + Hi = DAG.getNode(ISD::MULHS, NVT, LL, RL); + return; + } + } + if (HasUMUL_LOHI) { + // Lo,Hi = umul LHS, RHS. + SDOperand UMulLOHI = DAG.getNode(ISD::UMUL_LOHI, + DAG.getVTList(NVT, NVT), LL, RL); + Lo = UMulLOHI; + Hi = UMulLOHI.getValue(1); + RH = DAG.getNode(ISD::MUL, NVT, LL, RH); + LH = DAG.getNode(ISD::MUL, NVT, LH, RL); + Hi = DAG.getNode(ISD::ADD, NVT, Hi, RH); + Hi = DAG.getNode(ISD::ADD, NVT, Hi, LH); + return; + } + } + + abort(); +#if 0 // FIXME! + // If nothing else, we can make a libcall. + Lo = ExpandLibCall(TLI.getLibcallName(RTLIB::MUL_I64), N, + false/*sign irrelevant*/, Hi); +#endif +} + + +void DAGTypeLegalizer::ExpandResult_Shift(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType VT = N->getValueType(0); + + // If the target wants custom lowering, do so. + if (TLI.getOperationAction(N->getOpcode(), VT) == TargetLowering::Custom) { + SDOperand Op = TLI.LowerOperation(SDOperand(N, 0), DAG); + if (Op.Val) { + // Now that the custom expander is done, expand the result, which is + // still VT. + // FIXME: Do a replace all uses with here! + abort(); +#if 0 + ExpandOp(Op, Lo, Hi); +#endif + return; + } + } + + // If we can emit an efficient shift operation, do so now. Check to see if + // the RHS is a constant. + if (ConstantSDNode *CN = dyn_cast(N->getOperand(1))) + return ExpandShiftByConstant(N, CN->getValue(), Lo, Hi); + + // If we can determine that the high bit of the shift is zero or one, even if + // the low bits are variable, emit this shift in an optimized form. + if (ExpandShiftWithKnownAmountBit(N, Lo, Hi)) + return; + + // If this target supports shift_PARTS, use it. First, map to the _PARTS opc. + unsigned PartsOpc; + if (N->getOpcode() == ISD::SHL) + PartsOpc = ISD::SHL_PARTS; + else if (N->getOpcode() == ISD::SRL) + PartsOpc = ISD::SRL_PARTS; + else { + assert(N->getOpcode() == ISD::SRA && "Unknown shift!"); + PartsOpc = ISD::SRA_PARTS; + } + + // Next check to see if the target supports this SHL_PARTS operation or if it + // will custom expand it. + MVT::ValueType NVT = TLI.getTypeToExpandTo(VT); + TargetLowering::LegalizeAction Action = TLI.getOperationAction(PartsOpc, NVT); + if ((Action == TargetLowering::Legal && TLI.isTypeLegal(NVT)) || + Action == TargetLowering::Custom) { + // Expand the subcomponents. + SDOperand LHSL, LHSH; + GetExpandedOp(N->getOperand(0), LHSL, LHSH); + + SDOperand Ops[] = { LHSL, LHSH, N->getOperand(1) }; + MVT::ValueType VT = LHSL.getValueType(); + Lo = DAG.getNode(PartsOpc, DAG.getNodeValueTypes(VT, VT), 2, Ops, 3); + Hi = Lo.getValue(1); + return; + } + + abort(); +#if 0 // FIXME! + // Otherwise, emit a libcall. + unsigned RuntimeCode = ; // SRL -> SRL_I64 etc. + bool Signed = ; + Lo = ExpandLibCall(TLI.getLibcallName(RTLIB::SRL_I64), N, + false/*lshr is unsigned*/, Hi); +#endif +} + + +/// ExpandShiftByConstant - N is a shift by a value that needs to be expanded, +/// and the shift amount is a constant 'Amt'. Expand the operation. +void DAGTypeLegalizer::ExpandShiftByConstant(SDNode *N, unsigned Amt, + SDOperand &Lo, SDOperand &Hi) { + // Expand the incoming operand to be shifted, so that we have its parts + SDOperand InL, InH; + GetExpandedOp(N->getOperand(0), InL, InH); + + MVT::ValueType NVT = InL.getValueType(); + unsigned VTBits = MVT::getSizeInBits(N->getValueType(0)); + unsigned NVTBits = MVT::getSizeInBits(NVT); + MVT::ValueType ShTy = N->getOperand(1).getValueType(); + + if (N->getOpcode() == ISD::SHL) { + if (Amt > VTBits) { + Lo = Hi = DAG.getConstant(0, NVT); + } else if (Amt > NVTBits) { + Lo = DAG.getConstant(0, NVT); + Hi = DAG.getNode(ISD::SHL, NVT, InL, DAG.getConstant(Amt-NVTBits,ShTy)); + } else if (Amt == NVTBits) { + Lo = DAG.getConstant(0, NVT); + Hi = InL; + } else { + Lo = DAG.getNode(ISD::SHL, NVT, InL, DAG.getConstant(Amt, ShTy)); + Hi = DAG.getNode(ISD::OR, NVT, + DAG.getNode(ISD::SHL, NVT, InH, + DAG.getConstant(Amt, ShTy)), + DAG.getNode(ISD::SRL, NVT, InL, + DAG.getConstant(NVTBits-Amt, ShTy))); + } + return; + } + + if (N->getOpcode() == ISD::SRL) { + if (Amt > VTBits) { + Lo = DAG.getConstant(0, NVT); + Hi = DAG.getConstant(0, NVT); + } else if (Amt > NVTBits) { + Lo = DAG.getNode(ISD::SRL, NVT, InH, DAG.getConstant(Amt-NVTBits,ShTy)); + Hi = DAG.getConstant(0, NVT); + } else if (Amt == NVTBits) { + Lo = InH; + Hi = DAG.getConstant(0, NVT); + } else { + Lo = DAG.getNode(ISD::OR, NVT, + DAG.getNode(ISD::SRL, NVT, InL, + DAG.getConstant(Amt, ShTy)), + DAG.getNode(ISD::SHL, NVT, InH, + DAG.getConstant(NVTBits-Amt, ShTy))); + Hi = DAG.getNode(ISD::SRL, NVT, InH, DAG.getConstant(Amt, ShTy)); + } + return; + } + + assert(N->getOpcode() == ISD::SRA && "Unknown shift!"); + if (Amt > VTBits) { + Hi = Lo = DAG.getNode(ISD::SRA, NVT, InH, + DAG.getConstant(NVTBits-1, ShTy)); + } else if (Amt > NVTBits) { + Lo = DAG.getNode(ISD::SRA, NVT, InH, + DAG.getConstant(Amt-NVTBits, ShTy)); + Hi = DAG.getNode(ISD::SRA, NVT, InH, + DAG.getConstant(NVTBits-1, ShTy)); + } else if (Amt == NVTBits) { + Lo = InH; + Hi = DAG.getNode(ISD::SRA, NVT, InH, + DAG.getConstant(NVTBits-1, ShTy)); + } else { + Lo = DAG.getNode(ISD::OR, NVT, + DAG.getNode(ISD::SRL, NVT, InL, + DAG.getConstant(Amt, ShTy)), + DAG.getNode(ISD::SHL, NVT, InH, + DAG.getConstant(NVTBits-Amt, ShTy))); + Hi = DAG.getNode(ISD::SRA, NVT, InH, DAG.getConstant(Amt, ShTy)); + } +} + +/// ExpandShiftWithKnownAmountBit - Try to determine whether we can simplify +/// this shift based on knowledge of the high bit of the shift amount. If we +/// can tell this, we know that it is >= 32 or < 32, without knowing the actual +/// shift amount. +bool DAGTypeLegalizer:: +ExpandShiftWithKnownAmountBit(SDNode *N, SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + unsigned NVTBits = MVT::getSizeInBits(NVT); + + uint64_t HighBitMask = NVTBits, KnownZero, KnownOne; + DAG.ComputeMaskedBits(N->getOperand(1), HighBitMask, KnownZero, KnownOne); + + // If we don't know anything about the high bit, exit. + if (((KnownZero|KnownOne) & HighBitMask) == 0) + return false; + + // Get the incoming operand to be shifted. + SDOperand InL, InH; + GetExpandedOp(N->getOperand(0), InL, InH); + SDOperand Amt = N->getOperand(1); + + // If we know that the high bit of the shift amount is one, then we can do + // this as a couple of simple shifts. + if (KnownOne & HighBitMask) { + // Mask out the high bit, which we know is set. + Amt = DAG.getNode(ISD::AND, Amt.getValueType(), Amt, + DAG.getConstant(NVTBits-1, Amt.getValueType())); + + switch (N->getOpcode()) { + default: assert(0 && "Unknown shift"); + case ISD::SHL: + Lo = DAG.getConstant(0, NVT); // Low part is zero. + Hi = DAG.getNode(ISD::SHL, NVT, InL, Amt); // High part from Lo part. + return true; + case ISD::SRL: + Hi = DAG.getConstant(0, NVT); // Hi part is zero. + Lo = DAG.getNode(ISD::SRL, NVT, InH, Amt); // Lo part from Hi part. + return true; + case ISD::SRA: + Hi = DAG.getNode(ISD::SRA, NVT, InH, // Sign extend high part. + DAG.getConstant(NVTBits-1, Amt.getValueType())); + Lo = DAG.getNode(ISD::SRA, NVT, InH, Amt); // Lo part from Hi part. + return true; + } + } + + // If we know that the high bit of the shift amount is zero, then we can do + // this as a couple of simple shifts. + assert((KnownZero & HighBitMask) && "Bad mask computation above"); + + // Compute 32-amt. + SDOperand Amt2 = DAG.getNode(ISD::SUB, Amt.getValueType(), + DAG.getConstant(NVTBits, Amt.getValueType()), + Amt); + unsigned Op1, Op2; + switch (N->getOpcode()) { + default: assert(0 && "Unknown shift"); + case ISD::SHL: Op1 = ISD::SHL; Op2 = ISD::SRL; break; + case ISD::SRL: + case ISD::SRA: Op1 = ISD::SRL; Op2 = ISD::SHL; break; + } + + Lo = DAG.getNode(N->getOpcode(), NVT, InL, Amt); + Hi = DAG.getNode(ISD::OR, NVT, + DAG.getNode(Op1, NVT, InH, Amt), + DAG.getNode(Op2, NVT, InL, Amt2)); + return true; +} + +//===----------------------------------------------------------------------===// +// Operand Promotion +//===----------------------------------------------------------------------===// + +/// PromoteOperand - This method is called when the specified operand of the +/// specified node is found to need promotion. At this point, all of the result +/// types of the node are known to be legal, but other operands of the node may +/// need promotion or expansion as well as the specified one. +bool DAGTypeLegalizer::PromoteOperand(SDNode *N, unsigned OpNo) { + DEBUG(cerr << "Promote node operand: "; N->dump(&DAG); cerr << "\n"); + SDOperand Res; + switch (N->getOpcode()) { + default: +#ifndef NDEBUG + cerr << "PromoteOperand Op #" << OpNo << ": "; + N->dump(&DAG); cerr << "\n"; +#endif + assert(0 && "Do not know how to promote this operator's operand!"); + abort(); + + case ISD::ANY_EXTEND: Res = PromoteOperand_ANY_EXTEND(N); break; + case ISD::ZERO_EXTEND: Res = PromoteOperand_ZERO_EXTEND(N); break; + case ISD::SIGN_EXTEND: Res = PromoteOperand_SIGN_EXTEND(N); break; + case ISD::FP_EXTEND: Res = PromoteOperand_FP_EXTEND(N); break; + case ISD::FP_ROUND: Res = PromoteOperand_FP_ROUND(N); break; + + case ISD::SELECT: Res = PromoteOperand_SELECT(N, OpNo); break; + case ISD::BRCOND: Res = PromoteOperand_BRCOND(N, OpNo); break; + case ISD::STORE: Res = PromoteOperand_STORE(cast(N), + OpNo); break; + } + + // If the result is null, the sub-method took care of registering results etc. + if (!Res.Val) return false; + // If the result is N, the sub-method updated N in place. + if (Res.Val == N) { + // Mark N as new and remark N and its operands. This allows us to correctly + // revisit N if it needs another step of promotion and allows us to visit + // any new operands to N. + N->setNodeId(NewNode); + MarkNewNodes(N); + return true; + } + + assert(Res.getValueType() == N->getValueType(0) && N->getNumValues() == 1 && + "Invalid operand expansion"); + + ReplaceLegalValueWith(SDOperand(N, 0), Res); + return false; +} + +SDOperand DAGTypeLegalizer::PromoteOperand_ANY_EXTEND(SDNode *N) { + SDOperand Op = GetPromotedOp(N->getOperand(0)); + return DAG.getNode(ISD::ANY_EXTEND, N->getValueType(0), Op); +} + +SDOperand DAGTypeLegalizer::PromoteOperand_ZERO_EXTEND(SDNode *N) { + SDOperand Op = GetPromotedOp(N->getOperand(0)); + Op = DAG.getNode(ISD::ANY_EXTEND, N->getValueType(0), Op); + return DAG.getZeroExtendInReg(Op, N->getOperand(0).getValueType()); +} +SDOperand DAGTypeLegalizer::PromoteOperand_SIGN_EXTEND(SDNode *N) { + SDOperand Op = GetPromotedOp(N->getOperand(0)); + Op = DAG.getNode(ISD::ANY_EXTEND, N->getValueType(0), Op); + return DAG.getNode(ISD::SIGN_EXTEND_INREG, Op.getValueType(), + Op, DAG.getValueType(N->getOperand(0).getValueType())); +} + +SDOperand DAGTypeLegalizer::PromoteOperand_FP_EXTEND(SDNode *N) { + SDOperand Op = GetPromotedOp(N->getOperand(0)); + return DAG.getNode(ISD::FP_EXTEND, N->getValueType(0), Op); +} +SDOperand DAGTypeLegalizer::PromoteOperand_FP_ROUND(SDNode *N) { + SDOperand Op = GetPromotedOp(N->getOperand(0)); + return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Op); +} + + +SDOperand DAGTypeLegalizer::PromoteOperand_SELECT(SDNode *N, unsigned OpNo) { + assert(OpNo == 0 && "Only know how to promote condition"); + SDOperand Cond = GetPromotedOp(N->getOperand(0)); // Promote the condition. + + // The top bits of the promoted condition are not necessarily zero, ensure + // that the value is properly zero extended. + if (!DAG.MaskedValueIsZero(Cond, + MVT::getIntVTBitMask(Cond.getValueType())^1)) { + Cond = DAG.getZeroExtendInReg(Cond, MVT::i1); + MarkNewNodes(Cond.Val); + } + + // The chain (Op#0) and basic block destination (Op#2) are always legal types. + return DAG.UpdateNodeOperands(SDOperand(N, 0), Cond, N->getOperand(1), + N->getOperand(2)); +} + + +SDOperand DAGTypeLegalizer::PromoteOperand_BRCOND(SDNode *N, unsigned OpNo) { + assert(OpNo == 1 && "only know how to promote condition"); + SDOperand Cond = GetPromotedOp(N->getOperand(1)); // Promote the condition. + + // The top bits of the promoted condition are not necessarily zero, ensure + // that the value is properly zero extended. + if (!DAG.MaskedValueIsZero(Cond, + MVT::getIntVTBitMask(Cond.getValueType())^1)) { + Cond = DAG.getZeroExtendInReg(Cond, MVT::i1); + MarkNewNodes(Cond.Val); + } + + // The chain (Op#0) and basic block destination (Op#2) are always legal types. + return DAG.UpdateNodeOperands(SDOperand(N, 0), N->getOperand(0), Cond, + N->getOperand(2)); +} + +SDOperand DAGTypeLegalizer::PromoteOperand_STORE(StoreSDNode *N, unsigned OpNo){ + SDOperand Ch = N->getChain(), Ptr = N->getBasePtr(); + int SVOffset = N->getSrcValueOffset(); + unsigned Alignment = N->getAlignment(); + bool isVolatile = N->isVolatile(); + + SDOperand Val = GetPromotedOp(N->getValue()); // Get promoted value. + + assert(!N->isTruncatingStore() && "Cannot promote this store operand!"); + + // Truncate the value and store the result. + return DAG.getTruncStore(Ch, Val, Ptr, N->getSrcValue(), + SVOffset, N->getStoredVT(), + isVolatile, Alignment); +} + + +//===----------------------------------------------------------------------===// +// Operand Expansion +//===----------------------------------------------------------------------===// + +/// ExpandOperand - This method is called when the specified operand of the +/// specified node is found to need expansion. At this point, all of the result +/// types of the node are known to be legal, but other operands of the node may +/// need promotion or expansion as well as the specified one. +bool DAGTypeLegalizer::ExpandOperand(SDNode *N, unsigned OpNo) { + DEBUG(cerr << "Expand node operand: "; N->dump(&DAG); cerr << "\n"); + SDOperand Res; + switch (N->getOpcode()) { + default: +#ifndef NDEBUG + cerr << "ExpandOperand Op #" << OpNo << ": "; + N->dump(&DAG); cerr << "\n"; +#endif + assert(0 && "Do not know how to expand this operator's operand!"); + abort(); + + case ISD::TRUNCATE: Res = ExpandOperand_TRUNCATE(N); break; + case ISD::EXTRACT_ELEMENT: Res = ExpandOperand_EXTRACT_ELEMENT(N); break; + case ISD::SETCC: Res = ExpandOperand_SETCC(N); break; + + case ISD::STORE: Res = ExpandOperand_STORE(cast(N), OpNo); break; + } + + // If the result is null, the sub-method took care of registering results etc. + if (!Res.Val) return false; + // If the result is N, the sub-method updated N in place. Check to see if any + // operands are new, and if so, mark them. + if (Res.Val == N) { + // Mark N as new and remark N and its operands. This allows us to correctly + // revisit N if it needs another step of promotion and allows us to visit + // any new operands to N. + N->setNodeId(NewNode); + MarkNewNodes(N); + return true; + } + + assert(Res.getValueType() == N->getValueType(0) && N->getNumValues() == 1 && + "Invalid operand expansion"); + + ReplaceLegalValueWith(SDOperand(N, 0), Res); + return false; +} + +SDOperand DAGTypeLegalizer::ExpandOperand_TRUNCATE(SDNode *N) { + SDOperand InL, InH; + GetExpandedOp(N->getOperand(0), InL, InH); + // Just truncate the low part of the source. + return DAG.getNode(ISD::TRUNCATE, N->getValueType(0), InL); +} + +SDOperand DAGTypeLegalizer::ExpandOperand_EXTRACT_ELEMENT(SDNode *N) { + SDOperand Lo, Hi; + GetExpandedOp(N->getOperand(0), Lo, Hi); + return cast(N->getOperand(1))->getValue() ? Hi : Lo; +} + +SDOperand DAGTypeLegalizer::ExpandOperand_SETCC(SDNode *N) { + SDOperand NewLHS = N->getOperand(0), NewRHS = N->getOperand(1); + ISD::CondCode CCCode = cast(N->getOperand(2))->get(); + ExpandSetCCOperands(NewLHS, NewRHS, CCCode); + + // If ExpandSetCCOperands returned a scalar, use it. + if (NewRHS.Val == 0) return NewLHS; + + // Otherwise, update N to have the operands specified. + return DAG.UpdateNodeOperands(SDOperand(N, 0), NewLHS, NewRHS, + DAG.getCondCode(CCCode)); +} + +/// ExpandSetCCOperands - Expand the operands to a comparison. This code is +/// shared among BR_CC, SELECT_CC, and SETCC handlers. +void DAGTypeLegalizer::ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, + ISD::CondCode &CCCode) { + SDOperand LHSLo, LHSHi, RHSLo, RHSHi; + GetExpandedOp(NewLHS, LHSLo, LHSHi); + GetExpandedOp(NewRHS, RHSLo, RHSHi); + + MVT::ValueType VT = NewLHS.getValueType(); + if (VT == MVT::f32 || VT == MVT::f64) { + assert(0 && "FIXME: softfp not implemented yet! should be promote not exp"); + } + + if (VT == MVT::ppcf128) { + // FIXME: This generated code sucks. We want to generate + // FCMP crN, hi1, hi2 + // BNE crN, L: + // FCMP crN, lo1, lo2 + // The following can be improved, but not that much. + SDOperand Tmp1, Tmp2, Tmp3; + Tmp1 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, ISD::SETEQ); + Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSLo, RHSLo, CCCode); + Tmp3 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2); + Tmp1 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, ISD::SETNE); + Tmp2 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, CCCode); + Tmp1 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2); + NewLHS = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp3); + NewRHS = SDOperand(); // LHS is the result, not a compare. + return; + } + + + if (CCCode == ISD::SETEQ || CCCode == ISD::SETNE) { + if (RHSLo == RHSHi) + if (ConstantSDNode *RHSCST = dyn_cast(RHSLo)) + if (RHSCST->isAllOnesValue()) { + // Equality comparison to -1. + NewLHS = DAG.getNode(ISD::AND, LHSLo.getValueType(), LHSLo, LHSHi); + NewRHS = RHSLo; + return; + } + + NewLHS = DAG.getNode(ISD::XOR, LHSLo.getValueType(), LHSLo, RHSLo); + NewRHS = DAG.getNode(ISD::XOR, LHSLo.getValueType(), LHSHi, RHSHi); + NewLHS = DAG.getNode(ISD::OR, NewLHS.getValueType(), NewLHS, NewRHS); + NewRHS = DAG.getConstant(0, NewLHS.getValueType()); + return; + } + + // If this is a comparison of the sign bit, just look at the top part. + // X > -1, x < 0 + if (ConstantSDNode *CST = dyn_cast(NewRHS)) + if ((CCCode == ISD::SETLT && CST->getValue() == 0) || // X < 0 + (CCCode == ISD::SETGT && CST->isAllOnesValue())) { // X > -1 + NewLHS = LHSHi; + NewRHS = RHSHi; + return; + } + + // FIXME: This generated code sucks. + ISD::CondCode LowCC; + switch (CCCode) { + default: assert(0 && "Unknown integer setcc!"); + case ISD::SETLT: + case ISD::SETULT: LowCC = ISD::SETULT; break; + case ISD::SETGT: + case ISD::SETUGT: LowCC = ISD::SETUGT; break; + case ISD::SETLE: + case ISD::SETULE: LowCC = ISD::SETULE; break; + case ISD::SETGE: + case ISD::SETUGE: LowCC = ISD::SETUGE; break; + } + + // Tmp1 = lo(op1) < lo(op2) // Always unsigned comparison + // Tmp2 = hi(op1) < hi(op2) // Signedness depends on operands + // dest = hi(op1) == hi(op2) ? Tmp1 : Tmp2; + + // NOTE: on targets without efficient SELECT of bools, we can always use + // this identity: (B1 ? B2 : B3) --> (B1 & B2)|(!B1&B3) + TargetLowering::DAGCombinerInfo DagCombineInfo(DAG, false, true, NULL); + SDOperand Tmp1, Tmp2; + Tmp1 = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSLo, RHSLo, LowCC, + false, DagCombineInfo); + if (!Tmp1.Val) + Tmp1 = DAG.getSetCC(TLI.getSetCCResultTy(), LHSLo, RHSLo, LowCC); + Tmp2 = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, + CCCode, false, DagCombineInfo); + if (!Tmp2.Val) + Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), LHSHi, RHSHi, + DAG.getCondCode(CCCode)); + + ConstantSDNode *Tmp1C = dyn_cast(Tmp1.Val); + ConstantSDNode *Tmp2C = dyn_cast(Tmp2.Val); + if ((Tmp1C && Tmp1C->getValue() == 0) || + (Tmp2C && Tmp2C->getValue() == 0 && + (CCCode == ISD::SETLE || CCCode == ISD::SETGE || + CCCode == ISD::SETUGE || CCCode == ISD::SETULE)) || + (Tmp2C && Tmp2C->getValue() == 1 && + (CCCode == ISD::SETLT || CCCode == ISD::SETGT || + CCCode == ISD::SETUGT || CCCode == ISD::SETULT))) { + // low part is known false, returns high part. + // For LE / GE, if high part is known false, ignore the low part. + // For LT / GT, if high part is known true, ignore the low part. + NewLHS = Tmp2; + NewRHS = SDOperand(); + return; + } + + NewLHS = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, + ISD::SETEQ, false, DagCombineInfo); + if (!NewLHS.Val) + NewLHS = DAG.getSetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, ISD::SETEQ); + NewLHS = DAG.getNode(ISD::SELECT, Tmp1.getValueType(), + NewLHS, Tmp1, Tmp2); + NewRHS = SDOperand(); +} + + +SDOperand DAGTypeLegalizer::ExpandOperand_STORE(StoreSDNode *N, unsigned OpNo) { + assert(OpNo == 1 && "Can only expand the stored value so far"); + assert(!N->isTruncatingStore() && "Can't expand truncstore!"); + + unsigned IncrementSize = 0; + SDOperand Lo, Hi; + + // If this is a vector type, then we have to calculate the increment as + // the product of the element size in bytes, and the number of elements + // in the high half of the vector. + if (MVT::isVector(N->getValue().getValueType())) { + assert(0 && "Vectors not supported yet"); +#if 0 + SDNode *InVal = ST->getValue().Val; + unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); + MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); + + // Figure out if there is a simple type corresponding to this Vector + // type. If so, convert to the vector type. + MVT::ValueType TVT = MVT::getVectorType(EVT, NumElems); + if (TLI.isTypeLegal(TVT)) { + // Turn this into a normal store of the vector type. + Tmp3 = LegalizeOp(Node->getOperand(1)); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + Result = LegalizeOp(Result); + break; + } else if (NumElems == 1) { + // Turn this into a normal store of the scalar type. + Tmp3 = ScalarizeVectorOp(Node->getOperand(1)); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + // The scalarized value type may not be legal, e.g. it might require + // promotion or expansion. Relegalize the scalar store. + return LegalizeOp(Result); + } else { + SplitVectorOp(Node->getOperand(1), Lo, Hi); + IncrementSize = NumElems/2 * MVT::getSizeInBits(EVT)/8; + } +#endif + } else { + GetExpandedOp(N->getValue(), Lo, Hi); + IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0; + + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); + } + + SDOperand Chain = N->getChain(); + SDOperand Ptr = N->getBasePtr(); + int SVOffset = N->getSrcValueOffset(); + unsigned Alignment = N->getAlignment(); + bool isVolatile = N->isVolatile(); + + Lo = DAG.getStore(Chain, Lo, Ptr, N->getSrcValue(), + SVOffset, isVolatile, Alignment); + + assert(Hi.Val && "FIXME: int <-> float should be handled with promote!"); +#if 0 + if (Hi.Val == NULL) { + // Must be int <-> float one-to-one expansion. + return Lo; + } +#endif + + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + getIntPtrConstant(IncrementSize)); + assert(isTypeLegal(Ptr.getValueType()) && "Pointers must be legal!"); + Hi = DAG.getStore(Chain, Hi, Ptr, N->getSrcValue(), SVOffset+IncrementSize, + isVolatile, std::max(Alignment, IncrementSize)); + return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); +} + +//===----------------------------------------------------------------------===// +// Entry Point +//===----------------------------------------------------------------------===// + +/// LegalizeTypes - This transforms the SelectionDAG into a SelectionDAG that +/// only uses types natively supported by the target. +/// +/// Note that this is an involved process that may invalidate pointers into +/// the graph. +void SelectionDAG::LegalizeTypes() { + DAGTypeLegalizer(*this).run(); +} + Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=42981&r1=42980&r2=42981&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Oct 15 01:10:22 2007 @@ -422,14 +422,12 @@ N = NewNodes[1]; SDNode *LoadNode = NewNodes[0]; - std::vector Deleted; unsigned NumVals = N->getNumValues(); unsigned OldNumVals = SU->Node->getNumValues(); for (unsigned i = 0; i != NumVals; ++i) - DAG.ReplaceAllUsesOfValueWith(SDOperand(SU->Node, i), - SDOperand(N, i), Deleted); + DAG.ReplaceAllUsesOfValueWith(SDOperand(SU->Node, i), SDOperand(N, i)); DAG.ReplaceAllUsesOfValueWith(SDOperand(SU->Node, OldNumVals-1), - SDOperand(LoadNode, 1), Deleted); + SDOperand(LoadNode, 1)); SUnit *LoadSU = NewSUnit(LoadNode); SUnit *NewSU = NewSUnit(N); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42981&r1=42980&r2=42981&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Oct 15 01:10:22 2007 @@ -3232,11 +3232,11 @@ /// uses of other values produced by From.Val alone. The Deleted vector is /// handled the same was as for ReplaceAllUsesWith. void SelectionDAG::ReplaceAllUsesOfValueWith(SDOperand From, SDOperand To, - std::vector &Deleted) { + std::vector *Deleted) { assert(From != To && "Cannot replace a value with itself"); // Handle the simple, trivial, case efficiently. if (From.Val->getNumValues() == 1 && To.Val->getNumValues() == 1) { - ReplaceAllUsesWith(From, To, &Deleted); + ReplaceAllUsesWith(From, To, Deleted); return; } @@ -3244,48 +3244,66 @@ // deterministically ordered and uniqued set, so we use a SmallSetVector. SmallSetVector Users(From.Val->use_begin(), From.Val->use_end()); + std::vector LocalDeletionVector; + + // Pick a deletion vector to use. If the user specified one, use theirs, + // otherwise use a local one. + std::vector *DeleteVector = Deleted ? Deleted : &LocalDeletionVector; while (!Users.empty()) { // We know that this user uses some value of From. If it is the right // value, update it. SDNode *User = Users.back(); Users.pop_back(); - for (SDOperand *Op = User->OperandList, - *E = User->OperandList+User->NumOperands; Op != E; ++Op) { + // Scan for an operand that matches From. + SDOperand *Op = User->OperandList, *E = User->OperandList+User->NumOperands; + for (; Op != E; ++Op) + if (*Op == From) break; + + // If there are no matches, the user must use some other result of From. + if (Op == E) continue; + + // Okay, we know this user needs to be updated. Remove its old self + // from the CSE maps. + RemoveNodeFromCSEMaps(User); + + // Update all operands that match "From". + for (; Op != E; ++Op) { if (*Op == From) { - // Okay, we know this user needs to be updated. Remove its old self - // from the CSE maps. - RemoveNodeFromCSEMaps(User); - - // Update all operands that match "From". - for (; Op != E; ++Op) { - if (*Op == From) { - From.Val->removeUser(User); - *Op = To; - To.Val->addUser(User); - } - } - - // Now that we have modified User, add it back to the CSE maps. If it - // already exists there, recursively merge the results together. - if (SDNode *Existing = AddNonLeafNodeToCSEMaps(User)) { - unsigned NumDeleted = Deleted.size(); - ReplaceAllUsesWith(User, Existing, &Deleted); - - // User is now dead. - Deleted.push_back(User); - DeleteNodeNotInCSEMaps(User); - - // We have to be careful here, because ReplaceAllUsesWith could have - // deleted a user of From, which means there may be dangling pointers - // in the "Users" setvector. Scan over the deleted node pointers and - // remove them from the setvector. - for (unsigned i = NumDeleted, e = Deleted.size(); i != e; ++i) - Users.remove(Deleted[i]); - } - break; // Exit the operand scanning loop. + From.Val->removeUser(User); + *Op = To; + To.Val->addUser(User); } } + + // Now that we have modified User, add it back to the CSE maps. If it + // already exists there, recursively merge the results together. + SDNode *Existing = AddNonLeafNodeToCSEMaps(User); + if (!Existing) continue; // Continue on to next user. + + // If there was already an existing matching node, use ReplaceAllUsesWith + // to replace the dead one with the existing one. However, this can cause + // recursive merging of other unrelated nodes down the line. The merging + // can cause deletion of nodes that used the old value. In this case, + // we have to be certain to remove them from the Users set. + unsigned NumDeleted = DeleteVector->size(); + ReplaceAllUsesWith(User, Existing, DeleteVector); + + // User is now dead. + DeleteVector->push_back(User); + DeleteNodeNotInCSEMaps(User); + + // We have to be careful here, because ReplaceAllUsesWith could have + // deleted a user of From, which means there may be dangling pointers + // in the "Users" setvector. Scan over the deleted node pointers and + // remove them from the setvector. + for (unsigned i = NumDeleted, e = DeleteVector->size(); i != e; ++i) + Users.remove((*DeleteVector)[i]); + + // If the user doesn't need the set of deleted elements, don't retain them + // to the next loop iteration. + if (Deleted == 0) + LocalDeletionVector.clear(); } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=42981&r1=42980&r2=42981&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct 15 01:10:22 2007 @@ -4714,6 +4714,10 @@ // Second step, hack on the DAG until it only uses operations and types that // the target supports. +#if 0 // Enable this some day. + DAG.LegalizeTypes(); + // Someday even later, enable a dag combine pass here. +#endif DAG.Legalize(); DOUT << "Legalized selection DAG:\n"; Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=42981&r1=42980&r2=42981&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Oct 15 01:10:22 2007 @@ -3939,7 +3939,7 @@ OS << "}\n\n"; OS << "void ReplaceUses(SDOperand F, SDOperand T) DISABLE_INLINE {\n"; - OS << " CurDAG->ReplaceAllUsesOfValueWith(F, T, ISelKilled);\n"; + OS << " CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISelKilled);\n"; OS << " setSelected(F.Val->getNodeId());\n"; OS << " RemoveKilled();\n"; OS << "}\n"; @@ -3950,7 +3950,7 @@ OS << " for (unsigned i = 0, e = std::min(FNumVals, TNumVals); " << "i < e; ++i)\n"; OS << " CurDAG->ReplaceAllUsesOfValueWith(SDOperand(F, i), " - << "SDOperand(T, i), ISelKilled);\n"; + << "SDOperand(T, i), &ISelKilled);\n"; OS << " } else {\n"; OS << " CurDAG->ReplaceAllUsesWith(F, T, &ISelKilled);\n"; OS << " }\n"; From baldrick at free.fr Mon Oct 15 07:01:43 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Oct 2007 14:01:43 +0200 Subject: [llvm-commits] [llvm] r42981 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp utils/TableGen/DAGISelEmitter.cpp In-Reply-To: <200710150610.l9F6ANV3030436@zion.cs.uiuc.edu> References: <200710150610.l9F6ANV3030436@zion.cs.uiuc.edu> Message-ID: <200710151401.46887.baldrick@free.fr> Hi Chris, this sounds like a big improvement! Where did you find the time to do this?! A few comments. > 1. When finished, this will *significantly* reduce the amount of code in > LegalizeDAG.cpp. It will remove all the code related to promotion and > expansion as well as splitting and scalarizing vectors. Yay! > 2. SoftFP is a mess, I need to talk to Evan about it. Presumably f64 will be promoted to i64 then possibly expanded into 2xi32, rather than mulching the two steps together in expand as is done now. Codegen support for arbitrary precision integers also needs to promote to a type which is then expanded. Does your new infrastructure support this (currently expand is only allowed to follow expand, not promote)? Dunno if it's useful to support promote following promote/expand - I don't have a use for it, and forbidding it would help prevent infinite promote/expand loops. > 5. The code nicely separates out handling of operations with invalid > results from operations with invalid operands, making some cases > simpler and easier to understand. Yay! The following two comments seem contradictory. The first one suggests that operations are not legalized... > ... This legalizer is designed to run before the > operation legalizer and ensure just that the input dag is transformed > into an output dag whose operand and result types are all legal, even > if the operations on those types are not. While here it sounds like operations are legalized... > +/// DAGTypeLegalizer - This takes an arbitrary SelectionDAG as input and > +/// hacks on it until the target machine can handle it. This involves > +/// eliminating value sizes the machine cannot handle (promoting small sizes to > +/// large sizes or splitting up large values into small values) as well as > +/// eliminating operations the machine cannot handle. > + enum LegalizeAction { > + Legal, // The target natively supports this operation. -> The target natively supports this type. > + Promote, // This operation should be executed in a larger type. -> This type should be replaced with a larger type. > + Expand // Try to expand this to other ops, otherwise use a libcall. -> This type should be split into two types of half the size. > + /// ValueTypeActions - This is a bitvector that contains two bits for each > + /// value type, where the two bits correspond to the LegalizeAction enum. value type -> simple value type That said, I will work on adding support for extended value types myself, so I won't mention extended value types in the result of this email. By the way the logic supposes that the result of any node is an operand for some other node. Is at least one result always used? > + // If the node needs revisitation, don't add all users to the worklist etc. revisitation -> revisiting Or is this a technical term? It's used several times. > +SDOperand DAGTypeLegalizer::PromoteResult_TRUNCATE(SDNode *N) { > + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); > + switch (getTypeAction(N->getOperand(0).getValueType())) { Presumably this switch is redundant, because it must be Promote, and you just didn't get around to cleaning it up yet? Ciao, Duncan. From baldrick at free.fr Mon Oct 15 08:30:19 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Oct 2007 13:30:19 -0000 Subject: [llvm-commits] [llvm] r42982 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710151330.l9FDUJeG023133@zion.cs.uiuc.edu> Author: baldrick Date: Mon Oct 15 08:30:18 2007 New Revision: 42982 URL: http://llvm.org/viewvc/llvm-project?rev=42982&view=rev Log: Fix some typos. Call getTypeToTransformTo rather than getTypeToExpandTo. The difference is that getTypeToExpandTo gives the final result of expansion (eg: i128 -> i32 on a 32 bit machine) while getTypeToTransformTo does just one step (i128 -> i64). Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=42982&r1=42981&r2=42982&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Mon Oct 15 08:30:18 2007 @@ -61,8 +61,8 @@ }; /// ValueTypeActions - This is a bitvector that contains two bits for each - /// value type, where the two bits correspond to the LegalizeAction enum. - /// This can be queried with "getTypeAction(VT)". + /// simple value type, where the two bits correspond to the LegalizeAction + /// enum. This can be queried with "getTypeAction(VT)". TargetLowering::ValueTypeActionImpl ValueTypeActions; /// getTypeAction - Return how we should legalize values of this type, either @@ -87,7 +87,7 @@ DenseMap PromotedNodes; /// ExpandedNodes - For nodes that need to be expanded this map indicates - /// which which operands are the expanded version of the input. + /// which operands are the expanded version of the input. DenseMap > ExpandedNodes; /// Worklist - This defines a worklist of nodes to process. In order to be @@ -190,7 +190,7 @@ DAG.setRoot(SDOperand()); // Walk all nodes in the graph, assigning them a NodeID of 'ReadyToProcess' - // (and remembering them) if they are leafs and assigning 'NewNode' if + // (and remembering them) if they are leaves and assigning 'NewNode' if // non-leaves. for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), E = DAG.allnodes_end(); I != E; ++I) { @@ -416,7 +416,7 @@ /// PromoteResult - This method is called when a result of a node is found to be /// in need of promotion to a larger type. At this point, the node may also /// have invalid operands or may have other results that need expansion, we just -/// know that (at least) the one result needs promotion. +/// know that (at least) one result needs promotion. void DAGTypeLegalizer::PromoteResult(SDNode *N, unsigned ResNo) { DEBUG(cerr << "Promote node result: "; N->dump(&DAG); cerr << "\n"); SDOperand Result = SDOperand(); @@ -556,7 +556,7 @@ /// ExpandResult - This method is called when the specified result of the /// specified node is found to need expansion. At this point, the node may also /// have invalid operands or may have other results that need promotion, we just -/// know that (at least) the one result needs expansion. +/// know that (at least) one result needs expansion. void DAGTypeLegalizer::ExpandResult(SDNode *N, unsigned ResNo) { DEBUG(cerr << "Expand node result: "; N->dump(&DAG); cerr << "\n"); SDOperand Lo, Hi; @@ -599,13 +599,13 @@ void DAGTypeLegalizer::ExpandResult_UNDEF(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); Lo = Hi = DAG.getNode(ISD::UNDEF, NVT); } void DAGTypeLegalizer::ExpandResult_Constant(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); uint64_t Cst = cast(N)->getValue(); Lo = DAG.getConstant(Cst, NVT); Hi = DAG.getConstant(Cst >> MVT::getSizeInBits(NVT), NVT); @@ -621,7 +621,7 @@ void DAGTypeLegalizer::ExpandResult_ANY_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); // The low part is any extension of the input (which degenerates to a copy). Lo = DAG.getNode(ISD::ANY_EXTEND, NVT, N->getOperand(0)); Hi = DAG.getNode(ISD::UNDEF, NVT); // The high part is undefined. @@ -629,7 +629,7 @@ void DAGTypeLegalizer::ExpandResult_ZERO_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); // The low part is zero extension of the input (which degenerates to a copy). Lo = DAG.getNode(ISD::ZERO_EXTEND, NVT, N->getOperand(0)); Hi = DAG.getConstant(0, NVT); // The high part is just a zero. @@ -637,7 +637,7 @@ void DAGTypeLegalizer::ExpandResult_SIGN_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType NVT = TLI.getTypeToExpandTo(N->getValueType(0)); + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); // The low part is sign extension of the input (which degenerates to a copy). Lo = DAG.getNode(ISD::SIGN_EXTEND, NVT, N->getOperand(0)); @@ -651,7 +651,7 @@ void DAGTypeLegalizer::ExpandResult_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi) { MVT::ValueType VT = N->getValueType(0); - MVT::ValueType NVT = TLI.getTypeToExpandTo(VT); + MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); SDOperand Ch = N->getChain(); // Legalize the chain. SDOperand Ptr = N->getBasePtr(); // Legalize the pointer. ISD::LoadExtType ExtType = N->getExtensionType(); @@ -816,7 +816,7 @@ void DAGTypeLegalizer::ExpandResult_MUL(SDNode *N, SDOperand &Lo, SDOperand &Hi) { MVT::ValueType VT = N->getValueType(0); - MVT::ValueType NVT = TLI.getTypeToExpandTo(VT); + MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); // If the target wants to custom expand this, let them. if (TLI.getOperationAction(ISD::MUL, VT) == TargetLowering::Custom) { @@ -941,7 +941,7 @@ // Next check to see if the target supports this SHL_PARTS operation or if it // will custom expand it. - MVT::ValueType NVT = TLI.getTypeToExpandTo(VT); + MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); TargetLowering::LegalizeAction Action = TLI.getOperationAction(PartsOpc, NVT); if ((Action == TargetLowering::Legal && TLI.isTypeLegal(NVT)) || Action == TargetLowering::Custom) { From baldrick at free.fr Mon Oct 15 09:19:05 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Oct 2007 16:19:05 +0200 Subject: [llvm-commits] [llvm] r42981 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp utils/TableGen/DAGISelEmitter.cpp In-Reply-To: <200710151401.46887.baldrick@free.fr> References: <200710150610.l9F6ANV3030436@zion.cs.uiuc.edu> <200710151401.46887.baldrick@free.fr> Message-ID: <200710151619.05947.baldrick@free.fr> > > +SDOperand DAGTypeLegalizer::PromoteResult_TRUNCATE(SDNode *N) { > > + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); > > + switch (getTypeAction(N->getOperand(0).getValueType())) { > > Presumably this switch is redundant, because it must be Promote, > and you just didn't get around to cleaning it up yet? Please ignore this, I understand how it works now. Ciao, Duncan. From neil at daikokuya.co.uk Mon Oct 15 10:00:55 2007 From: neil at daikokuya.co.uk (Neil Booth) Date: Mon, 15 Oct 2007 15:00:55 -0000 Subject: [llvm-commits] [llvm] r42984 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200710151500.l9FF0udn028071@zion.cs.uiuc.edu> Author: neil Date: Mon Oct 15 10:00:55 2007 New Revision: 42984 URL: http://llvm.org/viewvc/llvm-project?rev=42984&view=rev Log: Fast-track obviously over-large and over-small exponents during decimal-> integer conversion. In some such cases this makes us one or two orders of magnitude faster than NetBSD's libc. Glibc seems to have a similar fast path. Also, tighten up some upper bounds to save a bit of memory. Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42984&r1=42983&r2=42984&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Mon Oct 15 10:00:55 2007 @@ -59,7 +59,7 @@ /* A tight upper bound on number of parts required to hold the value pow(5, power) is - power * 1024 / (441 * integerPartWidth) + 1 + power * 815 / (351 * integerPartWidth) + 1 However, whilst the result may require only this many parts, because we are multiplying two values to get it, the @@ -70,8 +70,8 @@ const unsigned int maxExponent = 16383; const unsigned int maxPrecision = 113; const unsigned int maxPowerOfFiveExponent = maxExponent + maxPrecision - 1; - const unsigned int maxPowerOfFiveParts = 2 + ((maxPowerOfFiveExponent * 1024) - / (441 * integerPartWidth)); + const unsigned int maxPowerOfFiveParts = 2 + ((maxPowerOfFiveExponent * 815) + / (351 * integerPartWidth)); } /* Put a bunch of private, handy routines in an anonymous namespace. */ @@ -226,12 +226,19 @@ dddd.dddd[eE][+-]ddd where the decimal point and exponent are optional, fill out the - structure D. If the value is zero, V->firstSigDigit - points to a zero, and the return exponent is zero. */ + structure D. Exponent is appropriate if the significand is + treated as an integer, and normalizedExponent if the significand + is taken to have the decimal point after a single leading + non-zero digit. + + If the value is zero, V->firstSigDigit points to a zero, and the + return exponent is zero. + */ struct decimalInfo { const char *firstSigDigit; const char *lastSigDigit; int exponent; + int normalizedExponent; }; void @@ -243,6 +250,7 @@ D->firstSigDigit = p; D->exponent = 0; + D->normalizedExponent = 0; for (;;) { if (*p == '.') { @@ -270,8 +278,10 @@ while (*p == '0'); while (*p == '.'); - /* Adjust the specified exponent for any decimal point. */ + /* Adjust the exponents for any decimal point. */ D->exponent += (dot - p) - (dot > p); + D->normalizedExponent = (D->exponent + (p - D->firstSigDigit) + - (dot > D->firstSigDigit && dot < p)); } D->lastSigDigit = p; @@ -2079,19 +2089,45 @@ /* Scan the text. */ interpretDecimal(p, &D); + /* Handle the quick cases. First the case of no significant digits, + i.e. zero, and then exponents that are obviously too large or too + small. Writing L for log 10 / log 2, a number d.ddddd*10^exp + definitely overflows if + + (exp - 1) * L >= maxExponent + + and definitely underflows to zero where + + (exp + 1) * L <= minExponent - precision + + With integer arithmetic the tightest bounds for L are + + 93/28 < L < 196/59 [ numerator <= 256 ] + 42039/12655 < L < 28738/8651 [ numerator <= 65536 ] + */ + if (*D.firstSigDigit == '0') { category = fcZero; fs = opOK; + } else if ((D.normalizedExponent + 1) * 28738 + <= 8651 * (semantics->minExponent - (int) semantics->precision)) { + /* Underflow to zero and round. */ + zeroSignificand(); + fs = normalize(rounding_mode, lfLessThanHalf); + } else if ((D.normalizedExponent - 1) * 42039 + >= 12655 * semantics->maxExponent) { + /* Overflow and round. */ + fs = handleOverflow(rounding_mode); } else { integerPart *decSignificand; unsigned int partCount; /* A tight upper bound on number of bits required to hold an - N-digit decimal integer is N * 256 / 77. Allocate enough space + N-digit decimal integer is N * 196 / 59. Allocate enough space to hold the full significand, and an extra part required by tcMultiplyPart. */ partCount = (D.lastSigDigit - D.firstSigDigit) + 1; - partCount = partCountForBits(1 + 256 * partCount / 77); + partCount = partCountForBits(1 + 196 * partCount / 59); decSignificand = new integerPart[partCount + 1]; partCount = 0; From dpatel at apple.com Mon Oct 15 10:31:35 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 15:31:35 -0000 Subject: [llvm-commits] [llvm] r42985 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200710151531.l9FFVZpF029764@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 10:31:35 2007 New Revision: 42985 URL: http://llvm.org/viewvc/llvm-project?rev=42985&view=rev Log: Achieve same result but use fewer lines of code. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=42985&r1=42984&r2=42985&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 15 10:31:35 2007 @@ -7674,14 +7674,13 @@ unsigned Align = cast(CI.getOperand(4))->getZExtValue(); PointerType *NewPtrTy = NULL; // Destination pointer type is always i8 * - if (Size == 8) - NewPtrTy = PointerType::get(Type::Int64Ty); - else if (Size == 4) - NewPtrTy = PointerType::get(Type::Int32Ty); - else if (Size == 2) - NewPtrTy = PointerType::get(Type::Int16Ty); - else if (Size == 1) - NewPtrTy = PointerType::get(Type::Int8Ty); + // If Size is 8 then use Int64Ty + // If Size is 4 then use Int32Ty + // If Size is 2 then use Int16Ty + // If Size is 1 then use Int8Ty + if (Size && Size <=8 && !(Size&(Size-1))) + NewPtrTy = PointerType::get(IntegerType::get(Size<<3)); + if (NewPtrTy) { Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), NewPtrTy, CI); Value *Dest = InsertCastBefore(Instruction::BitCast, CI.getOperand(1), NewPtrTy, CI); From dpatel at apple.com Mon Oct 15 10:41:07 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 15:41:07 -0000 Subject: [llvm-commits] [llvm] r42986 - /llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c Message-ID: <200710151541.l9FFf7KM030418@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 10:41:07 2007 New Revision: 42986 URL: http://llvm.org/viewvc/llvm-project?rev=42986&view=rev Log: New test. Added: llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c Added: llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c?rev=42986&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c (added) +++ llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c Mon Oct 15 10:41:07 2007 @@ -0,0 +1,5 @@ +// RUN: llvm-gcc -S %s -o /dev/null +void bork(void **data) { + (*(unsigned short *) (&(data[37])[927]) = 0); +} + From dpatel at apple.com Mon Oct 15 10:41:50 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 15:41:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42987 - in /llvm-gcc-4.0/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200710151541.l9FFfoLV030502@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 10:41:50 2007 New Revision: 42987 URL: http://llvm.org/viewvc/llvm-project?rev=42987&view=rev Log: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071015/054529.html Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=42987&r1=42986&r2=42987&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Mon Oct 15 10:41:50 2007 @@ -5288,13 +5288,21 @@ // float foo(int w, float A[][w], int g) { return A[g][0]; } ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); - Value *TypeSize = Emit(array_ref_element_size(exp), 0); - TypeSize = CastToUIntType(TypeSize, IntPtrTy); + Value *TypeSize = NULL; + if (VOID_TYPE_P(TREE_TYPE(ArrayType))) { + // void * size is 1 + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + return BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); + } + else { + TypeSize = Emit(array_ref_element_size(exp), 0); + TypeSize = CastToUIntType(TypeSize, IntPtrTy); + IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + } - IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=42987&r1=42986&r2=42987&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Mon Oct 15 10:41:50 2007 @@ -303,7 +303,7 @@ TREE_CODE (type) == REFERENCE_TYPE) && "not a sequential type!"); // This relies on gcc types with constant size mapping to LLVM types with the // same size. - return isInt64(TYPE_SIZE(TREE_TYPE(type)), true); + return !VOID_TYPE_P(TREE_TYPE(type)) && isInt64(TYPE_SIZE(TREE_TYPE(type)), true); } /// isArrayCompatible - Return true if the specified gcc array or pointer type From dpatel at apple.com Mon Oct 15 11:00:25 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 16:00:25 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42988 - /llvm-gcc-4.2/trunk/gcc/config.gcc Message-ID: <200710151600.l9FG0PUC031348@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 11:00:25 2007 New Revision: 42988 URL: http://llvm.org/viewvc/llvm-project?rev=42988&view=rev Log: Remove c style comment. Modified: llvm-gcc-4.2/trunk/gcc/config.gcc Modified: llvm-gcc-4.2/trunk/gcc/config.gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=42988&r1=42987&r2=42988&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config.gcc (original) +++ llvm-gcc-4.2/trunk/gcc/config.gcc Mon Oct 15 11:00:25 2007 @@ -1040,7 +1040,6 @@ # Deleted a comment here. # APPLE LOCAL mainline with_cpu=${with_cpu:-core2} - /* APPLE LOCAL Macintosh alignment 2002-2-19 --ff */ extra_options="${extra_options} i386/darwin.opt" # APPLE LOCAL 4099000 tmake_file="${tmake_file} i386/t-darwin" From dpatel at apple.com Mon Oct 15 11:01:09 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 16:01:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42989 - in /llvm-gcc-4.2/trunk: configure configure.in Message-ID: <200710151601.l9FG194m031388@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 11:01:08 2007 New Revision: 42989 URL: http://llvm.org/viewvc/llvm-project?rev=42989&view=rev Log: Do not build libobjc on darwin. Modified: llvm-gcc-4.2/trunk/configure llvm-gcc-4.2/trunk/configure.in Modified: llvm-gcc-4.2/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure?rev=42989&r1=42988&r2=42989&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure (original) +++ llvm-gcc-4.2/trunk/configure Mon Oct 15 11:01:08 2007 @@ -1216,6 +1216,8 @@ noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" noconfigdirs="$noconfigdirs ${libgcj} target-libstdc++-v3" + # LLVM LOCAL + noconfigdirs="$noconfigdirs target-libobjc" ;; *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" @@ -1870,7 +1872,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1874: checking for $ac_word" >&5 +echo "configure:1876: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1900,7 +1902,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1904: checking for $ac_word" >&5 +echo "configure:1906: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1951,7 +1953,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1955: checking for $ac_word" >&5 +echo "configure:1957: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1983,7 +1985,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1987: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1989: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1994,12 +1996,12 @@ cat > conftest.$ac_ext << EOF -#line 1998 "configure" +#line 2000 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2025,12 +2027,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2029: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2031: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2034: checking whether we are using GNU C" >&5 +echo "configure:2036: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2039,7 +2041,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2058,7 +2060,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2062: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2064: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2125,7 +2127,7 @@ # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2129: checking for $ac_word" >&5 +echo "configure:2131: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2157,7 +2159,7 @@ # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2161: checking for $ac_word" >&5 +echo "configure:2163: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2190,7 +2192,7 @@ fi echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2194: checking whether compiler driver understands Ada" >&5 +echo "configure:2196: checking whether compiler driver understands Ada" >&5 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2222,7 +2224,7 @@ fi echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2226: checking how to compare bootstrapped objects" >&5 +echo "configure:2228: checking how to compare bootstrapped objects" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2342,9 +2344,9 @@ CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2346: checking for correct version of gmp.h" >&5 +echo "configure:2348: checking for correct version of gmp.h" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2368,9 +2370,9 @@ if test x"$have_gmp" = xyes; then echo $ac_n "checking for correct version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2372: checking for correct version of mpfr.h" >&5 +echo "configure:2374: checking for correct version of mpfr.h" >&5 cat > conftest.$ac_ext < @@ -2382,7 +2384,7 @@ ; return 0; } EOF -if { (eval echo configure:2386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2396,9 +2398,9 @@ saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" echo $ac_n "checking for any version of mpfr.h""... $ac_c" 1>&6 -echo "configure:2400: checking for any version of mpfr.h" >&5 +echo "configure:2402: checking for any version of mpfr.h" >&5 cat > conftest.$ac_ext < #include @@ -2406,7 +2408,7 @@ mpfr_t n; mpfr_init(n); ; return 0; } EOF -if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3517,7 +3519,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3521: checking for $ac_word" >&5 +echo "configure:3523: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3557,7 +3559,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3561: checking for $ac_word" >&5 +echo "configure:3563: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3596,7 +3598,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3600: checking for $ac_word" >&5 +echo "configure:3602: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3635,7 +3637,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3639: checking for $ac_word" >&5 +echo "configure:3641: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3675,7 +3677,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3679: checking for $ac_word" >&5 +echo "configure:3681: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3714,7 +3716,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3718: checking for $ac_word" >&5 +echo "configure:3720: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3767,7 +3769,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3771: checking for $ac_word" >&5 +echo "configure:3773: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3808,7 +3810,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3812: checking for $ac_word" >&5 +echo "configure:3814: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3856,7 +3858,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3860: checking for $ac_word" >&5 +echo "configure:3862: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3887,7 +3889,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3891: checking for $ac_word" >&5 +echo "configure:3893: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3931,7 +3933,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3935: checking for $ac_word" >&5 +echo "configure:3937: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3962,7 +3964,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3966: checking for $ac_word" >&5 +echo "configure:3968: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4006,7 +4008,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4010: checking for $ac_word" >&5 +echo "configure:4012: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4037,7 +4039,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4041: checking for $ac_word" >&5 +echo "configure:4043: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4081,7 +4083,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4085: checking for $ac_word" >&5 +echo "configure:4087: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4112,7 +4114,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4116: checking for $ac_word" >&5 +echo "configure:4118: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4156,7 +4158,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4160: checking for $ac_word" >&5 +echo "configure:4162: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4187,7 +4189,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4191: checking for $ac_word" >&5 +echo "configure:4193: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4231,7 +4233,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4235: checking for $ac_word" >&5 +echo "configure:4237: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4262,7 +4264,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4266: checking for $ac_word" >&5 +echo "configure:4268: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4306,7 +4308,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4310: checking for $ac_word" >&5 +echo "configure:4312: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4337,7 +4339,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4341: checking for $ac_word" >&5 +echo "configure:4343: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4376,7 +4378,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4380: checking for $ac_word" >&5 +echo "configure:4382: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4407,7 +4409,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4411: checking for $ac_word" >&5 +echo "configure:4413: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4446,7 +4448,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4450: checking for $ac_word" >&5 +echo "configure:4452: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4477,7 +4479,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4481: checking for $ac_word" >&5 +echo "configure:4483: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4521,7 +4523,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4525: checking for $ac_word" >&5 +echo "configure:4527: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4552,7 +4554,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4556: checking for $ac_word" >&5 +echo "configure:4558: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4596,7 +4598,7 @@ # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4600: checking for $ac_word" >&5 +echo "configure:4602: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4627,7 +4629,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4631: checking for $ac_word" >&5 +echo "configure:4633: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4691,7 +4693,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in cc gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4695: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4697: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4708,7 +4710,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4712: checking for $ac_word" >&5 +echo "configure:4714: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4739,7 +4741,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4743: checking for $ac_word" >&5 +echo "configure:4745: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4784,7 +4786,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in c++ g++ cxx gxx; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4788: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4790: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4801,7 +4803,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4805: checking for $ac_word" >&5 +echo "configure:4807: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4832,7 +4834,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4836: checking for $ac_word" >&5 +echo "configure:4838: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4877,7 +4879,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4881: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4883: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4894,7 +4896,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4898: checking for $ac_word" >&5 +echo "configure:4900: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4925,7 +4927,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4929: checking for $ac_word" >&5 +echo "configure:4931: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4965,7 +4967,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gcj; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4969: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4971: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4982,7 +4984,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4986: checking for $ac_word" >&5 +echo "configure:4988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5013,7 +5015,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5017: checking for $ac_word" >&5 +echo "configure:5019: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5058,7 +5060,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in gfortran; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5062: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5064: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5075,7 +5077,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5079: checking for $ac_word" >&5 +echo "configure:5081: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5106,7 +5108,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5110: checking for $ac_word" >&5 +echo "configure:5112: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5215,7 +5217,7 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5219: checking for ar in $with_build_time_tools" >&5 +echo "configure:5221: checking for ar in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ar; then AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET @@ -5233,7 +5235,7 @@ # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5237: checking for $ac_word" >&5 +echo "configure:5239: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5270,7 +5272,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ar; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5274: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5276: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5287,7 +5289,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5291: checking for $ac_word" >&5 +echo "configure:5293: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5318,7 +5320,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5322: checking for $ac_word" >&5 +echo "configure:5324: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5370,7 +5372,7 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5374: checking for as in $with_build_time_tools" >&5 +echo "configure:5376: checking for as in $with_build_time_tools" >&5 if test -x $with_build_time_tools/as; then AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET @@ -5388,7 +5390,7 @@ # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5392: checking for $ac_word" >&5 +echo "configure:5394: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5425,7 +5427,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in as; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5429: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5431: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5442,7 +5444,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5446: checking for $ac_word" >&5 +echo "configure:5448: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5473,7 +5475,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5477: checking for $ac_word" >&5 +echo "configure:5479: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5525,7 +5527,7 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5529: checking for dlltool in $with_build_time_tools" >&5 +echo "configure:5531: checking for dlltool in $with_build_time_tools" >&5 if test -x $with_build_time_tools/dlltool; then DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET @@ -5543,7 +5545,7 @@ # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5547: checking for $ac_word" >&5 +echo "configure:5549: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5580,7 +5582,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in dlltool; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5584: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5586: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5597,7 +5599,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5601: checking for $ac_word" >&5 +echo "configure:5603: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5628,7 +5630,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5632: checking for $ac_word" >&5 +echo "configure:5634: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5680,7 +5682,7 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5684: checking for ld in $with_build_time_tools" >&5 +echo "configure:5686: checking for ld in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ld; then LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET @@ -5698,7 +5700,7 @@ # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5702: checking for $ac_word" >&5 +echo "configure:5704: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5735,7 +5737,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ld; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5739: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5741: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5752,7 +5754,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5756: checking for $ac_word" >&5 +echo "configure:5758: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5783,7 +5785,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5787: checking for $ac_word" >&5 +echo "configure:5789: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5835,7 +5837,7 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5839: checking for lipo in $with_build_time_tools" >&5 +echo "configure:5841: checking for lipo in $with_build_time_tools" >&5 if test -x $with_build_time_tools/lipo; then LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET @@ -5853,7 +5855,7 @@ # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5857: checking for $ac_word" >&5 +echo "configure:5859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5890,7 +5892,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in lipo; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5894: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5896: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5907,7 +5909,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5911: checking for $ac_word" >&5 +echo "configure:5913: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5938,7 +5940,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5942: checking for $ac_word" >&5 +echo "configure:5944: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5990,7 +5992,7 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5994: checking for nm in $with_build_time_tools" >&5 +echo "configure:5996: checking for nm in $with_build_time_tools" >&5 if test -x $with_build_time_tools/nm; then NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET @@ -6008,7 +6010,7 @@ # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6012: checking for $ac_word" >&5 +echo "configure:6014: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6045,7 +6047,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in nm; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6049: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6051: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6062,7 +6064,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6066: checking for $ac_word" >&5 +echo "configure:6068: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6093,7 +6095,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6097: checking for $ac_word" >&5 +echo "configure:6099: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6145,7 +6147,7 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6149: checking for objdump in $with_build_time_tools" >&5 +echo "configure:6151: checking for objdump in $with_build_time_tools" >&5 if test -x $with_build_time_tools/objdump; then OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET @@ -6163,7 +6165,7 @@ # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6167: checking for $ac_word" >&5 +echo "configure:6169: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6200,7 +6202,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in objdump; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6204: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6206: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6217,7 +6219,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6221: checking for $ac_word" >&5 +echo "configure:6223: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6248,7 +6250,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6252: checking for $ac_word" >&5 +echo "configure:6254: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6300,7 +6302,7 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6304: checking for ranlib in $with_build_time_tools" >&5 +echo "configure:6306: checking for ranlib in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ranlib; then RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET @@ -6318,7 +6320,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6322: checking for $ac_word" >&5 +echo "configure:6324: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6355,7 +6357,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in ranlib; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6359: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6361: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6372,7 +6374,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6376: checking for $ac_word" >&5 +echo "configure:6378: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6403,7 +6405,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6407: checking for $ac_word" >&5 +echo "configure:6409: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6455,7 +6457,7 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6459: checking for strip in $with_build_time_tools" >&5 +echo "configure:6461: checking for strip in $with_build_time_tools" >&5 if test -x $with_build_time_tools/strip; then STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET @@ -6473,7 +6475,7 @@ # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6477: checking for $ac_word" >&5 +echo "configure:6479: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6510,7 +6512,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in strip; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6514: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6516: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6527,7 +6529,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6531: checking for $ac_word" >&5 +echo "configure:6533: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6558,7 +6560,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6562: checking for $ac_word" >&5 +echo "configure:6564: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6610,7 +6612,7 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6614: checking for windres in $with_build_time_tools" >&5 +echo "configure:6616: checking for windres in $with_build_time_tools" >&5 if test -x $with_build_time_tools/windres; then WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET @@ -6628,7 +6630,7 @@ # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6632: checking for $ac_word" >&5 +echo "configure:6634: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6665,7 +6667,7 @@ if test -n "$with_build_time_tools"; then for ncn_progname in windres; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6669: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6671: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6682,7 +6684,7 @@ # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6686: checking for $ac_word" >&5 +echo "configure:6688: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6713,7 +6715,7 @@ # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6717: checking for $ac_word" >&5 +echo "configure:6719: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6763,7 +6765,7 @@ RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6 -echo "configure:6767: checking where to find the target ar" >&5 +echo "configure:6769: checking where to find the target ar" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6796,7 +6798,7 @@ fi fi echo $ac_n "checking where to find the target as""... $ac_c" 1>&6 -echo "configure:6800: checking where to find the target as" >&5 +echo "configure:6802: checking where to find the target as" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6829,7 +6831,7 @@ fi fi echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6 -echo "configure:6833: checking where to find the target cc" >&5 +echo "configure:6835: checking where to find the target cc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6862,7 +6864,7 @@ fi fi echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6 -echo "configure:6866: checking where to find the target c++" >&5 +echo "configure:6868: checking where to find the target c++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6898,7 +6900,7 @@ fi fi echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6 -echo "configure:6902: checking where to find the target c++ for libstdc++" >&5 +echo "configure:6904: checking where to find the target c++ for libstdc++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6934,7 +6936,7 @@ fi fi echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6 -echo "configure:6938: checking where to find the target dlltool" >&5 +echo "configure:6940: checking where to find the target dlltool" >&5 if test "x${build}" != "x${host}" ; then if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6967,7 +6969,7 @@ fi fi echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6 -echo "configure:6971: checking where to find the target gcc" >&5 +echo "configure:6973: checking where to find the target gcc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7000,7 +7002,7 @@ fi fi echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6 -echo "configure:7004: checking where to find the target gcj" >&5 +echo "configure:7006: checking where to find the target gcj" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7036,7 +7038,7 @@ fi fi echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6 -echo "configure:7040: checking where to find the target gfortran" >&5 +echo "configure:7042: checking where to find the target gfortran" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7072,7 +7074,7 @@ fi fi echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6 -echo "configure:7076: checking where to find the target ld" >&5 +echo "configure:7078: checking where to find the target ld" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7105,7 +7107,7 @@ fi fi echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6 -echo "configure:7109: checking where to find the target lipo" >&5 +echo "configure:7111: checking where to find the target lipo" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7128,7 +7130,7 @@ fi fi echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6 -echo "configure:7132: checking where to find the target nm" >&5 +echo "configure:7134: checking where to find the target nm" >&5 if test "x${build}" != "x${host}" ; then if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7161,7 +7163,7 @@ fi fi echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6 -echo "configure:7165: checking where to find the target objdump" >&5 +echo "configure:7167: checking where to find the target objdump" >&5 if test "x${build}" != "x${host}" ; then if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7194,7 +7196,7 @@ fi fi echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6 -echo "configure:7198: checking where to find the target ranlib" >&5 +echo "configure:7200: checking where to find the target ranlib" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7227,7 +7229,7 @@ fi fi echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6 -echo "configure:7231: checking where to find the target strip" >&5 +echo "configure:7233: checking where to find the target strip" >&5 if test "x${build}" != "x${host}" ; then if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7260,7 +7262,7 @@ fi fi echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6 -echo "configure:7264: checking where to find the target windres" >&5 +echo "configure:7266: checking where to find the target windres" >&5 if test "x${build}" != "x${host}" ; then if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7321,7 +7323,7 @@ echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:7325: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:7327: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -7370,9 +7372,9 @@ # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it. CFLAGS="$CFLAGS -fkeep-inline-functions" echo $ac_n "checking whether -fkeep-inline-functions is supported""... $ac_c" 1>&6 -echo "configure:7374: checking whether -fkeep-inline-functions is supported" >&5 +echo "configure:7376: checking whether -fkeep-inline-functions is supported" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6; stage1_cflags="$stage1_cflags -fkeep-inline-functions" else Modified: llvm-gcc-4.2/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=42989&r1=42988&r2=42989&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure.in (original) +++ llvm-gcc-4.2/trunk/configure.in Mon Oct 15 11:01:08 2007 @@ -376,6 +376,8 @@ noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" noconfigdirs="$noconfigdirs ${libgcj} target-libstdc++-v3" + # LLVM LOCAL + noconfigdirs="$noconfigdirs target-libobjc" ;; *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" From tonic at nondot.org Mon Oct 15 11:35:13 2007 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 15 Oct 2007 16:35:13 -0000 Subject: [llvm-commits] [llvm] r42990 - /llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll Message-ID: <200710151635.l9FGZDad000701@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Oct 15 11:35:13 2007 New Revision: 42990 URL: http://llvm.org/viewvc/llvm-project?rev=42990&view=rev Log: Fix run line. Modified: llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll Modified: llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll?rev=42990&r1=42989&r2=42990&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll Mon Oct 15 11:35:13 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | \ +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin %struct._Unwind_Context = type { } From lattner at apple.com Mon Oct 15 11:35:38 2007 From: lattner at apple.com (Tanya Lattner) Date: Mon, 15 Oct 2007 09:35:38 -0700 Subject: [llvm-commits] [llvm] r42963 - /llvm/trunk/test/CodeGen/X86/2007-10-14-CoalescerCrash.ll In-Reply-To: <9986BF9A-FAF3-4C0A-AA0B-0AC636C77B9D@gmail.com> References: <200710141015.l9EAF3hi017832@zion.cs.uiuc.edu> <9986BF9A-FAF3-4C0A-AA0B-0AC636C77B9D@gmail.com> Message-ID: <5DC91550-8E9F-4AFE-92CA-17C9B1165263@apple.com> I deleted the extra |\ at the end so the test would pass. Evan, if thats not what you want, please fix. Thanks, Tanya On Oct 14, 2007, at 3:47 AM, Bill Wendling wrote: > On Oct 14, 2007, at 3:15 AM, Evan Cheng wrote: > >> +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | \ >> + > The backslash-newline looks suspect. > > -bw > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Oct 15 11:46:19 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 15 Oct 2007 09:46:19 -0700 Subject: [llvm-commits] [llvm] r42981 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp utils/TableGen/DAGISelEmitter.cpp In-Reply-To: <200710151401.46887.baldrick@free.fr> References: <200710150610.l9F6ANV3030436@zion.cs.uiuc.edu> <200710151401.46887.baldrick@free.fr> Message-ID: On Oct 15, 2007, at 5:01 AM, Duncan Sands wrote: > Hi Chris, this sounds like a big improvement! Where did you find > the time > to do this?! :) "You don't find time, you make time." This is something we've needed for a long time, and your recent work on supporting apint's made it even more necessary. >> 2. SoftFP is a mess, I need to talk to Evan about it. > > Presumably f64 will be promoted to i64 then possibly expanded into > 2xi32, > rather than mulching the two steps together in expand as is done now. Yes, exactly. > Codegen > support for arbitrary precision integers also needs to promote to a > type which > is then expanded. Does your new infrastructure support this > (currently expand > is only allowed to follow expand, not promote)? Untested, but yes it should :) > Dunno if it's useful to support > promote following promote/expand - I don't have a use for it, and > forbidding > it would help prevent infinite promote/expand loops. I don't have any explicit support for one or the other. It just supports relegalizing nodes after they've been transformed. >> 5. The code nicely separates out handling of operations with invalid >> results from operations with invalid operands, making some cases >> simpler and easier to understand. > > Yay! > > The following two comments seem contradictory. The first one suggests > that operations are not legalized... It separates handling "results vs operands" of a node. >> ... This legalizer is designed to run before the >> operation legalizer and ensure just that the input dag is transformed >> into an output dag whose operand and result types are all legal, even >> if the operations on those types are not. > > While here it sounds like operations are legalized... Nope, not intentionally. :) The type legalizer does not legalize operations, only types :) > >> + enum LegalizeAction { >> + Legal, // The target natively supports this operation. > > -> The target natively supports this type. > >> + Promote, // This operation should be executed in a larger >> type. > > -> This type should be replaced with a larger type. > >> + Expand // Try to expand this to other ops, otherwise use >> a libcall. > > -> This type should be split into two types of half the size. Fixed, pasto :) > > >> + /// ValueTypeActions - This is a bitvector that contains two >> bits for each >> + /// value type, where the two bits correspond to the >> LegalizeAction enum. > > value type -> simple value type > That said, I will work on adding support for extended value types > myself, so I > won't mention extended value types in the result of this email. Ok, thx for fixing. > By the way the logic supposes that the result of any node is an > operand for > some other node. Is at least one result always used? Nope, nodes are allowed to be unreachable/dead. What part assumes that they are used? >> + // If the node needs revisitation, don't add all users to the >> worklist etc. > > revisitation -> revisiting > Or is this a technical term? It's used several times. Just me accidentally making up new words, fixed. Thanks Duncan! -Chris From sabre at nondot.org Mon Oct 15 11:46:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 16:46:29 -0000 Subject: [llvm-commits] [llvm] r42991 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710151646.l9FGkTMA001465@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 11:46:29 2007 New Revision: 42991 URL: http://llvm.org/viewvc/llvm-project?rev=42991&view=rev Log: updates from duncan Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=42991&r1=42990&r2=42991&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Mon Oct 15 11:46:29 2007 @@ -55,9 +55,9 @@ }; enum LegalizeAction { - Legal, // The target natively supports this operation. - Promote, // This operation should be executed in a larger type. - Expand // Try to expand this to other ops, otherwise use a libcall. + Legal, // The target natively supports this type. + Promote, // This type should be executed in a larger type. + Expand // This type should be split into two types of half the size. }; /// ValueTypeActions - This is a bitvector that contains two bits for each @@ -244,7 +244,7 @@ } } - // If the node needs revisitation, don't add all users to the worklist etc. + // If the node needs revisiting, don't add all users to the worklist etc. if (NeedsRevisit) continue; @@ -328,7 +328,7 @@ // Okay, we know that this node is new. Recursively walk all of its operands // to see if they are new also. The depth of this walk is bounded by the size // of the new tree that was constructed (usually 2-3 nodes), so we don't worry - // about revisitation of nodes. + // about revisitating of nodes. // // As we walk the operands, keep track of the number of nodes that are // processed. If non-zero, this will become the new nodeid of this node. From sabre at nondot.org Mon Oct 15 12:16:12 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 17:16:12 -0000 Subject: [llvm-commits] [llvm] r42992 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710151716.l9FHGCUr002887@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 12:16:12 2007 New Revision: 42992 URL: http://llvm.org/viewvc/llvm-project?rev=42992&view=rev Log: implement promotion of BR_CC operands, fixing bisort on ppc. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=42992&r1=42991&r2=42992&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Mon Oct 15 12:16:12 2007 @@ -161,8 +161,11 @@ SDOperand PromoteOperand_FP_ROUND(SDNode *N); SDOperand PromoteOperand_SELECT(SDNode *N, unsigned OpNo); SDOperand PromoteOperand_BRCOND(SDNode *N, unsigned OpNo); + SDOperand PromoteOperand_BR_CC(SDNode *N, unsigned OpNo); SDOperand PromoteOperand_STORE(StoreSDNode *N, unsigned OpNo); + void PromoteSetCCOperands(SDOperand &LHS,SDOperand &RHS, ISD::CondCode Code); + // Operand Expansion. bool ExpandOperand(SDNode *N, unsigned OperandNo); SDOperand ExpandOperand_TRUNCATE(SDNode *N); @@ -328,7 +331,7 @@ // Okay, we know that this node is new. Recursively walk all of its operands // to see if they are new also. The depth of this walk is bounded by the size // of the new tree that was constructed (usually 2-3 nodes), so we don't worry - // about revisitating of nodes. + // about revisiting of nodes. // // As we walk the operands, keep track of the number of nodes that are // processed. If non-zero, this will become the new nodeid of this node. @@ -1141,6 +1144,8 @@ case ISD::SELECT: Res = PromoteOperand_SELECT(N, OpNo); break; case ISD::BRCOND: Res = PromoteOperand_BRCOND(N, OpNo); break; + case ISD::BR_CC: Res = PromoteOperand_BR_CC(N, OpNo); break; + case ISD::STORE: Res = PromoteOperand_STORE(cast(N), OpNo); break; } @@ -1226,6 +1231,64 @@ N->getOperand(2)); } +SDOperand DAGTypeLegalizer::PromoteOperand_BR_CC(SDNode *N, unsigned OpNo) { + assert(OpNo == 2 && "Don't know how to promote this operand"); + + SDOperand LHS = N->getOperand(2); + SDOperand RHS = N->getOperand(3); + PromoteSetCCOperands(LHS, RHS, cast(N->getOperand(1))->get()); + + // The chain (Op#0), CC (#1) and basic block destination (Op#4) are always + // legal types. + return DAG.UpdateNodeOperands(SDOperand(N, 0), N->getOperand(0), + N->getOperand(1), LHS, RHS, N->getOperand(4)); +} + +/// PromoteSetCCOperands - Promote the operands of a comparison. This code is +/// shared among BR_CC, SELECT_CC, and SETCC handlers. +void DAGTypeLegalizer::PromoteSetCCOperands(SDOperand &NewLHS,SDOperand &NewRHS, + ISD::CondCode CCCode) { + MVT::ValueType VT = NewLHS.getValueType(); + + // Get the promoted values. + NewLHS = GetPromotedOp(NewLHS); + NewRHS = GetPromotedOp(NewRHS); + + // If this is an FP compare, the operands have already been extended. + if (!MVT::isInteger(NewLHS.getValueType())) + return; + + // Otherwise, we have to insert explicit sign or zero extends. Note + // that we could insert sign extends for ALL conditions, but zero extend + // is cheaper on many machines (an AND instead of two shifts), so prefer + // it. + switch (CCCode) { + default: assert(0 && "Unknown integer comparison!"); + case ISD::SETEQ: + case ISD::SETNE: + case ISD::SETUGE: + case ISD::SETUGT: + case ISD::SETULE: + case ISD::SETULT: + // ALL of these operations will work if we either sign or zero extend + // the operands (including the unsigned comparisons!). Zero extend is + // usually a simpler/cheaper operation, so prefer it. + NewLHS = DAG.getZeroExtendInReg(NewLHS, VT); + NewRHS = DAG.getZeroExtendInReg(NewRHS, VT); + return; + case ISD::SETGE: + case ISD::SETGT: + case ISD::SETLT: + case ISD::SETLE: + NewLHS = DAG.getNode(ISD::SIGN_EXTEND_INREG, NewLHS.getValueType(), NewLHS, + DAG.getValueType(VT)); + NewRHS = DAG.getNode(ISD::SIGN_EXTEND_INREG, NewRHS.getValueType(), NewRHS, + DAG.getValueType(VT)); + return; + } +} + + SDOperand DAGTypeLegalizer::PromoteOperand_STORE(StoreSDNode *N, unsigned OpNo){ SDOperand Ch = N->getChain(), Ptr = N->getBasePtr(); int SVOffset = N->getSrcValueOffset(); @@ -1316,7 +1379,7 @@ DAG.getCondCode(CCCode)); } -/// ExpandSetCCOperands - Expand the operands to a comparison. This code is +/// ExpandSetCCOperands - Expand the operands of a comparison. This code is /// shared among BR_CC, SELECT_CC, and SETCC handlers. void DAGTypeLegalizer::ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, ISD::CondCode &CCCode) { From dpatel at apple.com Mon Oct 15 12:29:17 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 17:29:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42993 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200710151729.l9FHTHRM003477@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 12:29:14 2007 New Revision: 42993 URL: http://llvm.org/viewvc/llvm-project?rev=42993&view=rev Log: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071015/054529.html Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=42993&r1=42992&r2=42993&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct 15 12:29:14 2007 @@ -4838,13 +4838,20 @@ // float foo(int w, float A[][w], int g) { return A[g][0]; } ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); - Value *TypeSize = Emit(array_ref_element_size(exp), 0); - TypeSize = CastToUIntType(TypeSize, IntPtrTy); + Value *TypeSize = NULL; + if (VOID_TYPE_P(TREE_TYPE(ArrayType))) { + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + return BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); + } + else { + TypeSize = Emit(array_ref_element_size(exp), 0); + TypeSize = CastToUIntType(TypeSize, IntPtrTy); + IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + } - IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=42993&r1=42992&r2=42993&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Oct 15 12:29:14 2007 @@ -303,7 +303,7 @@ TREE_CODE(type) == REFERENCE_TYPE) && "not a sequential type!"); // This relies on gcc types with constant size mapping to LLVM types with the // same size. - return isInt64(TYPE_SIZE(TREE_TYPE(type)), true); + return !VOID_TYPE_P(TREE_TYPE(type)) && isInt64(TYPE_SIZE(TREE_TYPE(type)), true); } /// isArrayCompatible - Return true if the specified gcc array or pointer type From dalej at apple.com Mon Oct 15 12:36:45 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 15 Oct 2007 10:36:45 -0700 Subject: [llvm-commits] [llvm] r42991 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp In-Reply-To: <200710151646.l9FGkTMA001465@zion.cs.uiuc.edu> References: <200710151646.l9FGkTMA001465@zion.cs.uiuc.edu> Message-ID: <4CC6E082-2B40-4824-99C6-3727DBB593EA@apple.com> On Oct 15, 2007, at 9:46 AM, Chris Lattner wrote: > @@ -328,7 +328,7 @@ > // Okay, we know that this node is new. Recursively walk all of > its operands > // to see if they are new also. The depth of this walk is > bounded by the size > // of the new tree that was constructed (usually 2-3 nodes), so > we don't worry > - // about revisitation of nodes. > + // about revisitating of nodes. > // > // As we walk the operands, keep track of the number of nodes > that are > // processed. If non-zero, this will become the new nodeid of > this node. Actually 'revisitation' is a perfectly good word; but 'revisitating' is not. From sabre at nondot.org Mon Oct 15 12:47:20 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 17:47:20 -0000 Subject: [llvm-commits] [llvm] r42994 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200710151747.l9FHlK5Q004052@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 12:47:20 2007 New Revision: 42994 URL: http://llvm.org/viewvc/llvm-project?rev=42994&view=rev Log: add a new CreateStackTemporary helper method. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=42994&r1=42993&r2=42994&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Oct 15 12:47:20 2007 @@ -492,6 +492,10 @@ void dump() const; + /// CreateStackTemporary - Create a stack temporary, suitable for holding the + /// specified value type. + SDOperand CreateStackTemporary(MVT::ValueType VT); + /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT::ValueType VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42994&r1=42993&r2=42994&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Oct 15 12:47:20 2007 @@ -19,6 +19,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/TargetData.h" @@ -913,6 +914,18 @@ return SDOperand(N, 0); } +/// CreateStackTemporary - Create a stack temporary, suitable for holding the +/// specified value type. +SDOperand SelectionDAG::CreateStackTemporary(MVT::ValueType VT) { + MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); + unsigned ByteSize = MVT::getSizeInBits(VT)/8; + const Type *Ty = MVT::getTypeForValueType(VT); + unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty); + int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); + return getFrameIndex(FrameIdx, TLI.getPointerTy()); +} + + SDOperand SelectionDAG::FoldSetCC(MVT::ValueType VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond) { // These setcc operations always fold. From sabre at nondot.org Mon Oct 15 12:48:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 17:48:57 -0000 Subject: [llvm-commits] [llvm] r42995 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200710151748.l9FHmvwD004103@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 12:48:57 2007 New Revision: 42995 URL: http://llvm.org/viewvc/llvm-project?rev=42995&view=rev Log: Move CreateStackTemporary out to SelectionDAG Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42995&r1=42994&r2=42995&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Oct 15 12:48:57 2007 @@ -193,8 +193,6 @@ void LegalizeSetCCOperands(SDOperand &LHS, SDOperand &RHS, SDOperand &CC); - SDOperand CreateStackTemporary(MVT::ValueType VT); - SDOperand ExpandLibCall(const char *Name, SDNode *Node, bool isSigned, SDOperand &Hi); SDOperand ExpandIntToFP(bool isSigned, MVT::ValueType DestTy, @@ -1245,7 +1243,7 @@ MVT::ValueType EltVT = Tmp2.getValueType(); MVT::ValueType IdxVT = Tmp3.getValueType(); MVT::ValueType PtrVT = TLI.getPointerTy(); - SDOperand StackPtr = CreateStackTemporary(VT); + SDOperand StackPtr = DAG.CreateStackTemporary(VT); // Store the vector. SDOperand Ch = DAG.getStore(DAG.getEntryNode(), Tmp1, StackPtr, NULL, 0); @@ -4129,7 +4127,7 @@ } else { // Store the value to a temporary stack slot, then LOAD the scalar // element back out. - SDOperand StackPtr = CreateStackTemporary(Vec.getValueType()); + SDOperand StackPtr = DAG.CreateStackTemporary(Vec.getValueType()); SDOperand Ch = DAG.getStore(DAG.getEntryNode(), Vec, StackPtr, NULL, 0); // Add the offset to the index. @@ -4391,7 +4389,7 @@ Tmp2 = TLI.SimplifySetCC(TLI.getSetCCResultTy(), LHSHi, RHSHi, CCCode, false, DagCombineInfo); if (!Tmp2.Val) - Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), LHSHi, RHSHi, CC); + Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), LHSHi, RHSHi,CC); ConstantSDNode *Tmp1C = dyn_cast(Tmp1.Val); ConstantSDNode *Tmp2C = dyn_cast(Tmp2.Val); @@ -4430,7 +4428,7 @@ SDOperand SelectionDAGLegalize::ExpandBIT_CONVERT(MVT::ValueType DestVT, SDOperand SrcOp) { // Create the stack frame object. - SDOperand FIPtr = CreateStackTemporary(DestVT); + SDOperand FIPtr = DAG.CreateStackTemporary(DestVT); // Emit a store to the stack slot. SDOperand Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, NULL, 0); @@ -4441,7 +4439,7 @@ SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) { // Create a vector sized/aligned stack slot, store the value to element #0, // then load the whole vector back out. - SDOperand StackPtr = CreateStackTemporary(Node->getValueType(0)); + SDOperand StackPtr = DAG.CreateStackTemporary(Node->getValueType(0)); SDOperand Ch = DAG.getStore(DAG.getEntryNode(), Node->getOperand(0), StackPtr, NULL, 0); return DAG.getLoad(Node->getValueType(0), Ch, StackPtr, NULL, 0); @@ -4574,7 +4572,7 @@ // the result as a vector. MVT::ValueType VT = Node->getValueType(0); // Create the stack frame object. - SDOperand FIPtr = CreateStackTemporary(VT); + SDOperand FIPtr = DAG.CreateStackTemporary(VT); // Emit a store of each element to the stack slot. SmallVector Stores; @@ -4605,17 +4603,6 @@ return DAG.getLoad(VT, StoreChain, FIPtr, NULL, 0); } -/// CreateStackTemporary - Create a stack temporary, suitable for holding the -/// specified value type. -SDOperand SelectionDAGLegalize::CreateStackTemporary(MVT::ValueType VT) { - MachineFrameInfo *FrameInfo = DAG.getMachineFunction().getFrameInfo(); - unsigned ByteSize = MVT::getSizeInBits(VT)/8; - const Type *Ty = MVT::getTypeForValueType(VT); - unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty); - int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); - return DAG.getFrameIndex(FrameIdx, TLI.getPointerTy()); -} - void SelectionDAGLegalize::ExpandShiftParts(unsigned NodeOp, SDOperand Op, SDOperand Amt, SDOperand &Lo, SDOperand &Hi) { @@ -6318,7 +6305,7 @@ // The input is a scalar or single-element vector. // Lower to a store/load so that it can be split. // FIXME: this could be improved probably. - SDOperand Ptr = CreateStackTemporary(InOp.getValueType()); + SDOperand Ptr = DAG.CreateStackTemporary(InOp.getValueType()); SDOperand St = DAG.getStore(DAG.getEntryNode(), InOp, Ptr, NULL, 0); From baldrick at free.fr Mon Oct 15 13:03:33 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Oct 2007 20:03:33 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r42993 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp In-Reply-To: <200710151729.l9FHTHRM003477@zion.cs.uiuc.edu> References: <200710151729.l9FHTHRM003477@zion.cs.uiuc.edu> Message-ID: <200710152003.33404.baldrick@free.fr> Hi Devang, > // float foo(int w, float A[][w], int g) { return A[g][0]; } > > ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); > - Value *TypeSize = Emit(array_ref_element_size(exp), 0); > - TypeSize = CastToUIntType(TypeSize, IntPtrTy); > + Value *TypeSize = NULL; since TypeSize is only used in the second branch of the "if", it could be declared there. > + if (VOID_TYPE_P(TREE_TYPE(ArrayType))) { > + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); > + return BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); If ArrayAddr is not an i8*, then the CreateGEP line is wrong, so this bitcast should be useless. Ciao, Duncan. From evan.cheng at apple.com Mon Oct 15 13:33:51 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 15 Oct 2007 18:33:51 -0000 Subject: [llvm-commits] [llvm] r42996 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2007-10-15-CoalescerCrash.ll Message-ID: <200710151833.l9FIXpgi006206@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 15 13:33:50 2007 New Revision: 42996 URL: http://llvm.org/viewvc/llvm-project?rev=42996&view=rev Log: Fix PR1729: watch out for val# with no def. Added: llvm/trunk/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=42996&r1=42995&r2=42996&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Oct 15 13:33:50 2007 @@ -422,14 +422,19 @@ // then create and update the actual physical register allocated to RHS. if (RealDstReg) { LiveInterval &RealDstInt = li_->getOrCreateInterval(RealDstReg); - for (unsigned i = 0, e = ResSrcInt->getNumValNums(); i != e; ++i) { - const VNInfo *SrcValNo = ResSrcInt->getValNumInfo(i); - const VNInfo *DstValNo = - ResDstInt->FindLiveRangeContaining(SrcValNo->def)->valno; - VNInfo *ValNo = RealDstInt.getNextValue(DstValNo->def, DstValNo->reg, - li_->getVNInfoAllocator()); - RealDstInt.addKills(ValNo, DstValNo->kills); - RealDstInt.MergeValueInAsValue(*ResDstInt, DstValNo, ValNo); + SmallSet CopiedValNos; + for (LiveInterval::Ranges::const_iterator I = ResSrcInt->ranges.begin(), + E = ResSrcInt->ranges.end(); I != E; ++I) { + LiveInterval::const_iterator DstLR = + ResDstInt->FindLiveRangeContaining(I->start); + assert(DstLR != ResDstInt->end() && "Invalid joined interval!"); + const VNInfo *DstValNo = DstLR->valno; + if (CopiedValNos.insert(DstValNo)) { + VNInfo *ValNo = RealDstInt.getNextValue(DstValNo->def, DstValNo->reg, + li_->getVNInfoAllocator()); + RealDstInt.addKills(ValNo, DstValNo->kills); + RealDstInt.MergeValueInAsValue(*ResDstInt, DstValNo, ValNo); + } } repDstReg = RealDstReg; } Added: llvm/trunk/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll?rev=42996&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-15-CoalescerCrash.ll Mon Oct 15 13:33:50 2007 @@ -0,0 +1,400 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-linux-gnu +; PR1729 + + %struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.VEC_edge = type { i32, i32, [1 x %struct.edge_def*] } + %struct.VEC_tree = type { i32, i32, [1 x %struct.tree_node*] } + %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] } + %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } + %struct._obstack_chunk = type { i8*, %struct._obstack_chunk*, [4 x i8] } + %struct.addr_diff_vec_flags = type <{ i8, i8, i8, i8 }> + %struct.alloc_pool_def = type { i8*, i64, i64, %struct.alloc_pool_list_def*, i64, i64, i64, %struct.alloc_pool_list_def*, i64, i64 } + %struct.alloc_pool_list_def = type { %struct.alloc_pool_list_def* } + %struct.basic_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.tree_node*, %struct.VEC_edge*, %struct.VEC_edge*, %struct.bitmap_head_def*, %struct.bitmap_head_def*, i8*, %struct.loop*, [2 x %struct.et_node*], %struct.basic_block_def*, %struct.basic_block_def*, %struct.reorder_block_def*, %struct.bb_ann_d*, i64, i32, i32, i32, i32 } + %struct.bb_ann_d = type opaque + %struct.bitmap_element_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, i32, [2 x i64] } + %struct.bitmap_head_def = type { %struct.bitmap_element_def*, %struct.bitmap_element_def*, i32, %struct.bitmap_obstack* } + %struct.bitmap_obstack = type { %struct.bitmap_element_def*, %struct.bitmap_head_def*, %struct.obstack } + %struct.cselib_val_struct = type opaque + %struct.dataflow_d = type opaque + %struct.die_struct = type opaque + %struct.edge_def = type { %struct.basic_block_def*, %struct.basic_block_def*, %struct.edge_def_insns, i8*, %struct.location_t*, i32, i32, i64, i32 } + %struct.edge_def_insns = type { %struct.rtx_def* } + %struct.edge_iterator = type { i32, %struct.VEC_edge** } + %struct.eh_status = type opaque + %struct.elt_list = type opaque + %struct.emit_status = type { i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, i32, %struct.location_t, i32, i8*, %struct.rtx_def** } + %struct.et_node = type opaque + %struct.expr_status = type { i32, i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } + %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, i32, i32, i32, i32, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i8, i32, i64, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, i32, %struct.var_refs_queue*, i32, i32, %struct.rtvec_def*, %struct.tree_node*, i32, i32, i32, %struct.machine_function*, i32, i32, i8, i8, %struct.language_function*, %struct.rtx_def*, i32, i32, i32, i32, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, %struct.tree_node*, i8, i8, i8 } + %struct.ht_identifier = type { i8*, i32, i32 } + %struct.initial_value_struct = type opaque + %struct.lang_decl = type opaque + %struct.lang_type = type opaque + %struct.language_function = type opaque + %struct.location_t = type { i8*, i32 } + %struct.loop = type opaque + %struct.machine_function = type { %struct.stack_local_entry*, i8*, %struct.rtx_def*, i32, i32, i32, i32, i32 } + %struct.mem_attrs = type { i64, %struct.tree_node*, %struct.rtx_def*, %struct.rtx_def*, i32 } + %struct.obstack = type { i64, %struct._obstack_chunk*, i8*, i8*, i8*, i64, i32, %struct._obstack_chunk* (i8*, i64)*, void (i8*, %struct._obstack_chunk*)*, i8*, i8 } + %struct.phi_arg_d = type { %struct.tree_node*, i8 } + %struct.ptr_info_def = type opaque + %struct.real_value = type opaque + %struct.reg_attrs = type { %struct.tree_node*, i64 } + %struct.reg_info_def = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.reorder_block_def = type { %struct.rtx_def*, %struct.rtx_def*, %struct.basic_block_def*, %struct.basic_block_def*, %struct.basic_block_def*, i32, i32, i32 } + %struct.rtunion = type { i8* } + %struct.rtvec_def = type { i32, [1 x %struct.rtx_def*] } + %struct.rtx_def = type { i16, i8, i8, %struct.u } + %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } + %struct.simple_bitmap_def = type { i32, i32, i32, [1 x i64] } + %struct.stack_local_entry = type opaque + %struct.temp_slot = type opaque + %struct.tree_binfo = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.VEC_tree*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.VEC_tree } + %struct.tree_block = type { %struct.tree_common, i32, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node* } + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, i8, i8, i8, i8, i8 } + %struct.tree_complex = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, i32, %struct.tree_node*, i8, i8, i8, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, i32, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_decl* } + %struct.tree_decl_u1 = type { i64 } + %struct.tree_decl_u1_a = type <{ i32 }> + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_exp = type { %struct.tree_common, %struct.location_t*, i32, %struct.tree_node*, [1 x %struct.tree_node*] } + %struct.tree_identifier = type { %struct.tree_common, %struct.ht_identifier } + %struct.tree_int_cst = type { %struct.tree_common, %struct.tree_int_cst_lowhi } + %struct.tree_int_cst_lowhi = type { i64, i64 } + %struct.tree_list = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } + %struct.tree_node = type { %struct.tree_decl } + %struct.tree_phi_node = type { %struct.tree_common, %struct.tree_node*, i32, i32, i32, %struct.basic_block_def*, %struct.dataflow_d*, [1 x %struct.phi_arg_d] } + %struct.tree_real_cst = type { %struct.tree_common, %struct.real_value* } + %struct.tree_ssa_name = type { %struct.tree_common, %struct.tree_node*, i32, %struct.ptr_info_def*, %struct.tree_node*, i8* } + %struct.tree_statement_list = type { %struct.tree_common, %struct.tree_statement_list_node*, %struct.tree_statement_list_node* } + %struct.tree_statement_list_node = type { %struct.tree_statement_list_node*, %struct.tree_statement_list_node*, %struct.tree_node* } + %struct.tree_string = type { %struct.tree_common, i32, [1 x i8] } + %struct.tree_type = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i32, i16, i8, i8, i32, %struct.tree_node*, %struct.tree_node*, %struct.rtunion, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_type* } + %struct.tree_type_symtab = type { i8* } + %struct.tree_value_handle = type { %struct.tree_common, %struct.value_set*, i32 } + %struct.tree_vec = type { %struct.tree_common, i32, [1 x %struct.tree_node*] } + %struct.tree_vector = type { %struct.tree_common, %struct.tree_node* } + %struct.u = type { [1 x %struct.rtunion] } + %struct.value_set = type opaque + %struct.var_refs_queue = type { %struct.rtx_def*, i32, i32, %struct.var_refs_queue* } + %struct.varasm_status = type opaque + %struct.varray_data = type { [1 x i64] } + %struct.varray_head_tag = type { i64, i64, i32, i8*, %struct.varray_data } + %union.tree_ann_d = type opaque + at first_edge_aux_obj = external global i8* ; [#uses=0] + at first_block_aux_obj = external global i8* ; [#uses=0] + at n_edges = external global i32 ; [#uses=0] + at ENTRY_BLOCK_PTR = external global %struct.basic_block_def* ; <%struct.basic_block_def**> [#uses=0] + at EXIT_BLOCK_PTR = external global %struct.basic_block_def* ; <%struct.basic_block_def**> [#uses=0] + at n_basic_blocks = external global i32 ; [#uses=0] + at .str = external constant [9 x i8] ; <[9 x i8]*> [#uses=0] + at rbi_pool = external global %struct.alloc_pool_def* ; <%struct.alloc_pool_def**> [#uses=0] + at __FUNCTION__.19643 = external constant [18 x i8] ; <[18 x i8]*> [#uses=0] + at .str1 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] + at __FUNCTION__.19670 = external constant [15 x i8] ; <[15 x i8]*> [#uses=0] + at basic_block_info = external global %struct.varray_head_tag* ; <%struct.varray_head_tag**> [#uses=0] + at last_basic_block = external global i32 ; [#uses=0] + at __FUNCTION__.19696 = external constant [14 x i8] ; <[14 x i8]*> [#uses=0] + at __FUNCTION__.20191 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] + at block_aux_obstack = external global %struct.obstack ; <%struct.obstack*> [#uses=0] + at __FUNCTION__.20301 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] + at __FUNCTION__.20316 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at edge_aux_obstack = external global %struct.obstack ; <%struct.obstack*> [#uses=0] + at stderr = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=0] + at __FUNCTION__.20463 = external constant [11 x i8] ; <[11 x i8]*> [#uses=0] + at .str2 = external constant [7 x i8] ; <[7 x i8]*> [#uses=0] + at .str3 = external constant [6 x i8] ; <[6 x i8]*> [#uses=0] + at .str4 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0] + at .str5 = external constant [11 x i8] ; <[11 x i8]*> [#uses=0] + at .str6 = external constant [8 x i8] ; <[8 x i8]*> [#uses=0] + at .str7 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0] + at bitnames.20157 = external constant [13 x i8*] ; <[13 x i8*]*> [#uses=0] + at .str8 = external constant [9 x i8] ; <[9 x i8]*> [#uses=0] + at .str9 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at .str10 = external constant [7 x i8] ; <[7 x i8]*> [#uses=0] + at .str11 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at .str12 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0] + at .str13 = external constant [9 x i8] ; <[9 x i8]*> [#uses=0] + at .str14 = external constant [13 x i8] ; <[13 x i8]*> [#uses=0] + at .str15 = external constant [12 x i8] ; <[12 x i8]*> [#uses=0] + at .str16 = external constant [8 x i8] ; <[8 x i8]*> [#uses=0] + at .str17 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0] + at .str18 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0] + at .str19 = external constant [6 x i8] ; <[6 x i8]*> [#uses=0] + at .str20 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0] + at .str21 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at .str22 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at __FUNCTION__.19709 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] + at .str23 = external constant [5 x i8] ; <[5 x i8]*> [#uses=0] + at .str24 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0] + at __FUNCTION__.19813 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at .str25 = external constant [7 x i8] ; <[7 x i8]*> [#uses=0] + at .str26 = external constant [6 x i8] ; <[6 x i8]*> [#uses=0] + at initialized.20241.b = external global i1 ; [#uses=0] + at __FUNCTION__.20244 = external constant [21 x i8] ; <[21 x i8]*> [#uses=0] + at __FUNCTION__.19601 = external constant [12 x i8] ; <[12 x i8]*> [#uses=0] + at __FUNCTION__.14571 = external constant [8 x i8] ; <[8 x i8]*> [#uses=0] + at __FUNCTION__.14535 = external constant [13 x i8] ; <[13 x i8]*> [#uses=0] + at .str27 = external constant [28 x i8] ; <[28 x i8]*> [#uses=0] + at __FUNCTION__.14589 = external constant [8 x i8] ; <[8 x i8]*> [#uses=0] + at __FUNCTION__.19792 = external constant [12 x i8] ; <[12 x i8]*> [#uses=0] + at __FUNCTION__.19851 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at profile_status = external global i32 ; [#uses=0] + at .str29 = external constant [46 x i8] ; <[46 x i8]*> [#uses=0] + at .str30 = external constant [49 x i8] ; <[49 x i8]*> [#uses=0] + at .str31 = external constant [54 x i8] ; <[54 x i8]*> [#uses=0] + at .str32 = external constant [49 x i8] ; <[49 x i8]*> [#uses=1] + at __FUNCTION__.19948 = external constant [15 x i8] ; <[15 x i8]*> [#uses=0] + at reg_n_info = external global %struct.varray_head_tag* ; <%struct.varray_head_tag**> [#uses=0] + at reload_completed = external global i32 ; [#uses=0] + at .str33 = external constant [15 x i8] ; <[15 x i8]*> [#uses=0] + at .str34 = external constant [43 x i8] ; <[43 x i8]*> [#uses=0] + at .str35 = external constant [13 x i8] ; <[13 x i8]*> [#uses=0] + at .str36 = external constant [1 x i8] ; <[1 x i8]*> [#uses=0] + at .str37 = external constant [2 x i8] ; <[2 x i8]*> [#uses=0] + at .str38 = external constant [16 x i8] ; <[16 x i8]*> [#uses=0] + at cfun = external global %struct.function* ; <%struct.function**> [#uses=0] + at .str39 = external constant [14 x i8] ; <[14 x i8]*> [#uses=0] + at .str40 = external constant [11 x i8] ; <[11 x i8]*> [#uses=0] + at .str41 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] + at .str42 = external constant [17 x i8] ; <[17 x i8]*> [#uses=0] + at .str43 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at mode_size = external global [48 x i8] ; <[48 x i8]*> [#uses=0] + at target_flags = external global i32 ; [#uses=0] + at .str44 = external constant [11 x i8] ; <[11 x i8]*> [#uses=0] + at reg_class_names = external global [0 x i8*] ; <[0 x i8*]*> [#uses=0] + at .str45 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0] + at .str46 = external constant [13 x i8] ; <[13 x i8]*> [#uses=0] + at .str47 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at .str48 = external constant [12 x i8] ; <[12 x i8]*> [#uses=0] + at .str49 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0] + at .str50 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at .str51 = external constant [29 x i8] ; <[29 x i8]*> [#uses=0] + at .str52 = external constant [17 x i8] ; <[17 x i8]*> [#uses=0] + at .str53 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at .str54 = external constant [22 x i8] ; <[22 x i8]*> [#uses=0] + at .str55 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0] + at .str56 = external constant [12 x i8] ; <[12 x i8]*> [#uses=0] + at .str57 = external constant [26 x i8] ; <[26 x i8]*> [#uses=0] + at .str58 = external constant [15 x i8] ; <[15 x i8]*> [#uses=0] + at .str59 = external constant [14 x i8] ; <[14 x i8]*> [#uses=0] + at .str60 = external constant [26 x i8] ; <[26 x i8]*> [#uses=0] + at .str61 = external constant [24 x i8] ; <[24 x i8]*> [#uses=0] + at initialized.20366.b = external global i1 ; [#uses=0] + at __FUNCTION__.20369 = external constant [20 x i8] ; <[20 x i8]*> [#uses=0] + at __FUNCTION__.20442 = external constant [19 x i8] ; <[19 x i8]*> [#uses=0] + at bb_bitnames.20476 = external constant [6 x i8*] ; <[6 x i8*]*> [#uses=0] + at .str62 = external constant [6 x i8] ; <[6 x i8]*> [#uses=0] + at .str63 = external constant [4 x i8] ; <[4 x i8]*> [#uses=0] + at .str64 = external constant [10 x i8] ; <[10 x i8]*> [#uses=0] + at .str65 = external constant [8 x i8] ; <[8 x i8]*> [#uses=0] + at .str66 = external constant [17 x i8] ; <[17 x i8]*> [#uses=0] + at .str67 = external constant [11 x i8] ; <[11 x i8]*> [#uses=0] + at .str68 = external constant [15 x i8] ; <[15 x i8]*> [#uses=0] + at .str69 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at .str70 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0] + at __FUNCTION__.20520 = external constant [32 x i8] ; <[32 x i8]*> [#uses=0] + at dump_file = external global %struct._IO_FILE* ; <%struct._IO_FILE**> [#uses=0] + at .str71 = external constant [86 x i8] ; <[86 x i8]*> [#uses=0] + at .str72 = external constant [94 x i8] ; <[94 x i8]*> [#uses=0] + at reg_obstack = external global %struct.bitmap_obstack ; <%struct.bitmap_obstack*> [#uses=0] + +declare void @init_flow() + +declare i8* @ggc_alloc_cleared_stat(i64) + +declare fastcc void @free_edge(%struct.edge_def*) + +declare void @ggc_free(i8*) + +declare %struct.basic_block_def* @alloc_block() + +declare void @alloc_rbi_pool() + +declare %struct.alloc_pool_def* @create_alloc_pool(i8*, i64, i64) + +declare void @free_rbi_pool() + +declare void @free_alloc_pool(%struct.alloc_pool_def*) + +declare void @initialize_bb_rbi(%struct.basic_block_def*) + +declare void @fancy_abort(i8*, i32, i8*) + +declare i8* @pool_alloc(%struct.alloc_pool_def*) + +declare void @llvm.memset.i64(i8*, i8, i64, i32) + +declare void @link_block(%struct.basic_block_def*, %struct.basic_block_def*) + +declare void @unlink_block(%struct.basic_block_def*) + +declare void @compact_blocks() + +declare void @varray_check_failed(%struct.varray_head_tag*, i64, i8*, i32, i8*) + +declare void @expunge_block(%struct.basic_block_def*) + +declare void @clear_bb_flags() + +declare void @alloc_aux_for_block(%struct.basic_block_def*, i32) + +declare void @_obstack_newchunk(%struct.obstack*, i32) + +declare void @clear_aux_for_blocks() + +declare void @free_aux_for_blocks() + +declare void @obstack_free(%struct.obstack*, i8*) + +declare void @alloc_aux_for_edge(%struct.edge_def*, i32) + +declare void @debug_bb(%struct.basic_block_def*) + +declare void @dump_bb(%struct.basic_block_def*, %struct._IO_FILE*, i32) + +declare %struct.basic_block_def* @debug_bb_n(i32) + +declare void @dump_edge_info(%struct._IO_FILE*, %struct.edge_def*, i32) + +declare i32 @fputs_unlocked(i8* noalias , %struct._IO_FILE* noalias ) + +declare i32 @fprintf(%struct._IO_FILE* noalias , i8* noalias , ...) + +declare i64 @fwrite(i8*, i64, i64, i8*) + +declare i32 @__overflow(%struct._IO_FILE*, i32) + +declare %struct.edge_def* @unchecked_make_edge(%struct.basic_block_def*, %struct.basic_block_def*, i32) + +declare i8* @vec_gc_p_reserve(i8*, i32) + +declare void @vec_assert_fail(i8*, i8*, i8*, i32, i8*) + +declare void @execute_on_growing_pred(%struct.edge_def*) + +declare %struct.edge_def* @make_edge(%struct.basic_block_def*, %struct.basic_block_def*, i32) + +declare %struct.edge_def* @find_edge(%struct.basic_block_def*, %struct.basic_block_def*) + +declare %struct.edge_def* @make_single_succ_edge(%struct.basic_block_def*, %struct.basic_block_def*, i32) + +declare %struct.edge_def* @cached_make_edge(%struct.simple_bitmap_def**, %struct.basic_block_def*, %struct.basic_block_def*, i32) + +declare void @redirect_edge_succ(%struct.edge_def*, %struct.basic_block_def*) + +declare void @execute_on_shrinking_pred(%struct.edge_def*) + +declare void @alloc_aux_for_blocks(i32) + +declare i8* @xmalloc(i64) + +declare i32 @_obstack_begin(%struct.obstack*, i32, i32, i8* (i64)*, void (i8*)*) + +declare void @free(i8*) + +declare void @clear_edges() + +declare void @remove_edge(%struct.edge_def*) + +declare %struct.edge_def* @redirect_edge_succ_nodup(%struct.edge_def*, %struct.basic_block_def*) + +declare void @redirect_edge_pred(%struct.edge_def*, %struct.basic_block_def*) + +define void @check_bb_profile(%struct.basic_block_def* %bb, %struct._IO_FILE* %file) { +entry: + br i1 false, label %cond_false759.preheader, label %cond_false149.preheader + +cond_false149.preheader: ; preds = %entry + ret void + +cond_false759.preheader: ; preds = %entry + br i1 false, label %cond_next873, label %cond_true794 + +bb644: ; preds = %cond_next873 + ret void + +cond_true794: ; preds = %cond_false759.preheader + ret void + +cond_next873: ; preds = %cond_false759.preheader + br i1 false, label %bb882, label %bb644 + +bb882: ; preds = %cond_next873 + br i1 false, label %cond_true893, label %cond_next901 + +cond_true893: ; preds = %bb882 + br label %cond_false1036 + +cond_next901: ; preds = %bb882 + ret void + +bb929: ; preds = %cond_next1150 + %tmp934 = add i64 0, %lsum.11225.0 ; [#uses=1] + br i1 false, label %cond_next979, label %cond_true974 + +cond_true974: ; preds = %bb929 + ret void + +cond_next979: ; preds = %bb929 + br label %cond_false1036 + +cond_false1036: ; preds = %cond_next979, %cond_true893 + %lsum.11225.0 = phi i64 [ 0, %cond_true893 ], [ %tmp934, %cond_next979 ] ; [#uses=2] + br i1 false, label %cond_next1056, label %cond_true1051 + +cond_true1051: ; preds = %cond_false1036 + ret void + +cond_next1056: ; preds = %cond_false1036 + br i1 false, label %cond_next1150, label %cond_true1071 + +cond_true1071: ; preds = %cond_next1056 + ret void + +cond_next1150: ; preds = %cond_next1056 + %tmp1156 = icmp eq %struct.edge_def* null, null ; [#uses=1] + br i1 %tmp1156, label %bb1159, label %bb929 + +bb1159: ; preds = %cond_next1150 + br i1 false, label %cond_true1169, label %UnifiedReturnBlock + +cond_true1169: ; preds = %bb1159 + %tmp11741175 = trunc i64 %lsum.11225.0 to i32 ; [#uses=1] + %tmp1178 = tail call i32 (%struct._IO_FILE* noalias , i8* noalias , ...)* @fprintf( %struct._IO_FILE* %file noalias , i8* getelementptr ([49 x i8]* @.str32, i32 0, i64 0) noalias , i32 %tmp11741175, i32 0 ) ; [#uses=0] + ret void + +UnifiedReturnBlock: ; preds = %bb1159 + ret void +} + +declare void @dump_flow_info(%struct._IO_FILE*) + +declare i32 @max_reg_num() + +declare void @rtl_check_failed_flag(i8*, %struct.rtx_def*, i8*, i32, i8*) + +declare i32 @reg_preferred_class(i32) + +declare i32 @reg_alternate_class(i32) + +declare i8 @maybe_hot_bb_p(%struct.basic_block_def*) zeroext + +declare i8 @probably_never_executed_bb_p(%struct.basic_block_def*) zeroext + +declare void @dump_regset(%struct.bitmap_head_def*, %struct._IO_FILE*) + +declare void @debug_flow_info() + +declare void @alloc_aux_for_edges(i32) + +declare void @clear_aux_for_edges() + +declare void @free_aux_for_edges() + +declare void @brief_dump_cfg(%struct._IO_FILE*) + +declare i32 @fputc(i32, i8*) + +declare void @update_bb_profile_for_threading(%struct.basic_block_def*, i32, i64, %struct.edge_def*) From dalej at apple.com Mon Oct 15 13:42:17 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 15 Oct 2007 18:42:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42997 - /llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c Message-ID: <200710151842.l9FIgHj6006655@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 15 13:42:17 2007 New Revision: 42997 URL: http://llvm.org/viewvc/llvm-project?rev=42997&view=rev Log: Set modes for Altivec bool and pixel types. From vecLib. Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c?rev=42997&r1=42996&r2=42997&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/rs6000.c Mon Oct 15 13:42:17 2007 @@ -9161,22 +9161,6 @@ unsigned_V8HI_type_node = build_vector_type (unsigned_intHI_type_node, 8); unsigned_V4SI_type_node = build_vector_type (unsigned_intSI_type_node, 4); - /* APPLE LOCAL begin LLVM */ -#ifdef ENABLE_LLVM - /* LLVM doesn't initialize the RTL backend, so build_vector_type will assign - all of these types BLKmode. This interferes with rs6000.c-specific - handling of -faltivec overloads (an apple local patch). As such, give them - the correct modes here manually. */ - TYPE_MODE (V4SI_type_node) = V4SImode; - TYPE_MODE (V4SF_type_node) = V4SFmode; - TYPE_MODE (V8HI_type_node) = V8HImode; - TYPE_MODE (V16QI_type_node) = V16QImode; - TYPE_MODE (unsigned_V4SI_type_node) = V4SImode; - TYPE_MODE (unsigned_V8HI_type_node) = V8HImode; - TYPE_MODE (unsigned_V16QI_type_node) = V16QImode; -#endif - /* APPLE LOCAL end LLVM */ - opaque_V2SF_type_node = build_opaque_vector_type (float_type_node, 2); opaque_V2SI_type_node = build_opaque_vector_type (intSI_type_node, 2); opaque_p_V2SI_type_node = build_pointer_type (opaque_V2SI_type_node); @@ -9208,6 +9192,26 @@ bool_V4SI_type_node = build_vector_type (bool_int_type_node, 4); pixel_V8HI_type_node = build_vector_type (pixel_type_node, 8); + /* APPLE LOCAL begin LLVM */ +#ifdef ENABLE_LLVM + /* LLVM doesn't initialize the RTL backend, so build_vector_type will assign + all of these types BLKmode. This interferes with rs6000.c-specific + handling of -faltivec overloads (an apple local patch). As such, give them + the correct modes here manually. */ + TYPE_MODE (V4SI_type_node) = V4SImode; + TYPE_MODE (V4SF_type_node) = V4SFmode; + TYPE_MODE (V8HI_type_node) = V8HImode; + TYPE_MODE (V16QI_type_node) = V16QImode; + TYPE_MODE (unsigned_V4SI_type_node) = V4SImode; + TYPE_MODE (unsigned_V8HI_type_node) = V8HImode; + TYPE_MODE (unsigned_V16QI_type_node) = V16QImode; + TYPE_MODE (bool_V16QI_type_node) = V16QImode; + TYPE_MODE (bool_V8HI_type_node) = V8HImode; + TYPE_MODE (bool_V4SI_type_node) = V4SImode; + TYPE_MODE (pixel_V8HI_type_node) = V8HImode; +#endif + /* APPLE LOCAL end LLVM */ + (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, get_identifier ("__vector unsigned char"), unsigned_V16QI_type_node)); From kremenek at apple.com Mon Oct 15 13:52:34 2007 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 15 Oct 2007 18:52:34 -0000 Subject: [llvm-commits] [llvm] r42998 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h Message-ID: <200710151852.l9FIqY9p007090@zion.cs.uiuc.edu> Author: kremenek Date: Mon Oct 15 13:52:34 2007 New Revision: 42998 URL: http://llvm.org/viewvc/llvm-project?rev=42998&view=rev Log: Added more doxygen comments. Renamed internal method of ImutAVLTree::RemoveMutableFlag to MarkImmutable. Added enum for bit manipulation (more self-documentating). Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=42998&r1=42997&r2=42998&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Oct 15 13:52:34 2007 @@ -198,7 +198,12 @@ //===----------------------------------------------------===// // Profiling or FoldingSet. //===----------------------------------------------------===// - + +private: + + /// Profile - Generates a FoldingSet profile for a tree node before it is + /// created. This is used by the ImutAVLFactory when creating + /// trees. static inline void Profile(FoldingSetNodeID& ID, ImutAVLTree* L, ImutAVLTree* R, value_type_ref V) { @@ -208,7 +213,8 @@ } public: - + + /// Profile - Generates a FoldingSet profile for an existing tree node. void Profile(FoldingSetNodeID& ID) { Profile(ID,getSafeLeft(),getRight(),getValue()); } @@ -219,41 +225,72 @@ private: + enum { Mutable = 0x1 }; + + /// ImutAVLTree - Internal constructor that is only called by + /// ImutAVLFactory. ImutAVLTree(ImutAVLTree* l, ImutAVLTree* r, value_type_ref v, unsigned height) - : Left(reinterpret_cast(l) | 0x1), + : Left(reinterpret_cast(l) | Mutable), Right(r), Height(height), Value(v) {} - bool isMutable() const { return Left & 0x1; } + /// isMutable - Returns true if the left and right subtree references + /// (as well as height) can be changed. If this method returns false, + /// the tree is truly immutable. Trees returned from an ImutAVLFactory + /// object should always have this method return true. Further, if this + /// method returns false for an instance of ImutAVLTree, all subtrees + /// will also have this method return false. The converse is not true. + bool isMutable() const { return Left & Mutable; } + + /// getSafeLeft - Returns the pointer to the left tree by always masking + /// out the mutable bit. This is used internally by ImutAVLFactory, + /// as no trees returned to the client should have the mutable flag set. ImutAVLTree* getSafeLeft() const { - return reinterpret_cast(Left & ~0x1); + return reinterpret_cast(Left & ~Mutable); } - // Mutating operations. A tree root can be manipulated as long as - // its reference has not "escaped" from internal methods of a - // factory object (see below). When a tree pointer is externally - // viewable by client code, the internal "mutable bit" is cleared - // to mark the tree immutable. Note that a tree that still has - // its mutable bit set may have children (subtrees) that are themselves + //===----------------------------------------------------===// + // Mutating operations. A tree root can be manipulated as + // long as its reference has not "escaped" from internal + // methods of a factory object (see below). When a tree + // pointer is externally viewable by client code, the + // internal "mutable bit" is cleared to mark the tree + // immutable. Note that a tree that still has its mutable + // bit set may have children (subtrees) that are themselves // immutable. + //===----------------------------------------------------===// - void RemoveMutableFlag() { - assert (Left & 0x1 && "Mutable flag already removed."); - Left &= ~0x1; + + /// MarkImmutable - Clears the mutable flag for a tree. After this happens, + /// it is an error to call setLeft(), setRight(), and setHeight(). It + /// is also then safe to call getLeft() instead of getSafeLeft(). + void MarkMutable() { + assert (isMutable() && "Mutable flag already removed."); + Left &= ~Mutable; } + /// setLeft - Changes the reference of the left subtree. Used internally + /// by ImutAVLFactory. void setLeft(ImutAVLTree* NewLeft) { - assert (isMutable()); - Left = reinterpret_cast(NewLeft) | 0x1; + assert (isMutable() && + "Only a mutable tree can have its left subtree changed."); + + Left = reinterpret_cast(NewLeft) | Mutable; } + /// setRight - Changes the reference of the right subtree. Used internally + /// by ImutAVLFactory. void setRight(ImutAVLTree* NewRight) { - assert (isMutable()); + assert (isMutable() && + "Only a mutable tree can have its right subtree changed."); + Right = NewRight; } + /// setHeight - Changes the height of the tree. Used internally by + /// ImutAVLFactory. void setHeight(unsigned h) { - assert (isMutable()); + assert (isMutable() && "Only a mutable tree can have its height changed."); Height = h; } }; @@ -470,7 +507,7 @@ if (!T || !T->isMutable()) return; - T->RemoveMutableFlag(); + T->MarkMutable(); MarkImmutable(Left(T)); MarkImmutable(Right(T)); } From kremenek at apple.com Mon Oct 15 14:15:48 2007 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 15 Oct 2007 19:15:48 -0000 Subject: [llvm-commits] [llvm] r42999 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h Message-ID: <200710151915.l9FJFmHx008213@zion.cs.uiuc.edu> Author: kremenek Date: Mon Oct 15 14:15:48 2007 New Revision: 42999 URL: http://llvm.org/viewvc/llvm-project?rev=42999&view=rev Log: Fixed incorrect renaming of method name (forgot two characters). Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=42999&r1=42998&r2=42999&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Mon Oct 15 14:15:48 2007 @@ -264,7 +264,7 @@ /// MarkImmutable - Clears the mutable flag for a tree. After this happens, /// it is an error to call setLeft(), setRight(), and setHeight(). It /// is also then safe to call getLeft() instead of getSafeLeft(). - void MarkMutable() { + void MarkImmutable() { assert (isMutable() && "Mutable flag already removed."); Left &= ~Mutable; } @@ -507,7 +507,7 @@ if (!T || !T->isMutable()) return; - T->MarkMutable(); + T->MarkImmutable(); MarkImmutable(Left(T)); MarkImmutable(Right(T)); } From djg at cray.com Mon Oct 15 14:22:17 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 15 Oct 2007 19:22:17 -0000 Subject: [llvm-commits] [llvm] r43001 - /llvm/trunk/test/CodeGen/X86/fp_constant_op.llx Message-ID: <200710151922.l9FJMHak008591@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 15 14:22:17 2007 New Revision: 43001 URL: http://llvm.org/viewvc/llvm-project?rev=43001&view=rev Log: Reapply the fix in 42908 for this file. This changes the function names from "test" to "foo" so that they don't match the grep -i ST. Modified: llvm/trunk/test/CodeGen/X86/fp_constant_op.llx Modified: llvm/trunk/test/CodeGen/X86/fp_constant_op.llx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp_constant_op.llx?rev=43001&r1=43000&r2=43001&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fp_constant_op.llx (original) +++ llvm/trunk/test/CodeGen/X86/fp_constant_op.llx Mon Oct 15 14:22:17 2007 @@ -3,32 +3,32 @@ ; Test that the load of the constant is folded into the operation. -double %test_add(double %P) { +double %foo_add(double %P) { %tmp.1 = add double %P, 0x405EC00000000000 ret double %tmp.1 } -double %test_mul(double %P) { +double %foo_mul(double %P) { %tmp.1 = mul double %P, 0x405EC00000000000 ret double %tmp.1 } -double %test_sub(double %P) { +double %foo_sub(double %P) { %tmp.1 = sub double %P, 0x405EC00000000000 ret double %tmp.1 } -double %test_subr(double %P) { +double %foo_subr(double %P) { %tmp.1 = sub double 0x405EC00000000000, %P ret double %tmp.1 } -double %test_div(double %P) { +double %foo_div(double %P) { %tmp.1 = div double %P, 0x405EC00000000000 ret double %tmp.1 } -double %test_divr(double %P) { +double %foo_divr(double %P) { %tmp.1 = div double 0x405EC00000000000, %P ret double %tmp.1 } From dpatel at apple.com Mon Oct 15 14:56:32 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 19:56:32 -0000 Subject: [llvm-commits] [llvm] r43002 - in /llvm/trunk: include/llvm/ExecutionEngine/ExecutionEngine.h lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200710151956.l9FJuWNC010761@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 14:56:32 2007 New Revision: 43002 URL: http://llvm.org/viewvc/llvm-project?rev=43002&view=rev Log: Add removeModuleProvider() Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=43002&r1=43001&r2=43002&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Mon Oct 15 14:56:32 2007 @@ -97,7 +97,11 @@ void addModuleProvider(ModuleProvider *P) { Modules.push_back(P); } - + + /// removeModuleProvider - Remove a ModuleProvider from the list of modules. + /// Release module from ModuleProvider. + Module* removeModuleProvider(ModuleProvider *P, std::string *ErrInfo = 0); + /// FindFunctionNamed - Search all of the active modules to find the one that /// defines FnName. This is very slow operation and shouldn't be used for /// general code. Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=43002&r1=43001&r2=43002&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Mon Oct 15 14:56:32 2007 @@ -51,6 +51,21 @@ delete Modules[i]; } +/// removeModuleProvider - Remove a ModuleProvider from the list of modules. +/// Release module from ModuleProvider. +Module* ExecutionEngine::removeModuleProvider(ModuleProvider *P, + std::string *ErrInfo) { + for(SmallVector::iterator I = Modules.begin(), + E = Modules.end(); I != E; ++I) { + ModuleProvider *MP = *I; + if (MP == P) { + Modules.erase(I); + return MP->releaseModule(ErrInfo); + } + } + return NULL; +} + /// FindFunctionNamed - Search all of the active modules to find the one that /// defines FnName. This is very slow operation and shouldn't be used for /// general code. From dalej at apple.com Mon Oct 15 15:03:01 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 15 Oct 2007 20:03:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43003 - /llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Message-ID: <200710152003.l9FK31JS011088@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 15 15:03:00 2007 New Revision: 43003 URL: http://llvm.org/viewvc/llvm-project?rev=43003&view=rev Log: Set modes for bool and pixel Altivec types. Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c?rev=43003&r1=43002&r2=43003&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Mon Oct 15 15:03:00 2007 @@ -9077,22 +9077,6 @@ unsigned_V8HI_type_node = build_vector_type (unsigned_intHI_type_node, 8); unsigned_V4SI_type_node = build_vector_type (unsigned_intSI_type_node, 4); - /* LLVM LOCAL begin */ -#ifdef ENABLE_LLVM - /* LLVM doesn't initialize the RTL backend, so build_vector_type will assign - all of these types BLKmode. This interferes with rs6000.c-specific - handling of -faltivec overloads (an apple local patch). As such, give them - the correct modes here manually. */ - TYPE_MODE (V4SI_type_node) = V4SImode; - TYPE_MODE (V4SF_type_node) = V4SFmode; - TYPE_MODE (V8HI_type_node) = V8HImode; - TYPE_MODE (V16QI_type_node) = V16QImode; - TYPE_MODE (unsigned_V4SI_type_node) = V4SImode; - TYPE_MODE (unsigned_V8HI_type_node) = V8HImode; - TYPE_MODE (unsigned_V16QI_type_node) = V16QImode; -#endif - /* LLVM LOCAL end */ - opaque_V2SF_type_node = build_opaque_vector_type (float_type_node, 2); opaque_V2SI_type_node = build_opaque_vector_type (intSI_type_node, 2); opaque_p_V2SI_type_node = build_pointer_type (opaque_V2SI_type_node); @@ -9107,6 +9091,26 @@ bool_int_type_node = build_distinct_type_copy (unsigned_intSI_type_node); pixel_type_node = build_distinct_type_copy (unsigned_intHI_type_node); + /* APPLE LOCAL begin LLVM */ +#ifdef ENABLE_LLVM + /* LLVM doesn't initialize the RTL backend, so build_vector_type will assign + all of these types BLKmode. This interferes with rs6000.c-specific + handling of -faltivec overloads (an apple local patch). As such, give them + the correct modes here manually. */ + TYPE_MODE (V4SI_type_node) = V4SImode; + TYPE_MODE (V4SF_type_node) = V4SFmode; + TYPE_MODE (V8HI_type_node) = V8HImode; + TYPE_MODE (V16QI_type_node) = V16QImode; + TYPE_MODE (unsigned_V4SI_type_node) = V4SImode; + TYPE_MODE (unsigned_V8HI_type_node) = V8HImode; + TYPE_MODE (unsigned_V16QI_type_node) = V16QImode; + TYPE_MODE (bool_V16QI_type_node) = V16QImode; + TYPE_MODE (bool_V8HI_type_node) = V8HImode; + TYPE_MODE (bool_V4SI_type_node) = V4SImode; + TYPE_MODE (pixel_V8HI_type_node) = V8HImode; +#endif + /* APPLE LOCAL end LLVM */ + long_integer_type_internal_node = long_integer_type_node; long_unsigned_type_internal_node = long_unsigned_type_node; intQI_type_internal_node = intQI_type_node; From evan.cheng at apple.com Mon Oct 15 15:11:21 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 15 Oct 2007 20:11:21 -0000 Subject: [llvm-commits] [llvm] r43004 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/fp2sint.ll Message-ID: <200710152011.l9FKBLX1011439@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 15 15:11:21 2007 New Revision: 43004 URL: http://llvm.org/viewvc/llvm-project?rev=43004&view=rev Log: LowerFP_TO_SINT must not create a stack object if it's not needed. Added: llvm/trunk/test/CodeGen/X86/fp2sint.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43004&r1=43003&r2=43004&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 15 15:11:21 2007 @@ -3895,13 +3895,7 @@ SDOperand X86TargetLowering::LowerFP_TO_SINT(SDOperand Op, SelectionDAG &DAG) { assert(Op.getValueType() <= MVT::i64 && Op.getValueType() >= MVT::i16 && "Unknown FP_TO_SINT to lower!"); - // We lower FP->sint64 into FISTP64, followed by a load, all to a temporary - // stack slot. SDOperand Result; - MachineFunction &MF = DAG.getMachineFunction(); - unsigned MemSize = MVT::getSizeInBits(Op.getValueType())/8; - int SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize); - SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); // These are really Legal. if (Op.getValueType() == MVT::i32 && @@ -3915,6 +3909,12 @@ Op.getOperand(0).getValueType() != MVT::f80) return Result; + // We lower FP->sint64 into FISTP64, followed by a load, all to a temporary + // stack slot. + MachineFunction &MF = DAG.getMachineFunction(); + unsigned MemSize = MVT::getSizeInBits(Op.getValueType())/8; + int SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize); + SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); unsigned Opc; switch (Op.getValueType()) { default: assert(0 && "Invalid FP_TO_SINT to lower!"); Added: llvm/trunk/test/CodeGen/X86/fp2sint.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp2sint.ll?rev=43004&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/fp2sint.ll (added) +++ llvm/trunk/test/CodeGen/X86/fp2sint.ll Mon Oct 15 15:11:21 2007 @@ -0,0 +1,18 @@ +;; LowerFP_TO_SINT should not create a stack object if it's not needed. + +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep add + +define i32 @main(i32 %argc, i8** %argv) { +cond_false.i.i.i: ; preds = %bb.i5 + %tmp35.i = load double* null, align 8 ; [#uses=1] + %tmp3536.i = fptosi double %tmp35.i to i32 ; [#uses=1] + %tmp3536140.i = zext i32 %tmp3536.i to i64 ; [#uses=1] + %tmp39.i = load double* null, align 4 ; [#uses=1] + %tmp3940.i = fptosi double %tmp39.i to i32 ; [#uses=1] + %tmp3940137.i = zext i32 %tmp3940.i to i64 ; [#uses=1] + %tmp3940137138.i = shl i64 %tmp3940137.i, 32 ; [#uses=1] + %tmp3940137138.ins.i = or i64 %tmp3940137138.i, %tmp3536140.i ; [#uses=1] + %tmp95.i.i = trunc i64 %tmp3940137138.ins.i to i32 ; [#uses=1] + store i32 %tmp95.i.i, i32* null, align 4 + ret i32 0 +} From sabre at nondot.org Mon Oct 15 15:14:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Oct 2007 20:14:53 -0000 Subject: [llvm-commits] [llvm] r43005 - /llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200710152014.l9FKErXm011603@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 15:14:52 2007 New Revision: 43005 URL: http://llvm.org/viewvc/llvm-project?rev=43005&view=rev Log: Change LowerFP_TO_SINT to create the specific code it needs instead of unconditionally creating an i64 bitcast. With the future legalizer design, operation legalization can't introduce new nodes with illegal types. This fixes the rest of olden on ppc32. Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=43005&r1=43004&r2=43005&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Oct 15 15:14:52 2007 @@ -2028,7 +2028,7 @@ DAG.getNode(ISD::FNEG, MVT::f64, LHS), TV, FV); } - SDOperand Cmp; + SDOperand Cmp; switch (CC) { default: break; // SETUO etc aren't handled by fsel. case ISD::SETULT: @@ -2081,10 +2081,17 @@ } // Convert the FP value to an int value through memory. - SDOperand Bits = DAG.getNode(ISD::BIT_CONVERT, MVT::i64, Tmp); + SDOperand FIPtr = DAG.CreateStackTemporary(MVT::f64); + + // Emit a store to the stack slot. + SDOperand Chain = DAG.getStore(DAG.getEntryNode(), Tmp, FIPtr, NULL, 0); + + // Result is a load from the stack slot. If loading 4 bytes, make sure to + // add in a bias. if (Op.getValueType() == MVT::i32) - Bits = DAG.getNode(ISD::TRUNCATE, MVT::i32, Bits); - return Bits; + FIPtr = DAG.getNode(ISD::ADD, FIPtr.getValueType(), FIPtr, + DAG.getConstant(4, FIPtr.getValueType())); + return DAG.getLoad(Op.getValueType(), Chain, FIPtr, NULL, 0); } static SDOperand LowerFP_ROUND_INREG(SDOperand Op, SelectionDAG &DAG) { From djg at cray.com Mon Oct 15 15:30:11 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 15 Oct 2007 20:30:11 -0000 Subject: [llvm-commits] [llvm] r43007 - /llvm/trunk/docs/LangRef.html Message-ID: <200710152030.l9FKUBxZ012325@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 15 15:30:11 2007 New Revision: 43007 URL: http://llvm.org/viewvc/llvm-project?rev=43007&view=rev Log: Document the new llvm.sin, llvm.cos, and llvm.pow intrinsics. Feedback is welcome! Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=43007&r1=43006&r2=43007&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Oct 15 15:30:11 2007 @@ -177,6 +177,9 @@
  • 'llvm.memset.*' Intrinsic
  • 'llvm.sqrt.*' Intrinsic
  • 'llvm.powi.*' Intrinsic
  • +
  • 'llvm.sin.*' Intrinsic
  • +
  • 'llvm.cos.*' Intrinsic
  • +
  • 'llvm.pow.*' Intrinsic
  • Bit Manipulation Intrinsics @@ -4492,7 +4495,8 @@
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sqrt on any -floating point type. Not all targets support all types however. +floating point or vector of floating point type. Not all targets support all +types however.

       declare float     @llvm.sqrt.f32(float %Val)
       declare double    @llvm.sqrt.f64(double %Val)
    @@ -4505,7 +4509,7 @@
     
     

    The 'llvm.sqrt' intrinsics return the sqrt of the specified operand, -returning the same value as the libm 'sqrt' function would. Unlike +returning the same value as the libm 'sqrt' functions would. Unlike sqrt in libm, however, llvm.sqrt has undefined behavior for negative numbers (which allows for better optimization).

    @@ -4533,7 +4537,8 @@
    Syntax:

    This is an overloaded intrinsic. You can use llvm.powi on any -floating point type. Not all targets support all types however. +floating point or vector of floating point type. Not all targets support all +types however.

       declare float     @llvm.powi.f32(float  %Val, i32 %power)
       declare double    @llvm.powi.f64(double %Val, i32 %power)
    @@ -4547,7 +4552,8 @@
     

    The 'llvm.powi.*' intrinsics return the first operand raised to the specified (positive or negative) power. The order of evaluation of -multiplications is not defined. +multiplications is not defined. When a vector of floating point type is +used, the second argument remains a scalar integer value.

    Arguments:
    @@ -4564,6 +4570,132 @@ unspecified sequence of rounding operations.

    + + + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.sin on any +floating point or vector of floating point type. Not all targets support all +types however. +

    +  declare float     @llvm.sin.f32(float  %Val)
    +  declare double    @llvm.sin.f64(double %Val)
    +  declare x86_fp80  @llvm.sin.f80(x86_fp80  %Val)
    +  declare fp128     @llvm.sin.f128(fp128 %Val)
    +  declare ppc_fp128 @llvm.sin.ppcf128(ppc_fp128  %Val)
    +
    + +
    Overview:
    + +

    +The 'llvm.sin.*' intrinsics return the sine of the operand. +

    + +
    Arguments:
    + +

    +The argument and return value are floating point numbers of the same type. +

    + +
    Semantics:
    + +

    +This function returns the sine of the specified operand, returning the +same values as the libm sin functions would, and handles error +conditions in the same way, unless the --enable-unsafe-fp-math is enabled +during code generation, in which case the result may have different +precision and if any errors occur the behavior is undefined.

    +
    + + + + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.cos on any +floating point or vector of floating point type. Not all targets support all +types however. +

    +  declare float     @llvm.cos.f32(float  %Val)
    +  declare double    @llvm.cos.f64(double %Val)
    +  declare x86_fp80  @llvm.cos.f80(x86_fp80  %Val)
    +  declare fp128     @llvm.cos.f128(fp128 %Val)
    +  declare ppc_fp128 @llvm.cos.ppcf128(ppc_fp128  %Val)
    +
    + +
    Overview:
    + +

    +The 'llvm.cos.*' intrinsics return the cosine of the operand. +

    + +
    Arguments:
    + +

    +The argument and return value are floating point numbers of the same type. +

    + +
    Semantics:
    + +

    +This function returns the cosine of the specified operand, returning the +same values as the libm cos functions would, and handles error +conditions in the same way, unless the --enable-unsafe-fp-math is enabled +during code generation, in which case the result may have different +precision and if any errors occur the behavior is undefined.

    +
    + + + + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.pow on any +floating point or vector of floating point type. Not all targets support all +types however. +

    +  declare float     @llvm.pow.f32(float  %Val, float %Power)
    +  declare double    @llvm.pow.f64(double %Val, double %Power)
    +  declare x86_fp80  @llvm.pow.f80(x86_fp80  %Val, x86_fp80 %Power)
    +  declare fp128     @llvm.pow.f128(fp128 %Val, fp128 %Power)
    +  declare ppc_fp128 @llvm.pow.ppcf128(ppc_fp128  %Val, ppc_fp128 Power)
    +
    + +
    Overview:
    + +

    +The 'llvm.pow.*' intrinsics return the first operand raised to the +specified (positive or negative) power. +

    + +
    Arguments:
    + +

    +The second argument is a floating point power, and the first is a value to +raise to that power. +

    + +
    Semantics:
    + +

    +This function returns the first value raised to the second power, +returning the +same values as the libm pow functions would, and handles error +conditions in the same way, unless the --enable-unsafe-fp-math is enabled +during code generation, in which case the result may have different +precision and if any errors occur the behavior is undefined.

    +
    +
    From dalej at apple.com Mon Oct 15 15:35:08 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 15 Oct 2007 20:35:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43008 - /llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Message-ID: <200710152035.l9FKZ8pw012480@zion.cs.uiuc.edu> Author: johannes Date: Mon Oct 15 15:35:07 2007 New Revision: 43008 URL: http://llvm.org/viewvc/llvm-project?rev=43008&view=rev Log: Make previous patch actually work. Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c?rev=43008&r1=43007&r2=43008&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Mon Oct 15 15:35:07 2007 @@ -9091,26 +9091,6 @@ bool_int_type_node = build_distinct_type_copy (unsigned_intSI_type_node); pixel_type_node = build_distinct_type_copy (unsigned_intHI_type_node); - /* APPLE LOCAL begin LLVM */ -#ifdef ENABLE_LLVM - /* LLVM doesn't initialize the RTL backend, so build_vector_type will assign - all of these types BLKmode. This interferes with rs6000.c-specific - handling of -faltivec overloads (an apple local patch). As such, give them - the correct modes here manually. */ - TYPE_MODE (V4SI_type_node) = V4SImode; - TYPE_MODE (V4SF_type_node) = V4SFmode; - TYPE_MODE (V8HI_type_node) = V8HImode; - TYPE_MODE (V16QI_type_node) = V16QImode; - TYPE_MODE (unsigned_V4SI_type_node) = V4SImode; - TYPE_MODE (unsigned_V8HI_type_node) = V8HImode; - TYPE_MODE (unsigned_V16QI_type_node) = V16QImode; - TYPE_MODE (bool_V16QI_type_node) = V16QImode; - TYPE_MODE (bool_V8HI_type_node) = V8HImode; - TYPE_MODE (bool_V4SI_type_node) = V4SImode; - TYPE_MODE (pixel_V8HI_type_node) = V8HImode; -#endif - /* APPLE LOCAL end LLVM */ - long_integer_type_internal_node = long_integer_type_node; long_unsigned_type_internal_node = long_unsigned_type_node; intQI_type_internal_node = intQI_type_node; @@ -9140,6 +9120,27 @@ bool_V4SI_type_node = build_vector_type (bool_int_type_node, 4); pixel_V8HI_type_node = build_vector_type (pixel_type_node, 8); + + /* APPLE LOCAL begin LLVM */ +#ifdef ENABLE_LLVM + /* LLVM doesn't initialize the RTL backend, so build_vector_type will assign + all of these types BLKmode. This interferes with rs6000.c-specific + handling of -faltivec overloads (an apple local patch). As such, give them + the correct modes here manually. */ + TYPE_MODE (V4SI_type_node) = V4SImode; + TYPE_MODE (V4SF_type_node) = V4SFmode; + TYPE_MODE (V8HI_type_node) = V8HImode; + TYPE_MODE (V16QI_type_node) = V16QImode; + TYPE_MODE (unsigned_V4SI_type_node) = V4SImode; + TYPE_MODE (unsigned_V8HI_type_node) = V8HImode; + TYPE_MODE (unsigned_V16QI_type_node) = V16QImode; + TYPE_MODE (bool_V16QI_type_node) = V16QImode; + TYPE_MODE (bool_V8HI_type_node) = V8HImode; + TYPE_MODE (bool_V4SI_type_node) = V4SImode; + TYPE_MODE (pixel_V8HI_type_node) = V8HImode; +#endif + /* APPLE LOCAL end LLVM */ + (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, get_identifier ("__vector unsigned char"), unsigned_V16QI_type_node)); From isanbard at gmail.com Mon Oct 15 15:47:57 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Oct 2007 20:47:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43010 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Message-ID: <200710152047.l9FKlwqD012936@zion.cs.uiuc.edu> Author: void Date: Mon Oct 15 15:47:57 2007 New Revision: 43010 URL: http://llvm.org/viewvc/llvm-project?rev=43010&view=rev Log: In new ABI, it wants an 'objc_object' pointer instead of 'objc_protocol_extension' pointer Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=43010&r1=43009&r2=43010&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Mon Oct 15 15:47:57 2007 @@ -9330,15 +9330,8 @@ /* APPLE LOCAL begin radar 4533974 - ObjC newprotocol - radar 4695109 */ /* APPLE LOCAL LLVM - begin NUL pointer */ if (newabi) - { - if (!objc_protocol_extension_template) - build_objc_protocol_extension_template (); - - /* 'isa' is NULL in the new ObjC abi */ - expr = - convert (build_pointer_type (objc_protocol_extension_template), - build_int_cst (NULL_TREE, 0)); - } + /* 'isa' is NULL in the new ObjC abi */ + expr = convert (objc_object_type, build_int_cst (NULL_TREE, 0)); /* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */ /* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */ /* "isa" field now points to struct _objc_protocol_extension * */ From isanbard at gmail.com Mon Oct 15 15:51:09 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 15 Oct 2007 20:51:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43011 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200710152051.l9FKpAJR013150@zion.cs.uiuc.edu> Author: void Date: Mon Oct 15 15:51:09 2007 New Revision: 43011 URL: http://llvm.org/viewvc/llvm-project?rev=43011&view=rev Log: In new ABI, it wants an 'objc_object' pointer instead of 'objc_protocol_extension' pointer Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=43011&r1=43010&r2=43011&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Oct 15 15:51:09 2007 @@ -9230,15 +9230,8 @@ /* APPLE LOCAL begin radar 4533974 - ObjC newprotocol - radar 4695109 */ /* APPLE LOCAL LLVM - begin NUL pointer */ if (newabi) - { - if (!objc_protocol_extension_template) - build_objc_protocol_extension_template (); - - /* 'isa' is NULL in the new ObjC abi */ - expr = - convert (build_pointer_type (objc_protocol_extension_template), - build_int_cst (NULL_TREE, 0)); - } + /* 'isa' is NULL in the new ObjC abi */ + expr = convert (objc_object_type, build_int_cst (NULL_TREE, 0)); /* APPLE LOCAL end radar 4533974 - ObjC newprotocol - radar 4695109 */ /* APPLE LOCAL begin radar 4585769 - Objective-C 1.0 extensions */ /* "isa" field now points to struct _objc_protocol_extension * */ From dpatel at apple.com Mon Oct 15 15:57:34 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 20:57:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43013 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200710152057.l9FKvYKM013367@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 15:57:34 2007 New Revision: 43013 URL: http://llvm.org/viewvc/llvm-project?rev=43013&view=rev Log: Simplify. Incorporate feedback. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43013&r1=43012&r2=43013&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Mon Oct 15 15:57:34 2007 @@ -5288,21 +5288,16 @@ // float foo(int w, float A[][w], int g) { return A[g][0]; } ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); - Value *TypeSize = NULL; - if (VOID_TYPE_P(TREE_TYPE(ArrayType))) { - // void * size is 1 - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); - } - else { - TypeSize = Emit(array_ref_element_size(exp), 0); - TypeSize = CastToUIntType(TypeSize, IntPtrTy); - IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); - } - + if (VOID_TYPE_P(TREE_TYPE(ArrayType))) + // void * size is 1 + return Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + + Value *TypeSize = Emit(array_ref_element_size(exp), 0); + TypeSize = CastToUIntType(TypeSize, IntPtrTy); + IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a From dpatel at apple.com Mon Oct 15 15:59:02 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 20:59:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43014 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200710152059.l9FKx2cR013430@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 15:59:02 2007 New Revision: 43014 URL: http://llvm.org/viewvc/llvm-project?rev=43014&view=rev Log: Simplify. Incorporate feedback. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43014&r1=43013&r2=43014&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct 15 15:59:02 2007 @@ -4838,20 +4838,14 @@ // float foo(int w, float A[][w], int g) { return A[g][0]; } ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); - Value *TypeSize = NULL; - if (VOID_TYPE_P(TREE_TYPE(ArrayType))) { - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); - } - else { - TypeSize = Emit(array_ref_element_size(exp), 0); - TypeSize = CastToUIntType(TypeSize, IntPtrTy); - IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); - Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); - } - + if (VOID_TYPE_P(TREE_TYPE(ArrayType))) + return Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + Value *TypeSize = Emit(array_ref_element_size(exp), 0); + TypeSize = CastToUIntType(TypeSize, IntPtrTy); + IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); + Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); + return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a From djg at cray.com Mon Oct 15 16:07:59 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 15 Oct 2007 21:07:59 -0000 Subject: [llvm-commits] [llvm] r43015 - /llvm/trunk/docs/CodeGenerator.html Message-ID: <200710152107.l9FL7xlv014275@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 15 16:07:59 2007 New Revision: 43015 URL: http://llvm.org/viewvc/llvm-project?rev=43015&view=rev Log: Document the -view-sunit-dags option. Modified: llvm/trunk/docs/CodeGenerator.html Modified: llvm/trunk/docs/CodeGenerator.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodeGenerator.html?rev=43015&r1=43014&r2=43015&view=diff ============================================================================== --- llvm/trunk/docs/CodeGenerator.html (original) +++ llvm/trunk/docs/CodeGenerator.html Mon Oct 15 16:07:59 2007 @@ -862,7 +862,11 @@ this, you probably need to configure your system to add support for it). The -view-sched-dags option views the SelectionDAG output from the Select phase and input to the Scheduler -phase.

    +phase. The -view-sunit-dags option views the ScheduleDAG, which is +based on the final SelectionDAG, with nodes that must be scheduled as a unit +bundled together into a single node, and with immediate operands and other +nodes that aren't relevent for scheduling omitted. +

    From djg at cray.com Mon Oct 15 16:10:03 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 15 Oct 2007 21:10:03 -0000 Subject: [llvm-commits] [llvm] r43016 - /llvm/trunk/tools/llvm-ar/llvm-ar.cpp Message-ID: <200710152110.l9FLA3E5014368@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 15 16:10:03 2007 New Revision: 43016 URL: http://llvm.org/viewvc/llvm-project?rev=43016&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=43016&r1=43015&r2=43016&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original) +++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Mon Oct 15 16:10:03 2007 @@ -23,7 +23,7 @@ #include using namespace llvm; -// Option for compatibility with ASIX, not used but must allow it to be present. +// Option for compatibility with AIX, not used but must allow it to be present. static cl::opt X32Option ("X32_64", cl::Hidden, cl::desc("Ignored option for compatibility with AIX")); From baldrick at free.fr Mon Oct 15 16:22:34 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 15 Oct 2007 23:22:34 +0200 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r42981_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/CodeGen/SelectionDAG=2Eh=09lib/CodeGen/Se?= =?iso-8859-1?q?lectionDAG/DAGCombiner=2Ecpp_lib/CodeGen/SelectionDAG/Lega?= =?iso-8859-1?q?lizeDAGTypes=2Ecpp_lib/CodeGen/SelectionDAG/ScheduleDAGRRL?= =?iso-8859-1?q?ist=2Ecpp_lib/CodeGen/SelectionDAG/SelectionDAG=2Ecpp_lib/?= =?iso-8859-1?q?CodeGen/SelectionDAG/SelectionDAGISel=2Ecpp=09utils/TableG?= =?iso-8859-1?q?en/DAGISelEmitter=2Ecpp?= In-Reply-To: References: <200710150610.l9F6ANV3030436@zion.cs.uiuc.edu> <200710151401.46887.baldrick@free.fr> Message-ID: <200710152322.35643.baldrick@free.fr> Hi Chris, > > By the way the logic supposes that the result of any node is an > > operand for > > some other node. Is at least one result always used? > > Nope, nodes are allowed to be unreachable/dead. What part assumes > that they are used? I thought I had spotted a problem, but I can't find it anymore, so don't worry about it :) Ciao, Duncan. From evan.cheng at apple.com Mon Oct 15 16:33:22 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 15 Oct 2007 21:33:22 -0000 Subject: [llvm-commits] [llvm] r43017 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Message-ID: <200710152133.l9FLXMXG015140@zion.cs.uiuc.edu> Author: evancheng Date: Mon Oct 15 16:33:22 2007 New Revision: 43017 URL: http://llvm.org/viewvc/llvm-project?rev=43017&view=rev Log: Make CalcLatency() non-recursive. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp?rev=43017&r1=43016&r2=43017&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Mon Oct 15 16:33:22 2007 @@ -443,22 +443,57 @@ int &Latency = Latencies[SU.NodeNum]; if (Latency != -1) return Latency; - - int MaxSuccLatency = 0; - for (SUnit::const_succ_iterator I = SU.Succs.begin(), E = SU.Succs.end(); - I != E; ++I) - MaxSuccLatency = std::max(MaxSuccLatency, CalcLatency(*I->Dep)); - return Latency = MaxSuccLatency + SU.Latency; + std::vector WorkList; + WorkList.push_back(&SU); + while (!WorkList.empty()) { + const SUnit *Cur = WorkList.back(); + bool AllDone = true; + int MaxSuccLatency = 0; + for (SUnit::const_succ_iterator I = Cur->Succs.begin(),E = Cur->Succs.end(); + I != E; ++I) { + int SuccLatency = Latencies[I->Dep->NodeNum]; + if (SuccLatency == -1) { + AllDone = false; + WorkList.push_back(I->Dep); + } else { + MaxSuccLatency = std::max(MaxSuccLatency, SuccLatency); + } + } + if (AllDone) { + Latencies[Cur->NodeNum] = MaxSuccLatency + Cur->Latency; + WorkList.pop_back(); + } + } + + return Latency; } /// CalculatePriorities - Calculate priorities of all scheduling units. void LatencyPriorityQueue::CalculatePriorities() { Latencies.assign(SUnits->size(), -1); NumNodesSolelyBlocking.assign(SUnits->size(), 0); - - for (unsigned i = 0, e = SUnits->size(); i != e; ++i) - CalcLatency((*SUnits)[i]); + + // For each node, calculate the maximal path from the node to the exit. + std::vector > WorkList; + for (unsigned i = 0, e = SUnits->size(); i != e; ++i) { + const SUnit *SU = &(*SUnits)[i]; + if (SU->Succs.size() == 0) + WorkList.push_back(std::make_pair(SU, 0U)); + } + + while (!WorkList.empty()) { + const SUnit *SU = WorkList.back().first; + unsigned SuccLat = WorkList.back().second; + WorkList.pop_back(); + int &Latency = Latencies[SU->NodeNum]; + if (Latency == -1 || (SU->Latency + SuccLat) > (unsigned)Latency) { + Latency = SU->Latency + SuccLat; + for (SUnit::const_pred_iterator I = SU->Preds.begin(),E = SU->Preds.end(); + I != E; ++I) + WorkList.push_back(std::make_pair(I->Dep, Latency)); + } + } } /// getSingleUnscheduledPred - If there is exactly one unscheduled predecessor From dpatel at apple.com Mon Oct 15 16:59:23 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 21:59:23 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43018 - in /llvm-gcc-4.2/trunk: gcc/Makefile.in gcc/configure gcc/configure.ac libcpp/configure libcpp/configure.ac Message-ID: <200710152159.l9FLxNim016022@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 16:59:22 2007 New Revision: 43018 URL: http://llvm.org/viewvc/llvm-project?rev=43018&view=rev Log: Accept installed llvm location (e.g. allow --enable-llvm=/usr/local ) Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in llvm-gcc-4.2/trunk/gcc/configure llvm-gcc-4.2/trunk/gcc/configure.ac llvm-gcc-4.2/trunk/libcpp/configure llvm-gcc-4.2/trunk/libcpp/configure.ac Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=43018&r1=43017&r2=43018&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Mon Oct 15 16:59:22 2007 @@ -234,7 +234,11 @@ # Determine BUILDMODE from configure run (--enable-llvm) BUILDMODE := @LLVMBUILDMODE@ +ifneq ($(BUILDMODE),) LLVMBINPATH = $(LLVMOBJDIR)/$(BUILDMODE)/bin +else +LLVMBINPATH = $(LLVMOBJDIR)/bin +endif ifeq ($(LLVMOBJDIR),) CPPFLAGS = @CPPFLAGS@ Modified: llvm-gcc-4.2/trunk/gcc/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/configure?rev=43018&r1=43017&r2=43018&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/configure (original) +++ llvm-gcc-4.2/trunk/gcc/configure Mon Oct 15 16:59:22 2007 @@ -7392,6 +7392,8 @@ elif test -x "$LLVMBASEPATH/Debug-Asserts+Checks/bin/llc$EXEEXT"; then echo Found Debug-Asserts+Checks LLVM Tree in $LLVMBASEPATH LLVMBUILDMODE="Debug-Asserts+Checks" + elif test -x "$LLVMBASEPATH/bin/llc$EXEEXT"; then + echo Found Installed LLVM Tree in $LLVMBASEPATH else { { echo "$as_me:$LINENO: error: You must specify valid path to your LLVM tree with --enable-llvm=DIR" >&5 echo "$as_me: error: You must specify valid path to your LLVM tree with --enable-llvm=DIR" >&2;} @@ -8018,7 +8020,7 @@ else ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - echo "configure:8021: version of makeinfo is $ac_prog_version" >&5 + echo "configure:8023: version of makeinfo is $ac_prog_version" >&5 case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; 4.[4-9]*) Modified: llvm-gcc-4.2/trunk/gcc/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/configure.ac?rev=43018&r1=43017&r2=43018&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/configure.ac (original) +++ llvm-gcc-4.2/trunk/gcc/configure.ac Mon Oct 15 16:59:22 2007 @@ -877,6 +877,8 @@ elif test -x "$LLVMBASEPATH/Debug-Asserts+Checks/bin/llc$EXEEXT"; then echo Found Debug-Asserts+Checks LLVM Tree in $LLVMBASEPATH LLVMBUILDMODE="Debug-Asserts+Checks" + elif test -x "$LLVMBASEPATH/bin/llc$EXEEXT"; then + echo Found Installed LLVM Tree in $LLVMBASEPATH else AC_MSG_ERROR([You must specify valid path to your LLVM tree with --enable-llvm=DIR]) fi Modified: llvm-gcc-4.2/trunk/libcpp/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libcpp/configure?rev=43018&r1=43017&r2=43018&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/libcpp/configure (original) +++ llvm-gcc-4.2/trunk/libcpp/configure Mon Oct 15 16:59:22 2007 @@ -8310,6 +8310,8 @@ elif test -x "$LLVMBASEPATH/Debug-Asserts+Checks/bin/llc$EXEEXT"; then echo Found Debug-Asserts+Checks LLVM Tree in $LLVMBASEPATH LLVMBUILDMODE="Debug-Asserts+Checks" + elif test -x "$LLVMBASEPATH/bin/llc$EXEEXT"; then + echo Found Installed LLVM Tree in $LLVMBASEPATH else { { echo "$as_me:$LINENO: error: You must specify valid path to your LLVM tree with --enable-llvm=DIR" >&5 echo "$as_me: error: You must specify valid path to your LLVM tree with --enable-llvm=DIR" >&2;} Modified: llvm-gcc-4.2/trunk/libcpp/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libcpp/configure.ac?rev=43018&r1=43017&r2=43018&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/libcpp/configure.ac (original) +++ llvm-gcc-4.2/trunk/libcpp/configure.ac Mon Oct 15 16:59:22 2007 @@ -186,6 +186,8 @@ elif test -x "$LLVMBASEPATH/Debug-Asserts+Checks/bin/llc$EXEEXT"; then echo Found Debug-Asserts+Checks LLVM Tree in $LLVMBASEPATH LLVMBUILDMODE="Debug-Asserts+Checks" + elif test -x "$LLVMBASEPATH/bin/llc$EXEEXT"; then + echo Found Installed LLVM Tree in $LLVMBASEPATH else AC_MSG_ERROR([You must specify valid path to your LLVM tree with --enable-llvm=DIR]) fi From dpatel at apple.com Mon Oct 15 17:01:15 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 15 Oct 2007 22:01:15 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43019 - /llvm-gcc-4.2/trunk/gcc/passes.c Message-ID: <200710152201.l9FM1FfP016103@zion.cs.uiuc.edu> Author: dpatel Date: Mon Oct 15 17:01:14 2007 New Revision: 43019 URL: http://llvm.org/viewvc/llvm-project?rev=43019&view=rev Log: dead strip rtl passes. Modified: llvm-gcc-4.2/trunk/gcc/passes.c Modified: llvm-gcc-4.2/trunk/gcc/passes.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=43019&r1=43018&r2=43019&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/passes.c (original) +++ llvm-gcc-4.2/trunk/gcc/passes.c Mon Oct 15 17:01:14 2007 @@ -659,6 +659,8 @@ NEXT_PASS (pass_dce_loop); *p = NULL; + /* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM p = &pass_loop2.sub; NEXT_PASS (pass_rtl_loop_init); NEXT_PASS (pass_rtl_move_loop_invariants); @@ -733,6 +735,8 @@ NEXT_PASS (pass_set_nothrow_function_flags); NEXT_PASS (pass_final); *p = NULL; +#endif + /* LLVM LOCAL end */ #undef NEXT_PASS From djg at cray.com Mon Oct 15 17:07:31 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 15 Oct 2007 22:07:31 -0000 Subject: [llvm-commits] [llvm] r43020 - /llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200710152207.l9FM7Vrh016322@zion.cs.uiuc.edu> Author: djg Date: Mon Oct 15 17:07:31 2007 New Revision: 43020 URL: http://llvm.org/viewvc/llvm-project?rev=43020&view=rev Log: Teach IntrinsicLowering.cpp about the sin, cos, and pow intrinsics. Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=43020&r1=43019&r2=43020&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Mon Oct 15 17:07:31 2007 @@ -114,6 +114,51 @@ I->arg_begin()->getType()); } break; + case Intrinsic::sin: + switch((int)I->arg_begin()->getType()->getTypeID()) { + case Type::FloatTyID: + EnsureFunctionExists(M, "sinf", I->arg_begin(), I->arg_end(), + Type::FloatTy); + case Type::DoubleTyID: + EnsureFunctionExists(M, "sin", I->arg_begin(), I->arg_end(), + Type::DoubleTy); + case Type::X86_FP80TyID: + case Type::FP128TyID: + case Type::PPC_FP128TyID: + EnsureFunctionExists(M, "sinl", I->arg_begin(), I->arg_end(), + I->arg_begin()->getType()); + } + break; + case Intrinsic::cos: + switch((int)I->arg_begin()->getType()->getTypeID()) { + case Type::FloatTyID: + EnsureFunctionExists(M, "cosf", I->arg_begin(), I->arg_end(), + Type::FloatTy); + case Type::DoubleTyID: + EnsureFunctionExists(M, "cos", I->arg_begin(), I->arg_end(), + Type::DoubleTy); + case Type::X86_FP80TyID: + case Type::FP128TyID: + case Type::PPC_FP128TyID: + EnsureFunctionExists(M, "cosl", I->arg_begin(), I->arg_end(), + I->arg_begin()->getType()); + } + break; + case Intrinsic::pow: + switch((int)I->arg_begin()->getType()->getTypeID()) { + case Type::FloatTyID: + EnsureFunctionExists(M, "powf", I->arg_begin(), I->arg_end(), + Type::FloatTy); + case Type::DoubleTyID: + EnsureFunctionExists(M, "pow", I->arg_begin(), I->arg_end(), + Type::DoubleTy); + case Type::X86_FP80TyID: + case Type::FP128TyID: + case Type::PPC_FP128TyID: + EnsureFunctionExists(M, "powl", I->arg_begin(), I->arg_end(), + I->arg_begin()->getType()); + } + break; } } From sabre at nondot.org Mon Oct 15 22:00:22 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Oct 2007 03:00:22 -0000 Subject: [llvm-commits] [llvm] r43025 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710160300.l9G30MMp026561@zion.cs.uiuc.edu> Author: lattner Date: Mon Oct 15 22:00:22 2007 New Revision: 43025 URL: http://llvm.org/viewvc/llvm-project?rev=43025&view=rev Log: implement promotion of select and select_cc, allowing MallocBench/gs to work with type promotion on x86. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43025&r1=43024&r2=43025&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Mon Oct 15 22:00:22 2007 @@ -130,6 +130,8 @@ SDOperand PromoteResult_SETCC(SDNode *N); SDOperand PromoteResult_LOAD(LoadSDNode *N); SDOperand PromoteResult_SimpleIntBinOp(SDNode *N); + SDOperand PromoteResult_SELECT (SDNode *N); + SDOperand PromoteResult_SELECT_CC(SDNode *N); // Result Expansion. void ExpandResult(SDNode *N, unsigned ResNo); @@ -450,6 +452,10 @@ case ISD::ADD: case ISD::SUB: case ISD::MUL: Result = PromoteResult_SimpleIntBinOp(N); break; + + case ISD::SELECT: Result = PromoteResult_SELECT(N); break; + case ISD::SELECT_CC: Result = PromoteResult_SELECT_CC(N); break; + } // If Result is null, the sub-method took care of registering the result. @@ -552,6 +558,19 @@ return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS); } +SDOperand DAGTypeLegalizer::PromoteResult_SELECT(SDNode *N) { + SDOperand LHS = GetPromotedOp(N->getOperand(1)); + SDOperand RHS = GetPromotedOp(N->getOperand(2)); + return DAG.getNode(ISD::SELECT, LHS.getValueType(), N->getOperand(0),LHS,RHS); +} + +SDOperand DAGTypeLegalizer::PromoteResult_SELECT_CC(SDNode *N) { + SDOperand LHS = GetPromotedOp(N->getOperand(2)); + SDOperand RHS = GetPromotedOp(N->getOperand(3)); + return DAG.getNode(ISD::SELECT_CC, LHS.getValueType(), N->getOperand(0), + N->getOperand(1), LHS, RHS, N->getOperand(4)); +} + //===----------------------------------------------------------------------===// // Result Expansion //===----------------------------------------------------------------------===// From evan.cheng at apple.com Tue Oct 16 03:04:24 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 16 Oct 2007 08:04:24 -0000 Subject: [llvm-commits] [llvm] r43026 - in /llvm/trunk: include/llvm/CodeGen/SimpleRegisterCoalescing.h lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200710160804.l9G84P8p014119@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 03:04:24 2007 New Revision: 43026 URL: http://llvm.org/viewvc/llvm-project?rev=43026&view=rev Log: Code clean up. Modified: llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h?rev=43026&r1=43025&r2=43026&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h (original) +++ llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h Tue Oct 16 03:04:24 2007 @@ -100,7 +100,7 @@ /// CopyCoalesceInMBB - Coalesce copies in the specified MBB, putting /// copies that cannot yet be coalesced into the "TryAgain" list. void CopyCoalesceInMBB(MachineBasicBlock *MBB, - std::vector *TryAgain, bool PhysOnly = false); + std::vector &TryAgain); /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true @@ -108,8 +108,7 @@ /// to coalesce these this copy, due to register constraints. It returns /// false if it is not currently possible to coalesce this interval, but /// it may be possible if other things get coalesced. - bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg, - bool PhysOnly = false); + bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg); /// JoinIntervals - Attempt to join these two intervals. On failure, this /// returns false. Otherwise, if one of the intervals being joined is a Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=43026&r1=43025&r2=43026&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Oct 16 03:04:24 2007 @@ -192,7 +192,7 @@ /// false if it is not currently possible to coalesce this interval, but /// it may be possible if other things get coalesced. bool SimpleRegisterCoalescing::JoinCopy(MachineInstr *CopyMI, - unsigned SrcReg, unsigned DstReg, bool PhysOnly) { + unsigned SrcReg, unsigned DstReg) { DOUT << li_->getInstructionIndex(CopyMI) << '\t' << *CopyMI; // Get representative registers. @@ -207,9 +207,6 @@ bool SrcIsPhys = MRegisterInfo::isPhysicalRegister(repSrcReg); bool DstIsPhys = MRegisterInfo::isPhysicalRegister(repDstReg); - if (PhysOnly && !SrcIsPhys && !DstIsPhys) - // Only joining physical registers with virtual registers in this round. - return true; // If they are both physical registers, we cannot join them. if (SrcIsPhys && DstIsPhys) { @@ -932,9 +929,11 @@ } void SimpleRegisterCoalescing::CopyCoalesceInMBB(MachineBasicBlock *MBB, - std::vector *TryAgain, bool PhysOnly) { + std::vector &TryAgain) { DOUT << ((Value*)MBB->getBasicBlock())->getName() << ":\n"; + std::vector VirtCopies; + std::vector PhysCopies; for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end(); MII != E;) { MachineInstr *Inst = MII++; @@ -946,10 +945,27 @@ SrcReg = Inst->getOperand(1).getReg(); } else if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue; - - bool Done = JoinCopy(Inst, SrcReg, DstReg, PhysOnly); - if (TryAgain && !Done) - TryAgain->push_back(getCopyRec(Inst, SrcReg, DstReg)); + + unsigned repSrcReg = rep(SrcReg); + unsigned repDstReg = rep(DstReg); + bool SrcIsPhys = MRegisterInfo::isPhysicalRegister(repSrcReg); + bool DstIsPhys = MRegisterInfo::isPhysicalRegister(repDstReg); + if (SrcIsPhys || DstIsPhys) + PhysCopies.push_back(getCopyRec(Inst, SrcReg, DstReg)); + else + VirtCopies.push_back(getCopyRec(Inst, SrcReg, DstReg)); + } + + // Try coalescing physical register + virtual register first. + for (unsigned i = 0, e = PhysCopies.size(); i != e; ++i) { + CopyRec &TheCopy = PhysCopies[i]; + if (!JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) + TryAgain.push_back(TheCopy); + } + for (unsigned i = 0, e = VirtCopies.size(); i != e; ++i) { + CopyRec &TheCopy = VirtCopies[i]; + if (!JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) + TryAgain.push_back(TheCopy); } } @@ -965,7 +981,7 @@ // If there are no loops in the function, join intervals in function order. for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E; ++I) - CopyCoalesceInMBB(I, &TryAgainList); + CopyCoalesceInMBB(I, TryAgainList); } else { // Otherwise, join intervals in inner loops before other intervals. // Unfortunately we can't just iterate over loop hierarchy here because @@ -982,9 +998,7 @@ // Finally, join intervals in loop nest order. for (unsigned i = 0, e = MBBs.size(); i != e; ++i) - CopyCoalesceInMBB(MBBs[i].second, NULL, true); - for (unsigned i = 0, e = MBBs.size(); i != e; ++i) - CopyCoalesceInMBB(MBBs[i].second, &TryAgainList, false); + CopyCoalesceInMBB(MBBs[i].second, TryAgainList); } // Joining intervals can allow other intervals to be joined. Iteratively join From arnold.schwaighofer at gmail.com Tue Oct 16 04:05:01 2007 From: arnold.schwaighofer at gmail.com (Arnold Schwaighofer) Date: Tue, 16 Oct 2007 09:05:01 -0000 Subject: [llvm-commits] [llvm] r43027 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200710160905.l9G951hR017802@zion.cs.uiuc.edu> Author: arnolds Date: Tue Oct 16 04:05:00 2007 New Revision: 43027 URL: http://llvm.org/viewvc/llvm-project?rev=43027&view=rev Log: Correction to tail call optimization code. The new return address was stored to the acutal stack slot before the parameters were lowered to their stack slot. This could cause arguments to be overwritten by the return address if the called function had less parameters than the caller function. The update should remove the last failing test case of llc-beta: SPASS. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43027&r1=43026&r2=43027&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 16 04:05:00 2007 @@ -707,10 +707,11 @@ Operands.push_back(StackAdjustment); // Copy registers used by the call. Last operand is a flag so it is not // copied. - for(unsigned i=3; i < TailCall.getNumOperands()-1;i++) { + for (unsigned i=3; i < TailCall.getNumOperands()-1; i++) { Operands.push_back(Chain.getOperand(i)); } - return DAG.getNode(X86ISD::TC_RETURN, MVT::Other, &Operands[0], Operands.size()); + return DAG.getNode(X86ISD::TC_RETURN, MVT::Other, &Operands[0], + Operands.size()); } // Regular return. @@ -1520,23 +1521,25 @@ if (FPDiff < (MF.getInfo()->getTCReturnAddrDelta())) MF.getInfo()->setTCReturnAddrDelta(FPDiff); - // Adjust the ret address stack slot. + Chain = DAG. + getCALLSEQ_START(Chain, DAG.getConstant(NumBytesToBePushed, getPointerTy())); + + // Adjust the Return address stack slot. + SDOperand RetAddrFrIdx, NewRetAddrFrIdx; if (FPDiff) { MVT::ValueType VT = is64Bit ? MVT::i64 : MVT::i32; - SDOperand RetAddrFrIdx = getReturnAddressFrameIndex(DAG); + RetAddrFrIdx = getReturnAddressFrameIndex(DAG); + // Load the "old" Return address. RetAddrFrIdx = - DAG.getLoad(VT, DAG.getEntryNode(),RetAddrFrIdx, NULL, 0); - // Emit a store of the saved ret value to the new location. + DAG.getLoad(VT, Chain,RetAddrFrIdx, NULL, 0); + // Calculate the new stack slot for the return address. int SlotSize = is64Bit ? 8 : 4; int NewReturnAddrFI = MF.getFrameInfo()->CreateFixedObject(SlotSize, FPDiff-SlotSize); - SDOperand NewRetAddrFrIdx = DAG.getFrameIndex(NewReturnAddrFI, VT); - Chain = DAG.getStore(Chain,RetAddrFrIdx, NewRetAddrFrIdx, NULL, 0); + NewRetAddrFrIdx = DAG.getFrameIndex(NewReturnAddrFI, VT); + Chain = SDOperand(RetAddrFrIdx.Val, 1); } - Chain = DAG. - getCALLSEQ_START(Chain, DAG.getConstant(NumBytesToBePushed, getPointerTy())); - SmallVector, 8> RegsToPass; SmallVector MemOpChains; SmallVector MemOpChains2; @@ -1592,6 +1595,7 @@ InFlag = Chain.getValue(1); } InFlag = SDOperand(); + // Copy from stack slots to stack slot of a tail called function. This needs // to be done because if we would lower the arguments directly to their real // stack slot we might end up overwriting each other. @@ -1637,6 +1641,10 @@ Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &MemOpChains2[0], MemOpChains.size()); + // Store the return address to the appropriate stack slot. + if (FPDiff) + Chain = DAG.getStore(Chain,RetAddrFrIdx, NewRetAddrFrIdx, NULL, 0); + // ELF / PIC requires GOT in the EBX register before function calls via PLT // GOT pointer. // Does not work with tail call since ebx is not restored correctly by From baldrick at free.fr Tue Oct 16 04:07:22 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 16 Oct 2007 09:07:22 -0000 Subject: [llvm-commits] [llvm] r43028 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200710160907.l9G97M6G018043@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 16 04:07:20 2007 New Revision: 43028 URL: http://llvm.org/viewvc/llvm-project?rev=43028&view=rev Log: Fixes due to lack of type-safety for ValueType: (1) ValueType being passed instead of an opcode; (2) ValueType being passed for isVolatile (!) in getLoad. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43028&r1=43027&r2=43028&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Oct 16 04:07:20 2007 @@ -772,7 +772,7 @@ case ISD::STRING: case ISD::CONDCODE: // Primitives must all be legal. - assert(TLI.isOperationLegal(Node->getValueType(0), Node->getValueType(0)) && + assert(TLI.isOperationLegal(Node->getOpcode(), Node->getValueType(0)) && "This must be legal!"); break; default: @@ -2752,7 +2752,7 @@ case ISD::UDIVREM: // These nodes will only be produced by target-specific lowering, so // they shouldn't be here if they aren't legal. - assert(TLI.isOperationLegal(Node->getValueType(0), Node->getValueType(0)) && + assert(TLI.isOperationLegal(Node->getOpcode(), Node->getValueType(0)) && "This must be legal!"); Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS @@ -3521,7 +3521,7 @@ } else { Result = DAG.getTruncStore(DAG.getEntryNode(), Node->getOperand(0), StackSlot, NULL, 0, newVT); - Result = DAG.getLoad(newVT, Result, StackSlot, NULL, 0, newVT); + Result = DAG.getLoad(newVT, Result, StackSlot, NULL, 0); } break; } From baldrick at free.fr Tue Oct 16 04:56:50 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 16 Oct 2007 09:56:50 -0000 Subject: [llvm-commits] [llvm] r43030 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/VMCore/ValueTypes.cpp Message-ID: <200710160956.l9G9uoRa020224@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 16 04:56:48 2007 New Revision: 43030 URL: http://llvm.org/viewvc/llvm-project?rev=43030&view=rev Log: Initial infrastructure for arbitrary precision integer codegen support. This should have no effect on codegen for other types. Debatable bits: (1) the use (abuse?) of a set in SDNode::getValueTypeList; (2) the length of getTypeToTransformTo, which maybe should be refactored with a non-inline part for extended value types. Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/VMCore/ValueTypes.cpp Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=43030&r1=43029&r2=43030&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Tue Oct 16 04:56:48 2007 @@ -19,6 +19,7 @@ #include #include #include "llvm/Support/DataTypes.h" +#include "llvm/Support/MathExtras.h" namespace llvm { class Type; @@ -38,6 +39,9 @@ i64 = 5, // This is a 64 bit integer value i128 = 6, // This is a 128 bit integer value + FIRST_INTEGER_VALUETYPE = i1, + LAST_INTEGER_VALUETYPE = i128, + f32 = 7, // This is a 32 bit floating point value f64 = 8, // This is a 64 bit floating point value f80 = 9, // This is a 80 bit floating point value @@ -46,22 +50,22 @@ Flag = 12, // This is a condition code or machine flag. isVoid = 13, // This has no value - + v8i8 = 14, // 8 x i8 v4i16 = 15, // 4 x i16 v2i32 = 16, // 2 x i32 v1i64 = 17, // 1 x i64 v16i8 = 18, // 16 x i8 v8i16 = 19, // 8 x i16 - v3i32 = 20, // 3 x i32 + v3i32 = 20, // 3 x i32 v4i32 = 21, // 4 x i32 v2i64 = 22, // 2 x i64 v2f32 = 23, // 2 x f32 - v3f32 = 24, // 3 x f32 + v3f32 = 24, // 3 x f32 v4f32 = 25, // 4 x f32 v2f64 = 26, // 2 x f64 - + FIRST_VECTOR_VALUETYPE = v8i8, LAST_VECTOR_VALUETYPE = v2f64, @@ -70,12 +74,12 @@ // fAny - Any floating-point or vector floating-point value. This is used // for intrinsics that have overloadings based on floating-point types. // This is only for tblgen's consumption! - fAny = 253, + fAny = 253, // iAny - An integer or vector integer value of any bit width. This is // used for intrinsics that have overloadings based on integer bit widths. // This is only for tblgen's consumption! - iAny = 254, + iAny = 254, // iPTR - An int value the size of the pointer of the current // target. This should only be used internal to tblgen! @@ -93,17 +97,36 @@ /// value types that are not legal. /// /// @internal - /// Currently extended types are always vector types. Extended types are - /// encoded by having the first SimpleTypeBits bits encode the vector - /// element type (which must be a scalar type) and the remaining upper - /// bits encode the vector length, offset by one. + /// Extended types are either vector types or arbitrary precision integers. + /// Arbitrary precision integers have iAny in the first SimpleTypeBits bits, + /// and the bit-width in the next PrecisionBits bits, offset by minus one. + /// Vector types are encoded by having the first SimpleTypeBits+PrecisionBits + /// bits encode the vector element type (which must be a scalar type, possibly + /// an arbitrary precision integer) and the remaining VectorBits upper bits + /// encode the vector length, offset by one. + /// + /// 31--------------16-----------8-------------0 + /// | Vector length | Precision | Simple type | + /// | Vector element | + typedef uint32_t ValueType; static const int SimpleTypeBits = 8; + static const int PrecisionBits = 8; + static const int VectorBits = 32 - SimpleTypeBits - PrecisionBits; static const uint32_t SimpleTypeMask = (~uint32_t(0) << (32 - SimpleTypeBits)) >> (32 - SimpleTypeBits); + static const uint32_t PrecisionMask = + ((~uint32_t(0) << VectorBits) >> (32 - PrecisionBits)) << SimpleTypeBits; + + static const uint32_t VectorMask = + (~uint32_t(0) >> (32 - VectorBits)) << (32 - VectorBits); + + static const uint32_t ElementMask = + (~uint32_t(0) << VectorBits) >> VectorBits; + /// MVT::isExtendedVT - Test if the given ValueType is extended /// (as opposed to being simple). static inline bool isExtendedVT(ValueType VT) { @@ -114,33 +137,34 @@ /// type. static inline bool isInteger(ValueType VT) { ValueType SVT = VT & SimpleTypeMask; - return (SVT >= i1 && SVT <= i128) || (SVT >= v8i8 && SVT <= v2i64); + return (SVT >= FIRST_INTEGER_VALUETYPE && SVT <= LAST_INTEGER_VALUETYPE) || + (SVT >= v8i8 && SVT <= v2i64) || (SVT == iAny && (VT & PrecisionMask)); } - + /// MVT::isFloatingPoint - Return true if this is an FP, or a vector FP type. static inline bool isFloatingPoint(ValueType VT) { ValueType SVT = VT & SimpleTypeMask; return (SVT >= f32 && SVT <= ppcf128) || (SVT >= v2f32 && SVT <= v2f64); } - + /// MVT::isVector - Return true if this is a vector value type. static inline bool isVector(ValueType VT) { return (VT >= FIRST_VECTOR_VALUETYPE && VT <= LAST_VECTOR_VALUETYPE) || - isExtendedVT(VT); + (VT & VectorMask); } - + /// MVT::getVectorElementType - Given a vector type, return the type of /// each element. static inline ValueType getVectorElementType(ValueType VT) { + assert(isVector(VT) && "Invalid vector type!"); switch (VT) { default: - if (isExtendedVT(VT)) - return VT & SimpleTypeMask; - assert(0 && "Invalid vector type!"); + assert(isExtendedVT(VT) && "Unknown simple vector type!"); + return VT & ElementMask; case v8i8 : case v16i8: return i8; case v4i16: - case v8i16: return i16; + case v8i16: return i16; case v2i32: case v3i32: case v4i32: return i32; @@ -152,20 +176,20 @@ case v2f64: return f64; } } - + /// MVT::getVectorNumElements - Given a vector type, return the /// number of elements it contains. static inline unsigned getVectorNumElements(ValueType VT) { + assert(isVector(VT) && "Invalid vector type!"); switch (VT) { default: - if (isExtendedVT(VT)) - return ((VT & ~SimpleTypeMask) >> SimpleTypeBits) - 1; - assert(0 && "Invalid vector type!"); + assert(isExtendedVT(VT) && "Unknown simple vector type!"); + return ((VT & VectorMask) >> (32 - VectorBits)) - 1; case v16i8: return 16; case v8i8 : case v8i16: return 8; case v4i16: - case v4i32: + case v4i32: case v4f32: return 4; case v3i32: case v3f32: return 3; @@ -176,17 +200,20 @@ case v1i64: return 1; } } - + /// MVT::getSizeInBits - Return the size of the specified value type /// in bits. /// static inline unsigned getSizeInBits(ValueType VT) { switch (VT) { default: - if (isExtendedVT(VT)) + assert(isExtendedVT(VT) && "ValueType has no known size!"); + if (isVector(VT)) return getSizeInBits(getVectorElementType(VT)) * getVectorNumElements(VT); - assert(0 && "ValueType has no known size!"); + if (isInteger(VT)) + return ((VT & PrecisionMask) >> SimpleTypeBits) + 1; + assert(0 && "Unknown value type!"); case MVT::i1 : return 1; case MVT::i8 : return 8; case MVT::i16 : return 16; @@ -196,7 +223,7 @@ case MVT::i64 : case MVT::v8i8: case MVT::v4i16: - case MVT::v2i32: + case MVT::v2i32: case MVT::v1i64: case MVT::v2f32: return 64; case MVT::f80 : return 80; @@ -204,7 +231,7 @@ case MVT::v3f32: return 96; case MVT::f128: case MVT::ppcf128: - case MVT::i128: + case MVT::i128: case MVT::v16i8: case MVT::v8i16: case MVT::v4i32: @@ -213,7 +240,46 @@ case MVT::v2f64: return 128; } } - + + /// MVT::getIntegerType - Returns the ValueType that represents an integer + /// with the given number of bits. + /// + static inline ValueType getIntegerType(unsigned BitWidth) { + switch (BitWidth) { + default: + break; + case 1: + return MVT::i1; + case 8: + return MVT::i8; + case 16: + return MVT::i16; + case 32: + return MVT::i32; + case 64: + return MVT::i64; + case 128: + return MVT::i128; + } + ValueType Result = iAny | + (((BitWidth - 1) << SimpleTypeBits) & PrecisionMask); + assert(getSizeInBits(Result) == BitWidth && "Bad bit width!"); + return Result; + } + + /// MVT::RoundIntegerType - Rounds the bit-width of the given integer + /// ValueType up to the nearest power of two (and at least to eight), + /// and returns the integer ValueType with that number of bits. + /// + static inline ValueType RoundIntegerType(ValueType VT) { + assert(isInteger(VT) && !isVector(VT) && "Invalid integer type!"); + unsigned BitWidth = getSizeInBits(VT); + if (BitWidth <= 8) + return MVT::i8; + else + return getIntegerType(1 << Log2_32_Ceil(BitWidth)); + } + /// MVT::getVectorType - Returns the ValueType that represents a vector /// NumElements in length, where each element is of type VT. /// @@ -247,7 +313,7 @@ if (NumElements == 2) return MVT::v2f64; break; } - ValueType Result = VT | ((NumElements + 1) << SimpleTypeBits); + ValueType Result = VT | ((NumElements + 1) << (32 - VectorBits)); assert(getVectorElementType(Result) == VT && "Bad vector element type!"); assert(getVectorNumElements(Result) == NumElements && @@ -268,8 +334,8 @@ case 16: return v16i8; } } - - + + /// MVT::getIntVTBitMask - Return an integer with 1's every place there are /// bits in the specified integer value type. static inline uint64_t getIntVTBitMask(ValueType VT) { @@ -291,7 +357,7 @@ /// to the specified ValueType. For integer types, this returns an unsigned /// type. Note that this will abort for types that cannot be represented. const Type *getTypeForValueType(ValueType VT); - + /// MVT::getValueType - Return the value type corresponding to the specified /// type. This returns all pointers as MVT::iPTR. If HandleUnknown is true, /// unknown types are returned as Other, otherwise they are invalid. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=43030&r1=43029&r2=43030&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Oct 16 04:56:48 2007 @@ -150,7 +150,13 @@ } LegalizeAction getTypeAction(MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + if (MVT::isExtendedVT(VT)) { + if (MVT::isVector(VT)) return Expand; + if (MVT::isInteger(VT)) + // First promote to a power-of-two size, then expand if necessary. + return VT == MVT::RoundIntegerType(VT) ? Expand : Promote; + assert(0 && "Unsupported extended type!"); + } return (LegalizeAction)((ValueTypeActions[VT>>4] >> ((2*VT) & 31)) & 3); } void setTypeAction(MVT::ValueType VT, LegalizeAction Action) { @@ -179,19 +185,34 @@ /// to get to the smaller register. For illegal floating point types, this /// returns the integer type to transform to. MVT::ValueType getTypeToTransformTo(MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) + if (!MVT::isExtendedVT(VT)) { + MVT::ValueType NVT = TransformToType[VT]; + assert(getTypeAction(NVT) != Promote && + "Promote may not follow Expand or Promote"); + return NVT; + } + + if (MVT::isVector(VT)) return MVT::getVectorType(MVT::getVectorElementType(VT), MVT::getVectorNumElements(VT) / 2); - - return TransformToType[VT]; + if (MVT::isInteger(VT)) { + MVT::ValueType NVT = MVT::RoundIntegerType(VT); + if (NVT == VT) + // Size is a power of two - expand to half the size. + return MVT::getIntegerType(MVT::getSizeInBits(VT) / 2); + else + // Promote to a power of two size, avoiding multi-step promotion. + return getTypeAction(NVT) == Promote ? getTypeToTransformTo(NVT) : NVT; + } + assert(0 && "Unsupported extended type!"); } - + /// getTypeToExpandTo - For types supported by the target, this is an /// identity function. For types that must be expanded (i.e. integer types /// that are larger than the largest integer register or illegal floating /// point types), this returns the largest legal type it will be expanded to. MVT::ValueType getTypeToExpandTo(MVT::ValueType VT) const { - assert(!MVT::isExtendedVT(VT)); + assert(!MVT::isVector(VT)); while (true) { switch (getTypeAction(VT)) { case Legal: @@ -252,7 +273,7 @@ /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction getOperationAction(unsigned Op, MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + if (MVT::isExtendedVT(VT)) return getTypeAction(VT); return (LegalizeAction)((OpActions[Op] >> (2*VT)) & 3); } @@ -268,7 +289,7 @@ /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction getLoadXAction(unsigned LType, MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + if (MVT::isExtendedVT(VT)) return getTypeAction(VT); return (LegalizeAction)((LoadXActions[LType] >> (2*VT)) & 3); } @@ -284,7 +305,7 @@ /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction getStoreXAction(MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + if (MVT::isExtendedVT(VT)) return getTypeAction(VT); return (LegalizeAction)((StoreXActions >> (2*VT)) & 3); } @@ -300,7 +321,7 @@ /// for it. LegalizeAction getIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + if (MVT::isExtendedVT(VT)) return getTypeAction(VT); return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> (2*VT)) & 3); } @@ -317,7 +338,7 @@ /// for it. LegalizeAction getIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return Expand; + if (MVT::isExtendedVT(VT)) return getTypeAction(VT); return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> (2*VT)) & 3); } @@ -385,13 +406,15 @@ MVT::ValueType getRegisterType(MVT::ValueType VT) const { if (!MVT::isExtendedVT(VT)) return RegisterTypeForVT[VT]; - - MVT::ValueType VT1, RegisterVT; - unsigned NumIntermediates; - (void)getVectorTypeBreakdown(VT, VT1, NumIntermediates, RegisterVT); - return RegisterVT; + if (MVT::isVector(VT)) { + MVT::ValueType VT1, RegisterVT; + unsigned NumIntermediates; + (void)getVectorTypeBreakdown(VT, VT1, NumIntermediates, RegisterVT); + return RegisterVT; + } + assert(0 && "Unsupported extended type!"); } - + /// getNumRegisters - Return the number of registers that this ValueType will /// eventually require. This is one for any types promoted to live in larger /// registers, but may be more than one for types (like i64) that are split @@ -399,10 +422,12 @@ unsigned getNumRegisters(MVT::ValueType VT) const { if (!MVT::isExtendedVT(VT)) return NumRegistersForVT[VT]; - - MVT::ValueType VT1, VT2; - unsigned NumIntermediates; - return getVectorTypeBreakdown(VT, VT1, NumIntermediates, VT2); + if (MVT::isVector(VT)) { + MVT::ValueType VT1, VT2; + unsigned NumIntermediates; + return getVectorTypeBreakdown(VT, VT1, NumIntermediates, VT2); + } + assert(0 && "Unsupported extended type!"); } /// hasTargetDAGCombine - If true, the target has custom DAG combine Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=43030&r1=43029&r2=43030&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 16 04:56:48 2007 @@ -28,6 +28,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include @@ -846,6 +847,7 @@ } SDOperand SelectionDAG::getValueType(MVT::ValueType VT) { + assert(!MVT::isExtendedVT(VT) && "Expecting a simple value type!"); if ((unsigned)VT >= ValueTypeNodes.size()) ValueTypeNodes.resize(VT+1); if (ValueTypeNodes[VT] == 0) { @@ -1734,7 +1736,8 @@ assert(MVT::isInteger(VT) && MVT::isInteger(Operand.getValueType()) && "Invalid SIGN_EXTEND!"); if (Operand.getValueType() == VT) return Operand; // noop extension - assert(Operand.getValueType() < VT && "Invalid sext node, dst < src!"); + assert(MVT::getSizeInBits(Operand.getValueType()) < MVT::getSizeInBits(VT) + && "Invalid sext node, dst < src!"); if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); break; @@ -1742,7 +1745,8 @@ assert(MVT::isInteger(VT) && MVT::isInteger(Operand.getValueType()) && "Invalid ZERO_EXTEND!"); if (Operand.getValueType() == VT) return Operand; // noop extension - assert(Operand.getValueType() < VT && "Invalid zext node, dst < src!"); + assert(MVT::getSizeInBits(Operand.getValueType()) < MVT::getSizeInBits(VT) + && "Invalid zext node, dst < src!"); if (OpOpcode == ISD::ZERO_EXTEND) // (zext (zext x)) -> (zext x) return getNode(ISD::ZERO_EXTEND, VT, Operand.Val->getOperand(0)); break; @@ -1750,7 +1754,8 @@ assert(MVT::isInteger(VT) && MVT::isInteger(Operand.getValueType()) && "Invalid ANY_EXTEND!"); if (Operand.getValueType() == VT) return Operand; // noop extension - assert(Operand.getValueType() < VT && "Invalid anyext node, dst < src!"); + assert(MVT::getSizeInBits(Operand.getValueType()) < MVT::getSizeInBits(VT) + && "Invalid anyext node, dst < src!"); if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND) // (ext (zext x)) -> (zext x) and (ext (sext x)) -> (sext x) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); @@ -1759,15 +1764,18 @@ assert(MVT::isInteger(VT) && MVT::isInteger(Operand.getValueType()) && "Invalid TRUNCATE!"); if (Operand.getValueType() == VT) return Operand; // noop truncate - assert(Operand.getValueType() > VT && "Invalid truncate node, src < dst!"); + assert(MVT::getSizeInBits(Operand.getValueType()) > MVT::getSizeInBits(VT) + && "Invalid truncate node, src < dst!"); if (OpOpcode == ISD::TRUNCATE) return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); else if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ANY_EXTEND) { // If the source is smaller than the dest, we still need an extend. - if (Operand.Val->getOperand(0).getValueType() < VT) + if (MVT::getSizeInBits(Operand.Val->getOperand(0).getValueType()) + < MVT::getSizeInBits(VT)) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); - else if (Operand.Val->getOperand(0).getValueType() > VT) + else if (MVT::getSizeInBits(Operand.Val->getOperand(0).getValueType()) + > MVT::getSizeInBits(VT)) return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); else return Operand.Val->getOperand(0); @@ -1874,7 +1882,8 @@ assert(VT == N1.getValueType() && "Not an inreg round!"); assert(MVT::isFloatingPoint(VT) && MVT::isFloatingPoint(EVT) && "Cannot FP_ROUND_INREG integer types"); - assert(EVT <= VT && "Not rounding down!"); + assert(MVT::getSizeInBits(EVT) <= MVT::getSizeInBits(VT) && + "Not rounding down!"); break; } case ISD::AssertSext: @@ -1884,7 +1893,8 @@ assert(VT == N1.getValueType() && "Not an inreg extend!"); assert(MVT::isInteger(VT) && MVT::isInteger(EVT) && "Cannot *_EXTEND_INREG FP types"); - assert(EVT <= VT && "Not extending!"); + assert(MVT::getSizeInBits(EVT) <= MVT::getSizeInBits(VT) && + "Not extending!"); } default: break; @@ -2299,7 +2309,8 @@ if (MVT::isVector(VT)) assert(EVT == MVT::getVectorElementType(VT) && "Invalid vector extload!"); else - assert(EVT < VT && "Should only be an extending load, not truncating!"); + assert(MVT::getSizeInBits(EVT) < MVT::getSizeInBits(VT) && + "Should only be an extending load, not truncating!"); assert((ExtType == ISD::EXTLOAD || MVT::isInteger(VT)) && "Cannot sign/zero extend a FP/Vector load!"); assert(MVT::isInteger(VT) == MVT::isInteger(EVT) && @@ -2415,7 +2426,8 @@ MVT::ValueType VT = Val.getValueType(); bool isTrunc = VT != SVT; - assert(VT > SVT && "Not a truncation?"); + assert(MVT::getSizeInBits(VT) > MVT::getSizeInBits(SVT) && + "Not a truncation?"); assert(MVT::isInteger(VT) == MVT::isInteger(SVT) && "Can't do FP-INT conversion!"); @@ -2648,18 +2660,7 @@ } SDVTList SelectionDAG::getVTList(MVT::ValueType VT) { - if (!MVT::isExtendedVT(VT)) - return makeVTList(SDNode::getValueTypeList(VT), 1); - - for (std::list >::iterator I = VTList.begin(), - E = VTList.end(); I != E; ++I) { - if (I->size() == 1 && (*I)[0] == VT) - return makeVTList(&(*I)[0], 1); - } - std::vector V; - V.push_back(VT); - VTList.push_front(V); - return makeVTList(&(*VTList.begin())[0], 1); + return makeVTList(SDNode::getValueTypeList(VT), 1); } SDVTList SelectionDAG::getVTList(MVT::ValueType VT1, MVT::ValueType VT2) { @@ -3427,11 +3428,16 @@ /// getValueTypeList - Return a pointer to the specified value type. /// MVT::ValueType *SDNode::getValueTypeList(MVT::ValueType VT) { - static MVT::ValueType VTs[MVT::LAST_VALUETYPE]; - VTs[VT] = VT; - return &VTs[VT]; + if (MVT::isExtendedVT(VT)) { + static std::set EVTs; + return (MVT::ValueType *)&(*EVTs.insert(VT).first); + } else { + static MVT::ValueType VTs[MVT::LAST_VALUETYPE]; + VTs[VT] = VT; + return &VTs[VT]; + } } - + /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the /// indicated value. This method ignores uses of other values defined by this /// operation. Modified: llvm/trunk/lib/VMCore/ValueTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ValueTypes.cpp?rev=43030&r1=43029&r2=43030&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ValueTypes.cpp (original) +++ llvm/trunk/lib/VMCore/ValueTypes.cpp Tue Oct 16 04:56:48 2007 @@ -22,9 +22,11 @@ std::string MVT::getValueTypeString(MVT::ValueType VT) { switch (VT) { default: - if (isExtendedVT(VT)) + if (isVector(VT)) return "v" + utostr(getVectorNumElements(VT)) + getValueTypeString(getVectorElementType(VT)); + if (isInteger(VT)) + return "i" + utostr(getSizeInBits(VT)); assert(0 && "Invalid ValueType!"); case MVT::i1: return "i1"; case MVT::i8: return "i8"; @@ -62,9 +64,11 @@ const Type *MVT::getTypeForValueType(MVT::ValueType VT) { switch (VT) { default: - if (isExtendedVT(VT)) + if (isVector(VT)) return VectorType::get(getTypeForValueType(getVectorElementType(VT)), getVectorNumElements(VT)); + if (isInteger(VT)) + return IntegerType::get(getSizeInBits(VT)); assert(0 && "ValueType does not correspond to LLVM type!"); case MVT::isVoid:return Type::VoidTy; case MVT::i1: return Type::Int1Ty; @@ -105,19 +109,7 @@ case Type::VoidTyID: return MVT::isVoid; case Type::IntegerTyID: - switch (cast(Ty)->getBitWidth()) { - default: - // FIXME: Return MVT::iANY. - if (HandleUnknown) return MVT::Other; - assert(0 && "Invalid width for value type"); - case 1: return MVT::i1; - case 8: return MVT::i8; - case 16: return MVT::i16; - case 32: return MVT::i32; - case 64: return MVT::i64; - case 128: return MVT::i128; - } - break; + return getIntegerType(cast(Ty)->getBitWidth()); case Type::FloatTyID: return MVT::f32; case Type::DoubleTyID: return MVT::f64; case Type::X86_FP80TyID: return MVT::f80; From baldrick at free.fr Tue Oct 16 08:34:12 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 16 Oct 2007 13:34:12 -0000 Subject: [llvm-commits] [llvm] r43031 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h Message-ID: <200710161334.l9GDYChk032490@zion.cs.uiuc.edu> Author: baldrick Date: Tue Oct 16 08:34:11 2007 New Revision: 43031 URL: http://llvm.org/viewvc/llvm-project?rev=43031&view=rev Log: Document the fact that the verifier currently requires the top bit of a ValueType to be zero. Enforce this by ensuring an assertion failure if someone tries to create a ValueType without this property. I chose this minimal approach rather than a more official integration of the notion of reserved bits into ValueType because I'm hoping that the verifier will be changed to no longer require this :) Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=43031&r1=43030&r2=43031&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original) +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Tue Oct 16 08:34:11 2007 @@ -107,7 +107,9 @@ /// /// 31--------------16-----------8-------------0 /// | Vector length | Precision | Simple type | - /// | Vector element | + /// | | Vector element | + /// + /// Note that the verifier currently requires the top bit to be zero. typedef uint32_t ValueType; @@ -313,7 +315,8 @@ if (NumElements == 2) return MVT::v2f64; break; } - ValueType Result = VT | ((NumElements + 1) << (32 - VectorBits)); + // Set the length with the top bit forced to zero (needed by the verifier). + ValueType Result = VT | (((NumElements + 1) << (33 - VectorBits)) >> 1); assert(getVectorElementType(Result) == VT && "Bad vector element type!"); assert(getVectorNumElements(Result) == NumElements && From asl at math.spbu.ru Tue Oct 16 11:28:47 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 16 Oct 2007 11:28:47 -0500 Subject: [llvm-commits] CVS: llvm-www/releases/download.html Message-ID: <200710161628.l9GGSlBo007128@zion.cs.uiuc.edu> Changes in directory llvm-www/releases: download.html updated: 1.46 -> 1.47 --- Log message: Add links to pre-built packages for FreeBSD and ArchLinux --- Diffs of the changes: (+5 -2) download.html | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm-www/releases/download.html diff -u llvm-www/releases/download.html:1.46 llvm-www/releases/download.html:1.47 --- llvm-www/releases/download.html:1.46 Thu Sep 27 01:18:06 2007 +++ llvm-www/releases/download.html Tue Oct 16 11:28:11 2007 @@ -41,13 +41,16 @@

    Here are additional useful binaries:

    From sabre at nondot.org Tue Oct 16 13:00:19 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 16 Oct 2007 18:00:19 -0000 Subject: [llvm-commits] [llvm] r43032 - in /llvm/trunk: lib/Target/PowerPC/PPCRegisterInfo.cpp test/CodeGen/PowerPC/2007-10-16-InlineAsmFrameOffset.ll Message-ID: <200710161800.l9GI0JHM010203@zion.cs.uiuc.edu> Author: lattner Date: Tue Oct 16 13:00:18 2007 New Revision: 43032 URL: http://llvm.org/viewvc/llvm-project?rev=43032&view=rev Log: Fix a bug handling frame references in ppc inline asm when the frame offset doesn't fit into 16 bits. Added: llvm/trunk/test/CodeGen/PowerPC/2007-10-16-InlineAsmFrameOffset.ll Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=43032&r1=43031&r2=43032&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Oct 16 13:00:18 2007 @@ -722,18 +722,19 @@ MachineFrameInfo *MFI = MF.getFrameInfo(); // Find out which operand is the frame index. - unsigned i = 0; - while (!MI.getOperand(i).isFrameIndex()) { - ++i; - assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!"); + unsigned FIOperandNo = 0; + while (!MI.getOperand(FIOperandNo).isFrameIndex()) { + ++FIOperandNo; + assert(FIOperandNo != MI.getNumOperands() && + "Instr doesn't have FrameIndex operand!"); } // Take into account whether it's an add or mem instruction - unsigned OffIdx = (i == 2) ? 1 : 2; + unsigned OffsetOperandNo = (FIOperandNo == 2) ? 1 : 2; if (MI.getOpcode() == TargetInstrInfo::INLINEASM) - OffIdx = i-1; + OffsetOperandNo = FIOperandNo-1; // Get the frame index. - int FrameIndex = MI.getOperand(i).getFrameIndex(); + int FrameIndex = MI.getOperand(FIOperandNo).getFrameIndex(); // Get the frame pointer save index. Users of this index are primarily // DYNALLOC instructions. @@ -750,7 +751,8 @@ } // Replace the FrameIndex with base register with GPR1 (SP) or GPR31 (FP). - MI.getOperand(i).ChangeToRegister(hasFP(MF) ? PPC::R31 : PPC::R1, false); + MI.getOperand(FIOperandNo).ChangeToRegister(hasFP(MF) ? PPC::R31 : PPC::R1, + false); // Figure out if the offset in the instruction is shifted right two bits. This // is true for instructions like "STD", which the machine implicitly adds two @@ -767,37 +769,44 @@ // Now add the frame object offset to the offset from r1. int Offset = MFI->getObjectOffset(FrameIndex); - if (!isIXAddr) - Offset += MI.getOperand(OffIdx).getImmedValue(); + Offset += MI.getOperand(OffsetOperandNo).getImmedValue(); else - Offset += MI.getOperand(OffIdx).getImmedValue() << 2; + Offset += MI.getOperand(OffsetOperandNo).getImmedValue() << 2; // If we're not using a Frame Pointer that has been set to the value of the // SP before having the stack size subtracted from it, then add the stack size // to Offset to get the correct offset. Offset += MFI->getStackSize(); - if (!isInt16(Offset)) { + if (isInt16(Offset)) { + if (isIXAddr) { + assert((Offset & 3) == 0 && "Invalid frame offset!"); + Offset >>= 2; // The actual encoded value has the low two bits zero. + } + MI.getOperand(OffsetOperandNo).ChangeToImmediate(Offset); + } else { // Insert a set of r0 with the full offset value before the ld, st, or add BuildMI(MBB, II, TII.get(PPC::LIS), PPC::R0).addImm(Offset >> 16); BuildMI(MBB, II, TII.get(PPC::ORI), PPC::R0).addReg(PPC::R0).addImm(Offset); - // convert into indexed form of the instruction + // Convert into indexed form of the instruction // sth 0:rA, 1:imm 2:(rB) ==> sthx 0:rA, 2:rB, 1:r0 // addi 0:rA 1:rB, 2, imm ==> add 0:rA, 1:rB, 2:r0 - assert(ImmToIdxMap.count(OpC) && - "No indexed form of load or store available!"); - unsigned NewOpcode = ImmToIdxMap.find(OpC)->second; - MI.setInstrDescriptor(TII.get(NewOpcode)); - MI.getOperand(1).ChangeToRegister(MI.getOperand(i).getReg(), false); - MI.getOperand(2).ChangeToRegister(PPC::R0, false); - } else { - if (isIXAddr) { - assert((Offset & 3) == 0 && "Invalid frame offset!"); - Offset >>= 2; // The actual encoded value has the low two bits zero. + unsigned OperandBase; + if (OpC != TargetInstrInfo::INLINEASM) { + assert(ImmToIdxMap.count(OpC) && + "No indexed form of load or store available!"); + unsigned NewOpcode = ImmToIdxMap.find(OpC)->second; + MI.setInstrDescriptor(TII.get(NewOpcode)); + OperandBase = 1; + } else { + OperandBase = OffsetOperandNo; } - MI.getOperand(OffIdx).ChangeToImmediate(Offset); + + unsigned StackReg = MI.getOperand(FIOperandNo).getReg(); + MI.getOperand(OperandBase).ChangeToRegister(StackReg, false); + MI.getOperand(OperandBase+1).ChangeToRegister(PPC::R0, false); } } Added: llvm/trunk/test/CodeGen/PowerPC/2007-10-16-InlineAsmFrameOffset.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-10-16-InlineAsmFrameOffset.ll?rev=43032&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2007-10-16-InlineAsmFrameOffset.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2007-10-16-InlineAsmFrameOffset.ll Tue Oct 16 13:00:18 2007 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llc -march=ppc32 +; rdar://5538377 + + %struct.disk_unsigned = type { i32 } + %struct._StorePageMax = type { %struct.disk_unsigned, %struct.disk_unsigned, [65536 x i8] } + +define i32 @test() { +entry: + %data = alloca i32 ; [#uses=1] + %compressedPage = alloca %struct._StorePageMax ; <%struct._StorePageMax*> [#uses=0] + %tmp107 = call i32 asm "lwbrx $0, $2, $1", "=r,r,bO,*m"( i8* null, i32 0, i32* %data ) ; [#uses=0] + unreachable +} + From dalej at apple.com Tue Oct 16 13:09:09 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 16 Oct 2007 18:09:09 -0000 Subject: [llvm-commits] [llvm] r43033 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200710161809.l9GI999L010472@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 16 13:09:08 2007 New Revision: 43033 URL: http://llvm.org/viewvc/llvm-project?rev=43033&view=rev Log: Check for invalid cc's in f80 select. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43033&r1=43032&r2=43033&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 16 13:09:08 2007 @@ -4139,6 +4139,8 @@ IllegalFPCMov = !hasFPCMov(cast(CC)->getSignExtended()); else if (VT == MVT::f64 && !X86ScalarSSEf64) IllegalFPCMov = !hasFPCMov(cast(CC)->getSignExtended()); + else if (VT == MVT::f80) + IllegalFPCMov = !hasFPCMov(cast(CC)->getSignExtended()); if ((Opc == X86ISD::CMP || Opc == X86ISD::COMI || Opc == X86ISD::UCOMI) && !IllegalFPCMov) { From dalej at apple.com Tue Oct 16 13:10:14 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 16 Oct 2007 18:10:14 -0000 Subject: [llvm-commits] [llvm] r43034 - /llvm/trunk/test/CodeGen/X86/2007-10-16-fp80_select.ll Message-ID: <200710161810.l9GIAEHe010520@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 16 13:10:14 2007 New Revision: 43034 URL: http://llvm.org/viewvc/llvm-project?rev=43034&view=rev Log: New test for svn rev 43033, radar 5538745. Added: llvm/trunk/test/CodeGen/X86/2007-10-16-fp80_select.ll Added: llvm/trunk/test/CodeGen/X86/2007-10-16-fp80_select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-16-fp80_select.ll?rev=43034&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-16-fp80_select.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-16-fp80_select.ll Tue Oct 16 13:10:14 2007 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | llc -march=x86 +; ModuleID = 'bugpoint-reduced-simplified.bc' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9" + %struct.wxPoint2DInt = type { i32, i32 } + +define x86_fp80 @_ZNK12wxPoint2DInt14GetVectorAngleEv(%struct.wxPoint2DInt* %this) { +entry: + br i1 false, label %cond_true, label %UnifiedReturnBlock + +cond_true: ; preds = %entry + %tmp8 = load i32* null, align 4 ; [#uses=1] + %tmp9 = icmp sgt i32 %tmp8, -1 ; [#uses=1] + %retval = select i1 %tmp9, x86_fp80 0xK4005B400000000000000, x86_fp80 0xK40078700000000000000 ; [#uses=1] + ret x86_fp80 %retval + +UnifiedReturnBlock: ; preds = %entry + ret x86_fp80 0xK4005B400000000000000 +} From evan.cheng at apple.com Tue Oct 16 14:29:47 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 16 Oct 2007 19:29:47 -0000 Subject: [llvm-commits] [llvm] r43035 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2007-10-16-IllegalAsm.ll Message-ID: <200710161929.l9GJTl8o012981@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 14:29:47 2007 New Revision: 43035 URL: http://llvm.org/viewvc/llvm-project?rev=43035&view=rev Log: Fix PR1734. Added: llvm/trunk/test/CodeGen/X86/2007-10-16-IllegalAsm.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=43035&r1=43034&r2=43035&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Oct 16 14:29:47 2007 @@ -459,7 +459,7 @@ std::swap(repSrcReg, repDstReg); std::swap(ResSrcInt, ResDstInt); } - SubRegIdxes.push_back(std::make_pair(repSrcReg, + SubRegIdxes.push_back(std::make_pair(DstReg, CopyMI->getOperand(2).getImm())); } Added: llvm/trunk/test/CodeGen/X86/2007-10-16-IllegalAsm.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-16-IllegalAsm.ll?rev=43035&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-16-IllegalAsm.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-16-IllegalAsm.ll Tue Oct 16 14:29:47 2007 @@ -0,0 +1,272 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-linux-gnu | grep movb | not grep x +; PR1734 + + %struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.eh_status = type opaque + %struct.emit_status = type { i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, i32, %struct.location_t, i32, i8*, %struct.rtx_def** } + %struct.expr_status = type { i32, i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } + %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, i32, i32, i32, i32, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i8, i32, i64, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, i32, %struct.var_refs_queue*, i32, i32, %struct.rtvec_def*, %struct.tree_node*, i32, i32, i32, %struct.machine_function*, i32, i32, i8, i8, %struct.language_function*, %struct.rtx_def*, i32, i32, i32, i32, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, %struct.tree_node*, i8, i8, i8 } + %struct.initial_value_struct = type opaque + %struct.lang_decl = type opaque + %struct.lang_type = type opaque + %struct.language_function = type opaque + %struct.location_t = type { i8*, i32 } + %struct.machine_function = type { %struct.stack_local_entry*, i8*, %struct.rtx_def*, i32, i32, i32, i32, i32 } + %struct.rtunion = type { i8* } + %struct.rtvec_def = type { i32, [1 x %struct.rtx_def*] } + %struct.rtx_def = type { i16, i8, i8, %struct.u } + %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } + %struct.stack_local_entry = type opaque + %struct.temp_slot = type opaque + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, i8, i8, i8, i8, i8 } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, i32, %struct.tree_node*, i8, i8, i8, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, i32, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_decl* } + %struct.tree_decl_u1 = type { i64 } + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_node = type { %struct.tree_decl } + %struct.tree_type = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i32, i16, i8, i8, i32, %struct.tree_node*, %struct.tree_node*, %struct.rtunion, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_type* } + %struct.u = type { [1 x %struct.rtunion] } + %struct.var_refs_queue = type { %struct.rtx_def*, i32, i32, %struct.var_refs_queue* } + %struct.varasm_status = type opaque + %struct.varray_data = type { [1 x i64] } + %struct.varray_head_tag = type { i64, i64, i32, i8*, %struct.varray_data } + %union.tree_ann_d = type opaque + at .str = external constant [28 x i8] ; <[28 x i8]*> [#uses=1] + at tree_code_type = external constant [0 x i32] ; <[0 x i32]*> [#uses=5] + at global_trees = external global [47 x %struct.tree_node*] ; <[47 x %struct.tree_node*]*> [#uses=1] + at mode_size = external global [48 x i8] ; <[48 x i8]*> [#uses=1] + at __FUNCTION__.22683 = external constant [12 x i8] ; <[12 x i8]*> [#uses=1] + +define void @layout_type(%struct.tree_node* %type) { +entry: + %tmp15 = icmp eq %struct.tree_node* %type, null ; [#uses=1] + br i1 %tmp15, label %cond_true, label %cond_false + +cond_true: ; preds = %entry + tail call void @fancy_abort( i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1713, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_false: ; preds = %entry + %tmp19 = load %struct.tree_node** getelementptr ([47 x %struct.tree_node*]* @global_trees, i32 0, i64 0), align 8 ; <%struct.tree_node*> [#uses=1] + %tmp21 = icmp eq %struct.tree_node* %tmp19, %type ; [#uses=1] + br i1 %tmp21, label %UnifiedReturnBlock, label %cond_next25 + +cond_next25: ; preds = %cond_false + %tmp30 = getelementptr %struct.tree_node* %type, i32 0, i32 0, i32 0, i32 3 ; [#uses=1] + %tmp3031 = bitcast i8* %tmp30 to i32* ; [#uses=6] + %tmp32 = load i32* %tmp3031, align 8 ; [#uses=3] + %tmp3435 = trunc i32 %tmp32 to i8 ; [#uses=3] + %tmp34353637 = zext i8 %tmp3435 to i64 ; [#uses=1] + %tmp38 = getelementptr [0 x i32]* @tree_code_type, i32 0, i64 %tmp34353637 ; [#uses=1] + %tmp39 = load i32* %tmp38, align 4 ; [#uses=1] + %tmp40 = icmp eq i32 %tmp39, 2 ; [#uses=4] + br i1 %tmp40, label %cond_next46, label %cond_true43 + +cond_true43: ; preds = %cond_next25 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1719, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next46: ; preds = %cond_next25 + %tmp4950 = bitcast %struct.tree_node* %type to %struct.tree_type* ; <%struct.tree_type*> [#uses=2] + %tmp51 = getelementptr %struct.tree_type* %tmp4950, i32 0, i32 2 ; <%struct.tree_node**> [#uses=2] + %tmp52 = load %struct.tree_node** %tmp51, align 8 ; <%struct.tree_node*> [#uses=1] + %tmp53 = icmp eq %struct.tree_node* %tmp52, null ; [#uses=1] + br i1 %tmp53, label %cond_next57, label %UnifiedReturnBlock + +cond_next57: ; preds = %cond_next46 + %tmp65 = and i32 %tmp32, 255 ; [#uses=1] + switch i32 %tmp65, label %UnifiedReturnBlock [ + i32 6, label %bb140 + i32 7, label %bb69 + i32 8, label %bb140 + i32 13, label %bb478 + i32 23, label %bb + ] + +bb: ; preds = %cond_next57 + tail call void @fancy_abort( i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1727, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +bb69: ; preds = %cond_next57 + br i1 %tmp40, label %cond_next91, label %cond_true88 + +cond_true88: ; preds = %bb69 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1730, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next91: ; preds = %bb69 + %tmp96 = getelementptr %struct.tree_node* %type, i32 0, i32 0, i32 8 ; [#uses=1] + %tmp9697 = bitcast i8* %tmp96 to i32* ; [#uses=2] + %tmp98 = load i32* %tmp9697, align 8 ; [#uses=2] + %tmp100101552 = and i32 %tmp98, 511 ; [#uses=1] + %tmp102 = icmp eq i32 %tmp100101552, 0 ; [#uses=1] + br i1 %tmp102, label %cond_true105, label %bb140 + +cond_true105: ; preds = %cond_next91 + br i1 %tmp40, label %cond_next127, label %cond_true124 + +cond_true124: ; preds = %cond_true105 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1731, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next127: ; preds = %cond_true105 + %tmp136 = or i32 %tmp98, 1 ; [#uses=1] + %tmp137 = and i32 %tmp136, -511 ; [#uses=1] + store i32 %tmp137, i32* %tmp9697, align 8 + br label %bb140 + +bb140: ; preds = %cond_next127, %cond_next91, %cond_next57, %cond_next57 + switch i8 %tmp3435, label %cond_true202 [ + i8 6, label %cond_next208 + i8 9, label %cond_next208 + i8 7, label %cond_next208 + i8 8, label %cond_next208 + i8 10, label %cond_next208 + ] + +cond_true202: ; preds = %bb140 + tail call void (%struct.tree_node*, i8*, i32, i8*, ...)* @tree_check_failed( %struct.tree_node* %type, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1738, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0), i32 9, i32 6, i32 7, i32 8, i32 10, i32 0 ) + unreachable + +cond_next208: ; preds = %bb140, %bb140, %bb140, %bb140, %bb140 + %tmp213 = getelementptr %struct.tree_type* %tmp4950, i32 0, i32 14 ; <%struct.tree_node**> [#uses=1] + %tmp214 = load %struct.tree_node** %tmp213, align 8 ; <%struct.tree_node*> [#uses=2] + %tmp217 = getelementptr %struct.tree_node* %tmp214, i32 0, i32 0, i32 0, i32 3 ; [#uses=1] + %tmp217218 = bitcast i8* %tmp217 to i32* ; [#uses=1] + %tmp219 = load i32* %tmp217218, align 8 ; [#uses=1] + %tmp221222 = trunc i32 %tmp219 to i8 ; [#uses=1] + %tmp223 = icmp eq i8 %tmp221222, 24 ; [#uses=1] + br i1 %tmp223, label %cond_true226, label %cond_next340 + +cond_true226: ; preds = %cond_next208 + switch i8 %tmp3435, label %cond_true288 [ + i8 6, label %cond_next294 + i8 9, label %cond_next294 + i8 7, label %cond_next294 + i8 8, label %cond_next294 + i8 10, label %cond_next294 + ] + +cond_true288: ; preds = %cond_true226 + tail call void (%struct.tree_node*, i8*, i32, i8*, ...)* @tree_check_failed( %struct.tree_node* %type, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1739, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0), i32 9, i32 6, i32 7, i32 8, i32 10, i32 0 ) + unreachable + +cond_next294: ; preds = %cond_true226, %cond_true226, %cond_true226, %cond_true226, %cond_true226 + %tmp301 = tail call i32 @tree_int_cst_sgn( %struct.tree_node* %tmp214 ) ; [#uses=1] + %tmp302 = icmp sgt i32 %tmp301, -1 ; [#uses=1] + br i1 %tmp302, label %cond_true305, label %cond_next340 + +cond_true305: ; preds = %cond_next294 + %tmp313 = load i32* %tmp3031, align 8 ; [#uses=2] + %tmp315316 = trunc i32 %tmp313 to i8 ; [#uses=1] + %tmp315316317318 = zext i8 %tmp315316 to i64 ; [#uses=1] + %tmp319 = getelementptr [0 x i32]* @tree_code_type, i32 0, i64 %tmp315316317318 ; [#uses=1] + %tmp320 = load i32* %tmp319, align 4 ; [#uses=1] + %tmp321 = icmp eq i32 %tmp320, 2 ; [#uses=1] + br i1 %tmp321, label %cond_next327, label %cond_true324 + +cond_true324: ; preds = %cond_true305 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1740, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next327: ; preds = %cond_true305 + %tmp338 = or i32 %tmp313, 8192 ; [#uses=1] + store i32 %tmp338, i32* %tmp3031, align 8 + br label %cond_next340 + +cond_next340: ; preds = %cond_next327, %cond_next294, %cond_next208 + %tmp348 = load i32* %tmp3031, align 8 ; [#uses=1] + %tmp350351 = trunc i32 %tmp348 to i8 ; [#uses=1] + %tmp350351352353 = zext i8 %tmp350351 to i64 ; [#uses=1] + %tmp354 = getelementptr [0 x i32]* @tree_code_type, i32 0, i64 %tmp350351352353 ; [#uses=1] + %tmp355 = load i32* %tmp354, align 4 ; [#uses=1] + %tmp356 = icmp eq i32 %tmp355, 2 ; [#uses=1] + br i1 %tmp356, label %cond_next385, label %cond_true359 + +cond_true359: ; preds = %cond_next340 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1742, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next385: ; preds = %cond_next340 + %tmp390 = getelementptr %struct.tree_node* %type, i32 0, i32 0, i32 8 ; [#uses=1] + %tmp390391 = bitcast i8* %tmp390 to i32* ; [#uses=3] + %tmp392 = load i32* %tmp390391, align 8 ; [#uses=1] + %tmp394 = and i32 %tmp392, 511 ; [#uses=1] + %tmp397 = tail call i32 @smallest_mode_for_size( i32 %tmp394, i32 2 ) ; [#uses=1] + %tmp404 = load i32* %tmp390391, align 8 ; [#uses=1] + %tmp397398405 = shl i32 %tmp397, 9 ; [#uses=1] + %tmp407 = and i32 %tmp397398405, 65024 ; [#uses=1] + %tmp408 = and i32 %tmp404, -65025 ; [#uses=1] + %tmp409 = or i32 %tmp408, %tmp407 ; [#uses=2] + store i32 %tmp409, i32* %tmp390391, align 8 + %tmp417 = load i32* %tmp3031, align 8 ; [#uses=1] + %tmp419420 = trunc i32 %tmp417 to i8 ; [#uses=1] + %tmp419420421422 = zext i8 %tmp419420 to i64 ; [#uses=1] + %tmp423 = getelementptr [0 x i32]* @tree_code_type, i32 0, i64 %tmp419420421422 ; [#uses=1] + %tmp424 = load i32* %tmp423, align 4 ; [#uses=1] + %tmp425 = icmp eq i32 %tmp424, 2 ; [#uses=1] + br i1 %tmp425, label %cond_next454, label %cond_true428 + +cond_true428: ; preds = %cond_next385 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1744, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next454: ; preds = %cond_next385 + lshr i32 %tmp409, 9 ; :0 [#uses=1] + trunc i32 %0 to i8 ; :1 [#uses=1] + %tmp463464 = and i8 %1, 127 ; [#uses=1] + %tmp463464465466 = zext i8 %tmp463464 to i64 ; [#uses=1] + %tmp467 = getelementptr [48 x i8]* @mode_size, i32 0, i64 %tmp463464465466 ; [#uses=1] + %tmp468 = load i8* %tmp467, align 1 ; [#uses=1] + %tmp468469553 = zext i8 %tmp468 to i16 ; [#uses=1] + %tmp470471 = shl i16 %tmp468469553, 3 ; [#uses=1] + %tmp470471472 = zext i16 %tmp470471 to i64 ; [#uses=1] + %tmp473 = tail call %struct.tree_node* @size_int_kind( i64 %tmp470471472, i32 2 ) ; <%struct.tree_node*> [#uses=1] + store %struct.tree_node* %tmp473, %struct.tree_node** %tmp51, align 8 + ret void + +bb478: ; preds = %cond_next57 + br i1 %tmp40, label %cond_next500, label %cond_true497 + +cond_true497: ; preds = %bb478 + tail call void @tree_class_check_failed( %struct.tree_node* %type, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1755, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next500: ; preds = %bb478 + %tmp506 = getelementptr %struct.tree_node* %type, i32 0, i32 0, i32 0, i32 1 ; <%struct.tree_node**> [#uses=1] + %tmp507 = load %struct.tree_node** %tmp506, align 8 ; <%struct.tree_node*> [#uses=2] + %tmp511 = getelementptr %struct.tree_node* %tmp507, i32 0, i32 0, i32 0, i32 3 ; [#uses=1] + %tmp511512 = bitcast i8* %tmp511 to i32* ; [#uses=1] + %tmp513 = load i32* %tmp511512, align 8 ; [#uses=2] + %tmp515516 = trunc i32 %tmp513 to i8 ; [#uses=1] + %tmp515516517518 = zext i8 %tmp515516 to i64 ; [#uses=1] + %tmp519 = getelementptr [0 x i32]* @tree_code_type, i32 0, i64 %tmp515516517518 ; [#uses=1] + %tmp520 = load i32* %tmp519, align 4 ; [#uses=1] + %tmp521 = icmp eq i32 %tmp520, 2 ; [#uses=1] + br i1 %tmp521, label %cond_next527, label %cond_true524 + +cond_true524: ; preds = %cond_next500 + tail call void @tree_class_check_failed( %struct.tree_node* %tmp507, i32 2, i8* getelementptr ([28 x i8]* @.str, i32 0, i64 0), i32 1755, i8* getelementptr ([12 x i8]* @__FUNCTION__.22683, i32 0, i32 0) ) + unreachable + +cond_next527: ; preds = %cond_next500 + %tmp545 = and i32 %tmp513, 8192 ; [#uses=1] + %tmp547 = and i32 %tmp32, -8193 ; [#uses=1] + %tmp548 = or i32 %tmp547, %tmp545 ; [#uses=1] + store i32 %tmp548, i32* %tmp3031, align 8 + ret void + +UnifiedReturnBlock: ; preds = %cond_next57, %cond_next46, %cond_false + ret void +} + +declare void @fancy_abort(i8*, i32, i8*) + +declare void @tree_class_check_failed(%struct.tree_node*, i32, i8*, i32, i8*) + +declare i32 @smallest_mode_for_size(i32, i32) + +declare %struct.tree_node* @size_int_kind(i64, i32) + +declare void @tree_check_failed(%struct.tree_node*, i8*, i32, i8*, ...) + +declare i32 @tree_int_cst_sgn(%struct.tree_node*) From resistor at mac.com Tue Oct 16 14:59:25 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 16 Oct 2007 19:59:25 -0000 Subject: [llvm-commits] [llvm] r43036 - in /llvm/trunk: include/llvm/Analysis/DominatorInternals.h include/llvm/Analysis/Dominators.h include/llvm/Analysis/PostDominators.h lib/Analysis/PostDominators.cpp lib/VMCore/Dominators.cpp Message-ID: <200710161959.l9GJxQdj013902@zion.cs.uiuc.edu> Author: resistor Date: Tue Oct 16 14:59:25 2007 New Revision: 43036 URL: http://llvm.org/viewvc/llvm-project?rev=43036&view=rev Log: Template DominatorTreeBase by node type. This is the next major step towards having dominator information on MBB's. Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/include/llvm/Analysis/PostDominators.h llvm/trunk/lib/Analysis/PostDominators.cpp llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=43036&r1=43035&r2=43036&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original) +++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Tue Oct 16 14:59:25 2007 @@ -35,8 +35,8 @@ namespace llvm { template -unsigned DFSPass(DominatorTreeBase& DT, typename GraphT::NodeType* V, - unsigned N) { +unsigned DFSPass(DominatorTreeBase& DT, + typename GraphT::NodeType* V, unsigned N) { // This is more understandable as a recursive algorithm, but we can't use the // recursive algorithm due to stack depth issues. Keep it here for // documentation purposes. @@ -67,7 +67,8 @@ // First time we visited this BB? if (NextSucc == GraphT::child_begin(BB)) { - DominatorTree::InfoRec &BBInfo = DT.Info[BB]; + typename DominatorTreeBase::InfoRec &BBInfo = + DT.Info[BB]; BBInfo.Semi = ++N; BBInfo.Label = BB; @@ -89,7 +90,8 @@ // Visit the successor next, if it isn't already visited. typename GraphT::NodeType* Succ = *NextSucc; - DominatorTree::InfoRec &SuccVInfo = DT.Info[Succ]; + typename DominatorTreeBase::InfoRec &SuccVInfo = + DT.Info[Succ]; if (SuccVInfo.Semi == 0) { SuccVInfo.Parent = BB; Worklist.push_back(std::make_pair(Succ, GraphT::child_begin(Succ))); @@ -100,20 +102,24 @@ } template -void Compress(DominatorTreeBase& DT, typename GraphT::NodeType *VIn) { +void Compress(DominatorTreeBase& DT, + typename GraphT::NodeType *VIn) { std::vector Work; SmallPtrSet Visited; typename GraphT::NodeType* VInAncestor = DT.Info[VIn].Ancestor; - DominatorTreeBase::InfoRec &VInVAInfo = DT.Info[VInAncestor]; + typename DominatorTreeBase::InfoRec &VInVAInfo = + DT.Info[VInAncestor]; if (VInVAInfo.Ancestor != 0) Work.push_back(VIn); while (!Work.empty()) { typename GraphT::NodeType* V = Work.back(); - DominatorTree::InfoRec &VInfo = DT.Info[V]; + typename DominatorTreeBase::InfoRec &VInfo = + DT.Info[V]; typename GraphT::NodeType* VAncestor = VInfo.Ancestor; - DominatorTreeBase::InfoRec &VAInfo = DT.Info[VAncestor]; + typename DominatorTreeBase::InfoRec &VAInfo = + DT.Info[VAncestor]; // Process Ancestor first if (Visited.insert(VAncestor) && @@ -135,9 +141,10 @@ } template -typename GraphT::NodeType* Eval(DominatorTreeBase& DT, +typename GraphT::NodeType* Eval(DominatorTreeBase& DT, typename GraphT::NodeType *V) { - DominatorTreeBase::InfoRec &VInfo = DT.Info[V]; + typename DominatorTreeBase::InfoRec &VInfo = + DT.Info[V]; #if !BALANCE_IDOM_TREE // Higher-complexity but faster implementation if (VInfo.Ancestor == 0) @@ -160,8 +167,9 @@ } template -void Link(DominatorTreeBase& DT, typename GraphT::NodeType* V, - typename GraphT::NodeType* W, DominatorTreeBase::InfoRec &WInfo) { +void Link(DominatorTreeBase& DT, + typename GraphT::NodeType* V, typename GraphT::NodeType* W, + typename DominatorTreeBase::InfoRec &WInfo) { #if !BALANCE_IDOM_TREE // Higher-complexity but faster implementation WInfo.Ancestor = V; @@ -208,49 +216,49 @@ #endif } -template -void Calculate(DominatorTreeBase& DT, Function& F) { +template +void Calculate(DominatorTreeBase& DT, Function& F) { // Step #1: Number blocks in depth-first order and initialize variables used // in later stages of the algorithm. unsigned N = 0; for (unsigned i = 0, e = DT.Roots.size(); i != e; ++i) - N = DFSPass >(DT, DT.Roots[i], N); + N = DFSPass(DT, DT.Roots[i], N); for (unsigned i = N; i >= 2; --i) { - typename GraphTraits::NodeType* W = DT.Vertex[i]; - DominatorTree::InfoRec &WInfo = DT.Info[W]; + typename GraphT::NodeType* W = DT.Vertex[i]; + typename DominatorTreeBase::InfoRec &WInfo = + DT.Info[W]; // Step #2: Calculate the semidominators of all vertices for (typename GraphTraits >::ChildIteratorType CI = GraphTraits >::child_begin(W), E = GraphTraits >::child_end(W); CI != E; ++CI) if (DT.Info.count(*CI)) { // Only if this predecessor is reachable! - unsigned SemiU = DT.Info[Eval >(DT, *CI)].Semi; + unsigned SemiU = DT.Info[Eval(DT, *CI)].Semi; if (SemiU < WInfo.Semi) WInfo.Semi = SemiU; } DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W); - typename GraphTraits::NodeType* WParent = WInfo.Parent; - Link >(DT, WParent, W, WInfo); + typename GraphT::NodeType* WParent = WInfo.Parent; + Link(DT, WParent, W, WInfo); // Step #3: Implicitly define the immediate dominator of vertices - std::vector::NodeType*> &WParentBucket = + std::vector &WParentBucket = DT.Info[WParent].Bucket; while (!WParentBucket.empty()) { - typename GraphTraits::NodeType* V = WParentBucket.back(); + typename GraphT::NodeType* V = WParentBucket.back(); WParentBucket.pop_back(); - typename GraphTraits::NodeType* U = - Eval >(DT, V); + typename GraphT::NodeType* U = Eval(DT, V); DT.IDoms[V] = DT.Info[U].Semi < DT.Info[V].Semi ? U : WParent; } } // Step #4: Explicitly define the immediate dominator of each vertex for (unsigned i = 2; i <= N; ++i) { - typename GraphTraits::NodeType* W = DT.Vertex[i]; - typename GraphTraits::NodeType*& WIDom = DT.IDoms[W]; + typename GraphT::NodeType* W = DT.Vertex[i]; + typename GraphT::NodeType*& WIDom = DT.IDoms[W]; if (WIDom != DT.Vertex[DT.Info[W].Semi]) WIDom = DT.IDoms[WIDom]; } @@ -260,13 +268,13 @@ // Add a node for the root. This node might be the actual root, if there is // one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0) // which postdominates all real exits if there are multiple exit blocks. - typename GraphTraits::NodeType* Root = DT.Roots.size() == 1 ? DT.Roots[0] - : 0; + typename GraphT::NodeType* Root = DT.Roots.size() == 1 ? DT.Roots[0] + : 0; DT.DomTreeNodes[Root] = DT.RootNode = new DomTreeNode(Root, 0); // Loop over all of the reachable blocks in the function... for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - if (typename GraphTraits::NodeType* ImmDom = DT.getIDom(I)) { + if (typename GraphT::NodeType* ImmDom = DT.getIDom(I)) { // Reachable block. DomTreeNode *BBNode = DT.DomTreeNodes[I]; if (BBNode) continue; // Haven't calculated this node yet? @@ -283,7 +291,7 @@ // Free temporary memory used to construct idom's DT.IDoms.clear(); DT.Info.clear(); - std::vector::NodeType*>().swap(DT.Vertex); + std::vector().swap(DT.Vertex); // FIXME: This does not work on PostDomTrees. It seems likely that this is // due to an error in the algorithm for post-dominators. This really should Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43036&r1=43035&r2=43036&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Oct 16 14:59:25 2007 @@ -22,23 +22,28 @@ #define LLVM_ANALYSIS_DOMINATORS_H #include "llvm/Pass.h" +#include "llvm/Instruction.h" +#include "llvm/Instructions.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Assembly/Writer.h" +#include "llvm/Support/Compiler.h" #include #include -#include "llvm/ADT/DenseMap.h" namespace llvm { -class Instruction; - template struct GraphTraits; //===----------------------------------------------------------------------===// /// DominatorBase - Base class that other, more interesting dominator analyses /// inherit from. /// +template class DominatorBase : public FunctionPass { protected: - std::vector Roots; + std::vector Roots; const bool IsPostDominators; inline DominatorBase(intptr_t ID, bool isPostDom) : FunctionPass(ID), Roots(), IsPostDominators(isPostDom) {} @@ -48,7 +53,7 @@ /// multiple blocks if we are computing post dominators. For forward /// dominators, this will always be a single block (the entry node). /// - inline const std::vector &getRoots() const { return Roots; } + inline const std::vector &getRoots() const { return Roots; } /// isPostDominator - Returns true if analysis based of postdoms /// @@ -58,7 +63,7 @@ //===----------------------------------------------------------------------===// // DomTreeNode - Dominator Tree Node -class DominatorTreeBase; +template class DominatorTreeBase; class PostDominatorTree; class MachineBasicBlock; @@ -69,7 +74,7 @@ std::vector *> Children; int DFSNumIn, DFSNumOut; - friend class DominatorTreeBase; + template friend class DominatorTreeBase; friend class PostDominatorTree; public: typedef typename std::vector *>::iterator iterator; @@ -124,18 +129,43 @@ } }; +EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase); + +template +static std::ostream &operator<<(std::ostream &o, + const DomTreeNodeBase *Node) { + if (Node->getBlock()) + WriteAsOperand(o, Node->getBlock(), false); + else + o << " <>"; + + o << " {" << Node->getDFSNumIn() << "," << Node->getDFSNumOut() << "}"; + + return o << "\n"; +} + +template +static void PrintDomTree(const DomTreeNodeBase *N, std::ostream &o, + unsigned Lev) { + o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N; + for (typename DomTreeNodeBase::const_iterator I = N->begin(), + E = N->end(); I != E; ++I) + PrintDomTree(*I, o, Lev+1); +} + typedef DomTreeNodeBase DomTreeNode; typedef DomTreeNodeBase MachineDomTreeNode; //===----------------------------------------------------------------------===// /// DominatorTree - Calculate the immediate dominator tree for a function. /// -class DominatorTreeBase : public DominatorBase { + +template +class DominatorTreeBase : public DominatorBase { protected: - void reset(); - typedef DenseMap DomTreeNodeMapType; + typedef DenseMap*> DomTreeNodeMapType; DomTreeNodeMapType DomTreeNodes; - DomTreeNode *RootNode; + DomTreeNodeBase *RootNode; bool DFSInfoValid; unsigned int SlowQueries; @@ -143,24 +173,35 @@ struct InfoRec { unsigned Semi; unsigned Size; - BasicBlock *Label, *Parent, *Child, *Ancestor; + NodeT *Label, *Parent, *Child, *Ancestor; - std::vector Bucket; + std::vector Bucket; InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0) {} }; - DenseMap IDoms; + DenseMap IDoms; // Vertex - Map the DFS number to the BasicBlock* - std::vector Vertex; + std::vector Vertex; // Info - Collection of information used during the computation of idoms. - DenseMap Info; + DenseMap Info; + + void reset() { + for (typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.begin(), + E = DomTreeNodes.end(); I != E; ++I) + delete I->second; + DomTreeNodes.clear(); + IDoms.clear(); + this->Roots.clear(); + Vertex.clear(); + RootNode = 0; + } public: DominatorTreeBase(intptr_t ID, bool isPostDom) - : DominatorBase(ID, isPostDom), DFSInfoValid(false), SlowQueries(0) {} + : DominatorBase(ID, isPostDom), DFSInfoValid(false), SlowQueries(0) {} ~DominatorTreeBase() { reset(); } virtual void releaseMemory() { reset(); } @@ -168,12 +209,12 @@ /// getNode - return the (Post)DominatorTree node for the specified basic /// block. This is the same as using operator[] on this class. /// - inline DomTreeNode *getNode(BasicBlock *BB) const { - DomTreeNodeMapType::const_iterator I = DomTreeNodes.find(BB); + inline DomTreeNodeBase *getNode(NodeT *BB) const { + typename DomTreeNodeMapType::const_iterator I = DomTreeNodes.find(BB); return I != DomTreeNodes.end() ? I->second : 0; } - inline DomTreeNode *operator[](BasicBlock *BB) const { + inline DomTreeNodeBase *operator[](NodeT *BB) const { return getNode(BB); } @@ -184,25 +225,25 @@ /// post-dominance information must be capable of dealing with this /// possibility. /// - DomTreeNode *getRootNode() { return RootNode; } - const DomTreeNode *getRootNode() const { return RootNode; } + DomTreeNodeBase *getRootNode() { return RootNode; } + const DomTreeNodeBase *getRootNode() const { return RootNode; } /// properlyDominates - Returns true iff this dominates N and this != N. /// Note that this is not a constant time operation! /// - bool properlyDominates(const DomTreeNode *A, - DomTreeNode *B) const { + bool properlyDominates(const DomTreeNodeBase *A, + DomTreeNodeBase *B) const { if (A == 0 || B == 0) return false; return dominatedBySlowTreeWalk(A, B); } - inline bool properlyDominates(BasicBlock *A, BasicBlock *B) { + inline bool properlyDominates(NodeT *A, NodeT *B) { return properlyDominates(getNode(A), getNode(B)); } - bool dominatedBySlowTreeWalk(const DomTreeNode *A, - const DomTreeNode *B) const { - const DomTreeNode *IDom; + bool dominatedBySlowTreeWalk(const DomTreeNodeBase *A, + const DomTreeNodeBase *B) const { + const DomTreeNodeBase *IDom; if (A == 0 || B == 0) return false; while ((IDom = B->getIDom()) != 0 && IDom != A && IDom != B) B = IDom; // Walk up the tree @@ -212,13 +253,17 @@ /// isReachableFromEntry - Return true if A is dominated by the entry /// block of the function containing it. - const bool isReachableFromEntry(BasicBlock* A); + const bool isReachableFromEntry(NodeT* A) { + assert (!this->isPostDominator() + && "This is not implemented for post dominators"); + return dominates(&A->getParent()->getEntryBlock(), A); + } /// dominates - Returns true iff A dominates B. Note that this is not a /// constant time operation! /// - inline bool dominates(const DomTreeNode *A, - DomTreeNode *B) { + inline bool dominates(const DomTreeNodeBase *A, + DomTreeNodeBase *B) { if (B == A) return true; // A node trivially dominates itself. @@ -239,7 +284,7 @@ return dominatedBySlowTreeWalk(A, B); } - inline bool dominates(BasicBlock *A, BasicBlock *B) { + inline bool dominates(NodeT *A, NodeT *B) { if (A == B) return true; @@ -248,11 +293,73 @@ /// findNearestCommonDominator - Find nearest common dominator basic block /// for basic block A and B. If there is no such block then return NULL. - BasicBlock *findNearestCommonDominator(BasicBlock *A, BasicBlock *B); + NodeT *findNearestCommonDominator(NodeT *A, NodeT *B) { + + assert (!this->isPostDominator() + && "This is not implemented for post dominators"); + assert (A->getParent() == B->getParent() + && "Two blocks are not in same function"); + + // If either A or B is a entry block then it is nearest common dominator. + NodeT &Entry = A->getParent()->getEntryBlock(); + if (A == &Entry || B == &Entry) + return &Entry; + + // If B dominates A then B is nearest common dominator. + if (dominates(B, A)) + return B; + + // If A dominates B then A is nearest common dominator. + if (dominates(A, B)) + return A; + + DomTreeNodeBase *NodeA = getNode(A); + DomTreeNodeBase *NodeB = getNode(B); + + // Collect NodeA dominators set. + SmallPtrSet*, 16> NodeADoms; + NodeADoms.insert(NodeA); + DomTreeNodeBase *IDomA = NodeA->getIDom(); + while (IDomA) { + NodeADoms.insert(IDomA); + IDomA = IDomA->getIDom(); + } + + // Walk NodeB immediate dominators chain and find common dominator node. + DomTreeNodeBase *IDomB = NodeB->getIDom(); + while(IDomB) { + if (NodeADoms.count(IDomB) != 0) + return IDomB->getBlock(); + + IDomB = IDomB->getIDom(); + } + + return NULL; + } // dominates - Return true if A dominates B. This performs the // special checks necessary if A and B are in the same basic block. - bool dominates(Instruction *A, Instruction *B); + bool dominates(Instruction *A, Instruction *B) { + NodeT *BBA = A->getParent(), *BBB = B->getParent(); + if (BBA != BBB) return this->dominates(BBA, BBB); + + // It is not possible to determine dominance between two PHI nodes + // based on their ordering. + if (isa(A) && isa(B)) + return false; + + // Loop through the basic block until we find A or B. + typename NodeT::iterator I = BBA->begin(); + for (; &*I != A && &*I != B; ++I) /*empty*/; + + if(!this->IsPostDominators) { + // A dominates B if it is found first in the basic block. + return &*I == A; + } else { + // A post-dominates B if B is found first in the basic block. + return &*I == B; + } + } //===--------------------------------------------------------------------===// // API to update (Post)DominatorTree information based on modifications to @@ -261,9 +368,9 @@ /// addNewBlock - Add a new node to the dominator tree information. This /// creates a new node as a child of DomBB dominator node,linking it into /// the children list of the immediate dominator. - DomTreeNode *addNewBlock(BasicBlock *BB, BasicBlock *DomBB) { + DomTreeNodeBase *addNewBlock(NodeT *BB, NodeT *DomBB) { assert(getNode(BB) == 0 && "Block already in dominator tree!"); - DomTreeNode *IDomNode = getNode(DomBB); + DomTreeNodeBase *IDomNode = getNode(DomBB); assert(IDomNode && "Not immediate dominator specified for block!"); DFSInfoValid = false; return DomTreeNodes[BB] = @@ -273,76 +380,156 @@ /// changeImmediateDominator - This method is used to update the dominator /// tree information when a node's immediate dominator changes. /// - void changeImmediateDominator(DomTreeNode *N, - DomTreeNode *NewIDom) { + void changeImmediateDominator(DomTreeNodeBase *N, + DomTreeNodeBase *NewIDom) { assert(N && NewIDom && "Cannot change null node pointers!"); DFSInfoValid = false; N->setIDom(NewIDom); } - void changeImmediateDominator(BasicBlock *BB, BasicBlock *NewBB) { + void changeImmediateDominator(NodeT *BB, NodeT *NewBB) { changeImmediateDominator(getNode(BB), getNode(NewBB)); } /// eraseNode - Removes a node from the dominator tree. Block must not /// domiante any other blocks. Removes node from its immediate dominator's /// children list. Deletes dominator node associated with basic block BB. - void eraseNode(BasicBlock *BB); + void eraseNode(NodeT *BB) { + DomTreeNodeBase *Node = getNode(BB); + assert (Node && "Removing node that isn't in dominator tree."); + assert (Node->getChildren().empty() && "Node is not a leaf node."); + + // Remove node from immediate dominator's children list. + DomTreeNodeBase *IDom = Node->getIDom(); + if (IDom) { + typename std::vector*>::iterator I = + std::find(IDom->Children.begin(), IDom->Children.end(), Node); + assert(I != IDom->Children.end() && + "Not in immediate dominator children set!"); + // I am no longer your child... + IDom->Children.erase(I); + } + + DomTreeNodes.erase(BB); + delete Node; + } /// removeNode - Removes a node from the dominator tree. Block must not /// dominate any other blocks. Invalidates any node pointing to removed /// block. - void removeNode(BasicBlock *BB) { + void removeNode(NodeT *BB) { assert(getNode(BB) && "Removing node that isn't in dominator tree."); DomTreeNodes.erase(BB); } /// print - Convert to human readable form /// - virtual void print(std::ostream &OS, const Module* = 0) const; + virtual void print(std::ostream &o, const Module* ) const { + o << "=============================--------------------------------\n"; + o << "Inorder Dominator Tree: "; + if (this->DFSInfoValid) + o << "DFSNumbers invalid: " << SlowQueries << " slow queries."; + o << "\n"; + + PrintDomTree(getRootNode(), o, 1); + } + void print(std::ostream *OS, const Module* M = 0) const { if (OS) print(*OS, M); } - virtual void dump(); + + virtual void dump() { + print(llvm::cerr); + } protected: - template friend void Compress(DominatorTreeBase& DT, + template friend void Compress(DominatorTreeBase& DT, typename GraphT::NodeType* VIn); template friend typename GraphT::NodeType* Eval( - DominatorTreeBase& DT, + DominatorTreeBase& DT, typename GraphT::NodeType* V); - template friend void Link(DominatorTreeBase& DT, + template friend void Link(DominatorTreeBase& DT, typename GraphT::NodeType* V, typename GraphT::NodeType* W, - InfoRec &WInfo); + typename DominatorTreeBase::InfoRec &WInfo); - template friend unsigned DFSPass(DominatorTreeBase& DT, + template friend unsigned DFSPass( + DominatorTreeBase& DT, typename GraphT::NodeType* V, unsigned N); - template friend void Calculate(DominatorTreeBase& DT, - Function& F); + template friend void Calculate(DominatorTreeBase& DT, + Function& F); /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. - void updateDFSNumbers(); + void updateDFSNumbers() { + unsigned DFSNum = 0; + + SmallVector*, + typename DomTreeNodeBase::iterator>, 32> WorkStack; + + for (unsigned i = 0, e = this->Roots.size(); i != e; ++i) { + DomTreeNodeBase *ThisRoot = getNode(this->Roots[i]); + WorkStack.push_back(std::make_pair(ThisRoot, ThisRoot->begin())); + ThisRoot->DFSNumIn = DFSNum++; + + while (!WorkStack.empty()) { + DomTreeNodeBase *Node = WorkStack.back().first; + typename DomTreeNodeBase::iterator ChildIt = + WorkStack.back().second; + + // If we visited all of the children of this node, "recurse" back up the + // stack setting the DFOutNum. + if (ChildIt == Node->end()) { + Node->DFSNumOut = DFSNum++; + WorkStack.pop_back(); + } else { + // Otherwise, recursively visit this child. + DomTreeNodeBase *Child = *ChildIt; + ++WorkStack.back().second; + + WorkStack.push_back(std::make_pair(Child, Child->begin())); + Child->DFSNumIn = DFSNum++; + } + } + } + + SlowQueries = 0; + DFSInfoValid = true; + } - DomTreeNode *getNodeForBlock(BasicBlock *BB); + DomTreeNodeBase *getNodeForBlock(NodeT *BB) { + if (DomTreeNodeBase *BBNode = this->DomTreeNodes[BB]) + return BBNode; + + // Haven't calculated this node yet? Get or calculate the node for the + // immediate dominator. + NodeT *IDom = getIDom(BB); + DomTreeNodeBase *IDomNode = getNodeForBlock(IDom); + + // Add a new tree node for this BasicBlock, and link it as a child of + // IDomNode + DomTreeNodeBase *C = new DomTreeNodeBase(BB, IDomNode); + return this->DomTreeNodes[BB] = IDomNode->addChild(C); + } - inline BasicBlock *getIDom(BasicBlock *BB) const { - DenseMap::const_iterator I = IDoms.find(BB); + inline NodeT *getIDom(NodeT *BB) const { + typename DenseMap::const_iterator I = IDoms.find(BB); return I != IDoms.end() ? I->second : 0; } }; +EXTERN_TEMPLATE_INSTANTIATION(class DominatorTreeBase); + //===------------------------------------- /// DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to /// compute a normal dominator tree. /// -class DominatorTree : public DominatorTreeBase { +class DominatorTree : public DominatorTreeBase { public: static char ID; // Pass ID, replacement for typeid - DominatorTree() : DominatorTreeBase(intptr_t(&ID), false) {} + DominatorTree() : DominatorTreeBase(intptr_t(&ID), false) {} BasicBlock *getRoot() const { assert(Roots.size() == 1 && "Should always have entry node!"); @@ -392,7 +579,7 @@ /// DominanceFrontierBase - Common base class for computing forward and inverse /// dominance frontiers for a function. /// -class DominanceFrontierBase : public DominatorBase { +class DominanceFrontierBase : public DominatorBase { public: typedef std::set DomSetType; // Dom set for a bb typedef std::map DomSetMapType; // Dom set map @@ -400,7 +587,7 @@ DomSetMapType Frontiers; public: DominanceFrontierBase(intptr_t ID, bool isPostDom) - : DominatorBase(ID, isPostDom) {} + : DominatorBase(ID, isPostDom) {} virtual void releaseMemory() { Frontiers.clear(); } Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=43036&r1=43035&r2=43036&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/PostDominators.h (original) +++ llvm/trunk/include/llvm/Analysis/PostDominators.h Tue Oct 16 14:59:25 2007 @@ -21,11 +21,11 @@ /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used to /// compute the a post-dominator tree. /// -struct PostDominatorTree : public DominatorTreeBase { +struct PostDominatorTree : public DominatorTreeBase { static char ID; // Pass identification, replacement for typeid PostDominatorTree() : - DominatorTreeBase((intptr_t)&ID, true) {} + DominatorTreeBase((intptr_t)&ID, true) {} virtual bool runOnFunction(Function &F); Modified: llvm/trunk/lib/Analysis/PostDominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=43036&r1=43035&r2=43036&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PostDominators.cpp (original) +++ llvm/trunk/lib/Analysis/PostDominators.cpp Tue Oct 16 14:59:25 2007 @@ -47,7 +47,7 @@ Vertex.push_back(0); - Calculate >(*this, F); + Calculate, GraphTraits > >(*this, F); return false; } Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=43036&r1=43035&r2=43036&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Tue Oct 16 14:59:25 2007 @@ -16,7 +16,7 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" -#include "llvm/Assembly/Writer.h" +#include "llvm/Support/Compiler.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/SmallPtrSet.h" @@ -49,6 +49,9 @@ // //===----------------------------------------------------------------------===// +TEMPLATE_INSTANTIATION(class DomTreeNodeBase); +TEMPLATE_INSTANTIATION(class DominatorTreeBase); + char DominatorTree::ID = 0; static RegisterPass E("domtree", "Dominator Tree Construction", true); @@ -135,203 +138,6 @@ } } -void DominatorTreeBase::updateDFSNumbers() { - unsigned DFSNum = 0; - - SmallVector, 32> WorkStack; - - for (unsigned i = 0, e = Roots.size(); i != e; ++i) { - DomTreeNode *ThisRoot = getNode(Roots[i]); - WorkStack.push_back(std::make_pair(ThisRoot, ThisRoot->begin())); - ThisRoot->DFSNumIn = DFSNum++; - - while (!WorkStack.empty()) { - DomTreeNode *Node = WorkStack.back().first; - DomTreeNode::iterator ChildIt = WorkStack.back().second; - - // If we visited all of the children of this node, "recurse" back up the - // stack setting the DFOutNum. - if (ChildIt == Node->end()) { - Node->DFSNumOut = DFSNum++; - WorkStack.pop_back(); - } else { - // Otherwise, recursively visit this child. - DomTreeNode *Child = *ChildIt; - ++WorkStack.back().second; - - WorkStack.push_back(std::make_pair(Child, Child->begin())); - Child->DFSNumIn = DFSNum++; - } - } - } - - SlowQueries = 0; - DFSInfoValid = true; -} - -/// isReachableFromEntry - Return true if A is dominated by the entry -/// block of the function containing it. -const bool DominatorTreeBase::isReachableFromEntry(BasicBlock* A) { - assert (!isPostDominator() - && "This is not implemented for post dominators"); - return dominates(&A->getParent()->getEntryBlock(), A); -} - -// dominates - Return true if A dominates B. THis performs the -// special checks necessary if A and B are in the same basic block. -bool DominatorTreeBase::dominates(Instruction *A, Instruction *B) { - BasicBlock *BBA = A->getParent(), *BBB = B->getParent(); - if (BBA != BBB) return dominates(BBA, BBB); - - // It is not possible to determine dominance between two PHI nodes - // based on their ordering. - if (isa(A) && isa(B)) - return false; - - // Loop through the basic block until we find A or B. - BasicBlock::iterator I = BBA->begin(); - for (; &*I != A && &*I != B; ++I) /*empty*/; - - if(!IsPostDominators) { - // A dominates B if it is found first in the basic block. - return &*I == A; - } else { - // A post-dominates B if B is found first in the basic block. - return &*I == B; - } -} - -// DominatorTreeBase::reset - Free all of the tree node memory. -// -void DominatorTreeBase::reset() { - for (DomTreeNodeMapType::iterator I = DomTreeNodes.begin(), - E = DomTreeNodes.end(); I != E; ++I) - delete I->second; - DomTreeNodes.clear(); - IDoms.clear(); - Roots.clear(); - Vertex.clear(); - RootNode = 0; -} - -DomTreeNode *DominatorTreeBase::getNodeForBlock(BasicBlock *BB) { - if (DomTreeNode *BBNode = DomTreeNodes[BB]) - return BBNode; - - // Haven't calculated this node yet? Get or calculate the node for the - // immediate dominator. - BasicBlock *IDom = getIDom(BB); - DomTreeNode *IDomNode = getNodeForBlock(IDom); - - // Add a new tree node for this BasicBlock, and link it as a child of - // IDomNode - DomTreeNode *C = new DomTreeNode(BB, IDomNode); - return DomTreeNodes[BB] = IDomNode->addChild(C); -} - -/// findNearestCommonDominator - Find nearest common dominator basic block -/// for basic block A and B. If there is no such block then return NULL. -BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A, - BasicBlock *B) { - - assert (!isPostDominator() - && "This is not implemented for post dominators"); - assert (A->getParent() == B->getParent() - && "Two blocks are not in same function"); - - // If either A or B is a entry block then it is nearest common dominator. - BasicBlock &Entry = A->getParent()->getEntryBlock(); - if (A == &Entry || B == &Entry) - return &Entry; - - // If B dominates A then B is nearest common dominator. - if (dominates(B, A)) - return B; - - // If A dominates B then A is nearest common dominator. - if (dominates(A, B)) - return A; - - DomTreeNode *NodeA = getNode(A); - DomTreeNode *NodeB = getNode(B); - - // Collect NodeA dominators set. - SmallPtrSet NodeADoms; - NodeADoms.insert(NodeA); - DomTreeNode *IDomA = NodeA->getIDom(); - while (IDomA) { - NodeADoms.insert(IDomA); - IDomA = IDomA->getIDom(); - } - - // Walk NodeB immediate dominators chain and find common dominator node. - DomTreeNode *IDomB = NodeB->getIDom(); - while(IDomB) { - if (NodeADoms.count(IDomB) != 0) - return IDomB->getBlock(); - - IDomB = IDomB->getIDom(); - } - - return NULL; -} - -static std::ostream &operator<<(std::ostream &o, const DomTreeNode *Node) { - if (Node->getBlock()) - WriteAsOperand(o, Node->getBlock(), false); - else - o << " <>"; - - o << " {" << Node->getDFSNumIn() << "," << Node->getDFSNumOut() << "}"; - - return o << "\n"; -} - -static void PrintDomTree(const DomTreeNode *N, std::ostream &o, - unsigned Lev) { - o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N; - for (DomTreeNode::const_iterator I = N->begin(), E = N->end(); - I != E; ++I) - PrintDomTree(*I, o, Lev+1); -} - -/// eraseNode - Removes a node from the domiantor tree. Block must not -/// domiante any other blocks. Removes node from its immediate dominator's -/// children list. Deletes dominator node associated with basic block BB. -void DominatorTreeBase::eraseNode(BasicBlock *BB) { - DomTreeNode *Node = getNode(BB); - assert (Node && "Removing node that isn't in dominator tree."); - assert (Node->getChildren().empty() && "Node is not a leaf node."); - - // Remove node from immediate dominator's children list. - DomTreeNode *IDom = Node->getIDom(); - if (IDom) { - std::vector::iterator I = - std::find(IDom->Children.begin(), IDom->Children.end(), Node); - assert(I != IDom->Children.end() && - "Not in immediate dominator children set!"); - // I am no longer your child... - IDom->Children.erase(I); - } - - DomTreeNodes.erase(BB); - delete Node; -} - -void DominatorTreeBase::print(std::ostream &o, const Module* ) const { - o << "=============================--------------------------------\n"; - o << "Inorder Dominator Tree: "; - if (DFSInfoValid) - o << "DFSNumbers invalid: " << SlowQueries << " slow queries."; - o << "\n"; - - PrintDomTree(getRootNode(), o, 1); -} - -void DominatorTreeBase::dump() { - print(llvm::cerr); -} - bool DominatorTree::runOnFunction(Function &F) { reset(); // Reset from the last time we were run... @@ -341,7 +147,7 @@ DomTreeNodes[&F.getEntryBlock()] = 0; Vertex.push_back(0); - Calculate(*this, F); + Calculate >(*this, F); updateDFSNumbers(); From clattner at apple.com Tue Oct 16 15:17:37 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 16 Oct 2007 13:17:37 -0700 Subject: [llvm-commits] [llvm] r43007 - /llvm/trunk/docs/LangRef.html In-Reply-To: <200710152030.l9FKUBxZ012325@zion.cs.uiuc.edu> References: <200710152030.l9FKUBxZ012325@zion.cs.uiuc.edu> Message-ID: <5D27F116-24EC-498B-BC4B-01C598B73E28@apple.com> On Oct 15, 2007, at 1:30 PM, Dan Gohman wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=43007&view=rev > Log: > Document the new llvm.sin, llvm.cos, and llvm.pow intrinsics. Feedback > is welcome! Looks great to me. I think you can remove explicit mention of -- enable-unsafe-fp-math: that flag basically mutates the spec at a global level, I don't think each intrinsic needs to talk about it, -Chris From evan.cheng at apple.com Tue Oct 16 16:09:14 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 16 Oct 2007 21:09:14 -0000 Subject: [llvm-commits] [llvm] r43043 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200710162109.l9GL9EId016376@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 16:09:14 2007 New Revision: 43043 URL: http://llvm.org/viewvc/llvm-project?rev=43043&view=rev Log: Some clean up. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=43043&r1=43042&r2=43043&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Oct 16 16:09:14 2007 @@ -44,9 +44,6 @@ createLinearScanRegisterAllocator); namespace { - static unsigned numIterations = 0; - static unsigned numIntervals = 0; - struct VISIBILITY_HIDDEN RALinScan : public MachineFunctionPass { static char ID; RALinScan() : MachineFunctionPass((intptr_t)&ID) {} @@ -249,16 +246,13 @@ DOUT << "********** LINEAR SCAN **********\n"; DOUT << "********** Function: " << mf_->getFunction()->getName() << '\n'; - // DEBUG(printIntervals("unhandled", unhandled_.begin(), unhandled_.end())); DEBUG(printIntervals("fixed", fixed_.begin(), fixed_.end())); - DEBUG(printIntervals("active", active_.begin(), active_.end())); - DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end())); while (!unhandled_.empty()) { // pick the interval with the earliest start point LiveInterval* cur = unhandled_.top(); unhandled_.pop(); - ++numIterations; + ++NumIters; DOUT << "\n*** CURRENT ***: " << *cur << '\n'; processActiveIntervals(cur->beginNumber()); @@ -275,27 +269,24 @@ DEBUG(printIntervals("active", active_.begin(), active_.end())); DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end())); } - numIntervals += li_->getNumIntervals(); - NumIters += numIterations; // expire any remaining active intervals - for (IntervalPtrs::reverse_iterator - i = active_.rbegin(); i != active_.rend(); ) { - unsigned reg = i->first->reg; - DOUT << "\tinterval " << *i->first << " expired\n"; + while (!active_.empty()) { + IntervalPtr &IP = active_.back(); + unsigned reg = IP.first->reg; + DOUT << "\tinterval " << *IP.first << " expired\n"; assert(MRegisterInfo::isVirtualRegister(reg) && "Can only allocate virtual registers!"); reg = vrm_->getPhys(reg); prt_->delRegUse(reg); - i = IntervalPtrs::reverse_iterator(active_.erase(i.base()-1)); + active_.pop_back(); } // expire any remaining inactive intervals - for (IntervalPtrs::reverse_iterator - i = inactive_.rbegin(); i != inactive_.rend(); ) { - DOUT << "\tinterval " << *i->first << " expired\n"; - i = IntervalPtrs::reverse_iterator(inactive_.erase(i.base()-1)); - } + DEBUG(for (IntervalPtrs::reverse_iterator + i = inactive_.rbegin(); i != inactive_.rend(); ) + DOUT << "\tinterval " << *i->first << " expired\n"); + inactive_.clear(); // A brute force way of adding live-ins to every BB. MachineFunction::iterator MBB = mf_->begin(); From resistor at mac.com Tue Oct 16 17:59:15 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 16 Oct 2007 22:59:15 -0000 Subject: [llvm-commits] [llvm] r43049 - /llvm/trunk/include/llvm/Analysis/Dominators.h Message-ID: <200710162259.l9GMxFsR019668@zion.cs.uiuc.edu> Author: resistor Date: Tue Oct 16 17:59:15 2007 New Revision: 43049 URL: http://llvm.org/viewvc/llvm-project?rev=43049&view=rev Log: Fix some formatting. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43049&r1=43048&r2=43049&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Oct 16 17:59:15 2007 @@ -443,23 +443,29 @@ } protected: - template friend void Compress(DominatorTreeBase& DT, - typename GraphT::NodeType* VIn); - template friend typename GraphT::NodeType* Eval( - DominatorTreeBase& DT, - typename GraphT::NodeType* V); - template friend void Link(DominatorTreeBase& DT, - typename GraphT::NodeType* V, - typename GraphT::NodeType* W, - typename DominatorTreeBase::InfoRec &WInfo); + template + friend void Compress(DominatorTreeBase& DT, + typename GraphT::NodeType* VIn); + + template + friend typename GraphT::NodeType* Eval( + DominatorTreeBase& DT, + typename GraphT::NodeType* V); + + template + friend void Link(DominatorTreeBase& DT, + typename GraphT::NodeType* V, + typename GraphT::NodeType* W, + typename DominatorTreeBase::InfoRec &WInfo); - template friend unsigned DFSPass( - DominatorTreeBase& DT, - typename GraphT::NodeType* V, - unsigned N); + template + friend unsigned DFSPass(DominatorTreeBase& DT, + typename GraphT::NodeType* V, + unsigned N); - template friend void Calculate(DominatorTreeBase& DT, - Function& F); + template + friend void Calculate(DominatorTreeBase& DT, + Function& F); /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. From dalej at apple.com Tue Oct 16 18:38:29 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 16 Oct 2007 23:38:29 -0000 Subject: [llvm-commits] [llvm] r43053 - in /llvm/trunk/lib: CodeGen/SelectionDAG/DAGCombiner.cpp CodeGen/SelectionDAG/SelectionDAG.cpp VMCore/ConstantFold.cpp Message-ID: <200710162338.l9GNcUul020846@zion.cs.uiuc.edu> Author: johannes Date: Tue Oct 16 18:38:29 2007 New Revision: 43053 URL: http://llvm.org/viewvc/llvm-project?rev=43053&view=rev Log: Disable attempts to constant fold PPC f128. Remove the assumption that this will happen from various places. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43053&r1=43052&r2=43053&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Oct 16 18:38:29 2007 @@ -364,6 +364,10 @@ /// specified expression for the same cost as the expression itself, or 2 if we /// can compute the negated form more cheaply than the expression itself. static char isNegatibleForFree(SDOperand Op, unsigned Depth = 0) { + // No compile time optimizations on this type. + if (Op.getValueType() == MVT::ppcf128) + return 0; + // fneg is removable even if it has multiple uses. if (Op.getOpcode() == ISD::FNEG) return 2; @@ -3211,7 +3215,7 @@ } // fold (fadd c1, c2) -> c1+c2 - if (N0CFP && N1CFP) + if (N0CFP && N1CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FADD, VT, N0, N1); // canonicalize constant to RHS if (N0CFP && !N1CFP) @@ -3246,7 +3250,7 @@ } // fold (fsub c1, c2) -> c1-c2 - if (N0CFP && N1CFP) + if (N0CFP && N1CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FSUB, VT, N0, N1); // fold (0-B) -> -B if (UnsafeFPMath && N0CFP && N0CFP->getValueAPF().isZero()) { @@ -3275,7 +3279,7 @@ } // fold (fmul c1, c2) -> c1*c2 - if (N0CFP && N1CFP) + if (N0CFP && N1CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FMUL, VT, N0, N1); // canonicalize constant to RHS if (N0CFP && !N1CFP) @@ -3321,7 +3325,7 @@ } // fold (fdiv c1, c2) -> c1/c2 - if (N0CFP && N1CFP) + if (N0CFP && N1CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FDIV, VT, N0, N1); @@ -3347,7 +3351,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (frem c1, c2) -> fmod(c1,c2) - if (N0CFP && N1CFP) + if (N0CFP && N1CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FREM, VT, N0, N1); return SDOperand(); @@ -3360,7 +3364,7 @@ ConstantFPSDNode *N1CFP = dyn_cast(N1); MVT::ValueType VT = N->getValueType(0); - if (N0CFP && N1CFP) // Constant fold + if (N0CFP && N1CFP && VT != MVT::ppcf128) // Constant fold return DAG.getNode(ISD::FCOPYSIGN, VT, N0, N1); if (N1CFP) { @@ -3404,7 +3408,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (sint_to_fp c1) -> c1fp - if (N0C) + if (N0C && N0.getValueType() != MVT::ppcf128) return DAG.getNode(ISD::SINT_TO_FP, VT, N0); return SDOperand(); } @@ -3415,7 +3419,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (uint_to_fp c1) -> c1fp - if (N0C) + if (N0C && N0.getValueType() != MVT::ppcf128) return DAG.getNode(ISD::UINT_TO_FP, VT, N0); return SDOperand(); } @@ -3437,7 +3441,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (fp_to_uint c1fp) -> c1 - if (N0CFP) + if (N0CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FP_TO_UINT, VT, N0); return SDOperand(); } @@ -3448,7 +3452,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (fp_round c1fp) -> c1fp - if (N0CFP) + if (N0CFP && N0.getValueType() != MVT::ppcf128) return DAG.getNode(ISD::FP_ROUND, VT, N0); // fold (fp_round (fp_extend x)) -> x @@ -3485,7 +3489,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (fp_extend c1fp) -> c1fp - if (N0CFP) + if (N0CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FP_EXTEND, VT, N0); // fold (fpext (load x)) -> (fpext (fpround (extload x))) @@ -3523,7 +3527,7 @@ MVT::ValueType VT = N->getValueType(0); // fold (fabs c1) -> fabs(c1) - if (N0CFP) + if (N0CFP && VT != MVT::ppcf128) return DAG.getNode(ISD::FABS, VT, N0); // fold (fabs (fabs x)) -> (fabs x) if (N0.getOpcode() == ISD::FABS) Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=43053&r1=43052&r2=43053&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Oct 16 18:38:29 2007 @@ -1612,6 +1612,9 @@ case ISD::UINT_TO_FP: case ISD::SINT_TO_FP: { const uint64_t zero[] = {0, 0}; + // No compile time operations on this type. + if (VT==MVT::ppcf128) + break; APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero)); (void)apf.convertFromZeroExtendedInteger(&Val, MVT::getSizeInBits(Operand.getValueType()), @@ -1684,42 +1687,44 @@ // Constant fold unary operations with a floating point constant operand. if (ConstantFPSDNode *C = dyn_cast(Operand.Val)) { APFloat V = C->getValueAPF(); // make copy - switch (Opcode) { - case ISD::FNEG: - V.changeSign(); - return getConstantFP(V, VT); - case ISD::FABS: - V.clearSign(); - return getConstantFP(V, VT); - case ISD::FP_ROUND: - case ISD::FP_EXTEND: - // This can return overflow, underflow, or inexact; we don't care. - // FIXME need to be more flexible about rounding mode. - (void) V.convert(VT==MVT::f32 ? APFloat::IEEEsingle : - VT==MVT::f64 ? APFloat::IEEEdouble : - VT==MVT::f80 ? APFloat::x87DoubleExtended : - VT==MVT::f128 ? APFloat::IEEEquad : - APFloat::Bogus, - APFloat::rmNearestTiesToEven); - return getConstantFP(V, VT); - case ISD::FP_TO_SINT: - case ISD::FP_TO_UINT: { - integerPart x; - assert(integerPartWidth >= 64); - // FIXME need to be more flexible about rounding mode. - APFloat::opStatus s = V.convertToInteger(&x, 64U, - Opcode==ISD::FP_TO_SINT, - APFloat::rmTowardZero); - if (s==APFloat::opInvalidOp) // inexact is OK, in fact usual + if (VT!=MVT::ppcf128 && Operand.getValueType()!=MVT::ppcf128) { + switch (Opcode) { + case ISD::FNEG: + V.changeSign(); + return getConstantFP(V, VT); + case ISD::FABS: + V.clearSign(); + return getConstantFP(V, VT); + case ISD::FP_ROUND: + case ISD::FP_EXTEND: + // This can return overflow, underflow, or inexact; we don't care. + // FIXME need to be more flexible about rounding mode. + (void) V.convert(VT==MVT::f32 ? APFloat::IEEEsingle : + VT==MVT::f64 ? APFloat::IEEEdouble : + VT==MVT::f80 ? APFloat::x87DoubleExtended : + VT==MVT::f128 ? APFloat::IEEEquad : + APFloat::Bogus, + APFloat::rmNearestTiesToEven); + return getConstantFP(V, VT); + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: { + integerPart x; + assert(integerPartWidth >= 64); + // FIXME need to be more flexible about rounding mode. + APFloat::opStatus s = V.convertToInteger(&x, 64U, + Opcode==ISD::FP_TO_SINT, + APFloat::rmTowardZero); + if (s==APFloat::opInvalidOp) // inexact is OK, in fact usual + break; + return getConstant(x, VT); + } + case ISD::BIT_CONVERT: + if (VT == MVT::i32 && C->getValueType(0) == MVT::f32) + return getConstant((uint32_t)V.convertToAPInt().getZExtValue(), VT); + else if (VT == MVT::i64 && C->getValueType(0) == MVT::f64) + return getConstant(V.convertToAPInt().getZExtValue(), VT); break; - return getConstant(x, VT); - } - case ISD::BIT_CONVERT: - if (VT == MVT::i32 && C->getValueType(0) == MVT::f32) - return getConstant((uint32_t)V.convertToAPInt().getZExtValue(), VT); - else if (VT == MVT::i64 && C->getValueType(0) == MVT::f64) - return getConstant(V.convertToAPInt().getZExtValue(), VT); - break; + } } } @@ -1957,7 +1962,7 @@ ConstantFPSDNode *N1CFP = dyn_cast(N1.Val); ConstantFPSDNode *N2CFP = dyn_cast(N2.Val); if (N1CFP) { - if (N2CFP) { + if (N2CFP && VT!=MVT::ppcf128) { APFloat V1 = N1CFP->getValueAPF(), V2 = N2CFP->getValueAPF(); APFloat::opStatus s; switch (Opcode) { Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=43053&r1=43052&r2=43053&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Oct 16 18:38:29 2007 @@ -464,6 +464,10 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *C1, const Constant *C2) { + // No compile-time operations on this type yet. + if (C1->getType() == Type::PPC_FP128Ty) + return 0; + // Handle UndefValue up front if (isa(C1) || isa(C2)) { switch (Opcode) { From dpatel at apple.com Tue Oct 16 18:44:18 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 16 Oct 2007 23:44:18 -0000 Subject: [llvm-commits] [llvm] r43055 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200710162344.l9GNiJNp020994@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 16 18:44:18 2007 New Revision: 43055 URL: http://llvm.org/viewvc/llvm-project?rev=43055&view=rev Log: Use immediate stores. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43055&r1=43054&r2=43055&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Oct 16 18:44:18 2007 @@ -7673,18 +7673,40 @@ unsigned Size = MemOpLength->getZExtValue(); unsigned Align = cast(CI.getOperand(4))->getZExtValue(); PointerType *NewPtrTy = NULL; + unsigned numBits = Size << 3; // Destination pointer type is always i8 * // If Size is 8 then use Int64Ty // If Size is 4 then use Int32Ty // If Size is 2 then use Int16Ty // If Size is 1 then use Int8Ty if (Size && Size <=8 && !(Size&(Size-1))) - NewPtrTy = PointerType::get(IntegerType::get(Size<<3)); + NewPtrTy = PointerType::get(IntegerType::get(numBits)); if (NewPtrTy) { - Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), NewPtrTy, CI); + Value *L = NULL; + // If source is a null terminated constant c string then try to use immediate store. + if (Constant *C = dyn_cast(CI.getOperand(2))) { + const std::string &Str = C->getStringValue(); + if (!Str.empty()) { + APInt StrVal(numBits, 0); + unsigned len = Str.length(); + APInt SingleChar(numBits, 0); + for (unsigned i = 0; i < len; i++) { + SingleChar = (uint64_t) Str[i]; + StrVal = (StrVal << 8) | SingleChar; + } + // Append NULL at the end. + SingleChar = 0; + StrVal = (StrVal << 8) | SingleChar; + L = ConstantInt::get(StrVal); + } + } + // Otherwise load source from memory. + if (L == NULL) { + Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), NewPtrTy, CI); + L = new LoadInst(Src, "tmp", false, Align, &CI); + } Value *Dest = InsertCastBefore(Instruction::BitCast, CI.getOperand(1), NewPtrTy, CI); - Value *L = new LoadInst(Src, "tmp", false, Align, &CI); Value *NS = new StoreInst(L, Dest, false, Align, &CI); CI.replaceAllUsesWith(NS); Changed = true; From dpatel at apple.com Tue Oct 16 19:07:16 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 17 Oct 2007 00:07:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43056 - /llvm-gcc-4.2/trunk/build_gcc Message-ID: <200710170007.l9H07GQx021587@zion.cs.uiuc.edu> Author: dpatel Date: Tue Oct 16 19:07:16 2007 New Revision: 43056 URL: http://llvm.org/viewvc/llvm-project?rev=43056&view=rev Log: Simplify. Use installed llvm. Modified: llvm-gcc-4.2/trunk/build_gcc Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=43056&r1=43055&r2=43056&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Tue Oct 16 19:07:16 2007 @@ -22,22 +22,8 @@ # installed. TARGETS=`echo $2 | $TRANSLATE_ARCH` -#LLVM LOCAL begin -# LLVM does not require host name translation. -LLVM_HOSTS=$1 -# LLVM target list is comma separated list. -#LLVM_TARGETS=`echo $2 | sed -e s/\ /\,/ -e s/ppc/powerpc/ -e s/i386/x86/ \ -# -e s/x86_64// -e s/powerpc64// -e s/ppc64//` -#FIXME : Hard code targets. See LLVMTARGETOBJ comment in gcc/Makefile.in -LLVM_TARGETS="x86,powerpc" -#LLVM LOCAL end - # The GNU makefile target ('bootstrap' by default). -if [ "x$LLVM_DEBUG" == "x" ]; then - BOOTSTRAP=${BOOTSTRAP-bootstrap} -else - BOOTSTRAP= -fi +BOOTSTRAP=${BOOTSTRAP-bootstrap} if [ "$BOOTSTRAP" != bootstrap ]; then bootstrap=--disable-bootstrap fi @@ -47,13 +33,7 @@ # $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto). # We will allow this to override the default $CFLAGS and $CXXFLAGS. -if [ "x$LLVM_DEBUG" == "x" ]; then - CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}" - OPTIMIZE_OPTS="ENABLE_OPTIMIZED=1" -else - CFLAGS="-g" - OPTIMIZE_OPTS= -fi +CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}" # This isn't a parameter; it is the architecture of the current machine. BUILD=`arch | $TRANSLATE_ARCH` @@ -83,26 +63,15 @@ ENABLE_LLVM="$7" # The eighth parameter is the version number of the submission, e.g. 1007. -LLVM_SUBMIT_VERSION="$8" +LLVM_GCC_SUBMIT_VERSION="$8" # The nineth parameter is the subversion number of the submission, e.g. 03. -LLVM_SUBMIT_SUBVERSION="$9" - -# The tenth parameter is a yes/no that indicates whether assertions should be -# enabled in the LLVM libs/tools. -LLVM_ASSERTIONS="${10}" +LLVM_GCC_SUBMIT_SUBVERSION="$9" # LLVM_INSTALL_PREFIX - This is the prefix where LLVM tools/headers/libraries # and the llvm-gcc/llvm-g++ symlinks get installed. LLVM_INSTALL_PREFIX=/usr/local -# LLVM_ARCHS - This tells us which architectures we'd like the libraries to be -# build for. The default is 4-way. -if [ "x$LLVM_ARCHS" == "x" ]; then - LLVM_ARCHS="ppc i386 ppc64 x86_64" -fi - -# LLVM LOCAL end # The current working directory is where the build will happen. # It may already contain a partial result of an interrupted build, @@ -127,6 +96,7 @@ MAJ_VERS="${MAJ_VERS}-llvm" fi # LLVM LOCAL end + # This is the libstdc++ version to use. LIBSTDCXX_VERSION=4.0.0 @@ -147,72 +117,25 @@ mkdir $SRC_DIR || exit 1 ln -s $ORIG_SRC_DIR/* $SRC_DIR/ || exit 1 rm -rf $SRC_DIR/tcl $SRC_DIR/expect $SRC_DIR/dejagnu || exit 1 - -# LLVM LOCAL begin Must build libstdc++ to install in /usr/local. -LIBSTDCXX_CONFIG_OPTION= # Also remove libstdc++ since it is built from a separate project. rm -rf $SRC_DIR/libstdc++-v3 || exit 1 -LIBSTDCXX_CONFIG_OPTION="--with-gxx-include-dir=/usr/include/c++/$LIBSTDCXX_VERSION" - -if [ "$ENABLE_LLVM" == false ]; then - # Clean out old specs files - rm -f /usr/lib/gcc/*/4.0.0/specs -fi -# LLVM LOCAL end +# Clean out old specs files +rm -f /usr/lib/gcc/*/4.0.0/specs # These are the configure and build flags that are used. -# LLVM LOCAL begin Support for non /usr $DEST_ROOT, use libstdc++ - -if [ "x$LLVM_DEBUG" == "x" ]; then - CHECKING_FLAGS="--disable-checking --enable-werror" -else - CHECKING_FLAGS="--enable-checking" -fi - -CONFIGFLAGS="$CHECKING_FLAGS \ +CONFIGFLAGS="--disable-checking -enable-werror \ --prefix=$DEST_ROOT \ - --mandir=$LLVM_INSTALL_PREFIX/share/man \ + --mandir=\${prefix}/share/man \ --enable-languages=c,objc,c++,obj-c++ \ --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \ - $LIBSTDCXX_CONFIG_OPTION \ + --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \ --with-slibdir=/usr/lib \ --build=$BUILD-apple-darwin$DARWIN_VERS" -# LLVM LOCAL end # LLVM LOCAL begin if [ "$ENABLE_LLVM" == true ]; then - CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=$DIR/obj-llvm" - - # Build the LLVM tree universal. - LLVMCONFIGFLAGS="--prefix=$DEST_DIR$LLVM_INSTALL_PREFIX \ - --enable-targets=$LLVM_TARGETS \ - --enable-assertions=$LLVM_ASSERTIONS" - mkdir -p $DIR/obj-llvm || exit 1 - cd $DIR/obj-llvm || exit 1 - if [ \! -f Makefile.config ]; then - $SRC_DIR/llvm/configure $LLVMCONFIGFLAGS || exit 1 - fi - - if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then - LLVM_VERSION="$LLVM_SUBMIT_VERSION" - else - LLVM_VERSION="$LLVM_SUBMIT_VERSION-$LLVM_SUBMIT_SUBVERSION" - fi - - # Note: Don't pass -jN here. Building universal already has parallelism and - # we don't want to make the builders hit swap by firing off too many gcc's at - # the same time. - ## FIXME: Remove -O2 when rdar://4560645 is fixed. - make $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$LLVM_ARCHS" \ - OPTIMIZE_OPTION='-O2' \ - CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" - - if ! test $? == 0 ; then - echo "error: LLVM 'make' failed!" - exit 1 - fi + CONFIGFLAGS="$CONFIGFLAGS --enable-llvm=/usr/local" fi -# LLVM LOCAL end # Figure out how many make processes to run. SYSCTL=`sysctl -n hw.activecpu` @@ -236,11 +159,7 @@ if [ "$ENABLE_LLVM" == true ]; then # Build llvm-gcc in 'dylib mode'. MAKEFLAGS="$MAKEFLAGS BUILD_LLVM_INTO_A_DYLIB=1" - MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_SUBMIT_VERSION" - - if [ "$LLVM_ASSERTIONS" == no ]; then - MAKEFLAGS="$MAKEFLAGS DISABLE_LLVMASSERTIONS=1" - fi + MAKEFLAGS="$MAKEFLAGS LLVM_VERSION_INFO=$LLVM_GCC_SUBMIT_VERSION" fi # LLVM LOCAL end @@ -253,10 +172,8 @@ --host=$BUILD-apple-darwin$DARWIN_VERS --target=$BUILD-apple-darwin$DARWIN_VERS || exit 1 fi # Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail. -# Also keep unset for cross compilers so that the cross built libraries are -# comparable to the native built libraries. -unset RC_DEBUG_OPTIONS -make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 +RC_DEBUG_OPTIONS= \ + make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \ CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 @@ -300,18 +217,14 @@ mkdir -p $DIR/obj-$BUILD-$t $DIR/dst-$BUILD-$t || exit 1 cd $DIR/obj-$BUILD-$t || exit 1 if [ \! -f Makefile ]; then - if [ "x$LLVM_DEBUG" == "x" ]; then - WERROR_FLAGS="--enable-werror-always" - else - WERROR_FLAGS="" - fi - $SRC_DIR/configure $CONFIGFLAGS $WERROR_FLAGS \ + $SRC_DIR/configure $CONFIGFLAGS --enable-werror-always \ --program-prefix=$t-apple-darwin$DARWIN_VERS- \ --host=$BUILD-apple-darwin$DARWIN_VERS --target=$t-apple-darwin$DARWIN_VERS || exit 1 fi make $MAKEFLAGS all CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$t install-gcc install-target \ CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 + # Add the compiler we just built to the path. # LLVM LOCAL Support for non /usr $DEST_ROOT PATH=$DIR/dst-$BUILD-$t/$DEST_ROOT/bin:$PATH @@ -373,38 +286,32 @@ HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools" mkdir -p ".$HTMLDIR" || exit 1 cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1 +fi # Manual pages -mkdir -p .$LLVM_INSTALL_PREFIX/share || exit 1 -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT -cp -Rp $DIR/dst-$BUILD-$BUILD$LLVM_INSTALL_PREFIX/share/man .$LLVM_INSTALL_PREFIX/share/ \ +mkdir -p .$DEST_ROOT/share || exit 1 +cp -Rp $DIR/dst-$BUILD-$BUILD$DEST_ROOT/share/man .$DEST_ROOT/share/ \ || exit 1 # exclude fsf-funding.7 gfdl.7 gpl.7 as they are currently built in # the gcc project rm -rf .$DEST_ROOT/share/man/man7 # libexec -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT -cd $DIR/dst-$BUILD-$BUILD/$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin$DARWIN_VERS/$VERS \ +cd $DIR/dst-$BUILD-$BUILD$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin$DARWIN_VERS/$VERS \ || exit 1 LIBEXEC_FILES=`find . -type f -print || exit 1` LIBEXEC_DIRS=`find . -type d -print || exit 1` cd $DEST_DIR || exit 1 for t in $TARGETS ; do DL=$DEST_ROOT/libexec/gcc/$t-apple-darwin$DARWIN_VERS/$VERS - # LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT - SL=/$DEST_ROOT/libexec/gcc/$t-apple-darwin$DARWIN_VERS/$VERS for d in $LIBEXEC_DIRS ; do mkdir -p .$DL/$d || exit 1 done for f in $LIBEXEC_FILES ; do -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT, allow dynamically linked shared libs. - if file $DIR/dst-*-$t$SL/$f | grep -q -E 'Mach-O (executable|dynamically linked shared library)' ; then -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT - lipo -output .$DL/$f -create $DIR/dst-*-$t$SL/$f || exit 1 + if file $DIR/dst-*-$t$DL/$f | grep -q 'Mach-O executable' ; then + lipo -output .$DL/$f -create $DIR/dst-*-$t$DL/$f || exit 1 else -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT - cp -p $DIR/dst-$BUILD-$t$SL/$f .$DL/$f || exit 1 + cp -p $DIR/dst-$BUILD-$t$DL/$f .$DL/$f || exit 1 fi done ln -s ../../../../bin/as .$DL/as @@ -416,31 +323,26 @@ BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \ | grep -v gccbug | grep -v gcov || exit 1` mkdir .$DEST_ROOT/bin -for f in $BIN_FILES ; do -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT - lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*/$DEST_ROOT/bin/$f || exit 1 +for f in $BIN_FILES ; do + lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1 done # gcov, which is special only because it gets built multiple times and lipo # will complain if we try to add two architectures into the same output. TARG0=`echo $TARGETS | cut -d ' ' -f 1` -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT lipo -output .$DEST_ROOT/bin/gcov-$MAJ_VERS -create \ - $DIR/dst-*-$TARG0/$DEST_ROOT/bin/*gcov* || exit 1 + $DIR/dst-*-$TARG0$DEST_ROOT/bin/*gcov* || exit 1 # The fully-named drivers, which have the same target on every host. for t in $TARGETS ; do -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS -create \ - $DIR/dst-*-$t/$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS || exit 1 -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT + $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS || exit 1 lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++-$VERS -create \ - $DIR/dst-*-$t/$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++* || exit 1 - done + $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++* || exit 1 +done # lib mkdir -p .$DEST_ROOT/lib/gcc || exit 1 for t in $TARGETS ; do -# LLVM LOCAL build_gcc bug with non-/usr $DEST_ROOT - cp -Rp $DIR/dst-$BUILD-$t/$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS \ + cp -Rp $DIR/dst-$BUILD-$t$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS \ .$DEST_ROOT/lib/gcc || exit 1 done @@ -471,8 +373,7 @@ cp -p /usr/lib/libstdc++.6.dylib \ .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib \ || exit 1 -# LLVM LOCAL -# strip -x -c .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib || exit 1 + strip -x -c .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib || exit 1 done # include @@ -500,7 +401,7 @@ done # Add extra man page symlinks for 'c++' and for arch-specific names. -MDIR=$DEST_DIR$LLVM_INSTALL_PREFIX/share/man/man1 +MDIR=$DEST_DIR$DEST_ROOT/share/man/man1 ln -f $MDIR/g++-$MAJ_VERS.1 $MDIR/c++-$MAJ_VERS.1 || exit 1 for t in $TARGETS ; do ln -f $MDIR/gcc-$MAJ_VERS.1 $MDIR/$t-apple-darwin$DARWIN_VERS-gcc-$VERS.1 \ @@ -567,87 +468,11 @@ ######################################## # Remove debugging information from DEST_DIR. -find $DEST_DIR -perm -0111 \! -name \*.dylib \! -name fixinc.sh \ +find $DEST_DIR -perm -0111 \! -name fixinc.sh \ \! -name mkheaders \! -name libstdc++.dylib -type f -print \ | xargs strip || exit 1 -# LLVM LOCAL begin - Strip with -Sx instead of -SX -find $DEST_DIR \( -name \*.a -or -name \*.dylib \) \ - \! -name libgcc_s.10.*.dylib -type f -print \ - | xargs strip -SX || exit 1 -# LLVM LOCAL end - Strip with -Sx instead of -SX -find $DEST_DIR -name \*.a -type f -print \ - | xargs ranlib || exit 1 - -# LLVM LOCAL begin -# Install LLVM libraries/headers/tools. -if [ "$ENABLE_LLVM" == true ]; then - cd $DIR/obj-llvm || exit 1 - - ## Install the tree into the destination directory. - make $MAKEFLAGS $OPTIMIZE_OPTS UNIVERSAL=1 OPTIMIZE_OPTION='-O2' install - - if ! test $? == 0 ; then - echo "error: LLVM 'make install' failed!" - exit 1 - fi - - ## Install Version.h - if [ "x$LLVM_SUBMIT_SUBVERSION" = "x00" -o "x$LLVM_SUBMIT_SUBVERSION" = "x0" ]; then - RC_ProjectSourceSubversion=0 - else - case "$LLVM_SUBMIT_SUBVERSION" in - 01) RC_ProjectSourceSubversion=1 ;; - 02) RC_ProjectSourceSubversion=2 ;; - 03) RC_ProjectSourceSubversion=3 ;; - 04) RC_ProjectSourceSubversion=4 ;; - 05) RC_ProjectSourceSubversion=5 ;; - 06) RC_ProjectSourceSubversion=6 ;; - 07) RC_ProjectSourceSubversion=7 ;; - 08) RC_ProjectSourceSubversion=8 ;; - 09) RC_ProjectSourceSubversion=9 ;; - *) RC_ProjectSourceSubversion=$LLVM_SUBMIT_SUBVERSION ;; - esac - fi - - echo "#define LLVM_VERSION ${RC_ProjectSourceVersion}" > $DEST_DIR$LLVM_INSTALL_PREFIX/include/llvm/Version.h - echo "#define LLVM_MINOR_VERSION ${RC_ProjectSourceSubversion}" >> $DEST_DIR$LLVM_INSTALL_PREFIX/include/llvm/Version.h - - ## Strip local symbols from llvm libraries. - strip -S $DEST_DIR$LLVM_INSTALL_PREFIX/lib/*.[oa] - strip -Sx $DEST_DIR$LLVM_INSTALL_PREFIX/lib/*.so - - # Remove .dir files - cd $DEST_DIR$LLVM_INSTALL_PREFIX/ - rm bin/.dir etc/llvm/.dir lib/.dir - - # Remove PPC64 fat slices. - cd $DEST_DIR$LLVM_INSTALL_PREFIX/bin -if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then - find . -perm 755 -type f -exec lipo -extract ppc -extract i386 {} -output {} \; -else - find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 {} -output {} \; -fi - cd $DEST_DIR$LLVM_INSTALL_PREFIX - lipo -extract ppc -extract i386 lib/LLVMlto.0.0.0.so -output lib/LLVMlto.0.0.0.so - - # Set up the llvm-gcc/llvm-g++ symlinks. - cd $DEST_DIR$LLVM_INSTALL_PREFIX/bin - ln -s -f ../../../$DEST_ROOT/bin/gcc-$MAJ_VERS llvm-gcc || exit 1 - ln -s -f ../../../$DEST_ROOT/bin/g++-$MAJ_VERS llvm-g++ || exit 1 - - # Copy one of the libllvmgcc.dylib's up to libexec/gcc. - cp $DEST_DIR/$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin$DARWIN_VERS/$VERS/libllvmgcc.dylib \ - $DEST_DIR/$DEST_ROOT/libexec/gcc/ - - # Replace the installed ones with symlinks to the common one. - for t in $TARGETS ; do - cd $DEST_DIR/$DEST_ROOT/libexec/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/ - rm libllvmgcc.dylib - ln -s ../../libllvmgcc.dylib - done -fi -# LLVM LOCAL end - +find $DEST_DIR -name \*.a -print | xargs strip -SX || exit 1 +find $DEST_DIR -name \*.a -print | xargs ranlib || exit 1 find $DEST_DIR -name \*.dSYM -print | xargs rm -r || exit 1 chgrp -h -R wheel $DEST_DIR chgrp -R wheel $DEST_DIR From clattner at apple.com Tue Oct 16 19:40:57 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 16 Oct 2007 17:40:57 -0700 Subject: [llvm-commits] [llvm] r43055 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200710162344.l9GNiJNp020994@zion.cs.uiuc.edu> References: <200710162344.l9GNiJNp020994@zion.cs.uiuc.edu> Message-ID: <4287DEF2-A56F-4800-8908-D0D238E05B29@apple.com> > URL: http://llvm.org/viewvc/llvm-project?rev=43055&view=rev > Log: > Use immediate stores. Hey Devang, There is nothing about this xform that is specific to the memcpy/ memmove xform. Can you just move this to visitLoadInst, transforming any load from a (casted) constant string? -Chris > Modified: > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Scalar/InstructionCombining.cpp?rev=43055&r1=43054&r2=43055&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue > Oct 16 18:44:18 2007 > @@ -7673,18 +7673,40 @@ > unsigned Size = MemOpLength->getZExtValue(); > unsigned Align = cast(CI.getOperand(4))- > >getZExtValue(); > PointerType *NewPtrTy = NULL; > + unsigned numBits = Size << 3; > // Destination pointer type is always i8 * > // If Size is 8 then use Int64Ty > // If Size is 4 then use Int32Ty > // If Size is 2 then use Int16Ty > // If Size is 1 then use Int8Ty > if (Size && Size <=8 && !(Size&(Size-1))) > - NewPtrTy = PointerType::get(IntegerType::get(Size<<3)); > + NewPtrTy = PointerType::get(IntegerType::get(numBits)); > > if (NewPtrTy) { > - Value *Src = InsertCastBefore(Instruction::BitCast, > CI.getOperand(2), NewPtrTy, CI); > + Value *L = NULL; > + // If source is a null terminated constant c string then > try to use immediate store. > + if (Constant *C = dyn_cast(CI.getOperand(2))) { > + const std::string &Str = C->getStringValue(); > + if (!Str.empty()) { > + APInt StrVal(numBits, 0); > + unsigned len = Str.length(); > + APInt SingleChar(numBits, 0); > + for (unsigned i = 0; i < len; i++) { > + SingleChar = (uint64_t) Str[i]; > + StrVal = (StrVal << 8) | SingleChar; > + } > + // Append NULL at the end. > + SingleChar = 0; > + StrVal = (StrVal << 8) | SingleChar; > + L = ConstantInt::get(StrVal); > + } > + } > + // Otherwise load source from memory. > + if (L == NULL) { > + Value *Src = InsertCastBefore(Instruction::BitCast, > CI.getOperand(2), NewPtrTy, CI); > + L = new LoadInst(Src, "tmp", false, Align, &CI); > + } > Value *Dest = InsertCastBefore(Instruction::BitCast, > CI.getOperand(1), NewPtrTy, CI); > - Value *L = new LoadInst(Src, "tmp", false, Align, &CI); > Value *NS = new StoreInst(L, Dest, false, Align, &CI); > CI.replaceAllUsesWith(NS); > Changed = true; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Tue Oct 16 21:03:18 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 17 Oct 2007 02:03:18 -0000 Subject: [llvm-commits] [llvm] r43059 - in /llvm/trunk: include/llvm/Analysis/DominatorInternals.h include/llvm/Analysis/Dominators.h lib/VMCore/Dominators.cpp Message-ID: <200710170203.l9H23ImV024841@zion.cs.uiuc.edu> Author: resistor Date: Tue Oct 16 21:03:17 2007 New Revision: 43059 URL: http://llvm.org/viewvc/llvm-project?rev=43059&view=rev Log: Move splitBlock into DomTreeBase from DomTree. Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=43059&r1=43058&r2=43059&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original) +++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Tue Oct 16 21:03:17 2007 @@ -303,6 +303,93 @@ DT.DFSInfoValid = false; } +// NewBB is split and now it has one successor. Update dominator tree to +// reflect this change. +template +void Split(DominatorTreeBase& DT, + typename GraphT::NodeType* NewBB) { + assert(std::distance(GraphT::child_begin(NewBB), GraphT::child_end(NewBB)) == 1 + && "NewBB should have a single successor!"); + typename GraphT::NodeType* NewBBSucc = *GraphT::child_begin(NewBB); + + std::vector PredBlocks; + for (typename GraphTraits >::ChildIteratorType PI = + GraphTraits >::child_begin(NewBB), + PE = GraphTraits >::child_end(NewBB); PI != PE; ++PI) + PredBlocks.push_back(*PI); + + assert(!PredBlocks.empty() && "No predblocks??"); + + // The newly inserted basic block will dominate existing basic blocks iff the + // PredBlocks dominate all of the non-pred blocks. If all predblocks dominate + // the non-pred blocks, then they all must be the same block! + // + bool NewBBDominatesNewBBSucc = true; + { + typename GraphT::NodeType* OnePred = PredBlocks[0]; + unsigned i = 1, e = PredBlocks.size(); + for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) { + assert(i != e && "Didn't find reachable pred?"); + OnePred = PredBlocks[i]; + } + + for (; i != e; ++i) + if (PredBlocks[i] != OnePred && DT.isReachableFromEntry(OnePred)) { + NewBBDominatesNewBBSucc = false; + break; + } + + if (NewBBDominatesNewBBSucc) + for (typename GraphTraits >::ChildIteratorType PI = + GraphTraits >::child_begin(NewBBSucc), + E = GraphTraits >::child_end(NewBBSucc); PI != E; ++PI) + if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { + NewBBDominatesNewBBSucc = false; + break; + } + } + + // The other scenario where the new block can dominate its successors are when + // all predecessors of NewBBSucc that are not NewBB are dominated by NewBBSucc + // already. + if (!NewBBDominatesNewBBSucc) { + NewBBDominatesNewBBSucc = true; + for (typename GraphTraits >::ChildIteratorType PI = + GraphTraits >::child_begin(NewBBSucc), + E = GraphTraits >::child_end(NewBBSucc); PI != E; ++PI) + if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { + NewBBDominatesNewBBSucc = false; + break; + } + } + + // Find NewBB's immediate dominator and create new dominator tree node for + // NewBB. + BasicBlock *NewBBIDom = 0; + unsigned i = 0; + for (i = 0; i < PredBlocks.size(); ++i) + if (DT.isReachableFromEntry(PredBlocks[i])) { + NewBBIDom = PredBlocks[i]; + break; + } + assert(i != PredBlocks.size() && "No reachable preds?"); + for (i = i + 1; i < PredBlocks.size(); ++i) { + if (DT.isReachableFromEntry(PredBlocks[i])) + NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]); + } + assert(NewBBIDom && "No immediate dominator found??"); + + // Create the new dominator tree node... and set the idom of NewBB. + DomTreeNode *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom); + + // If NewBB strictly dominates other blocks, then it is now the immediate + // dominator of NewBBSucc. Update the dominator tree as appropriate. + if (NewBBDominatesNewBBSucc) { + DomTreeNode *NewBBSuccNode = DT.getNode(NewBBSucc); + DT.changeImmediateDominator(NewBBSuccNode, NewBBNode); + } +} + } #endif Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43059&r1=43058&r2=43059&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Oct 16 21:03:17 2007 @@ -160,6 +160,10 @@ /// DominatorTree - Calculate the immediate dominator tree for a function. /// +template +void Split(DominatorTreeBase& DT, + typename GraphT::NodeType* NewBB); + template class DominatorTreeBase : public DominatorBase { protected: @@ -467,6 +471,21 @@ friend void Calculate(DominatorTreeBase& DT, Function& F); + template + friend void Split(DominatorTreeBase& DT, + typename GraphT::NodeType* NewBB); + +public: + /// splitBlock - BB is split and now it has one successor. Update dominator + /// tree to reflect this change. + void splitBlock(NodeT* NewBB) { + if (this->IsPostDominators) + Split, GraphTraits > >(*this, NewBB); + else + Split >(*this, NewBB); + } + +protected: /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers() { @@ -547,11 +566,6 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } - - /// splitBlock - /// BB is split and now it has one successor. Update dominator tree to - /// reflect this change. - void splitBlock(BasicBlock *BB); }; //===------------------------------------- Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=43059&r1=43058&r2=43059&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Tue Oct 16 21:03:17 2007 @@ -56,88 +56,6 @@ static RegisterPass E("domtree", "Dominator Tree Construction", true); -// NewBB is split and now it has one successor. Update dominator tree to -// reflect this change. -void DominatorTree::splitBlock(BasicBlock *NewBB) { - assert(NewBB->getTerminator()->getNumSuccessors() == 1 - && "NewBB should have a single successor!"); - BasicBlock *NewBBSucc = NewBB->getTerminator()->getSuccessor(0); - - std::vector PredBlocks; - for (pred_iterator PI = pred_begin(NewBB), PE = pred_end(NewBB); - PI != PE; ++PI) - PredBlocks.push_back(*PI); - - assert(!PredBlocks.empty() && "No predblocks??"); - - // The newly inserted basic block will dominate existing basic blocks iff the - // PredBlocks dominate all of the non-pred blocks. If all predblocks dominate - // the non-pred blocks, then they all must be the same block! - // - bool NewBBDominatesNewBBSucc = true; - { - BasicBlock *OnePred = PredBlocks[0]; - unsigned i = 1, e = PredBlocks.size(); - for (i = 1; !isReachableFromEntry(OnePred); ++i) { - assert(i != e && "Didn't find reachable pred?"); - OnePred = PredBlocks[i]; - } - - for (; i != e; ++i) - if (PredBlocks[i] != OnePred && isReachableFromEntry(OnePred)) { - NewBBDominatesNewBBSucc = false; - break; - } - - if (NewBBDominatesNewBBSucc) - for (pred_iterator PI = pred_begin(NewBBSucc), E = pred_end(NewBBSucc); - PI != E; ++PI) - if (*PI != NewBB && !dominates(NewBBSucc, *PI)) { - NewBBDominatesNewBBSucc = false; - break; - } - } - - // The other scenario where the new block can dominate its successors are when - // all predecessors of NewBBSucc that are not NewBB are dominated by NewBBSucc - // already. - if (!NewBBDominatesNewBBSucc) { - NewBBDominatesNewBBSucc = true; - for (pred_iterator PI = pred_begin(NewBBSucc), E = pred_end(NewBBSucc); - PI != E; ++PI) - if (*PI != NewBB && !dominates(NewBBSucc, *PI)) { - NewBBDominatesNewBBSucc = false; - break; - } - } - - // Find NewBB's immediate dominator and create new dominator tree node for - // NewBB. - BasicBlock *NewBBIDom = 0; - unsigned i = 0; - for (i = 0; i < PredBlocks.size(); ++i) - if (isReachableFromEntry(PredBlocks[i])) { - NewBBIDom = PredBlocks[i]; - break; - } - assert(i != PredBlocks.size() && "No reachable preds?"); - for (i = i + 1; i < PredBlocks.size(); ++i) { - if (isReachableFromEntry(PredBlocks[i])) - NewBBIDom = findNearestCommonDominator(NewBBIDom, PredBlocks[i]); - } - assert(NewBBIDom && "No immediate dominator found??"); - - // Create the new dominator tree node... and set the idom of NewBB. - DomTreeNode *NewBBNode = addNewBlock(NewBB, NewBBIDom); - - // If NewBB strictly dominates other blocks, then it is now the immediate - // dominator of NewBBSucc. Update the dominator tree as appropriate. - if (NewBBDominatesNewBBSucc) { - DomTreeNode *NewBBSuccNode = getNode(NewBBSucc); - changeImmediateDominator(NewBBSuccNode, NewBBNode); - } -} - bool DominatorTree::runOnFunction(Function &F) { reset(); // Reset from the last time we were run... From evan.cheng at apple.com Tue Oct 16 21:10:23 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 02:10:23 -0000 Subject: [llvm-commits] [llvm] r43060 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200710170210.l9H2ANds025011@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 21:10:22 2007 New Revision: 43060 URL: http://llvm.org/viewvc/llvm-project?rev=43060&view=rev Log: Clean up code that calculate MBB live-in's. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=43060&r1=43059&r2=43060&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Oct 16 21:10:22 2007 @@ -36,6 +36,7 @@ class TargetInstrInfo; class TargetRegisterClass; class VirtRegMap; + typedef std::pair IdxMBBPair; class LiveIntervals : public MachineFunctionPass { MachineFunction* mf_; @@ -52,6 +53,10 @@ /// specified basic block. std::vector > MBB2IdxMap; + /// Idx2MBBMap - Sorted list of pairs of index of first instruction + /// and MBB id. + std::vector Idx2MBBMap; + typedef std::map Mi2IndexMap; Mi2IndexMap mi2iMap_; @@ -158,6 +163,12 @@ return i2miMap_[index]; } + /// findLiveInMBBs - Given a live range, if the value of the range + /// is live in any MBB returns true as well as the list of basic blocks + /// where the value is live in. + bool findLiveInMBBs(const LiveRange &LR, + SmallVector &MBBs) const; + // Interval creation LiveInterval &getOrCreateInterval(unsigned reg) { Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=43060&r1=43059&r2=43060&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Oct 16 21:10:22 2007 @@ -62,6 +62,7 @@ } void LiveIntervals::releaseMemory() { + Idx2MBBMap.clear(); mi2iMap_.clear(); i2miMap_.clear(); r2iMap_.clear(); @@ -71,6 +72,22 @@ delete ClonedMIs[i]; } +namespace llvm { + inline bool operator<(unsigned V, const IdxMBBPair &IM) { + return V < IM.first; + } + + inline bool operator<(const IdxMBBPair &IM, unsigned V) { + return IM.first < V; + } + + struct Idx2MBBCompare { + bool operator()(const IdxMBBPair &LHS, const IdxMBBPair &RHS) const { + return LHS.first < RHS.first; + } + }; +} + /// runOnMachineFunction - Register allocate the whole function /// bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) { @@ -100,7 +117,9 @@ // Set the MBB2IdxMap entry for this MBB. MBB2IdxMap[MBB->getNumber()] = std::make_pair(StartIdx, MIIndex - 1); + Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB)); } + std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare()); computeIntervals(); @@ -797,6 +816,23 @@ } } +bool LiveIntervals::findLiveInMBBs(const LiveRange &LR, + SmallVector &MBBs) const { + std::vector::const_iterator I = + std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), LR.start); + + bool ResVal = false; + while (I != Idx2MBBMap.end()) { + if (LR.end <= I->first) + break; + MBBs.push_back(I->second); + ResVal = true; + ++I; + } + return ResVal; +} + + LiveInterval LiveIntervals::createInterval(unsigned reg) { float Weight = MRegisterInfo::isPhysicalRegister(reg) ? HUGE_VALF : 0.0F; From evan.cheng at apple.com Tue Oct 16 21:12:23 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 02:12:23 -0000 Subject: [llvm-commits] [llvm] r43061 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200710170212.l9H2CN44025111@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 21:12:22 2007 New Revision: 43061 URL: http://llvm.org/viewvc/llvm-project?rev=43061&view=rev Log: Clean up code that calculate MBB live-in's. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=43061&r1=43060&r2=43061&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Tue Oct 16 21:12:22 2007 @@ -288,23 +288,25 @@ DOUT << "\tinterval " << *i->first << " expired\n"); inactive_.clear(); - // A brute force way of adding live-ins to every BB. - MachineFunction::iterator MBB = mf_->begin(); - ++MBB; // Skip entry MBB. - for (MachineFunction::iterator E = mf_->end(); MBB != E; ++MBB) { - unsigned StartIdx = li_->getMBBStartIdx(MBB->getNumber()); - for (IntervalPtrs::iterator i = fixed_.begin(), e = fixed_.end(); - i != e; ++i) - if (i->first->liveAt(StartIdx)) - MBB->addLiveIn(i->first->reg); - - for (unsigned i = 0, e = handled_.size(); i != e; ++i) { - LiveInterval *HI = handled_[i]; - unsigned Reg = HI->reg; - if (vrm_->isAssignedReg(Reg) && HI->liveAt(StartIdx)) { - assert(MRegisterInfo::isVirtualRegister(Reg)); - Reg = vrm_->getPhys(Reg); - MBB->addLiveIn(Reg); + // Add live-ins to every BB except for entry. + MachineFunction::iterator EntryMBB = mf_->begin(); + for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { + const LiveInterval &cur = i->second; + unsigned Reg = 0; + if (MRegisterInfo::isPhysicalRegister(cur.reg)) + Reg = i->second.reg; + else if (vrm_->isAssignedReg(cur.reg)) + Reg = vrm_->getPhys(cur.reg); + if (!Reg) + continue; + for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end(); + I != E; ++I) { + const LiveRange &LR = *I; + SmallVector LiveInMBBs; + if (li_->findLiveInMBBs(LR, LiveInMBBs)) { + for (unsigned i = 0, e = LiveInMBBs.size(); i != e; ++i) + if (LiveInMBBs[i] != EntryMBB) + LiveInMBBs[i]->addLiveIn(Reg); } } } From evan.cheng at apple.com Tue Oct 16 21:13:30 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 02:13:30 -0000 Subject: [llvm-commits] [llvm] r43062 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp Message-ID: <200710170213.l9H2DU4G025145@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 21:13:29 2007 New Revision: 43062 URL: http://llvm.org/viewvc/llvm-project?rev=43062&view=rev Log: Fix MergeValueInAsValue(). It allows overlapping live ranges but should replace their value numbers with the specified value number. Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=43062&r1=43061&r2=43062&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Oct 16 21:13:29 2007 @@ -19,6 +19,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LiveInterval.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Streams.h" #include "llvm/Target/MRegisterInfo.h" @@ -386,19 +387,68 @@ /// MergeValueInAsValue - Merge all of the live ranges of a specific val# /// in RHS into this live interval as the specified value number. /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the -/// current interval, but only if the overlapping LiveRanges have the -/// specified value number. +/// current interval, it will replace the value numbers of the overlaped +/// live ranges with the specified value number. void LiveInterval::MergeValueInAsValue(const LiveInterval &RHS, const VNInfo *RHSValNo, VNInfo *LHSValNo) { - // TODO: Make this more efficient. - iterator InsertPos = begin(); + SmallVector ReplacedValNos; + iterator IP = begin(); for (const_iterator I = RHS.begin(), E = RHS.end(); I != E; ++I) { if (I->valno != RHSValNo) continue; + unsigned Start = I->start, End = I->end; + IP = std::upper_bound(IP, end(), Start); + // If the start of this range overlaps with an existing liverange, trim it. + if (IP != begin() && IP[-1].end > Start) { + if (IP->valno != LHSValNo) { + ReplacedValNos.push_back(IP->valno); + IP->valno = LHSValNo; // Update val#. + } + Start = IP[-1].end; + // Trimmed away the whole range? + if (Start >= End) continue; + } + // If the end of this range overlaps with an existing liverange, trim it. + if (IP != end() && End > IP->start) { + if (IP->valno != LHSValNo) { + ReplacedValNos.push_back(IP->valno); + IP->valno = LHSValNo; // Update val#. + } + End = IP->start; + // If this trimmed away the whole range, ignore it. + if (Start == End) continue; + } + // Map the valno in the other live range to the current live range. - LiveRange Tmp = *I; - Tmp.valno = LHSValNo; - InsertPos = addRangeFrom(Tmp, InsertPos); + IP = addRangeFrom(LiveRange(Start, End, LHSValNo), IP); + } + + + SmallSet Seen; + for (unsigned i = 0, e = ReplacedValNos.size(); i != e; ++i) { + VNInfo *V1 = ReplacedValNos[i]; + if (Seen.insert(V1)) { + bool isDead = true; + for (const_iterator I = begin(), E = end(); I != E; ++I) + if (I->valno == V1) { + isDead = false; + break; + } + if (isDead) { + // Now that V1 is dead, remove it. If it is the largest value number, + // just nuke it (and any other deleted values neighboring it), otherwise + // mark it as ~1U so it can be nuked later. + if (V1->id == getNumValNums()-1) { + do { + VNInfo *VNI = valnos.back(); + valnos.pop_back(); + VNI->~VNInfo(); + } while (valnos.back()->def == ~1U); + } else { + V1->def = ~1U; + } + } + } } } From evan.cheng at apple.com Tue Oct 16 21:15:06 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 02:15:06 -0000 Subject: [llvm-commits] [llvm] r43063 - /llvm/trunk/test/CodeGen/X86/2007-10-16-CoalescerCrash.ll Message-ID: <200710170215.l9H2F6w0025241@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 21:15:06 2007 New Revision: 43063 URL: http://llvm.org/viewvc/llvm-project?rev=43063&view=rev Log: Yet another test case for extract_subreg coalescing crash. Added: llvm/trunk/test/CodeGen/X86/2007-10-16-CoalescerCrash.ll Added: llvm/trunk/test/CodeGen/X86/2007-10-16-CoalescerCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-16-CoalescerCrash.ll?rev=43063&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-16-CoalescerCrash.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-16-CoalescerCrash.ll Tue Oct 16 21:15:06 2007 @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin + +define i64 @__ashldi3(i64 %u, i64 %b) { +entry: + br i1 false, label %UnifiedReturnBlock, label %cond_next + +cond_next: ; preds = %entry + %tmp9 = sub i64 32, %b ; [#uses=2] + %tmp11 = icmp slt i64 %tmp9, 1 ; [#uses=1] + %tmp2180 = trunc i64 %u to i32 ; [#uses=2] + %tmp2223 = trunc i64 %tmp9 to i32 ; [#uses=2] + br i1 %tmp11, label %cond_true14, label %cond_false + +cond_true14: ; preds = %cond_next + %tmp24 = sub i32 0, %tmp2223 ; [#uses=1] + %tmp25 = shl i32 %tmp2180, %tmp24 ; [#uses=1] + %tmp2569 = zext i32 %tmp25 to i64 ; [#uses=1] + %tmp256970 = shl i64 %tmp2569, 32 ; [#uses=1] + ret i64 %tmp256970 + +cond_false: ; preds = %cond_next + %tmp35 = lshr i32 %tmp2180, %tmp2223 ; [#uses=1] + %tmp54 = or i32 %tmp35, 0 ; [#uses=1] + %tmp5464 = zext i32 %tmp54 to i64 ; [#uses=1] + %tmp546465 = shl i64 %tmp5464, 32 ; [#uses=1] + %tmp546465.ins = or i64 %tmp546465, 0 ; [#uses=1] + ret i64 %tmp546465.ins + +UnifiedReturnBlock: + ret i64 %u +} From evan.cheng at apple.com Tue Oct 16 21:16:40 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 02:16:40 -0000 Subject: [llvm-commits] [llvm] r43064 - /llvm/trunk/include/llvm/CodeGen/LiveInterval.h Message-ID: <200710170216.l9H2Geiu025325@zion.cs.uiuc.edu> Author: evancheng Date: Tue Oct 16 21:16:40 2007 New Revision: 43064 URL: http://llvm.org/viewvc/llvm-project?rev=43064&view=rev Log: Update comments. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=43064&r1=43063&r2=43064&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Tue Oct 16 21:16:40 2007 @@ -241,10 +241,11 @@ void MergeInClobberRanges(const LiveInterval &Clobbers, BumpPtrAllocator &VNInfoAllocator); - /// MergeRangesInAsValue - Merge all of the live ranges in RHS into this - /// live interval as the specified value number. The LiveRanges in RHS are - /// allowed to overlap with LiveRanges in the current interval, but only if - /// the overlapping LiveRanges have the specified value number. + /// MergeValueInAsValue - Merge all of the live ranges of a specific val# + /// in RHS into this live interval as the specified value number. + /// The LiveRanges in RHS are allowed to overlap with LiveRanges in the + /// current interval, it will replace the value numbers of the overlaped + /// live ranges with the specified value number. void MergeRangesInAsValue(const LiveInterval &RHS, VNInfo *LHSValNo); /// MergeValueInAsValue - Merge all of the live ranges of a specific val# From clattner at apple.com Tue Oct 16 23:53:52 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 16 Oct 2007 21:53:52 -0700 Subject: [llvm-commits] [llvm] r43061 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp In-Reply-To: <200710170212.l9H2CN44025111@zion.cs.uiuc.edu> References: <200710170212.l9H2CN44025111@zion.cs.uiuc.edu> Message-ID: > URL: http://llvm.org/viewvc/llvm-project?rev=43061&view=rev > Log: > Clean up code that calculate MBB live-in's. Very nice Evan, this sped up linscan significantly. For example, on 176.gcc with a release-asserts build: old: 7.2973 ( 47.3%) 0.0527 ( 19.1%) 7.3501 ( 46.8%) 7.3503 ( 46.8%) X86 DAG->DAG Instruction Selection 2.1359 ( 13.8%) 0.0090 ( 3.2%) 2.1449 ( 13.6%) 2.1449 ( 13.6%) Linear Scan Register Allocator 0.9337 ( 6.0%) 0.0852 ( 30.9%) 1.0190 ( 6.4%) 1.0235 ( 6.5%) Live Interval Analysis 0.8634 ( 5.6%) 0.0093 ( 3.4%) 0.8728 ( 5.5%) 0.8732 ( 5.5%) Simple Register Coalescing .. 15.4108 (100.0%) 0.2757 (100.0%) 15.6865 (100.0%) 15.6943 (100.0%) TOTAL new: 7.3167 ( 50.1%) 0.0553 ( 19.8%) 7.3720 ( 49.6%) 7.4150 ( 49.7%) X86 DAG->DAG Instruction Selection 1.3034 ( 8.9%) 0.0079 ( 2.8%) 1.3113 ( 8.8%) 1.3114 ( 8.8%) Linear Scan Register Allocator 0.9415 ( 6.4%) 0.0889 ( 31.9%) 1.0305 ( 6.9%) 1.0303 ( 6.9%) Live Interval Analysis 0.8414 ( 5.7%) 0.0089 ( 3.2%) 0.8503 ( 5.7%) 0.8502 ( 5.7%) Simple Register Coalescing .. 14.5815 (100.0%) 0.2786 (100.0%) 14.8601 (100.0%) 14.9024 (100.0%) TOTAL That's a 63% speedup of the linscan pass! -Chris From evan.cheng at apple.com Wed Oct 17 00:29:38 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 05:29:38 -0000 Subject: [llvm-commits] [llvm] r43065 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200710170529.l9H5TcJJ031780@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 17 00:29:37 2007 New Revision: 43065 URL: http://llvm.org/viewvc/llvm-project?rev=43065&view=rev Log: One more extract_subreg coalescing bug fix. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=43065&r1=43064&r2=43065&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Oct 17 00:29:37 2007 @@ -236,7 +236,7 @@ // If this is a extract_subreg where dst is a physical register, e.g. // cl = EXTRACT_SUBREG reg1024, 1 // then create and update the actual physical register allocated to RHS. - const TargetRegisterClass *RC = mf_->getSSARegMap()->getRegClass(SrcReg); + const TargetRegisterClass *RC=mf_->getSSARegMap()->getRegClass(repSrcReg); for (const unsigned *SRs = mri_->getSuperRegisters(repDstReg); unsigned SR = *SRs; ++SRs) { if (repDstReg == mri_->getSubReg(SR, SubIdx) && From sabre at nondot.org Wed Oct 17 01:02:14 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 17 Oct 2007 06:02:14 -0000 Subject: [llvm-commits] [llvm] r43066 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200710170602.l9H62Evw000318@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 17 01:02:13 2007 New Revision: 43066 URL: http://llvm.org/viewvc/llvm-project?rev=43066&view=rev Log: fix some funny indentation, add comments. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43066&r1=43065&r2=43066&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 17 01:02:13 2007 @@ -3772,70 +3772,71 @@ return Result; } +/// LowerShift - Lower SRA_PARTS and friends, which return two i32 values and +/// take a 2 x i32 value to shift plus a shift amount. SDOperand X86TargetLowering::LowerShift(SDOperand Op, SelectionDAG &DAG) { - assert(Op.getNumOperands() == 3 && Op.getValueType() == MVT::i32 && - "Not an i64 shift!"); - bool isSRA = Op.getOpcode() == ISD::SRA_PARTS; - SDOperand ShOpLo = Op.getOperand(0); - SDOperand ShOpHi = Op.getOperand(1); - SDOperand ShAmt = Op.getOperand(2); - SDOperand Tmp1 = isSRA ? - DAG.getNode(ISD::SRA, MVT::i32, ShOpHi, DAG.getConstant(31, MVT::i8)) : - DAG.getConstant(0, MVT::i32); - - SDOperand Tmp2, Tmp3; - if (Op.getOpcode() == ISD::SHL_PARTS) { - Tmp2 = DAG.getNode(X86ISD::SHLD, MVT::i32, ShOpHi, ShOpLo, ShAmt); - Tmp3 = DAG.getNode(ISD::SHL, MVT::i32, ShOpLo, ShAmt); - } else { - Tmp2 = DAG.getNode(X86ISD::SHRD, MVT::i32, ShOpLo, ShOpHi, ShAmt); - Tmp3 = DAG.getNode(isSRA ? ISD::SRA : ISD::SRL, MVT::i32, ShOpHi, ShAmt); - } + assert(Op.getNumOperands() == 3 && Op.getValueType() == MVT::i32 && + "Not an i64 shift!"); + bool isSRA = Op.getOpcode() == ISD::SRA_PARTS; + SDOperand ShOpLo = Op.getOperand(0); + SDOperand ShOpHi = Op.getOperand(1); + SDOperand ShAmt = Op.getOperand(2); + SDOperand Tmp1 = isSRA ? + DAG.getNode(ISD::SRA, MVT::i32, ShOpHi, DAG.getConstant(31, MVT::i8)) : + DAG.getConstant(0, MVT::i32); + + SDOperand Tmp2, Tmp3; + if (Op.getOpcode() == ISD::SHL_PARTS) { + Tmp2 = DAG.getNode(X86ISD::SHLD, MVT::i32, ShOpHi, ShOpLo, ShAmt); + Tmp3 = DAG.getNode(ISD::SHL, MVT::i32, ShOpLo, ShAmt); + } else { + Tmp2 = DAG.getNode(X86ISD::SHRD, MVT::i32, ShOpLo, ShOpHi, ShAmt); + Tmp3 = DAG.getNode(isSRA ? ISD::SRA : ISD::SRL, MVT::i32, ShOpHi, ShAmt); + } - const MVT::ValueType *VTs = DAG.getNodeValueTypes(MVT::Other, MVT::Flag); - SDOperand AndNode = DAG.getNode(ISD::AND, MVT::i8, ShAmt, - DAG.getConstant(32, MVT::i8)); - SDOperand Cond = DAG.getNode(X86ISD::CMP, MVT::i32, - AndNode, DAG.getConstant(0, MVT::i8)); - - SDOperand Hi, Lo; - SDOperand CC = DAG.getConstant(X86::COND_NE, MVT::i8); - unsigned Opc = X86ISD::CMOV; - VTs = DAG.getNodeValueTypes(MVT::i32, MVT::Flag); - SmallVector Ops; - if (Op.getOpcode() == ISD::SHL_PARTS) { - Ops.push_back(Tmp2); - Ops.push_back(Tmp3); - Ops.push_back(CC); - Ops.push_back(Cond); - Hi = DAG.getNode(Opc, MVT::i32, &Ops[0], Ops.size()); - - Ops.clear(); - Ops.push_back(Tmp3); - Ops.push_back(Tmp1); - Ops.push_back(CC); - Ops.push_back(Cond); - Lo = DAG.getNode(Opc, MVT::i32, &Ops[0], Ops.size()); - } else { - Ops.push_back(Tmp2); - Ops.push_back(Tmp3); - Ops.push_back(CC); - Ops.push_back(Cond); - Lo = DAG.getNode(Opc, MVT::i32, &Ops[0], Ops.size()); - - Ops.clear(); - Ops.push_back(Tmp3); - Ops.push_back(Tmp1); - Ops.push_back(CC); - Ops.push_back(Cond); - Hi = DAG.getNode(Opc, MVT::i32, &Ops[0], Ops.size()); - } + const MVT::ValueType *VTs = DAG.getNodeValueTypes(MVT::Other, MVT::Flag); + SDOperand AndNode = DAG.getNode(ISD::AND, MVT::i8, ShAmt, + DAG.getConstant(32, MVT::i8)); + SDOperand Cond = DAG.getNode(X86ISD::CMP, MVT::i32, + AndNode, DAG.getConstant(0, MVT::i8)); + + SDOperand Hi, Lo; + SDOperand CC = DAG.getConstant(X86::COND_NE, MVT::i8); + VTs = DAG.getNodeValueTypes(MVT::i32, MVT::Flag); + SmallVector Ops; + if (Op.getOpcode() == ISD::SHL_PARTS) { + Ops.push_back(Tmp2); + Ops.push_back(Tmp3); + Ops.push_back(CC); + Ops.push_back(Cond); + Hi = DAG.getNode(X86ISD::CMOV, MVT::i32, &Ops[0], Ops.size()); + + Ops.clear(); + Ops.push_back(Tmp3); + Ops.push_back(Tmp1); + Ops.push_back(CC); + Ops.push_back(Cond); + Lo = DAG.getNode(X86ISD::CMOV, MVT::i32, &Ops[0], Ops.size()); + } else { + Ops.push_back(Tmp2); + Ops.push_back(Tmp3); + Ops.push_back(CC); + Ops.push_back(Cond); + Lo = DAG.getNode(X86ISD::CMOV, MVT::i32, &Ops[0], Ops.size()); - VTs = DAG.getNodeValueTypes(MVT::i32, MVT::i32); Ops.clear(); - Ops.push_back(Lo); - Ops.push_back(Hi); - return DAG.getNode(ISD::MERGE_VALUES, VTs, 2, &Ops[0], Ops.size()); + Ops.push_back(Tmp3); + Ops.push_back(Tmp1); + Ops.push_back(CC); + Ops.push_back(Cond); + Hi = DAG.getNode(X86ISD::CMOV, MVT::i32, &Ops[0], Ops.size()); + } + + VTs = DAG.getNodeValueTypes(MVT::i32, MVT::i32); + Ops.clear(); + Ops.push_back(Lo); + Ops.push_back(Hi); + return DAG.getNode(ISD::MERGE_VALUES, VTs, 2, &Ops[0], Ops.size()); } SDOperand X86TargetLowering::LowerSINT_TO_FP(SDOperand Op, SelectionDAG &DAG) { From sabre at nondot.org Wed Oct 17 01:17:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 17 Oct 2007 06:17:29 -0000 Subject: [llvm-commits] [llvm] r43068 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200710170617.l9H6HTMc000791@zion.cs.uiuc.edu> Author: lattner Date: Wed Oct 17 01:17:29 2007 New Revision: 43068 URL: http://llvm.org/viewvc/llvm-project?rev=43068&view=rev Log: Change fp to sint legalization on x86-32 to do 2 x i32 loads instead of 1 x i64 loads. This doesn't change any functionality yet. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43068&r1=43067&r2=43068&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 17 01:17:29 2007 @@ -3952,8 +3952,18 @@ SDOperand Ops[] = { Chain, Value, StackSlot }; SDOperand FIST = DAG.getNode(Opc, MVT::Other, Ops, 3); - // Load the result. - return DAG.getLoad(Op.getValueType(), FIST, StackSlot, NULL, 0); + // Load the result. If this is an i64 load on an x86-32 host, expand the + // load. + if (Op.getValueType() != MVT::i64 || Subtarget->is64Bit()) + return DAG.getLoad(Op.getValueType(), FIST, StackSlot, NULL, 0); + + SDOperand Lo = DAG.getLoad(MVT::i32, FIST, StackSlot, NULL, 0); + StackSlot = DAG.getNode(ISD::ADD, StackSlot.getValueType(), StackSlot, + DAG.getConstant(StackSlot.getValueType(), 4)); + SDOperand Hi = DAG.getLoad(MVT::i32, FIST, StackSlot, NULL, 0); + + + return DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); } SDOperand X86TargetLowering::LowerFABS(SDOperand Op, SelectionDAG &DAG) { From evan.cheng at apple.com Wed Oct 17 01:53:44 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 06:53:44 -0000 Subject: [llvm-commits] [llvm] r43069 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200710170653.l9H6rj7S002469@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 17 01:53:44 2007 New Revision: 43069 URL: http://llvm.org/viewvc/llvm-project?rev=43069&view=rev Log: Apply Chris' suggestions. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=43069&r1=43068&r2=43069&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Oct 17 01:53:44 2007 @@ -167,7 +167,7 @@ /// is live in any MBB returns true as well as the list of basic blocks /// where the value is live in. bool findLiveInMBBs(const LiveRange &LR, - SmallVector &MBBs) const; + SmallVectorImpl &MBBs) const; // Interval creation Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=43069&r1=43068&r2=43069&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Oct 17 01:53:44 2007 @@ -817,7 +817,7 @@ } bool LiveIntervals::findLiveInMBBs(const LiveRange &LR, - SmallVector &MBBs) const { + SmallVectorImpl &MBBs) const { std::vector::const_iterator I = std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), LR.start); Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=43069&r1=43068&r2=43069&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Oct 17 01:53:44 2007 @@ -290,6 +290,7 @@ // Add live-ins to every BB except for entry. MachineFunction::iterator EntryMBB = mf_->begin(); + SmallVector LiveInMBBs; for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) { const LiveInterval &cur = i->second; unsigned Reg = 0; @@ -302,11 +303,11 @@ for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end(); I != E; ++I) { const LiveRange &LR = *I; - SmallVector LiveInMBBs; if (li_->findLiveInMBBs(LR, LiveInMBBs)) { for (unsigned i = 0, e = LiveInMBBs.size(); i != e; ++i) if (LiveInMBBs[i] != EntryMBB) LiveInMBBs[i]->addLiveIn(Reg); + LiveInMBBs.clear(); } } } From dpatel at apple.com Wed Oct 17 02:24:40 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 17 Oct 2007 07:24:40 -0000 Subject: [llvm-commits] [llvm] r43070 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Message-ID: <200710170724.l9H7OeUm004564@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 17 02:24:40 2007 New Revision: 43070 URL: http://llvm.org/viewvc/llvm-project?rev=43070&view=rev Log: Apply "Instead of loading small c string constant, use integer constant directly" transformation while processing load instruction. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43070&r1=43069&r2=43070&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 17 02:24:40 2007 @@ -7673,41 +7673,21 @@ unsigned Size = MemOpLength->getZExtValue(); unsigned Align = cast(CI.getOperand(4))->getZExtValue(); PointerType *NewPtrTy = NULL; - unsigned numBits = Size << 3; // Destination pointer type is always i8 * // If Size is 8 then use Int64Ty // If Size is 4 then use Int32Ty // If Size is 2 then use Int16Ty // If Size is 1 then use Int8Ty if (Size && Size <=8 && !(Size&(Size-1))) - NewPtrTy = PointerType::get(IntegerType::get(numBits)); + NewPtrTy = PointerType::get(IntegerType::get(Size<<3)); if (NewPtrTy) { - Value *L = NULL; - // If source is a null terminated constant c string then try to use immediate store. - if (Constant *C = dyn_cast(CI.getOperand(2))) { - const std::string &Str = C->getStringValue(); - if (!Str.empty()) { - APInt StrVal(numBits, 0); - unsigned len = Str.length(); - APInt SingleChar(numBits, 0); - for (unsigned i = 0; i < len; i++) { - SingleChar = (uint64_t) Str[i]; - StrVal = (StrVal << 8) | SingleChar; - } - // Append NULL at the end. - SingleChar = 0; - StrVal = (StrVal << 8) | SingleChar; - L = ConstantInt::get(StrVal); - } - } - // Otherwise load source from memory. - if (L == NULL) { - Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), NewPtrTy, CI); - L = new LoadInst(Src, "tmp", false, Align, &CI); - } + Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), NewPtrTy, CI); Value *Dest = InsertCastBefore(Instruction::BitCast, CI.getOperand(1), NewPtrTy, CI); + Value *L = new LoadInst(Src, "tmp", false, Align, &CI); Value *NS = new StoreInst(L, Dest, false, Align, &CI); + AddToWorkList(cast(L)); + AddToWorkList(cast(NS)); CI.replaceAllUsesWith(NS); Changed = true; return EraseInstFromFunction(CI); @@ -9136,6 +9116,29 @@ } } else if (CE->isCast()) { + // Instead of loading constant c string, use corresponding integer value + // directly if string length is small enough. + const std::string &Str = CE->getOperand(0)->getStringValue(); + if (!Str.empty()) { + unsigned len = Str.length(); + const Type *Ty = cast(CE->getType())->getElementType(); + unsigned numBits = Ty->getPrimitiveSizeInBits(); + if ((numBits >> 3) == len + 1) { + // Replace LI with immediate integer store. + APInt StrVal(numBits, 0); + APInt SingleChar(numBits, 0); + for (unsigned i = 0; i < len; i++) { + SingleChar = (uint64_t) Str[i]; + StrVal = (StrVal << 8) | SingleChar; + } + // Append NULL at the end. + SingleChar = 0; + StrVal = (StrVal << 8) | SingleChar; + Value *NL = ConstantInt::get(StrVal); + return ReplaceInstUsesWith(LI, NL); + } + } + if (Instruction *Res = InstCombineLoadCast(*this, LI)) return Res; } Modified: llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll?rev=43070&r1=43069&r2=43070&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Wed Oct 17 02:24:40 2007 @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call +; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | not grep xyz @.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1] define void @foo(i8* %P) { From baldrick at free.fr Wed Oct 17 08:49:59 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 17 Oct 2007 13:49:59 -0000 Subject: [llvm-commits] [llvm] r43071 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200710171349.l9HDnxu9027400@zion.cs.uiuc.edu> Author: baldrick Date: Wed Oct 17 08:49:58 2007 New Revision: 43071 URL: http://llvm.org/viewvc/llvm-project?rev=43071&view=rev Log: Return Expand from getOperationAction for all extended types. This is needed for SIGN_EXTEND_INREG at least. It is not clear if this is correct for other operations. On the other hand, for the various load/store actions it seems to correct to return the type action, as is currently done. Also, it seems that SelectionDAG::getValueType can be called for extended value types; introduce a map for holding these, since we don't really want to extend the vector to be 2^32 pointers long! Generalize DAGTypeLegalizer::PromoteResult_TRUNCATE and DAGTypeLegalizer::PromoteResult_INT_EXTEND to handle the various funky possibilities that apints introduce, for example that you can promote to a type that needs to be expanded. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=43071&r1=43070&r2=43071&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Oct 17 08:49:58 2007 @@ -541,6 +541,7 @@ std::vector CondCodeNodes; std::vector ValueTypeNodes; + std::map ExtendedValueTypeNodes; std::map ExternalSymbols; std::map TargetExternalSymbols; std::map StringNodes; Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=43071&r1=43070&r2=43071&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Oct 17 08:49:58 2007 @@ -273,7 +273,7 @@ /// expanded to some other code sequence, or the target has a custom expander /// for it. LegalizeAction getOperationAction(unsigned Op, MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return getTypeAction(VT); + if (MVT::isExtendedVT(VT)) return Expand; return (LegalizeAction)((OpActions[Op] >> (2*VT)) & 3); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43071&r1=43070&r2=43071&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Oct 17 08:49:58 2007 @@ -1762,8 +1762,8 @@ Result = DAG.getExtLoad(ExtType, Node->getValueType(0), Tmp1, Tmp2, LD->getSrcValue(), LD->getSrcValueOffset(), MVT::i8, LD->isVolatile(), LD->getAlignment()); - Tmp1 = Result.getValue(0); - Tmp2 = Result.getValue(1); + Tmp1 = Result.getValue(0); + Tmp2 = Result.getValue(1); break; case TargetLowering::Custom: isCustom = true; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43071&r1=43070&r2=43071&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Wed Oct 17 08:49:58 2007 @@ -390,7 +390,6 @@ OpEntry = Result; } - void DAGTypeLegalizer::GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi) { std::pair &Entry = ExpandedNodes[Op]; @@ -479,46 +478,53 @@ } SDOperand DAGTypeLegalizer::PromoteResult_TRUNCATE(SDNode *N) { - MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + SDOperand Res; + switch (getTypeAction(N->getOperand(0).getValueType())) { default: assert(0 && "Unknown type action!"); - case Legal: { - SDOperand Res = N->getOperand(0); - assert(Res.getValueType() >= NVT && "Truncation doesn't make sense!"); - if (Res.getValueType() > NVT) // Truncate to NVT instead of VT - return DAG.getNode(ISD::TRUNCATE, NVT, Res); - return Res; - } - case Promote: - // The truncation is not required, because we don't guarantee anything - // about high bits anyway. - return GetPromotedOp(N->getOperand(0)); + case Legal: case Expand: - // Truncate the low part of the expanded value to the result type - SDOperand Lo, Hi; - GetExpandedOp(N->getOperand(0), Lo, Hi); - return DAG.getNode(ISD::TRUNCATE, NVT, Lo); + Res = N->getOperand(0); + break; + case Promote: + Res = GetPromotedOp(N->getOperand(0)); + break; } + + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + assert(MVT::getSizeInBits(Res.getValueType()) >= MVT::getSizeInBits(NVT) && + "Truncation doesn't make sense!"); + if (Res.getValueType() == NVT) + return Res; + + // Truncate to NVT instead of VT + return DAG.getNode(ISD::TRUNCATE, NVT, Res); } + SDOperand DAGTypeLegalizer::PromoteResult_INT_EXTEND(SDNode *N) { MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); - switch (getTypeAction(N->getOperand(0).getValueType())) { - default: assert(0 && "BUG: Smaller reg should have been promoted!"); - case Legal: - // Input is legal? Just do extend all the way to the larger type. - return DAG.getNode(N->getOpcode(), NVT, N->getOperand(0)); - case Promote: - // Get promoted operand if it is smaller. + + if (getTypeAction(N->getOperand(0).getValueType()) == Promote) { SDOperand Res = GetPromotedOp(N->getOperand(0)); - // The high bits are not guaranteed to be anything. Insert an extend. - if (N->getOpcode() == ISD::SIGN_EXTEND) - return DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Res, - DAG.getValueType(N->getOperand(0).getValueType())); - if (N->getOpcode() == ISD::ZERO_EXTEND) - return DAG.getZeroExtendInReg(Res, N->getOperand(0).getValueType()); - assert(N->getOpcode() == ISD::ANY_EXTEND && "Unknown integer extension!"); - return Res; + assert(MVT::getSizeInBits(Res.getValueType()) <= MVT::getSizeInBits(NVT) && + "Extension doesn't make sense!"); + + // If the result and operand types are the same after promotion, simplify + // to an in-register extension. + if (NVT == Res.getValueType()) { + // The high bits are not guaranteed to be anything. Insert an extend. + if (N->getOpcode() == ISD::SIGN_EXTEND) + return DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Res, + DAG.getValueType(N->getOperand(0).getValueType())); + if (N->getOpcode() == ISD::ZERO_EXTEND) + return DAG.getZeroExtendInReg(Res, N->getOperand(0).getValueType()); + assert(N->getOpcode() == ISD::ANY_EXTEND && "Unknown integer extension!"); + return Res; + } } + + // Otherwise, just extend the original operand all the way to the larger type. + return DAG.getNode(N->getOpcode(), NVT, N->getOperand(0)); } SDOperand DAGTypeLegalizer::PromoteResult_FP_ROUND(SDNode *N) { @@ -527,7 +533,6 @@ N->getOperand(0), DAG.getValueType(N->getValueType(0))); } - SDOperand DAGTypeLegalizer::PromoteResult_SETCC(SDNode *N) { assert(isTypeLegal(TLI.getSetCCResultTy()) && "SetCC type is not legal??"); return DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), N->getOperand(0), @@ -1198,6 +1203,7 @@ Op = DAG.getNode(ISD::ANY_EXTEND, N->getValueType(0), Op); return DAG.getZeroExtendInReg(Op, N->getOperand(0).getValueType()); } + SDOperand DAGTypeLegalizer::PromoteOperand_SIGN_EXTEND(SDNode *N) { SDOperand Op = GetPromotedOp(N->getOperand(0)); Op = DAG.getNode(ISD::ANY_EXTEND, N->getValueType(0), Op); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=43071&r1=43070&r2=43071&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Oct 17 08:49:58 2007 @@ -527,10 +527,16 @@ Erased = TargetExternalSymbols.erase(cast(N)->getSymbol()); break; - case ISD::VALUETYPE: - Erased = ValueTypeNodes[cast(N)->getVT()] != 0; - ValueTypeNodes[cast(N)->getVT()] = 0; + case ISD::VALUETYPE: { + MVT::ValueType VT = cast(N)->getVT(); + if (MVT::isExtendedVT(VT)) { + Erased = ExtendedValueTypeNodes.erase(VT); + } else { + Erased = ValueTypeNodes[VT] != 0; + ValueTypeNodes[VT] = 0; + } break; + } default: // Remove it from the CSE Map. Erased = CSEMap.RemoveNode(N); @@ -847,15 +853,16 @@ } SDOperand SelectionDAG::getValueType(MVT::ValueType VT) { - assert(!MVT::isExtendedVT(VT) && "Expecting a simple value type!"); - if ((unsigned)VT >= ValueTypeNodes.size()) + if (!MVT::isExtendedVT(VT) && (unsigned)VT >= ValueTypeNodes.size()) ValueTypeNodes.resize(VT+1); - if (ValueTypeNodes[VT] == 0) { - ValueTypeNodes[VT] = new VTSDNode(VT); - AllNodes.push_back(ValueTypeNodes[VT]); - } - return SDOperand(ValueTypeNodes[VT], 0); + SDNode *&N = MVT::isExtendedVT(VT) ? + ExtendedValueTypeNodes[VT] : ValueTypeNodes[VT]; + + if (N) return SDOperand(N, 0); + N = new VTSDNode(VT); + AllNodes.push_back(N); + return SDOperand(N, 0); } SDOperand SelectionDAG::getExternalSymbol(const char *Sym, MVT::ValueType VT) { From djg at cray.com Wed Oct 17 09:48:29 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 17 Oct 2007 14:48:29 -0000 Subject: [llvm-commits] [llvm] r43072 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/X86/split-select.ll Message-ID: <200710171448.l9HEmTBf031288@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 17 09:48:28 2007 New Revision: 43072 URL: http://llvm.org/viewvc/llvm-project?rev=43072&view=rev Log: Add support for ISD::SELECT in SplitVectorOp. Added: llvm/trunk/test/CodeGen/X86/split-select.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43072&r1=43071&r2=43072&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Oct 17 09:48:28 2007 @@ -6225,6 +6225,26 @@ } break; } + case ISD::SELECT: { + SDOperand Cond = Node->getOperand(0); + + SDOperand LL, LH, RL, RH; + SplitVectorOp(Node->getOperand(1), LL, LH); + SplitVectorOp(Node->getOperand(2), RL, RH); + + if (MVT::isVector(Cond.getValueType())) { + // Handle a vector merge. + SDOperand CL, CH; + SplitVectorOp(Cond, CL, CH); + Lo = DAG.getNode(Node->getOpcode(), NewVT, CL, LL, RL); + Hi = DAG.getNode(Node->getOpcode(), NewVT, CH, LH, RH); + } else { + // Handle a simple select with vector operands. + Lo = DAG.getNode(Node->getOpcode(), NewVT, Cond, LL, RL); + Hi = DAG.getNode(Node->getOpcode(), NewVT, Cond, LH, RH); + } + break; + } case ISD::ADD: case ISD::SUB: case ISD::MUL: Added: llvm/trunk/test/CodeGen/X86/split-select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/split-select.ll?rev=43072&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/split-select.ll (added) +++ llvm/trunk/test/CodeGen/X86/split-select.ll Wed Oct 17 09:48:28 2007 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep test | count 1 + +define void @foo(i1 %c, <2 x float> %a, <2 x float> %b, <2 x float>* %p) { + %x = select i1 %c, <2 x float> %a, <2 x float> %b + store <2 x float> %x, <2 x float>* %p + ret void +} From hartmut.kaiser at gmail.com Wed Oct 17 09:56:40 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Wed, 17 Oct 2007 14:56:40 -0000 Subject: [llvm-commits] [llvm] r43073 - in /llvm/trunk: include/llvm/ADT/APSInt.h include/llvm/ADT/BitVector.h include/llvm/Analysis/Dominators.h include/llvm/DerivedTypes.h include/llvm/InstrTypes.h include/llvm/Instructions.h include/llvm/Support/Registry.h include/llvm/Transforms/Utils/BasicInliner.h utils/TableGen/FileLexer.l win32/Analysis/Analysis.vcproj win32/ExecutionEngine/ExecutionEngine.vcproj win32/Transforms/Transforms.vcproj win32/config.h Message-ID: <200710171456.l9HEufHL031592@zion.cs.uiuc.edu> Author: hkaiser Date: Wed Oct 17 09:56:40 2007 New Revision: 43073 URL: http://llvm.org/viewvc/llvm-project?rev=43073&view=rev Log: Updated VC++ build system. Silenced some VC warnings. I'm getting linker errors, though: unresolved externals: llvm::Split >(class llvm::DominatorTreeBase &,class llvm::BasicBlock *) and llvm::Split,struct llvm::GraphTraits > >(class llvm::DominatorTreeBase &,class llvm::BasicBlock *) Where are these defined? Modified: llvm/trunk/include/llvm/ADT/APSInt.h llvm/trunk/include/llvm/ADT/BitVector.h llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/include/llvm/DerivedTypes.h llvm/trunk/include/llvm/InstrTypes.h llvm/trunk/include/llvm/Instructions.h llvm/trunk/include/llvm/Support/Registry.h llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h llvm/trunk/utils/TableGen/FileLexer.l llvm/trunk/win32/Analysis/Analysis.vcproj llvm/trunk/win32/ExecutionEngine/ExecutionEngine.vcproj llvm/trunk/win32/Transforms/Transforms.vcproj llvm/trunk/win32/config.h Modified: llvm/trunk/include/llvm/ADT/APSInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APSInt.h (original) +++ llvm/trunk/include/llvm/ADT/APSInt.h Wed Oct 17 09:56:40 2007 @@ -25,7 +25,7 @@ public: /// APSInt ctor - Create an APSInt with the specified width, default to /// unsigned. - explicit APSInt(unsigned BitWidth) : APInt(BitWidth, 0), IsUnsigned(true) {} + explicit APSInt(uint32_t BitWidth) : APInt(BitWidth, 0), IsUnsigned(true) {} APSInt(const APInt &I) : APInt(I), IsUnsigned(true) {} APSInt &operator=(const APSInt &RHS) { Modified: llvm/trunk/include/llvm/ADT/BitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/BitVector.h (original) +++ llvm/trunk/include/llvm/ADT/BitVector.h Wed Oct 17 09:56:40 2007 @@ -57,7 +57,7 @@ } operator bool() const { - return (*WordRef) & (1L << BitPos); + return ((*WordRef) & (1L << BitPos)) ? true : false; } }; Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Wed Oct 17 09:56:40 2007 @@ -64,7 +64,7 @@ //===----------------------------------------------------------------------===// // DomTreeNode - Dominator Tree Node template class DominatorTreeBase; -class PostDominatorTree; +struct PostDominatorTree; class MachineBasicBlock; template @@ -75,7 +75,7 @@ int DFSNumIn, DFSNumOut; template friend class DominatorTreeBase; - friend class PostDominatorTree; + friend struct PostDominatorTree; public: typedef typename std::vector *>::iterator iterator; typedef typename std::vector *>::const_iterator Modified: llvm/trunk/include/llvm/DerivedTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/DerivedTypes.h (original) +++ llvm/trunk/include/llvm/DerivedTypes.h Wed Oct 17 09:56:40 2007 @@ -263,7 +263,7 @@ return T->getTypeID() == StructTyID; } - bool isPacked() const { return getSubclassData(); } + bool isPacked() const { return (0 != getSubclassData()) ? true : false; } }; @@ -279,9 +279,12 @@ PATypeHandle ContainedType; ///< Storage for the single contained type SequentialType(const SequentialType &); // Do not implement! const SequentialType &operator=(const SequentialType &); // Do not implement! + + // avoiding warning: 'this' : used in base member initializer list + SequentialType* this_() { return this; } protected: SequentialType(TypeID TID, const Type *ElType) - : CompositeType(TID), ContainedType(ElType, this) { + : CompositeType(TID), ContainedType(ElType, this_()) { ContainedTys = &ContainedType; NumContainedTys = 1; } Modified: llvm/trunk/include/llvm/InstrTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/InstrTypes.h (original) +++ llvm/trunk/include/llvm/InstrTypes.h Wed Oct 17 09:56:40 2007 @@ -84,12 +84,15 @@ class UnaryInstruction : public Instruction { Use Op; + + // avoiding warning: 'this' : used in base member initializer list + UnaryInstruction* this_() { return this; } protected: UnaryInstruction(const Type *Ty, unsigned iType, Value *V, Instruction *IB =0) - : Instruction(Ty, iType, &Op, 1, IB), Op(V, this) { + : Instruction(Ty, iType, &Op, 1, IB), Op(V, this_()) { } UnaryInstruction(const Type *Ty, unsigned iType, Value *V, BasicBlock *IAE) - : Instruction(Ty, iType, &Op, 1, IAE), Op(V, this) { + : Instruction(Ty, iType, &Op, 1, IAE), Op(V, this_()) { } public: // Out of line virtual method, so the vtable, etc has a home. Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Wed Oct 17 09:56:40 2007 @@ -256,7 +256,7 @@ /// setVolatile - Specify whether this is a volatile load or not. /// void setVolatile(bool V) { - SubclassData = (SubclassData & ~1) | V; + SubclassData = (SubclassData & ~1) | (V ? 1 : 0); } virtual LoadInst *clone() const; @@ -324,7 +324,7 @@ /// setVolatile - Specify whether this is a volatile load or not. /// void setVolatile(bool V) { - SubclassData = (SubclassData & ~1) | V; + SubclassData = (SubclassData & ~1) | (V ? 1 : 0); } /// Transparently provide more efficient getOperand methods. Modified: llvm/trunk/include/llvm/Support/Registry.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Registry.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Registry.h (original) +++ llvm/trunk/include/llvm/Support/Registry.h Wed Oct 17 09:56:40 2007 @@ -67,7 +67,10 @@ private: Registry(); // Do not implement. - static void Announce(node *); + static void Announce(const entry &E) { + for (listener *Cur = ListenerHead; Cur; Cur = Cur->Next) + Cur->registered(E); + } friend class node; static node *Head, *Tail; @@ -229,13 +232,6 @@ } }; - - private: - static void Announce(const entry &E) { - for (listener *Cur = ListenerHead; Cur; Cur = Cur->Next) - Cur->registered(E); - } - }; } Modified: llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h (original) +++ llvm/trunk/include/llvm/Transforms/Utils/BasicInliner.h Wed Oct 17 09:56:40 2007 @@ -21,7 +21,7 @@ class Function; class TargetData; - class BasicInlinerImpl; + struct BasicInlinerImpl; /// BasicInliner - BasicInliner provides function level inlining interface. /// Clients provide list of functions which are inline without using Modified: llvm/trunk/utils/TableGen/FileLexer.l URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.l?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.l (original) +++ llvm/trunk/utils/TableGen/FileLexer.l Wed Oct 17 09:56:40 2007 @@ -24,7 +24,7 @@ %option noreject %option noyymore -%x comment +%x in_comment %{ #include "llvm/Config/config.h" @@ -226,13 +226,13 @@ [ \t\n\r]+ { /* Ignore whitespace */ } -"/*" { BEGIN(comment); CommentDepth++; } -[^*/]* {} /* eat anything that's not a '*' or '/' */ -"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ -"/*" { ++CommentDepth; } -"/"+[^*/]* {} /* eat up /'s not followed by *'s */ -"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } -<> { err() << "Unterminated comment!\n"; exit(1); } +"/*" { BEGIN(in_comment); CommentDepth++; } +[^*/]* {} /* eat anything that's not a '*' or '/' */ +"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ +"/*" { ++CommentDepth; } +"/"+[^*/]* {} /* eat up /'s not followed by *'s */ +"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } +<> { err() << "Unterminated comment!\n"; exit(1); } . { return Filetext[0]; } Modified: llvm/trunk/win32/Analysis/Analysis.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Analysis/Analysis.vcproj?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/win32/Analysis/Analysis.vcproj (original) +++ llvm/trunk/win32/Analysis/Analysis.vcproj Wed Oct 17 09:56:40 2007 @@ -41,7 +41,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include;.." - PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS" + PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS" StringPooling="true" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -111,7 +111,7 @@ + + Modified: llvm/trunk/win32/config.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/config.h?rev=43073&r1=43072&r2=43073&view=diff ============================================================================== --- llvm/trunk/win32/config.h (original) +++ llvm/trunk/win32/config.h Wed Oct 17 09:56:40 2007 @@ -1,8 +1,8 @@ /* This file is appended to config.h.in to form the Windows version of * config.h */ -#define PACKAGE_NAME "LLVM (win32 vc7.1)" -#define PACKAGE_VERSION 1.4 +#define PACKAGE_NAME "LLVM (win32 vc8.0)" +#define PACKAGE_VERSION 2.1 #define HAVE_WINDOWS_H 1 #define HAVE_LIMITS_H 1 #define HAVE_SYS_STAT_H 1 @@ -22,3 +22,6 @@ #define LLVM_ON_WIN32 1 #define strtoll strtol +#define stricmp _stricmp +#define strdup _strdup + From ghenriksen at carbonite.com Wed Oct 17 12:21:19 2007 From: ghenriksen at carbonite.com (Gordon Henriksen) Date: Wed, 17 Oct 2007 13:21:19 -0400 Subject: [llvm-commits] r43052 - in /cfe/trunk: Driver/ASTConsumers.h Driver/SerializationTest.cpp Driver/clang.cpp include/clang/Basic/IdentifierTable.h In-Reply-To: References: <200710162337.l9GNbSpi020800@zion.cs.uiuc.edu> Message-ID: On 2007-10-17, at 01:37, Chris Lattner wrote: > This is getting a bit crazy/unmaintainable. When convenient, can you > please investigate making the various clang modes dynamically > registratable using the "llvm/Support/Registry.h" mechanism? It > would be very nice for clang to just get new options when new .o > files are linked in (this also gives support for dynamically loadable > toys). Is there any interest in the below patch which converts TargetMachineRegistry to use the generic Registry.h facility, or should I drop it from my queue? On 2007-08-31, at 11:13, Gordon Henriksen wrote: > On 2007-08-31, at 01:32, Gordon Henriksen wrote: > >> This is a template that takes care of managing plugin registries. >> I haven't converted anything else to use it, though. > > -50 LOC for TargetMachineRegistry. > ? ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071017/5c98b1b8/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: targetmachineregistry.patch Type: application/octet-stream Size: 12284 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071017/5c98b1b8/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071017/5c98b1b8/attachment-0001.html From djg at cray.com Wed Oct 17 12:51:31 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 17 Oct 2007 17:51:31 -0000 Subject: [llvm-commits] [llvm] r43076 - in /llvm/trunk: include/llvm/Constants.h lib/VMCore/Constants.cpp Message-ID: <200710171751.l9HHpVQN008135@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 17 12:51:30 2007 New Revision: 43076 URL: http://llvm.org/viewvc/llvm-project?rev=43076&view=rev Log: Define a helper function ConstantVector::getSplatValue for testing for and working with broadcasted constants. Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=43076&r1=43075&r2=43076&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Wed Oct 17 12:51:30 2007 @@ -438,6 +438,10 @@ /// @brief Determine if the value is all ones. bool isAllOnesValue() const; + /// getSplatValue - If this is a splat constant, meaning that all of the + /// elements have the same value, return that value. Otherwise return NULL. + Constant *getSplatValue(); + virtual void destroyConstant(); virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=43076&r1=43075&r2=43076&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Wed Oct 17 12:51:30 2007 @@ -1286,6 +1286,17 @@ return true; } +/// getSplatValue - If this is a splat constant, where all of the +/// elements have the same value, return that value. Otherwise return null. +Constant *ConstantVector::getSplatValue() { + // Check out first element. + Constant *Elt = getOperand(0); + // Then make sure all remaining elements point to the same value. + for (unsigned I = 1, E = getNumOperands(); I < E; ++I) + if (getOperand(I) != Elt) return 0; + return Elt; +} + //---- ConstantPointerNull::get() implementation... // From djg at cray.com Wed Oct 17 13:05:13 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 17 Oct 2007 18:05:13 -0000 Subject: [llvm-commits] [llvm] r43078 - /llvm/trunk/docs/LangRef.html Message-ID: <200710171805.l9HI5D6j008717@zion.cs.uiuc.edu> Author: djg Date: Wed Oct 17 13:05:13 2007 New Revision: 43078 URL: http://llvm.org/viewvc/llvm-project?rev=43078&view=rev Log: Don't mention -enable-unsafe-fp-math in LangRef.html, as that option is assumed to globally mutate the spec. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=43078&r1=43077&r2=43078&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Wed Oct 17 13:05:13 2007 @@ -4606,9 +4606,7 @@

    This function returns the sine of the specified operand, returning the same values as the libm sin functions would, and handles error -conditions in the same way, unless the --enable-unsafe-fp-math is enabled -during code generation, in which case the result may have different -precision and if any errors occur the behavior is undefined.

    +conditions in the same way.

    @@ -4647,9 +4645,7 @@

    This function returns the cosine of the specified operand, returning the same values as the libm cos functions would, and handles error -conditions in the same way, unless the --enable-unsafe-fp-math is enabled -during code generation, in which case the result may have different -precision and if any errors occur the behavior is undefined.

    +conditions in the same way.

    @@ -4691,9 +4687,7 @@ This function returns the first value raised to the second power, returning the same values as the libm pow functions would, and handles error -conditions in the same way, unless the --enable-unsafe-fp-math is enabled -during code generation, in which case the result may have different -precision and if any errors occur the behavior is undefined.

    +conditions in the same way.

    From clattner at apple.com Wed Oct 17 13:11:54 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 11:11:54 -0700 Subject: [llvm-commits] r43052 - in /cfe/trunk: Driver/ASTConsumers.h Driver/SerializationTest.cpp Driver/clang.cpp include/clang/Basic/IdentifierTable.h In-Reply-To: References: <200710162337.l9GNbSpi020800@zion.cs.uiuc.edu> Message-ID: On Oct 17, 2007, at 10:21 AM, Gordon Henriksen wrote: > On 2007-10-17, at 01:37, Chris Lattner wrote: > >> This is getting a bit crazy/unmaintainable. When convenient, can you >> please investigate making the various clang modes dynamically >> registratable using the "llvm/Support/Registry.h" mechanism? It >> would be very nice for clang to just get new options when new .o >> files are linked in (this also gives support for dynamically loadable >> toys). > > Is there any interest in the below patch which converts > TargetMachineRegistry to use the generic Registry.h facility, or > should I drop it from my queue? Very nice, please apply. Does this change the llc --help output? -Chris > On 2007-08-31, at 11:13, Gordon Henriksen wrote: > >> On 2007-08-31, at 01:32, Gordon Henriksen wrote: >> >>> This is a template that takes care of managing plugin registries. >>> I haven't converted anything else to use it, though. >> >> -50 LOC for TargetMachineRegistry. >> > > > ? Gordon > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Oct 17 13:19:57 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 11:19:57 -0700 Subject: [llvm-commits] [llvm] r43071 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <200710171349.l9HDnxu9027400@zion.cs.uiuc.edu> References: <200710171349.l9HDnxu9027400@zion.cs.uiuc.edu> Message-ID: <5D258C75-0398-4AA6-BD73-21C4BB2F95CD@apple.com> On Oct 17, 2007, at 6:49 AM, Duncan Sands wrote: > Author: baldrick > Date: Wed Oct 17 08:49:58 2007 > New Revision: 43071 > > URL: http://llvm.org/viewvc/llvm-project?rev=43071&view=rev > Log: > Return Expand from getOperationAction for all extended > types. This is needed for SIGN_EXTEND_INREG at least. > It is not clear if this is correct for other operations. > On the other hand, for the various load/store actions > it seems to correct to return the type action, as is > currently done. I'm not sure about this change. It seems to make more sense for an i17 add to return promote, not expand, no? OTOH, <128 x float> add should return expand. More generally, I don't think we want to *ever* call getOperationAction on invalid types, but I know of at least one case where we do, and am not sure how to change it (x86 supports fp to i64 even though i64 isn't legal). > Also, it seems that SelectionDAG::getValueType can be > called for extended value types; introduce a map for > holding these, since we don't really want to extend > the vector to be 2^32 pointers long! yay :) > Generalize DAGTypeLegalizer::PromoteResult_TRUNCATE > and DAGTypeLegalizer::PromoteResult_INT_EXTEND to handle > the various funky possibilities that apints introduce, > for example that you can promote to a type that needs > to be expanded. Ok. Thanks Duncan, -Chris From hartmut.kaiser at gmail.com Wed Oct 17 13:37:09 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Wed, 17 Oct 2007 18:37:09 -0000 Subject: [llvm-commits] [llvm] r43081 - in /llvm/trunk/lib/Transforms/Utils: CodeExtractor.cpp LoopSimplify.cpp Message-ID: <200710171837.l9HIb9uV010279@zion.cs.uiuc.edu> Author: hkaiser Date: Wed Oct 17 13:37:09 2007 New Revision: 43081 URL: http://llvm.org/viewvc/llvm-project?rev=43081&view=rev Log: Fixed linker errors (unresolved externals: split<>(...)) when compiling with VC++. Please review. Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=43081&r1=43080&r2=43081&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Wed Oct 17 13:37:09 2007 @@ -21,6 +21,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Analysis/Dominators.h" +#include "llvm/Analysis/DominatorInternals.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=43081&r1=43080&r2=43081&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Wed Oct 17 13:37:09 2007 @@ -40,6 +40,7 @@ #include "llvm/Type.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Dominators.h" +#include "llvm/Analysis/DominatorInternals.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" From baldrick at free.fr Wed Oct 17 14:00:47 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 17 Oct 2007 21:00:47 +0200 Subject: [llvm-commits] [llvm] r43071 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <5D258C75-0398-4AA6-BD73-21C4BB2F95CD@apple.com> References: <200710171349.l9HDnxu9027400@zion.cs.uiuc.edu> <5D258C75-0398-4AA6-BD73-21C4BB2F95CD@apple.com> Message-ID: <200710172100.49334.baldrick@free.fr> Hi Chris, > > Return Expand from getOperationAction for all extended > > types. This is needed for SIGN_EXTEND_INREG at least. > > It is not clear if this is correct for other operations. > > On the other hand, for the various load/store actions > > it seems to correct to return the type action, as is > > currently done. > > I'm not sure about this change. It seems to make more sense for an > i17 add to return promote, not expand, no? OTOH, <128 x float> add > should return expand. at this point all return values and operands have been legalized by LegalizeDAGTypes. SIGN_EXTEND_INREG also holds the value type to extend, and this value type may not be legal, in fact most likely it is hardly ever legal. The code calls getOperationAction to see what to do. If this returns Expand then it turns the node into a series of shifting, masking operations (and this is what you want for funny sized integers). As such, here Expand means: expand into a sequence of code, and has nothing to do with whether this type is getting bigger or smaller. As for i17 add, this is quite different, and will have been dealt with by LegalizeDAGTypes. That said, returning Expand is most likely wrong for other cases. But it will do for the moment and doesn't make things worse. > More generally, I don't think we want to *ever* call > getOperationAction on invalid types, but I know of at least one case > where we do, and am not sure how to change it (x86 supports fp to i64 > even though i64 isn't legal). In a case like SIGN_EXTEND_INREG it is normal that the type may be invalid. The only two actions are: do nothing or expand into shifts. Now it may be that you should do nothing if and only if the type is legal. In that case there is no need to call getOperationAction at all. For other operations I can imagine that the legal and illegal type cases should be treated separately (though perhaps sharing code), with only the legal case calling getOperationAction. However there are also calls to getOperationAction for illegal types in order to see whether the action is Custom (there are such calls in LegalizeDAGTypes). Can there be custom actions for illegal types? Ciao, Duncan. From dpatel at apple.com Wed Oct 17 15:12:58 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 17 Oct 2007 20:12:58 -0000 Subject: [llvm-commits] [llvm] r43083 - in /llvm/trunk: lib/Transforms/IPO/RaiseAllocations.cpp test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll Message-ID: <200710172012.l9HKCwoJ015392@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 17 15:12:58 2007 New Revision: 43083 URL: http://llvm.org/viewvc/llvm-project?rev=43083&view=rev Log: Do not raise free() call that is called through invoke instruction. Added: llvm/trunk/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp?rev=43083&r1=43082&r2=43083&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Wed Oct 17 15:12:58 2007 @@ -204,6 +204,8 @@ Users.pop_back(); if (Instruction *I = dyn_cast(U)) { + if (isa(I)) + continue; CallSite CS = CallSite::get(I); if (CS.getInstruction() && !CS.arg_empty() && (CS.getCalledFunction() == FreeFunc || Added: llvm/trunk/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll?rev=43083&view=auto ============================================================================== --- llvm/trunk/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll (added) +++ llvm/trunk/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll Wed Oct 17 15:12:58 2007 @@ -0,0 +1,17 @@ +; RUN: llvm-as <%s | opt -raiseallocs -stats -disable-output |& \ +; RUN: not grep {Number of allocations raised} +define void @foo() { +entry: + %buffer = alloca i16* + %tmp = load i16** %buffer, align 8 + invoke i32(...)* @free(i16* %tmp) + to label %invcont unwind label %unwind +invcont: + br label %finally +unwind: + br label %finally +finally: + ret void +} +declare i32 @free(...) + From clattner at apple.com Wed Oct 17 15:30:58 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 13:30:58 -0700 Subject: [llvm-commits] [llvm] r43081 - in /llvm/trunk/lib/Transforms/Utils: CodeExtractor.cpp LoopSimplify.cpp In-Reply-To: <200710171837.l9HIb9uV010279@zion.cs.uiuc.edu> References: <200710171837.l9HIb9uV010279@zion.cs.uiuc.edu> Message-ID: <4D41E494-0BB2-46C0-A91A-C764085D0574@apple.com> On Oct 17, 2007, at 11:37 AM, Hartmut Kaiser wrote: > Author: hkaiser > Date: Wed Oct 17 13:37:09 2007 > New Revision: 43081 > > URL: http://llvm.org/viewvc/llvm-project?rev=43081&view=rev > Log: > Fixed linker errors (unresolved externals: split<>(...)) when > compiling with VC++. Please review. Owen, please see if you can find a better fix for this, ideally noone outside of the pass implementations should need DominatorInternals.h Thanks! -Chris > Modified: > llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp > llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Utils/CodeExtractor.cpp?rev=43081&r1=43080&r2=43081&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Wed Oct 17 > 13:37:09 2007 > @@ -21,6 +21,7 @@ > #include "llvm/Module.h" > #include "llvm/Pass.h" > #include "llvm/Analysis/Dominators.h" > +#include "llvm/Analysis/DominatorInternals.h" > #include "llvm/Analysis/LoopInfo.h" > #include "llvm/Analysis/Verifier.h" > #include "llvm/Transforms/Utils/BasicBlockUtils.h" > > Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Utils/LoopSimplify.cpp?rev=43081&r1=43080&r2=43081&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Wed Oct 17 > 13:37:09 2007 > @@ -40,6 +40,7 @@ > #include "llvm/Type.h" > #include "llvm/Analysis/AliasAnalysis.h" > #include "llvm/Analysis/Dominators.h" > +#include "llvm/Analysis/DominatorInternals.h" > #include "llvm/Analysis/LoopInfo.h" > #include "llvm/Support/CFG.h" > #include "llvm/Support/Compiler.h" > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kremenek at apple.com Wed Oct 17 15:56:48 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 20:56:48 -0000 Subject: [llvm-commits] [llvm] r43086 - /llvm/trunk/include/llvm/Support/AlignOf.h Message-ID: <200710172056.l9HKum98017341@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 15:56:47 2007 New Revision: 43086 URL: http://llvm.org/viewvc/llvm-project?rev=43086&view=rev Log: Added llvm::AlignOf, a template class whose purpose is to portably compute the minimum memory alignment of arbitrary types. Added: llvm/trunk/include/llvm/Support/AlignOf.h Added: llvm/trunk/include/llvm/Support/AlignOf.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h?rev=43086&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/AlignOf.h (added) +++ llvm/trunk/include/llvm/Support/AlignOf.h Wed Oct 17 15:56:47 2007 @@ -0,0 +1,43 @@ +//===--- AlignOf.h - Portable calculation of type alignment -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Ted Kremenek and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the AlignOf function that computes alignments for +// arbitrary types. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_ALIGNOF_H +#define LLVM_SUPPORT_ALIGNOF_H + +#include + +namespace llvm { + +template +struct AlignmentCalcImpl { + char x; + T t; +private: + AlignmentCalcImpl() {} // Never instantiate. +}; + +/// AlignOf - A templated class that contains an enum value representing +/// the alignment of the template argument. For example, +/// AlignOf::Alignment represents the alignment of type "int". The +/// alignment calculated is the minimum alignment, and not necessarily +/// the "desired" alignment returned by GCC's __alignof__ (for example). Note +/// that because the alignment is an enum value, it can be used as a +/// compile-time constant (e.g., for template instantiation). +template +struct AlignOf { + enum { Alignment = sizeof(AlignmentCalcImpl) - sizeof(T) }; +}; + +} // end namespace llvm +#endif From kremenek at apple.com Wed Oct 17 16:10:21 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 21:10:21 -0000 Subject: [llvm-commits] [llvm] r43087 - /llvm/trunk/include/llvm/Support/Allocator.h Message-ID: <200710172110.l9HLALvr017979@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 16:10:21 2007 New Revision: 43087 URL: http://llvm.org/viewvc/llvm-project?rev=43087&view=rev Log: Added member template functions to MallocAllocator and BumpPtrAllocator that implement allocations that return a properly typed pointer. For BumpPtrAllocator, the allocated memory is automatically aligned to the minimum alignment of the type (as calculated by llvm::AlignOf::Alignment). Modified: llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=43087&r1=43086&r2=43087&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Wed Oct 17 16:10:21 2007 @@ -14,6 +14,7 @@ #ifndef LLVM_SUPPORT_ALLOCATOR_H #define LLVM_SUPPORT_ALLOCATOR_H +#include "llvm/Support/AlignOf.h" #include namespace llvm { @@ -25,6 +26,10 @@ void Reset() {} void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); } + + template + T* Allocate() { return reinterpret_cast(malloc(sizeof(T))); } + void Deallocate(void *Ptr) { free(Ptr); } void PrintStats() const {} }; @@ -41,6 +46,13 @@ void Reset(); void *Allocate(unsigned Size, unsigned Alignment); + + template + T* Allocate() { + return reinterpret_cast(Allocate(sizeof(T),AlignOf::Alignment)); + } + + void Deallocate(void *Ptr) {} void PrintStats() const; }; From gordonhenriksen at mac.com Wed Oct 17 16:11:34 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Wed, 17 Oct 2007 21:11:34 -0000 Subject: [llvm-commits] [llvm] r43088 - /llvm/trunk/test/Transforms/LoopIndexSplit/ Message-ID: <200710172111.l9HLBY4Z018035@zion.cs.uiuc.edu> Author: gordon Date: Wed Oct 17 16:11:33 2007 New Revision: 43088 URL: http://llvm.org/viewvc/llvm-project?rev=43088&view=rev Log: Ignoring test/Transforms/LoopIndexSplit/Output. Modified: llvm/trunk/test/Transforms/LoopIndexSplit/ (props changed) Propchange: llvm/trunk/test/Transforms/LoopIndexSplit/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Oct 17 16:11:33 2007 @@ -0,0 +1 @@ +Output From kremenek at apple.com Wed Oct 17 16:13:50 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 21:13:50 -0000 Subject: [llvm-commits] [llvm] r43089 - /llvm/trunk/include/llvm/ADT/StringMap.h Message-ID: <200710172113.l9HLDoE1018158@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 16:13:50 2007 New Revision: 43089 URL: http://llvm.org/viewvc/llvm-project?rev=43089&view=rev Log: Updated StringMap to use llvm::AlignOf to compute the alignment of map entries. Modified: llvm/trunk/include/llvm/ADT/StringMap.h Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=43089&r1=43088&r2=43089&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Wed Oct 17 16:13:50 2007 @@ -141,15 +141,9 @@ // in. Allocate a new item with space for the string at the end and a null // terminator. unsigned AllocSize = sizeof(StringMapEntry)+KeyLength+1; - -#ifdef __GNUC__ - unsigned Alignment = __alignof__(StringMapEntry); -#else - // FIXME: ugly. - unsigned Alignment = 8; -#endif - StringMapEntry *NewItem = - static_cast(Allocator.Allocate(AllocSize, Alignment)); + + StringMapEntry *NewItem = static_cast( + Allocator.Allocate(AllocSize, AlignOf::Alignment)); // Default construct the value. new (NewItem) StringMapEntry(KeyLength); From gordonhenriksen at mac.com Wed Oct 17 16:28:48 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Wed, 17 Oct 2007 21:28:48 -0000 Subject: [llvm-commits] [llvm] r43094 - in /llvm/trunk: include/llvm/Target/TargetMachineRegistry.h lib/ExecutionEngine/JIT/TargetSelect.cpp lib/Target/CBackend/CBackend.cpp lib/Target/TargetMachineRegistry.cpp tools/llc/llc.cpp tools/lto/lto.cpp utils/TableGen/FileLexer.cpp.cvs utils/TableGen/FileLexer.l.cvs Message-ID: <200710172128.l9HLSmla018810@zion.cs.uiuc.edu> Author: gordon Date: Wed Oct 17 16:28:48 2007 New Revision: 43094 URL: http://llvm.org/viewvc/llvm-project?rev=43094&view=rev Log: Switching TargetMachineRegistry to use the new generic Registry. Modified: llvm/trunk/include/llvm/Target/TargetMachineRegistry.h llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Target/TargetMachineRegistry.cpp llvm/trunk/tools/llc/llc.cpp llvm/trunk/tools/lto/lto.cpp llvm/trunk/utils/TableGen/FileLexer.cpp.cvs llvm/trunk/utils/TableGen/FileLexer.l.cvs Modified: llvm/trunk/include/llvm/Target/TargetMachineRegistry.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachineRegistry.h?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetMachineRegistry.h (original) +++ llvm/trunk/include/llvm/Target/TargetMachineRegistry.h Wed Oct 17 16:28:48 2007 @@ -17,52 +17,49 @@ #ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H #define LLVM_TARGET_TARGETMACHINEREGISTRY_H -#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Registry.h" namespace llvm { class Module; class TargetMachine; + + struct TargetMachineRegistryEntry { + const char *Name; + const char *ShortDesc; + TargetMachine *(*CtorFn)(const Module &, const std::string &); + unsigned (*ModuleMatchQualityFn)(const Module &M); + unsigned (*JITMatchQualityFn)(); + + public: + TargetMachineRegistryEntry(const char *N, const char *SD, + TargetMachine *(*CF)(const Module &, const std::string &), + unsigned (*MMF)(const Module &M), + unsigned (*JMF)()) + : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF), + JITMatchQualityFn(JMF) {} + }; + + template<> + class RegistryTraits { + public: + typedef TargetMachineRegistryEntry entry; + + static const char *nameof(const entry &Entry) { return Entry.Name; } + static const char *descof(const entry &Entry) { return Entry.ShortDesc; } + }; - struct TargetMachineRegistry { - struct Entry; - - /// TargetMachineRegistry::getList - This static method returns the list of - /// target machines that are registered with the system. - static const Entry *getList() { return List; } - + struct TargetMachineRegistry : Registry { /// getClosestStaticTargetForModule - Given an LLVM module, pick the best /// target that is compatible with the module. If no close target can be /// found, this returns null and sets the Error string to a reason. - static const Entry *getClosestStaticTargetForModule(const Module &M, + static const entry *getClosestStaticTargetForModule(const Module &M, std::string &Error); /// getClosestTargetForJIT - Pick the best target that is compatible with /// the current host. If no close target can be found, this returns null /// and sets the Error string to a reason. - static const Entry *getClosestTargetForJIT(std::string &Error); - - - /// Entry - One instance of this struct is created for each target that is - /// registered. - struct Entry { - const char *Name; - const char *ShortDesc; - TargetMachine *(*CtorFn)(const Module &, const std::string &); - unsigned (*ModuleMatchQualityFn)(const Module &M); - unsigned (*JITMatchQualityFn)(); - - const Entry *getNext() const { return Next; } - - protected: - Entry(const char *N, const char *SD, - TargetMachine *(*CF)(const Module &, const std::string &), - unsigned (*MMF)(const Module &M), unsigned (*JMF)()); - private: - const Entry *Next; // Next entry in the linked list. - }; + static const entry *getClosestTargetForJIT(std::string &Error); - private: - static const Entry *List; }; //===--------------------------------------------------------------------===// @@ -77,51 +74,23 @@ /// flavour. template - struct RegisterTarget : public TargetMachineRegistry::Entry { - RegisterTarget(const char *Name, const char *ShortDesc) : - TargetMachineRegistry::Entry(Name, ShortDesc, &Allocator, - &TargetMachineImpl::getModuleMatchQuality, - &TargetMachineImpl::getJITMatchQuality) { - } + struct RegisterTarget { + RegisterTarget(const char *Name, const char *ShortDesc) + : Entry(Name, ShortDesc, &Allocator, + &TargetMachineImpl::getModuleMatchQuality, + &TargetMachineImpl::getJITMatchQuality), + Node(Entry) + {} + private: + TargetMachineRegistry::entry Entry; + TargetMachineRegistry::node Node; + static TargetMachine *Allocator(const Module &M, const std::string &FS) { return new TargetMachineImpl(M, FS); } }; - /// TargetRegistrationListener - This class allows code to listen for targets - /// that are dynamically registered, and be notified of it when they are. - class TargetRegistrationListener { - TargetRegistrationListener **Prev, *Next; - public: - TargetRegistrationListener(); - virtual ~TargetRegistrationListener(); - - TargetRegistrationListener *getNext() const { return Next; } - - virtual void targetRegistered(const TargetMachineRegistry::Entry *E) = 0; - }; - - - //===--------------------------------------------------------------------===// - /// TargetNameParser - This option can be used to provide a command line - /// option to choose among the various registered targets (commonly -march). - class TargetNameParser : public TargetRegistrationListener, - public cl::parser { - public: - void initialize(cl::Option &O) { - for (const TargetMachineRegistry::Entry *E = - TargetMachineRegistry::getList(); E; E = E->getNext()) - Values.push_back(std::make_pair(E->Name, - std::make_pair(E, E->ShortDesc))); - cl::parser::initialize(O); - } - - virtual void targetRegistered(const TargetMachineRegistry::Entry *E) { - Values.push_back(std::make_pair(E->Name, - std::make_pair(E, E->ShortDesc))); - } - }; } #endif Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Wed Oct 17 16:28:48 2007 @@ -20,7 +20,8 @@ #include "llvm/Target/TargetMachineRegistry.h" using namespace llvm; -static cl::opt +static cl::opt MArch("march", cl::desc("Architecture to generate assembly for:")); static cl::opt @@ -39,7 +40,7 @@ /// for the current target. Otherwise, return null. /// ExecutionEngine *JIT::create(ModuleProvider *MP, std::string *ErrorStr) { - const TargetMachineRegistry::Entry *TheArch = MArch; + const TargetMachineRegistry::entry *TheArch = MArch; if (TheArch == 0) { std::string Error; TheArch = TargetMachineRegistry::getClosestTargetForJIT(Error); Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Oct 17 16:28:48 2007 @@ -2684,7 +2684,7 @@ //Grab the translation table from TargetAsmInfo if it exists if (!TAsm) { std::string E; - const TargetMachineRegistry::Entry* Match = + const TargetMachineRegistry::entry* Match = TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E); if (Match) { //Per platform Target Machines don't exist, so create it Modified: llvm/trunk/lib/Target/TargetMachineRegistry.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachineRegistry.cpp?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachineRegistry.cpp (original) +++ llvm/trunk/lib/Target/TargetMachineRegistry.cpp Wed Oct 17 16:28:48 2007 @@ -18,44 +18,23 @@ #include using namespace llvm; -/// List - This is the main list of all of the registered target machines. -const TargetMachineRegistry::Entry *TargetMachineRegistry::List = 0; - -/// Listeners - All of the listeners registered to get notified when new targets -/// are loaded. -static TargetRegistrationListener *Listeners = 0; - -TargetMachineRegistry::Entry::Entry(const char *N, const char *SD, - TargetMachine *(*CF)(const Module &,const std::string &), - unsigned (*MMF)(const Module &M), unsigned (*JMF)()) - : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF), - JITMatchQualityFn(JMF), Next(List) { - List = this; - for (TargetRegistrationListener *L = Listeners; L; L = L->getNext()) - L->targetRegistered(this); -} - -TargetRegistrationListener::TargetRegistrationListener() { - Next = Listeners; - if (Next) Next->Prev = &Next; - Prev = &Listeners; - Listeners = this; -} - -TargetRegistrationListener::~TargetRegistrationListener() { - *Prev = Next; -} +template<> Registry::node *Registry::Head = 0; +template<> Registry::node *Registry::Tail = 0; +template<> Registry::listener *Registry:: +ListenerHead = 0; +template<> Registry::listener *Registry:: +ListenerTail = 0; /// getClosestStaticTargetForModule - Given an LLVM module, pick the best target /// that is compatible with the module. If no close target can be found, this /// returns null and sets the Error string to a reason. -const TargetMachineRegistry::Entry * +const TargetMachineRegistry::entry * TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M, std::string &Error) { - std::vector > UsableTargets; - for (const Entry *E = getList(); E; E = E->getNext()) - if (unsigned Qual = E->ModuleMatchQualityFn(M)) - UsableTargets.push_back(std::make_pair(Qual, E)); + std::vector > UsableTargets; + for (iterator I = begin(), E = end(); I != E; ++I) + if (unsigned Qual = I->ModuleMatchQualityFn(M)) + UsableTargets.push_back(std::make_pair(Qual, &*I)); if (UsableTargets.empty()) { Error = "No available targets are compatible with this module"; @@ -78,12 +57,12 @@ /// getClosestTargetForJIT - Pick the best target that is compatible with /// the current host. If no close target can be found, this returns null /// and sets the Error string to a reason. -const TargetMachineRegistry::Entry * +const TargetMachineRegistry::entry * TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) { - std::vector > UsableTargets; - for (const Entry *E = getList(); E; E = E->getNext()) - if (unsigned Qual = E->JITMatchQualityFn()) - UsableTargets.push_back(std::make_pair(Qual, E)); + std::vector > UsableTargets; + for (iterator I = begin(), E = end(); I != E; ++I) + if (unsigned Qual = I->JITMatchQualityFn()) + UsableTargets.push_back(std::make_pair(Qual, &*I)); if (UsableTargets.empty()) { Error = "No JIT is available for this host"; @@ -93,7 +72,7 @@ // Otherwise, take the best target. If there is a tie, just pick one. unsigned MaxQual = UsableTargets.front().first; - const Entry *MaxQualTarget = UsableTargets.front().second; + const entry *MaxQualTarget = UsableTargets.front().second; for (unsigned i = 1, e = UsableTargets.size(); i != e; ++i) if (UsableTargets[i].first > MaxQual) { Modified: llvm/trunk/tools/llc/llc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/tools/llc/llc.cpp (original) +++ llvm/trunk/tools/llc/llc.cpp Wed Oct 17 16:28:48 2007 @@ -57,7 +57,8 @@ static cl::opt TargetTriple("mtriple", cl::desc("Override target triple for module")); -static cl::opt +static cl::opt MArch("march", cl::desc("Architecture to generate code for:")); static cl::opt Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Wed Oct 17 16:28:48 2007 @@ -217,7 +217,7 @@ return; std::string Err; - const TargetMachineRegistry::Entry* March = + const TargetMachineRegistry::entry* March = TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err); if (March == 0) Modified: llvm/trunk/utils/TableGen/FileLexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.cpp.cvs?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.cpp.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.cpp.cvs Wed Oct 17 16:28:48 2007 @@ -502,7 +502,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 1 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" #define INITIAL 0 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// // @@ -518,9 +518,9 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#define comment 1 +#define in_comment 1 -#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 30 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" #include "llvm/Config/config.h" #include "llvm/Support/Streams.h" #include "Record.h" @@ -817,7 +817,7 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 185 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" #line 824 "Lexer.cpp" @@ -913,185 +913,185 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 187 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { /* Ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP -#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 189 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { HandleInclude(yytext); } YY_BREAK case 3: YY_RULE_SETUP -#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 190 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); return CODEFRAGMENT; } YY_BREAK case 4: YY_RULE_SETUP -#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 193 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return INT; } YY_BREAK case 5: YY_RULE_SETUP -#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 194 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return BIT; } YY_BREAK case 6: YY_RULE_SETUP -#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 195 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return BITS; } YY_BREAK case 7: YY_RULE_SETUP -#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 196 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 197 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return LIST; } YY_BREAK case 9: YY_RULE_SETUP -#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 198 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 199 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return DAG; } YY_BREAK case 11: YY_RULE_SETUP -#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 201 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return CLASS; } YY_BREAK case 12: YY_RULE_SETUP -#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 202 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return DEF; } YY_BREAK case 13: YY_RULE_SETUP -#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 203 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return DEFM; } YY_BREAK case 14: YY_RULE_SETUP -#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 204 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP -#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 205 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 206 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 207 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return IN; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 209 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return CONCATTOK; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 210 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return SRATOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 211 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return SRLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 212 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return SHLTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 213 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return STRCONCATTOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 216 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext, yytext+yyleng); return ID; } YY_BREAK case 24: YY_RULE_SETUP -#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 218 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); return VARNAME; } YY_BREAK case 25: YY_RULE_SETUP -#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 221 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); return STRVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 224 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 27: YY_RULE_SETUP -#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 226 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { /* Ignore whitespace */ } YY_BREAK case 28: YY_RULE_SETUP -#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" -{ BEGIN(comment); CommentDepth++; } +#line 229 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +{ BEGIN(in_comment); CommentDepth++; } YY_BREAK case 29: YY_RULE_SETUP -#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 230 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" {} /* eat anything that's not a '*' or '/' */ YY_BREAK case 30: YY_RULE_SETUP -#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 231 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" {} /* eat up '*'s not followed by '/'s */ YY_BREAK case 31: YY_RULE_SETUP -#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 232 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { ++CommentDepth; } YY_BREAK case 32: YY_RULE_SETUP -#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" {} /* eat up /'s not followed by *'s */ YY_BREAK case 33: YY_RULE_SETUP -#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 234 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK -case YY_STATE_EOF(comment): -#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +case YY_STATE_EOF(in_comment): +#line 235 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK case 34: YY_RULE_SETUP -#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 237 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK case 35: YY_RULE_SETUP -#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 1098 "Lexer.cpp" @@ -1978,6 +1978,6 @@ return 0; } #endif -#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" Modified: llvm/trunk/utils/TableGen/FileLexer.l.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.l.cvs?rev=43094&r1=43093&r2=43094&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.l.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.l.cvs Wed Oct 17 16:28:48 2007 @@ -24,7 +24,7 @@ %option noreject %option noyymore -%x comment +%x in_comment %{ #include "llvm/Config/config.h" @@ -226,13 +226,13 @@ [ \t\n\r]+ { /* Ignore whitespace */ } -"/*" { BEGIN(comment); CommentDepth++; } -[^*/]* {} /* eat anything that's not a '*' or '/' */ -"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ -"/*" { ++CommentDepth; } -"/"+[^*/]* {} /* eat up /'s not followed by *'s */ -"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } -<> { err() << "Unterminated comment!\n"; exit(1); } +"/*" { BEGIN(in_comment); CommentDepth++; } +[^*/]* {} /* eat anything that's not a '*' or '/' */ +"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ +"/*" { ++CommentDepth; } +"/"+[^*/]* {} /* eat up /'s not followed by *'s */ +"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } +<> { err() << "Unterminated comment!\n"; exit(1); } . { return Filetext[0]; } From ghenriksen at carbonite.com Wed Oct 17 16:30:26 2007 From: ghenriksen at carbonite.com (Gordon Henriksen) Date: Wed, 17 Oct 2007 17:30:26 -0400 Subject: [llvm-commits] r43052 - in /cfe/trunk: Driver/ASTConsumers.h Driver/SerializationTest.cpp Driver/clang.cpp include/clang/Basic/IdentifierTable.h In-Reply-To: References: <200710162337.l9GNbSpi020800@zion.cs.uiuc.edu> Message-ID: On 2007-10-17, at 14:11, Chris Lattner wrote: > On Oct 17, 2007, at 10:21 AM, Gordon Henriksen wrote: > >> Is there any interest in the below patch which converts >> TargetMachineRegistry to use the generic Registry.h facility, or >> should I drop it from my queue? > > Very nice, please apply. Done. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20071015/054612.html > Does this change the llc --help output? Not in the slightest. Though it probably wouldn't hurt to sort it. ? Gordon From gordonhenriksen at mac.com Wed Oct 17 16:36:08 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Wed, 17 Oct 2007 21:36:08 -0000 Subject: [llvm-commits] [llvm] r43095 - in /llvm/trunk/utils/TableGen: FileLexer.cpp.cvs FileLexer.l.cvs Message-ID: <200710172136.l9HLa9FY019166@zion.cs.uiuc.edu> Author: gordon Date: Wed Oct 17 16:36:08 2007 New Revision: 43095 URL: http://llvm.org/viewvc/llvm-project?rev=43095&view=rev Log: Reverting unnecessary commit of generated files. Modified: llvm/trunk/utils/TableGen/FileLexer.cpp.cvs llvm/trunk/utils/TableGen/FileLexer.l.cvs Modified: llvm/trunk/utils/TableGen/FileLexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.cpp.cvs?rev=43095&r1=43094&r2=43095&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.cpp.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.cpp.cvs Wed Oct 17 16:36:08 2007 @@ -502,7 +502,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #define INITIAL 0 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// // @@ -518,9 +518,9 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#define in_comment 1 +#define comment 1 -#line 30 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #include "llvm/Config/config.h" #include "llvm/Support/Streams.h" #include "Record.h" @@ -817,7 +817,7 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 185 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #line 824 "Lexer.cpp" @@ -913,185 +913,185 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 187 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { /* Ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP -#line 189 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { HandleInclude(yytext); } YY_BREAK case 3: YY_RULE_SETUP -#line 190 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); return CODEFRAGMENT; } YY_BREAK case 4: YY_RULE_SETUP -#line 193 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return INT; } YY_BREAK case 5: YY_RULE_SETUP -#line 194 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return BIT; } YY_BREAK case 6: YY_RULE_SETUP -#line 195 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return BITS; } YY_BREAK case 7: YY_RULE_SETUP -#line 196 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 197 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return LIST; } YY_BREAK case 9: YY_RULE_SETUP -#line 198 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 199 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DAG; } YY_BREAK case 11: YY_RULE_SETUP -#line 201 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CLASS; } YY_BREAK case 12: YY_RULE_SETUP -#line 202 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DEF; } YY_BREAK case 13: YY_RULE_SETUP -#line 203 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DEFM; } YY_BREAK case 14: YY_RULE_SETUP -#line 204 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP -#line 205 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 206 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 207 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return IN; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CONCATTOK; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SRATOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SRLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SHLTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return STRCONCATTOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 216 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext, yytext+yyleng); return ID; } YY_BREAK case 24: YY_RULE_SETUP -#line 218 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); return VARNAME; } YY_BREAK case 25: YY_RULE_SETUP -#line 221 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); return STRVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 224 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 27: YY_RULE_SETUP -#line 226 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { /* Ignore whitespace */ } YY_BREAK case 28: YY_RULE_SETUP -#line 229 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" -{ BEGIN(in_comment); CommentDepth++; } +#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" +{ BEGIN(comment); CommentDepth++; } YY_BREAK case 29: YY_RULE_SETUP -#line 230 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat anything that's not a '*' or '/' */ YY_BREAK case 30: YY_RULE_SETUP -#line 231 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat up '*'s not followed by '/'s */ YY_BREAK case 31: YY_RULE_SETUP -#line 232 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { ++CommentDepth; } YY_BREAK case 32: YY_RULE_SETUP -#line 233 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat up /'s not followed by *'s */ YY_BREAK case 33: YY_RULE_SETUP -#line 234 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK -case YY_STATE_EOF(in_comment): -#line 235 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +case YY_STATE_EOF(comment): +#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK case 34: YY_RULE_SETUP -#line 237 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK case 35: YY_RULE_SETUP -#line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 1098 "Lexer.cpp" @@ -1978,6 +1978,6 @@ return 0; } #endif -#line 239 "/Users/malichus/Source/llvm/src/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" Modified: llvm/trunk/utils/TableGen/FileLexer.l.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.l.cvs?rev=43095&r1=43094&r2=43095&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.l.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.l.cvs Wed Oct 17 16:36:08 2007 @@ -24,7 +24,7 @@ %option noreject %option noyymore -%x in_comment +%x comment %{ #include "llvm/Config/config.h" @@ -226,13 +226,13 @@ [ \t\n\r]+ { /* Ignore whitespace */ } -"/*" { BEGIN(in_comment); CommentDepth++; } -[^*/]* {} /* eat anything that's not a '*' or '/' */ -"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ -"/*" { ++CommentDepth; } -"/"+[^*/]* {} /* eat up /'s not followed by *'s */ -"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } -<> { err() << "Unterminated comment!\n"; exit(1); } +"/*" { BEGIN(comment); CommentDepth++; } +[^*/]* {} /* eat anything that's not a '*' or '/' */ +"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ +"/*" { ++CommentDepth; } +"/"+[^*/]* {} /* eat up /'s not followed by *'s */ +"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } +<> { err() << "Unterminated comment!\n"; exit(1); } . { return Filetext[0]; } From kremenek at apple.com Wed Oct 17 17:08:56 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 22:08:56 -0000 Subject: [llvm-commits] [llvm] r43096 - /llvm/trunk/include/llvm/Support/AlignOf.h Message-ID: <200710172208.l9HM8u3V020518@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 17:08:55 2007 New Revision: 43096 URL: http://llvm.org/viewvc/llvm-project?rev=43096&view=rev Log: Added template function alignof() which provides a clean function-based interface to getting the alignment of a type. Modified: llvm/trunk/include/llvm/Support/AlignOf.h Modified: llvm/trunk/include/llvm/Support/AlignOf.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h?rev=43096&r1=43095&r2=43096&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/AlignOf.h (original) +++ llvm/trunk/include/llvm/Support/AlignOf.h Wed Oct 17 17:08:55 2007 @@ -38,6 +38,13 @@ struct AlignOf { enum { Alignment = sizeof(AlignmentCalcImpl) - sizeof(T) }; }; + +/// alignof - A templated function that returns the mininum alignment of +/// of a type. This provides no extra functionality beyond the AlignOf +/// class besides some cosmetic cleanliness. Example usage: +/// alignof() returns the alignment of an int. +template +static inline unsigned alignof() { return AlignOf::Alignment; } } // end namespace llvm #endif From kremenek at apple.com Wed Oct 17 17:09:45 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 22:09:45 -0000 Subject: [llvm-commits] [llvm] r43097 - /llvm/trunk/include/llvm/ADT/StringMap.h Message-ID: <200710172209.l9HM9jCD020560@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 17:09:45 2007 New Revision: 43097 URL: http://llvm.org/viewvc/llvm-project?rev=43097&view=rev Log: Minor cosmetic cleanups in the calculation of alignments for StringMapEntry objects. No functionality change. Modified: llvm/trunk/include/llvm/ADT/StringMap.h Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=43097&r1=43096&r2=43097&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Wed Oct 17 17:09:45 2007 @@ -140,10 +140,12 @@ // Okay, the item doesn't already exist, and 'Bucket' is the bucket to fill // in. Allocate a new item with space for the string at the end and a null // terminator. + unsigned AllocSize = sizeof(StringMapEntry)+KeyLength+1; - - StringMapEntry *NewItem = static_cast( - Allocator.Allocate(AllocSize, AlignOf::Alignment)); + unsigned Alignment = alignof(); + + StringMapEntry *NewItem = + static_cast(Allocator.Allocate(AllocSize,Alignment)); // Default construct the value. new (NewItem) StringMapEntry(KeyLength); From isanbard at gmail.com Wed Oct 17 17:10:14 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 17 Oct 2007 22:10:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> Author: void Date: Wed Oct 17 17:10:14 2007 New Revision: 43098 URL: http://llvm.org/viewvc/llvm-project?rev=43098&view=rev Log: When ObjC is using SJLJ exceptions, don't create an unwind basic block Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43098&r1=43097&r2=43098&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Wed Oct 17 17:10:14 2007 @@ -2777,7 +2777,9 @@ // Do not turn intrinsic calls or no-throw calls into invokes. if ((!isa(Callee) || !cast(Callee)->getIntrinsicID()) && // Turn calls that throw that are inside of a cleanup scope into invokes. - !CurrentEHScopes.empty() && tree_could_throw_p(exp)) { + !CurrentEHScopes.empty() && tree_could_throw_p(exp) && + // Don't generate the unwind block for ObjC if it's using SJLJ exceptions. + !(c_dialect_objc() && flag_objc_sjlj_exceptions)) { if (UnwindBB == 0) UnwindBB = new BasicBlock("Unwind"); UnwindBlock = UnwindBB; From clattner at apple.com Wed Oct 17 17:10:42 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 15:10:42 -0700 Subject: [llvm-commits] [llvm] r43086 - /llvm/trunk/include/llvm/Support/AlignOf.h In-Reply-To: <200710172056.l9HKum98017341@zion.cs.uiuc.edu> References: <200710172056.l9HKum98017341@zion.cs.uiuc.edu> Message-ID: <9C66C809-B4C8-4404-BEAC-39AC84393AAE@apple.com> On Oct 17, 2007, at 1:56 PM, Ted Kremenek wrote: > Author: kremenek > Date: Wed Oct 17 15:56:47 2007 > New Revision: 43086 > > URL: http://llvm.org/viewvc/llvm-project?rev=43086&view=rev > Log: > Added llvm::AlignOf, a template class whose purpose is to portably > compute the minimum memory alignment of arbitrary types. Thanks! > +#ifndef LLVM_SUPPORT_ALIGNOF_H > +#define LLVM_SUPPORT_ALIGNOF_H > + > +#include No need for cassert anymore :) -Chris From kremenek at apple.com Wed Oct 17 17:12:15 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 22:12:15 -0000 Subject: [llvm-commits] [llvm] r43099 - /llvm/trunk/include/llvm/Support/AlignOf.h Message-ID: <200710172212.l9HMCF53020714@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 17:12:14 2007 New Revision: 43099 URL: http://llvm.org/viewvc/llvm-project?rev=43099&view=rev Log: Removed inclusion of cassert, which is no longer needed. Modified: llvm/trunk/include/llvm/Support/AlignOf.h Modified: llvm/trunk/include/llvm/Support/AlignOf.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h?rev=43099&r1=43098&r2=43099&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/AlignOf.h (original) +++ llvm/trunk/include/llvm/Support/AlignOf.h Wed Oct 17 17:12:14 2007 @@ -15,8 +15,6 @@ #ifndef LLVM_SUPPORT_ALIGNOF_H #define LLVM_SUPPORT_ALIGNOF_H -#include - namespace llvm { template From clattner at apple.com Wed Oct 17 17:12:52 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 15:12:52 -0700 Subject: [llvm-commits] r43052 - in /cfe/trunk: Driver/ASTConsumers.h Driver/SerializationTest.cpp Driver/clang.cpp include/clang/Basic/IdentifierTable.h In-Reply-To: References: <200710162337.l9GNbSpi020800@zion.cs.uiuc.edu> Message-ID: On Oct 17, 2007, at 2:30 PM, Gordon Henriksen wrote: > On 2007-10-17, at 14:11, Chris Lattner wrote: > >> On Oct 17, 2007, at 10:21 AM, Gordon Henriksen wrote: >> >>> Is there any interest in the below patch which converts >>> TargetMachineRegistry to use the generic Registry.h facility, or >>> should I drop it from my queue? >> >> Very nice, please apply. > > Done. > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20071015/054612.html Thanks, Gordon! >> Does this change the llc --help output? > > Not in the slightest. Though it probably wouldn't hurt to sort it. :) -Chris From clattner at apple.com Wed Oct 17 17:15:03 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 15:15:03 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> Message-ID: On Oct 17, 2007, at 3:10 PM, Bill Wendling wrote: > Author: void > Date: Wed Oct 17 17:10:14 2007 > New Revision: 43098 > > URL: http://llvm.org/viewvc/llvm-project?rev=43098&view=rev > Log: > When ObjC is using SJLJ exceptions, don't create an unwind basic block Thanks Bill, the patch looks fine. This needs a testcase and needs to be applied to 4.2 if it has the same problem, -Chris > Modified: > llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/ > llvm-convert.cpp?rev=43098&r1=43097&r2=43098&view=diff > > ====================================================================== > ======== > --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Wed Oct 17 17:10:14 2007 > @@ -2777,7 +2777,9 @@ > // Do not turn intrinsic calls or no-throw calls into invokes. > if ((!isa(Callee) || !cast(Callee)- > >getIntrinsicID()) && > // Turn calls that throw that are inside of a cleanup scope > into invokes. > - !CurrentEHScopes.empty() && tree_could_throw_p(exp)) { > + !CurrentEHScopes.empty() && tree_could_throw_p(exp) && > + // Don't generate the unwind block for ObjC if it's using > SJLJ exceptions. > + !(c_dialect_objc() && flag_objc_sjlj_exceptions)) { > if (UnwindBB == 0) > UnwindBB = new BasicBlock("Unwind"); > UnwindBlock = UnwindBB; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Wed Oct 17 17:15:48 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 17 Oct 2007 15:15:48 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> Message-ID: <16e5fdf90710171515y146cfde4n252baeaabb6f32c7@mail.gmail.com> On 10/17/07, Chris Lattner wrote: > > On Oct 17, 2007, at 3:10 PM, Bill Wendling wrote: > > > Author: void > > Date: Wed Oct 17 17:10:14 2007 > > New Revision: 43098 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=43098&view=rev > > Log: > > When ObjC is using SJLJ exceptions, don't create an unwind basic block > > Thanks Bill, the patch looks fine. This needs a testcase and needs > to be applied to 4.2 if it has the same problem, > Will do. -bw From kremenek at apple.com Wed Oct 17 17:17:02 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 22:17:02 -0000 Subject: [llvm-commits] [llvm] r43100 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h Message-ID: <200710172217.l9HMH2VS020953@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 17:17:01 2007 New Revision: 43100 URL: http://llvm.org/viewvc/llvm-project?rev=43100&view=rev Log: ImutAVLTree now allocates tree nodes from the BumpPtrAllocator using the new type-aligned Allocate() method. Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=43100&r1=43099&r2=43100&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Wed Oct 17 17:17:01 2007 @@ -373,12 +373,11 @@ assert (InsertPos != NULL); - // FIXME: more intelligent calculation of alignment. - TreeTy* T = (TreeTy*) Allocator.Allocate(sizeof(*T),16); - + // Allocate the new tree node and insert it into the cache. + TreeTy* T = Allocator.Allocate(); new (T) TreeTy(L,R,V,IncrementHeight(L,R)); - Cache.InsertNode(T,InsertPos); + return T; } From isanbard at gmail.com Wed Oct 17 18:14:58 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 17 Oct 2007 23:14:58 -0000 Subject: [llvm-commits] [llvm] r43102 - /llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Message-ID: <200710172314.l9HNEwOX023147@zion.cs.uiuc.edu> Author: void Date: Wed Oct 17 18:14:56 2007 New Revision: 43102 URL: http://llvm.org/viewvc/llvm-project?rev=43102&view=rev Log: Test to make sure we don't generate unwind info for non-64-bit Objective-C. Added: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Added: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m?rev=43102&view=auto ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m (added) +++ llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Wed Oct 17 18:14:56 2007 @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -x objective-c -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o - t.m | not grep Unwind_Resume + +#import + +static NSMutableArray *anArray = nil; + +CFArrayRef bork(void) { + CFArrayRef result = NULL; + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + @try { + result = CFRetain(anArray); + } @catch(id any) { + NSLog(@"Swallowed exception %@", any); + } + + [pool release]; + return result; +} From evan.cheng at apple.com Wed Oct 17 18:51:13 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 17 Oct 2007 23:51:13 -0000 Subject: [llvm-commits] [llvm] r43103 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200710172351.l9HNpD18024395@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 17 18:51:13 2007 New Revision: 43103 URL: http://llvm.org/viewvc/llvm-project?rev=43103&view=rev Log: Reverting r43070 for now. It's causing llc test failures. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43103&r1=43102&r2=43103&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 17 18:51:13 2007 @@ -7686,8 +7686,6 @@ Value *Dest = InsertCastBefore(Instruction::BitCast, CI.getOperand(1), NewPtrTy, CI); Value *L = new LoadInst(Src, "tmp", false, Align, &CI); Value *NS = new StoreInst(L, Dest, false, Align, &CI); - AddToWorkList(cast(L)); - AddToWorkList(cast(NS)); CI.replaceAllUsesWith(NS); Changed = true; return EraseInstFromFunction(CI); @@ -9116,29 +9114,6 @@ } } else if (CE->isCast()) { - // Instead of loading constant c string, use corresponding integer value - // directly if string length is small enough. - const std::string &Str = CE->getOperand(0)->getStringValue(); - if (!Str.empty()) { - unsigned len = Str.length(); - const Type *Ty = cast(CE->getType())->getElementType(); - unsigned numBits = Ty->getPrimitiveSizeInBits(); - if ((numBits >> 3) == len + 1) { - // Replace LI with immediate integer store. - APInt StrVal(numBits, 0); - APInt SingleChar(numBits, 0); - for (unsigned i = 0; i < len; i++) { - SingleChar = (uint64_t) Str[i]; - StrVal = (StrVal << 8) | SingleChar; - } - // Append NULL at the end. - SingleChar = 0; - StrVal = (StrVal << 8) | SingleChar; - Value *NL = ConstantInt::get(StrVal); - return ReplaceInstUsesWith(LI, NL); - } - } - if (Instruction *Res = InstCombineLoadCast(*this, LI)) return Res; } From clattner at apple.com Wed Oct 17 18:52:34 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 16:52:34 -0700 Subject: [llvm-commits] [llvm] r43100 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h In-Reply-To: <200710172217.l9HMH2VS020953@zion.cs.uiuc.edu> References: <200710172217.l9HMH2VS020953@zion.cs.uiuc.edu> Message-ID: On Oct 17, 2007, at 3:17 PM, Ted Kremenek wrote: > assert (InsertPos != NULL); > > - // FIXME: more intelligent calculation of alignment. > - TreeTy* T = (TreeTy*) Allocator.Allocate(sizeof(*T),16); > - > + // Allocate the new tree node and insert it into the cache. > + TreeTy* T = Allocator.Allocate(); > new (T) TreeTy(L,R,V,IncrementHeight(L,R)); > - > Cache.InsertNode(T,InsertPos); Random thought: The allocator "Allocate" method returns a pointer to uninitialized memory. Should'nt it return void *? This would give you: void *Tmp = Allocator.Allocate(); TreeTy *T = new (Tmp) TreeTy(L,R,V,IncrementHeight(L,R)); ... Reasonable? -Chris From clattner at apple.com Wed Oct 17 18:54:46 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 16:54:46 -0700 Subject: [llvm-commits] [llvm] r43103 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200710172351.l9HNpD18024395@zion.cs.uiuc.edu> References: <200710172351.l9HNpD18024395@zion.cs.uiuc.edu> Message-ID: On Oct 17, 2007, at 4:51 PM, Evan Cheng wrote: > Author: evancheng > Date: Wed Oct 17 18:51:13 2007 > New Revision: 43103 > > URL: http://llvm.org/viewvc/llvm-project?rev=43103&view=rev > Log: > Reverting r43070 for now. It's causing llc test failures. Please revert the testcase change too. Devang, please investigate :). Also, while you're at it, shouldn't the change be in 'InstCombineLoadCast'? -Chris From clattner at apple.com Wed Oct 17 18:58:02 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 17 Oct 2007 16:58:02 -0700 Subject: [llvm-commits] SCEV factories In-Reply-To: <20071011213109.GA21991@village.us.cray.com> References: <20071011213109.GA21991@village.us.cray.com> Message-ID: On Oct 11, 2007, at 2:31 PM, Dan Gohman wrote: > The attached patch changes the SCEV factory functions from being > static member functions of the SCEV subclasses to being non-static > member functions of the ScalarEvolution class. > > This will be useful for things like the FIXME comment in > SE.getSignExtendExpr (renamed from SCEVSignExtendExpr::get here). A > sign-extend operator with an add-recurrence operand can possibly be > transformed to an add-recurrence with a sign-extended base if the > ScalarEvolution object is available and knows about the trip-count of > the loop. This also applies to zero-extend as well. Very nice, please commit. > Also, this would make it easy to eliminate the static variables in > ScalarEvolution.cpp -- they could be members of ScalarEvolutionImpl, > if anyone is interested. That would be very nice also :) -Chris From kremenek at apple.com Wed Oct 17 19:26:36 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 17:26:36 -0700 Subject: [llvm-commits] [llvm] r43100 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h In-Reply-To: References: <200710172217.l9HMH2VS020953@zion.cs.uiuc.edu> Message-ID: <62A9AD67-8ACF-42F8-9E3F-D1AE4E18172D@apple.com> On Oct 17, 2007, at 4:52 PM, Chris Lattner wrote: > > On Oct 17, 2007, at 3:17 PM, Ted Kremenek wrote: > >> assert (InsertPos != NULL); >> >> - // FIXME: more intelligent calculation of alignment. >> - TreeTy* T = (TreeTy*) Allocator.Allocate(sizeof(*T),16); >> - >> + // Allocate the new tree node and insert it into the cache. >> + TreeTy* T = Allocator.Allocate(); >> new (T) TreeTy(L,R,V,IncrementHeight(L,R)); >> - >> Cache.InsertNode(T,InsertPos); > > Random thought: The allocator "Allocate" method returns a pointer to > uninitialized memory. Should'nt it return void *? This would give > you: > > void *Tmp = Allocator.Allocate(); > TreeTy *T = new (Tmp) TreeTy(L,R,V,IncrementHeight(L,R)); > ... > Yeah this is reasonable. We should make people thing we're actually creating the object. From kremenek at apple.com Wed Oct 17 19:30:14 2007 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 18 Oct 2007 00:30:14 -0000 Subject: [llvm-commits] [llvm] r43106 - in /llvm/trunk/include/llvm: ADT/ImmutableSet.h Support/Allocator.h Message-ID: <200710180030.l9I0UEr1026216@zion.cs.uiuc.edu> Author: kremenek Date: Wed Oct 17 19:30:14 2007 New Revision: 43106 URL: http://llvm.org/viewvc/llvm-project?rev=43106&view=rev Log: Changed the return type of type-specific Allocate() methods to return void*. This is hint that we are returning uninitialized memory rather than a constructed object. Patched ImutAVLTree to conform to this new interface. Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=43106&r1=43105&r2=43106&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Wed Oct 17 19:30:14 2007 @@ -374,7 +374,7 @@ assert (InsertPos != NULL); // Allocate the new tree node and insert it into the cache. - TreeTy* T = Allocator.Allocate(); + TreeTy* T = (TreeTy*) Allocator.Allocate(); new (T) TreeTy(L,R,V,IncrementHeight(L,R)); Cache.InsertNode(T,InsertPos); Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=43106&r1=43105&r2=43106&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Wed Oct 17 19:30:14 2007 @@ -28,7 +28,7 @@ void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); } template - T* Allocate() { return reinterpret_cast(malloc(sizeof(T))); } + void *Allocate() { return reinterpret_cast(malloc(sizeof(T))); } void Deallocate(void *Ptr) { free(Ptr); } void PrintStats() const {} @@ -48,7 +48,7 @@ void *Allocate(unsigned Size, unsigned Alignment); template - T* Allocate() { + void *Allocate() { return reinterpret_cast(Allocate(sizeof(T),AlignOf::Alignment)); } From kremenek at apple.com Wed Oct 17 19:31:48 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 17 Oct 2007 17:31:48 -0700 Subject: [llvm-commits] [llvm] r43100 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h In-Reply-To: <62A9AD67-8ACF-42F8-9E3F-D1AE4E18172D@apple.com> References: <200710172217.l9HMH2VS020953@zion.cs.uiuc.edu> <62A9AD67-8ACF-42F8-9E3F-D1AE4E18172D@apple.com> Message-ID: <3477FF9A-C503-48EC-81A7-B1D49AAD073A@apple.com> On Oct 17, 2007, at 5:26 PM, Ted Kremenek wrote: > > On Oct 17, 2007, at 4:52 PM, Chris Lattner wrote: > >> >> On Oct 17, 2007, at 3:17 PM, Ted Kremenek wrote: >> >>> assert (InsertPos != NULL); >>> >>> - // FIXME: more intelligent calculation of alignment. >>> - TreeTy* T = (TreeTy*) Allocator.Allocate(sizeof(*T),16); >>> - >>> + // Allocate the new tree node and insert it into the cache. >>> + TreeTy* T = Allocator.Allocate(); >>> new (T) TreeTy(L,R,V,IncrementHeight(L,R)); >>> - >>> Cache.InsertNode(T,InsertPos); >> >> Random thought: The allocator "Allocate" method returns a pointer to >> uninitialized memory. Should'nt it return void *? This would give >> you: >> >> void *Tmp = Allocator.Allocate(); >> TreeTy *T = new (Tmp) TreeTy(L,R,V,IncrementHeight(L,R)); >> ... >> > > Yeah this is reasonable. We should make people thing we're actually > creating the object. Apparently I cannot write English anymore. "We shouldn't make people think..." From evan.cheng at apple.com Wed Oct 17 19:35:06 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 00:35:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43107 - /llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Message-ID: <200710180035.l9I0Z6K6026429@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 17 19:35:06 2007 New Revision: 43107 URL: http://llvm.org/viewvc/llvm-project?rev=43107&view=rev Log: Reflects TargetMachineRegistry changes. Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=43107&r1=43106&r2=43107&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Wed Oct 17 19:35:06 2007 @@ -162,7 +162,7 @@ // Create the TargetMachine we will be generating code with. // FIXME: Figure out how to select the target and pass down subtarget info. std::string Err; - const TargetMachineRegistry::Entry *TME = + const TargetMachineRegistry::entry *TME = TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, Err); if (!TME) { cerr << "Did not get a target machine!\n"; From evan.cheng at apple.com Wed Oct 17 19:36:19 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 00:36:19 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43108 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200710180036.l9I0aJnK026495@zion.cs.uiuc.edu> Author: evancheng Date: Wed Oct 17 19:36:19 2007 New Revision: 43108 URL: http://llvm.org/viewvc/llvm-project?rev=43108&view=rev Log: Merge -r43106:43107 llvm-project/llvm-gcc-4.0/trunk Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=43108&r1=43107&r2=43108&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Oct 17 19:36:19 2007 @@ -163,7 +163,7 @@ // Create the TargetMachine we will be generating code with. // FIXME: Figure out how to select the target and pass down subtarget info. std::string Err; - const TargetMachineRegistry::Entry *TME = + const TargetMachineRegistry::entry *TME = TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, Err); if (!TME) { cerr << "Did not get a target machine!\n"; From dpatel at apple.com Wed Oct 17 19:48:43 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 18 Oct 2007 00:48:43 -0000 Subject: [llvm-commits] [llvm] r43111 - /llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Message-ID: <200710180048.l9I0mh4j027100@zion.cs.uiuc.edu> Author: dpatel Date: Wed Oct 17 19:48:43 2007 New Revision: 43111 URL: http://llvm.org/viewvc/llvm-project?rev=43111&view=rev Log: XFAIL for now. Modified: llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Modified: llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll?rev=43111&r1=43110&r2=43111&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Wed Oct 17 19:48:43 2007 @@ -1,5 +1,6 @@ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call ; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | not grep xyz +; XFAIL: * @.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1] define void @foo(i8* %P) { From gordonhenriksen at mac.com Wed Oct 17 20:08:28 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Wed, 17 Oct 2007 21:08:28 -0400 Subject: [llvm-commits] [llvm-gcc-4.2] r43108 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200710180036.l9I0aJnK026495@zion.cs.uiuc.edu> References: <200710180036.l9I0aJnK026495@zion.cs.uiuc.edu> Message-ID: <339C6420-CED6-4740-8198-0F99A73A368E@mac.com> Whoops. Thanks for cleaning that up, Evan. On Oct 17, 2007, at 20:36, Evan Cheng wrote: > Author: evancheng > Date: Wed Oct 17 19:36:19 2007 > New Revision: 43108 > > URL: http://llvm.org/viewvc/llvm-project?rev=43108&view=rev > Log: > Merge -r43106:43107 llvm-project/llvm-gcc-4.0/trunk > > Modified: > llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ > llvm-backend.cpp?rev=43108&r1=43107&r2=43108&view=diff > > ====================================================================== > ======== > --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Oct 17 19:36:19 2007 > @@ -163,7 +163,7 @@ > // Create the TargetMachine we will be generating code with. > // FIXME: Figure out how to select the target and pass down > subtarget info. > std::string Err; > - const TargetMachineRegistry::Entry *TME = > + const TargetMachineRegistry::entry *TME = > TargetMachineRegistry::getClosestStaticTargetForModule > (*TheModule, Err); > if (!TME) { > cerr << "Did not get a target machine!\n"; ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071017/dbe4a055/attachment.html From resistor at mac.com Thu Oct 18 00:13:53 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 18 Oct 2007 05:13:53 -0000 Subject: [llvm-commits] [llvm] r43115 - in /llvm/trunk: include/llvm/Analysis/DominatorInternals.h include/llvm/Analysis/Dominators.h lib/Transforms/Utils/CodeExtractor.cpp lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200710180513.l9I5DrOv008090@zion.cs.uiuc.edu> Author: resistor Date: Thu Oct 18 00:13:52 2007 New Revision: 43115 URL: http://llvm.org/viewvc/llvm-project?rev=43115&view=rev Log: Move Split<...>() into DomTreeBase. This should make the #include's of DominatorInternals.h in CodeExtractor and LoopSimplify unnecessary. Hartmut, could you confirm that this fixes the issues you were seeing? Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=43115&r1=43114&r2=43115&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original) +++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Thu Oct 18 00:13:52 2007 @@ -303,93 +303,6 @@ DT.DFSInfoValid = false; } -// NewBB is split and now it has one successor. Update dominator tree to -// reflect this change. -template -void Split(DominatorTreeBase& DT, - typename GraphT::NodeType* NewBB) { - assert(std::distance(GraphT::child_begin(NewBB), GraphT::child_end(NewBB)) == 1 - && "NewBB should have a single successor!"); - typename GraphT::NodeType* NewBBSucc = *GraphT::child_begin(NewBB); - - std::vector PredBlocks; - for (typename GraphTraits >::ChildIteratorType PI = - GraphTraits >::child_begin(NewBB), - PE = GraphTraits >::child_end(NewBB); PI != PE; ++PI) - PredBlocks.push_back(*PI); - - assert(!PredBlocks.empty() && "No predblocks??"); - - // The newly inserted basic block will dominate existing basic blocks iff the - // PredBlocks dominate all of the non-pred blocks. If all predblocks dominate - // the non-pred blocks, then they all must be the same block! - // - bool NewBBDominatesNewBBSucc = true; - { - typename GraphT::NodeType* OnePred = PredBlocks[0]; - unsigned i = 1, e = PredBlocks.size(); - for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) { - assert(i != e && "Didn't find reachable pred?"); - OnePred = PredBlocks[i]; - } - - for (; i != e; ++i) - if (PredBlocks[i] != OnePred && DT.isReachableFromEntry(OnePred)) { - NewBBDominatesNewBBSucc = false; - break; - } - - if (NewBBDominatesNewBBSucc) - for (typename GraphTraits >::ChildIteratorType PI = - GraphTraits >::child_begin(NewBBSucc), - E = GraphTraits >::child_end(NewBBSucc); PI != E; ++PI) - if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { - NewBBDominatesNewBBSucc = false; - break; - } - } - - // The other scenario where the new block can dominate its successors are when - // all predecessors of NewBBSucc that are not NewBB are dominated by NewBBSucc - // already. - if (!NewBBDominatesNewBBSucc) { - NewBBDominatesNewBBSucc = true; - for (typename GraphTraits >::ChildIteratorType PI = - GraphTraits >::child_begin(NewBBSucc), - E = GraphTraits >::child_end(NewBBSucc); PI != E; ++PI) - if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { - NewBBDominatesNewBBSucc = false; - break; - } - } - - // Find NewBB's immediate dominator and create new dominator tree node for - // NewBB. - BasicBlock *NewBBIDom = 0; - unsigned i = 0; - for (i = 0; i < PredBlocks.size(); ++i) - if (DT.isReachableFromEntry(PredBlocks[i])) { - NewBBIDom = PredBlocks[i]; - break; - } - assert(i != PredBlocks.size() && "No reachable preds?"); - for (i = i + 1; i < PredBlocks.size(); ++i) { - if (DT.isReachableFromEntry(PredBlocks[i])) - NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]); - } - assert(NewBBIDom && "No immediate dominator found??"); - - // Create the new dominator tree node... and set the idom of NewBB. - DomTreeNode *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom); - - // If NewBB strictly dominates other blocks, then it is now the immediate - // dominator of NewBBSucc. Update the dominator tree as appropriate. - if (NewBBDominatesNewBBSucc) { - DomTreeNode *NewBBSuccNode = DT.getNode(NewBBSucc); - DT.changeImmediateDominator(NewBBSuccNode, NewBBNode); - } -} - } #endif Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=43115&r1=43114&r2=43115&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Thu Oct 18 00:13:52 2007 @@ -202,6 +202,93 @@ Vertex.clear(); RootNode = 0; } + + // NewBB is split and now it has one successor. Update dominator tree to + // reflect this change. + template + void Split(DominatorTreeBase& DT, + typename GraphT::NodeType* NewBB) { + assert(std::distance(GraphT::child_begin(NewBB), GraphT::child_end(NewBB)) == 1 + && "NewBB should have a single successor!"); + typename GraphT::NodeType* NewBBSucc = *GraphT::child_begin(NewBB); + + std::vector PredBlocks; + for (typename GraphTraits >::ChildIteratorType PI = + GraphTraits >::child_begin(NewBB), + PE = GraphTraits >::child_end(NewBB); PI != PE; ++PI) + PredBlocks.push_back(*PI); + + assert(!PredBlocks.empty() && "No predblocks??"); + + // The newly inserted basic block will dominate existing basic blocks iff the + // PredBlocks dominate all of the non-pred blocks. If all predblocks dominate + // the non-pred blocks, then they all must be the same block! + // + bool NewBBDominatesNewBBSucc = true; + { + typename GraphT::NodeType* OnePred = PredBlocks[0]; + unsigned i = 1, e = PredBlocks.size(); + for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) { + assert(i != e && "Didn't find reachable pred?"); + OnePred = PredBlocks[i]; + } + + for (; i != e; ++i) + if (PredBlocks[i] != OnePred && DT.isReachableFromEntry(OnePred)) { + NewBBDominatesNewBBSucc = false; + break; + } + + if (NewBBDominatesNewBBSucc) + for (typename GraphTraits >::ChildIteratorType PI = + GraphTraits >::child_begin(NewBBSucc), + E = GraphTraits >::child_end(NewBBSucc); PI != E; ++PI) + if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { + NewBBDominatesNewBBSucc = false; + break; + } + } + + // The other scenario where the new block can dominate its successors are when + // all predecessors of NewBBSucc that are not NewBB are dominated by NewBBSucc + // already. + if (!NewBBDominatesNewBBSucc) { + NewBBDominatesNewBBSucc = true; + for (typename GraphTraits >::ChildIteratorType PI = + GraphTraits >::child_begin(NewBBSucc), + E = GraphTraits >::child_end(NewBBSucc); PI != E; ++PI) + if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { + NewBBDominatesNewBBSucc = false; + break; + } + } + + // Find NewBB's immediate dominator and create new dominator tree node for + // NewBB. + BasicBlock *NewBBIDom = 0; + unsigned i = 0; + for (i = 0; i < PredBlocks.size(); ++i) + if (DT.isReachableFromEntry(PredBlocks[i])) { + NewBBIDom = PredBlocks[i]; + break; + } + assert(i != PredBlocks.size() && "No reachable preds?"); + for (i = i + 1; i < PredBlocks.size(); ++i) { + if (DT.isReachableFromEntry(PredBlocks[i])) + NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]); + } + assert(NewBBIDom && "No immediate dominator found??"); + + // Create the new dominator tree node... and set the idom of NewBB. + DomTreeNode *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom); + + // If NewBB strictly dominates other blocks, then it is now the immediate + // dominator of NewBBSucc. Update the dominator tree as appropriate. + if (NewBBDominatesNewBBSucc) { + DomTreeNode *NewBBSuccNode = DT.getNode(NewBBSucc); + DT.changeImmediateDominator(NewBBSuccNode, NewBBNode); + } + } public: DominatorTreeBase(intptr_t ID, bool isPostDom) @@ -425,6 +512,15 @@ assert(getNode(BB) && "Removing node that isn't in dominator tree."); DomTreeNodes.erase(BB); } + + /// splitBlock - BB is split and now it has one successor. Update dominator + /// tree to reflect this change. + void splitBlock(NodeT* NewBB) { + if (this->IsPostDominators) + Split, GraphTraits > >(*this, NewBB); + else + Split >(*this, NewBB); + } /// print - Convert to human readable form /// @@ -471,21 +567,6 @@ friend void Calculate(DominatorTreeBase& DT, Function& F); - template - friend void Split(DominatorTreeBase& DT, - typename GraphT::NodeType* NewBB); - -public: - /// splitBlock - BB is split and now it has one successor. Update dominator - /// tree to reflect this change. - void splitBlock(NodeT* NewBB) { - if (this->IsPostDominators) - Split, GraphTraits > >(*this, NewBB); - else - Split >(*this, NewBB); - } - -protected: /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers() { Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=43115&r1=43114&r2=43115&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Thu Oct 18 00:13:52 2007 @@ -21,7 +21,6 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Analysis/Dominators.h" -#include "llvm/Analysis/DominatorInternals.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=43115&r1=43114&r2=43115&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Thu Oct 18 00:13:52 2007 @@ -40,7 +40,6 @@ #include "llvm/Type.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Dominators.h" -#include "llvm/Analysis/DominatorInternals.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" From sabre at nondot.org Thu Oct 18 01:17:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 06:17:07 -0000 Subject: [llvm-commits] [llvm] r43116 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200710180617.l9I6H7Fs011112@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 01:17:07 2007 New Revision: 43116 URL: http://llvm.org/viewvc/llvm-project?rev=43116&view=rev Log: legalizing the ret operation on f64 shouldn't introduce a new i64 bit convert needlessly. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=43116&r1=43115&r2=43116&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Oct 18 01:17:07 2007 @@ -670,10 +670,12 @@ if (Op.getValueType() == MVT::f32) { Op = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op); } else if (Op.getValueType() == MVT::f64) { - // Recursively legalize f64 -> i64. - Op = DAG.getNode(ISD::BIT_CONVERT, MVT::i64, Op); - return DAG.getNode(ISD::RET, MVT::Other, Chain, Op, - DAG.getConstant(0, MVT::i32)); + // Legalize ret f64 -> ret 2 x i32. We always have fmrrd if f64 is + // available. + Op = DAG.getNode(ARMISD::FMRRD, DAG.getVTList(MVT::i32, MVT::i32), &Op,1); + SDOperand Sign = DAG.getConstant(0, MVT::i32); + return DAG.getNode(ISD::RET, MVT::Other, Chain, Op, Sign, + Op.getValue(1), Sign); } Copy = DAG.getCopyToReg(Chain, ARM::R0, Op, SDOperand()); if (DAG.getMachineFunction().liveout_empty()) From resistor at mac.com Thu Oct 18 01:20:17 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 18 Oct 2007 01:20:17 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200710180620.l9I6KHKD011487@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.22 -> 1.23 --- Log message: Add several recent news posts: 1) More info from Zack Rusin about using LLVM in Mesa. 2) An interview and a video from Adobe about using LLVM to compile C/C++ code to Flash. --- Diffs of the changes: (+4 -1) InTheNews.html | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.22 llvm-www/InTheNews.html:1.23 --- llvm-www/InTheNews.html:1.22 Fri Aug 24 18:30:36 2007 +++ llvm-www/InTheNews.html Thu Oct 18 01:19:32 2007 @@ -15,6 +15,9 @@
    News Articles

    2007

      +
    • 2007-10-17, digitalbackcountry, "Interview with Scott Petersen on the C/C++ in Flash Player Sneak", Ryan Stewart
    • +
    • 2007-10-03, peterelst, "Flash on C/C++", Scott Petersen. Second video on linked page. +
    • 2007-09-29, zrusin, "Gallium3D, Shaders and LLVM", Zack Rusin
    • 2007-06-02, OSNews, "Apple Developing a New LLVM C Front-End", Eugenia Loli-Queru.
    • 2007-05-24, zrusin, "Mesa and LLVM", Zack Rusin.
    • @@ -108,6 +111,6 @@ Valid HTML 4.01!
      - Last modified: $Date: 2007/08/24 23:30:36 $ + Last modified: $Date: 2007/10/18 06:19:32 $ From evan.cheng at apple.com Thu Oct 18 02:47:55 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 07:47:55 -0000 Subject: [llvm-commits] [llvm] r43117 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200710180747.l9I7lteF022231@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 18 02:47:55 2007 New Revision: 43117 URL: http://llvm.org/viewvc/llvm-project?rev=43117&view=rev Log: Remove unnecessary include. Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=43117&r1=43116&r2=43117&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Thu Oct 18 02:47:55 2007 @@ -24,7 +24,6 @@ #include "llvm/CodeGen/LiveInterval.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Allocator.h" From evan.cheng at apple.com Thu Oct 18 02:50:00 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 07:50:00 -0000 Subject: [llvm-commits] [llvm] r43118 - in /llvm/trunk: include/llvm/CodeGen/SimpleRegisterCoalescing.h lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2007-10-17-IllegalAsm.ll Message-ID: <200710180750.l9I7o0Vu022318@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 18 02:49:59 2007 New Revision: 43118 URL: http://llvm.org/viewvc/llvm-project?rev=43118&view=rev Log: Really fix PR1734. Carefully track which register uses are sub-register uses by traversing inverse register coalescing map. Added: llvm/trunk/test/CodeGen/X86/2007-10-17-IllegalAsm.ll Modified: llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h?rev=43118&r1=43117&r2=43118&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h (original) +++ llvm/trunk/include/llvm/CodeGen/SimpleRegisterCoalescing.h Thu Oct 18 02:49:59 2007 @@ -37,19 +37,24 @@ LiveIntervals *li_; LiveVariables *lv_; - typedef IndexedMap Reg2RegMap; - Reg2RegMap r2rMap_; - BitVector allocatableRegs_; DenseMap allocatableRCRegs_; + /// r2rMap_ - Map from register to its representative register. + /// + IndexedMap r2rMap_; + + /// r2rRevMap_ - Reverse of r2rRevMap_, i.e. Map from register to all + /// the registers it represent. + IndexedMap > r2rRevMap_; + /// JoinedLIs - Keep track which register intervals have been coalesced /// with other intervals. BitVector JoinedLIs; - /// SubRegIdxes - Keep track of sub-register and sub-indexes. + /// SubRegIdxes - Keep track of sub-register and indexes. /// - std::vector > SubRegIdxes; + SmallVector, 32> SubRegIdxes; public: static char ID; // Pass identifcation, replacement for typeid @@ -132,10 +137,15 @@ bool AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB, MachineInstr *CopyMI); + /// AddSubRegIdxPairs - Recursively mark all the registers represented by the + /// specified register as sub-registers. The recursion level is expected to be + /// shallow. + void AddSubRegIdxPairs(unsigned Reg, unsigned SubIdx); + /// lastRegisterUse - Returns the last use of the specific register between /// cycles Start and End. It also returns the use operand by reference. It /// returns NULL if there are no uses. - MachineInstr *lastRegisterUse(unsigned Start, unsigned End, unsigned Reg, + MachineInstr *lastRegisterUse(unsigned Start, unsigned End, unsigned Reg, MachineOperand *&MOU); /// findDefOperand - Returns the MachineOperand that is a def of the specific Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=43118&r1=43117&r2=43118&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Oct 18 02:49:59 2007 @@ -57,7 +57,6 @@ const PassInfo *llvm::SimpleRegisterCoalescingID = X.getPassInfo(); void SimpleRegisterCoalescing::getAnalysisUsage(AnalysisUsage &AU) const { - //AU.addPreserved(); AU.addPreserved(); AU.addPreservedID(PHIEliminationID); AU.addPreservedID(TwoAddressInstructionPassID); @@ -185,6 +184,17 @@ return true; } +/// AddSubRegIdxPairs - Recursively mark all the registers represented by the +/// specified register as sub-registers. The recursion level is expected to be +/// shallow. +void SimpleRegisterCoalescing::AddSubRegIdxPairs(unsigned Reg, unsigned SubIdx) { + std::vector &JoinedRegs = r2rRevMap_[Reg]; + for (unsigned i = 0, e = JoinedRegs.size(); i != e; ++i) { + SubRegIdxes.push_back(std::make_pair(JoinedRegs[i], SubIdx)); + AddSubRegIdxPairs(JoinedRegs[i], SubIdx); + } +} + /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true /// if the copy was successfully coalesced away, or if it is never possible @@ -459,8 +469,9 @@ std::swap(repSrcReg, repDstReg); std::swap(ResSrcInt, ResDstInt); } - SubRegIdxes.push_back(std::make_pair(DstReg, - CopyMI->getOperand(2).getImm())); + unsigned SubIdx = CopyMI->getOperand(2).getImm(); + SubRegIdxes.push_back(std::make_pair(repSrcReg, SubIdx)); + AddSubRegIdxPairs(repSrcReg, SubIdx); } DOUT << "\n\t\tJoined. Result = "; ResDstInt->print(DOUT, mri_); @@ -470,6 +481,7 @@ // being merged. li_->removeInterval(repSrcReg); r2rMap_[repSrcReg] = repDstReg; + r2rRevMap_[repDstReg].push_back(repSrcReg); // Finally, delete the copy instruction. li_->RemoveMachineInstrFromMaps(CopyMI); @@ -1039,7 +1051,7 @@ } DOUT << "*** Register mapping ***\n"; - for (int i = 0, e = r2rMap_.size(); i != e; ++i) + for (unsigned i = 0, e = r2rMap_.size(); i != e; ++i) if (r2rMap_[i]) { DOUT << " reg " << i << " -> "; DEBUG(printRegName(r2rMap_[i])); @@ -1172,9 +1184,12 @@ } void SimpleRegisterCoalescing::releaseMemory() { - r2rMap_.clear(); - JoinedLIs.clear(); - SubRegIdxes.clear(); + for (unsigned i = 0, e = r2rMap_.size(); i != e; ++i) + r2rRevMap_[i].clear(); + r2rRevMap_.clear(); + r2rMap_.clear(); + JoinedLIs.clear(); + SubRegIdxes.clear(); } static bool isZeroLengthInterval(LiveInterval *li) { @@ -1204,6 +1219,7 @@ SSARegMap *RegMap = mf_->getSSARegMap(); r2rMap_.grow(RegMap->getLastVirtReg()); + r2rRevMap_.grow(RegMap->getLastVirtReg()); // Join (coalesce) intervals if requested. if (EnableJoining) { @@ -1214,7 +1230,8 @@ DOUT << "\n"; } - // Track coalesced sub-registers. + // Transfer sub-registers info to SSARegMap now that coalescing information + // is complete. while (!SubRegIdxes.empty()) { std::pair RI = SubRegIdxes.back(); SubRegIdxes.pop_back(); Added: llvm/trunk/test/CodeGen/X86/2007-10-17-IllegalAsm.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-17-IllegalAsm.ll?rev=43118&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-17-IllegalAsm.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-17-IllegalAsm.ll Thu Oct 18 02:49:59 2007 @@ -0,0 +1,87 @@ +; RUN: llvm-as < %s | llc -mtriple=x86_64-linux-gnu | grep addb | not grep x +; RUN: llvm-as < %s | llc -mtriple=x86_64-linux-gnu | grep cmpb | not grep x +; PR1734 + +target triple = "x86_64-unknown-linux-gnu" + %struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.eh_status = type opaque + %struct.emit_status = type { i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack*, i32, %struct.location_t, i32, i8*, %struct.rtx_def** } + %struct.expr_status = type { i32, i32, i32, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def* } + %struct.function = type { %struct.eh_status*, %struct.expr_status*, %struct.emit_status*, %struct.varasm_status*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.function*, i32, i32, i32, i32, %struct.rtx_def*, %struct.CUMULATIVE_ARGS, %struct.rtx_def*, %struct.rtx_def*, %struct.initial_value_struct*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, %struct.rtx_def*, i8, i32, i64, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, %struct.varray_head_tag*, %struct.temp_slot*, i32, %struct.var_refs_queue*, i32, i32, %struct.rtvec_def*, %struct.tree_node*, i32, i32, i32, %struct.machine_function*, i32, i32, i8, i8, %struct.language_function*, %struct.rtx_def*, i32, i32, i32, i32, %struct.location_t, %struct.varray_head_tag*, %struct.tree_node*, %struct.tree_node*, i8, i8, i8 } + %struct.initial_value_struct = type opaque + %struct.lang_decl = type opaque + %struct.language_function = type opaque + %struct.location_t = type { i8*, i32 } + %struct.machine_function = type { %struct.stack_local_entry*, i8*, %struct.rtx_def*, i32, i32, i32, i32, i32 } + %struct.rtunion = type { i8* } + %struct.rtvec_def = type { i32, [1 x %struct.rtx_def*] } + %struct.rtx_def = type { i16, i8, i8, %struct.u } + %struct.sequence_stack = type { %struct.rtx_def*, %struct.rtx_def*, %struct.sequence_stack* } + %struct.stack_local_entry = type opaque + %struct.temp_slot = type opaque + %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, i8, i8, i8, i8, i8 } + %struct.tree_decl = type { %struct.tree_common, %struct.location_t, i32, %struct.tree_node*, i8, i8, i8, i8, i8, i8, i8, i8, i32, %struct.tree_decl_u1, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.rtx_def*, i32, %struct.tree_decl_u2, %struct.tree_node*, %struct.tree_node*, i64, %struct.lang_decl* } + %struct.tree_decl_u1 = type { i64 } + %struct.tree_decl_u2 = type { %struct.function* } + %struct.tree_node = type { %struct.tree_decl } + %struct.u = type { [1 x %struct.rtunion] } + %struct.var_refs_queue = type { %struct.rtx_def*, i32, i32, %struct.var_refs_queue* } + %struct.varasm_status = type opaque + %struct.varray_data = type { [1 x i64] } + %struct.varray_head_tag = type { i64, i64, i32, i8*, %struct.varray_data } + %union.tree_ann_d = type opaque + +define void @layout_type(%struct.tree_node* %type) { +entry: + %tmp32 = load i32* null, align 8 ; [#uses=3] + %tmp3435 = trunc i32 %tmp32 to i8 ; [#uses=1] + %tmp53 = icmp eq %struct.tree_node* null, null ; [#uses=1] + br i1 %tmp53, label %cond_next57, label %UnifiedReturnBlock + +cond_next57: ; preds = %entry + %tmp65 = and i32 %tmp32, 255 ; [#uses=1] + switch i32 %tmp65, label %UnifiedReturnBlock [ + i32 6, label %bb140 + i32 7, label %bb140 + i32 8, label %bb140 + i32 13, label %bb478 + ] + +bb140: ; preds = %cond_next57, %cond_next57, %cond_next57 + %tmp219 = load i32* null, align 8 ; [#uses=1] + %tmp221222 = trunc i32 %tmp219 to i8 ; [#uses=1] + %tmp223 = icmp eq i8 %tmp221222, 24 ; [#uses=1] + br i1 %tmp223, label %cond_true226, label %cond_next340 + +cond_true226: ; preds = %bb140 + switch i8 %tmp3435, label %cond_true288 [ + i8 6, label %cond_next340 + i8 9, label %cond_next340 + i8 7, label %cond_next340 + i8 8, label %cond_next340 + i8 10, label %cond_next340 + ] + +cond_true288: ; preds = %cond_true226 + unreachable + +cond_next340: ; preds = %cond_true226, %cond_true226, %cond_true226, %cond_true226, %cond_true226, %bb140 + ret void + +bb478: ; preds = %cond_next57 + br i1 false, label %cond_next500, label %cond_true497 + +cond_true497: ; preds = %bb478 + unreachable + +cond_next500: ; preds = %bb478 + %tmp513 = load i32* null, align 8 ; [#uses=1] + %tmp545 = and i32 %tmp513, 8192 ; [#uses=1] + %tmp547 = and i32 %tmp32, -8193 ; [#uses=1] + %tmp548 = or i32 %tmp547, %tmp545 ; [#uses=1] + store i32 %tmp548, i32* null, align 8 + ret void + +UnifiedReturnBlock: ; preds = %cond_next57, %entry + ret void +} From baldrick at free.fr Thu Oct 18 03:07:22 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 18 Oct 2007 10:07:22 +0200 Subject: [llvm-commits] [llvm] r43083 - in /llvm/trunk: lib/Transforms/IPO/RaiseAllocations.cpp test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll In-Reply-To: <200710172012.l9HKCwoJ015392@zion.cs.uiuc.edu> References: <200710172012.l9HKCwoJ015392@zion.cs.uiuc.edu> Message-ID: <200710181007.26325.baldrick@free.fr> Hi Devang, > Do not raise free() call that is called through invoke instruction. why not? As far as I know free cannot raise an exception, and we don't support trapping exceptions for the moment. Ciao, Duncan. From baldrick at free.fr Thu Oct 18 03:11:53 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 18 Oct 2007 10:11:53 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> Message-ID: <200710181011.56463.baldrick@free.fr> Hi Bill, > When ObjC is using SJLJ exceptions, don't create an unwind basic block is this to avoid calling "unwind resume"? Do SJLJ exceptions actually work with ObjC - I thought LLVM support was needed for sjlj exceptions (I only looked at 4.2 though). Thanks, Duncan. From baldrick at free.fr Thu Oct 18 03:22:19 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 18 Oct 2007 08:22:19 -0000 Subject: [llvm-commits] [llvm] r43119 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710180822.l9I8MK4A023770@zion.cs.uiuc.edu> Author: baldrick Date: Thu Oct 18 03:22:16 2007 New Revision: 43119 URL: http://llvm.org/viewvc/llvm-project?rev=43119&view=rev Log: Support for ADDC/SUBC. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43119&r1=43118&r2=43119&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 03:22:16 2007 @@ -145,6 +145,7 @@ void ExpandResult_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_ADDSUBC (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SELECT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SELECT_CC (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_MUL (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -547,8 +548,8 @@ N->getSrcValue(), N->getSrcValueOffset(), N->getLoadedVT(), N->isVolatile(), N->getAlignment()); - - // Legalized the chain result, switching anything that used the old chain to + + // Legalized the chain result - switch anything that used the old chain to // use the new one. ReplaceLegalValueWith(SDOperand(N, 1), Res.getValue(1)); return Res; @@ -610,6 +611,8 @@ case ISD::XOR: ExpandResult_Logical(N, Lo, Hi); break; case ISD::ADD: case ISD::SUB: ExpandResult_ADDSUB(N, Lo, Hi); break; + case ISD::ADDC: + case ISD::SUBC: ExpandResult_ADDSUBC(N, Lo, Hi); break; case ISD::SELECT: ExpandResult_SELECT(N, Lo, Hi); break; case ISD::SELECT_CC: ExpandResult_SELECT_CC(N, Lo, Hi); break; case ISD::MUL: ExpandResult_MUL(N, Lo, Hi); break; @@ -759,7 +762,7 @@ } } - // Legalized the chain result, switching anything that used the old chain to + // Legalized the chain result - switch anything that used the old chain to // use the new one. ReplaceLegalValueWith(SDOperand(N, 1), Ch); } @@ -823,11 +826,9 @@ GetExpandedOp(N->getOperand(0), LHSL, LHSH); GetExpandedOp(N->getOperand(1), RHSL, RHSH); SDVTList VTList = DAG.getVTList(LHSL.getValueType(), MVT::Flag); - SDOperand LoOps[2], HiOps[3]; - LoOps[0] = LHSL; - LoOps[1] = RHSL; - HiOps[0] = LHSH; - HiOps[1] = RHSH; + SDOperand LoOps[2] = { LHSL, RHSL }; + SDOperand HiOps[3] = { LHSH, RHSH }; + if (N->getOpcode() == ISD::ADD) { Lo = DAG.getNode(ISD::ADDC, VTList, LoOps, 2); HiOps[2] = Lo.getValue(1); @@ -839,6 +840,30 @@ } } +void DAGTypeLegalizer::ExpandResult_ADDSUBC(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + // Expand the subcomponents. + SDOperand LHSL, LHSH, RHSL, RHSH; + GetExpandedOp(N->getOperand(0), LHSL, LHSH); + GetExpandedOp(N->getOperand(1), RHSL, RHSH); + SDVTList VTList = DAG.getVTList(LHSL.getValueType(), MVT::Flag); + SDOperand LoOps[2] = { LHSL, RHSL }; + SDOperand HiOps[3] = { LHSH, RHSH }; + + if (N->getOpcode() == ISD::ADDC) { + Lo = DAG.getNode(ISD::ADDC, VTList, LoOps, 2); + HiOps[2] = Lo.getValue(1); + Hi = DAG.getNode(ISD::ADDE, VTList, HiOps, 3); + } else { + Lo = DAG.getNode(ISD::SUBC, VTList, LoOps, 2); + HiOps[2] = Lo.getValue(1); + Hi = DAG.getNode(ISD::SUBE, VTList, HiOps, 3); + } + + // Legalized the flag result - switch anything that used the old flag to + // use the new one. + ReplaceLegalValueWith(SDOperand(N, 1), Hi.getValue(1)); +} void DAGTypeLegalizer::ExpandResult_MUL(SDNode *N, SDOperand &Lo, SDOperand &Hi) { From isanbard at gmail.com Thu Oct 18 03:32:40 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 08:32:40 -0000 Subject: [llvm-commits] [llvm] r43120 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll Message-ID: <200710180832.l9I8WfGI024162@zion.cs.uiuc.edu> Author: void Date: Thu Oct 18 03:32:37 2007 New Revision: 43120 URL: http://llvm.org/viewvc/llvm-project?rev=43120&view=rev Log: Pointer arithmetic should be done with the index the same size as the pointer. Added: llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43120&r1=43119&r2=43120&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 18 03:32:37 2007 @@ -4134,6 +4134,13 @@ unsigned EltSize = MVT::getSizeInBits(Op.getValueType())/8; Idx = DAG.getNode(ISD::MUL, Idx.getValueType(), Idx, DAG.getConstant(EltSize, Idx.getValueType())); + + if (MVT::getSizeInBits(Idx.getValueType()) > + MVT::getSizeInBits(TLI.getPointerTy())) + Idx = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), StackPtr); + else + Idx = DAG.getNode(ISD::SIGN_EXTEND, TLI.getPointerTy(), StackPtr); + StackPtr = DAG.getNode(ISD::ADD, Idx.getValueType(), Idx, StackPtr); Op = DAG.getLoad(Op.getValueType(), Ch, StackPtr, NULL, 0); Added: llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll?rev=43120&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll Thu Oct 18 03:32:37 2007 @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llc -march=ppc64 -mattr=+altivec + %struct.inoutprops = type <{ i8, [3 x i8] }> + +define void @bork(float* %argA, float* %argB, float* %res, i8 %inoutspec.0) { +entry: + %.mask = and i8 %inoutspec.0, -16 ; [#uses=1] + %tmp6 = icmp eq i8 %.mask, 16 ; [#uses=1] + br i1 %tmp6, label %cond_true, label %UnifiedReturnBlock + +cond_true: ; preds = %entry + %tmp89 = bitcast float* %res to <4 x i32>* ; <<4 x i32>*> [#uses=1] + %tmp1011 = bitcast float* %argA to <4 x i32>* ; <<4 x i32>*> [#uses=1] + %tmp14 = load <4 x i32>* %tmp1011, align 16 ; <<4 x i32>> [#uses=1] + %tmp1516 = bitcast float* %argB to <4 x i32>* ; <<4 x i32>*> [#uses=1] + %tmp18 = load <4 x i32>* %tmp1516, align 16 ; <<4 x i32>> [#uses=1] + %tmp19 = sdiv <4 x i32> %tmp14, %tmp18 ; <<4 x i32>> [#uses=1] + store <4 x i32> %tmp19, <4 x i32>* %tmp89, align 16 + ret void + +UnifiedReturnBlock: ; preds = %entry + ret void +} From isanbard at gmail.com Thu Oct 18 03:43:56 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 01:43:56 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710181011.56463.baldrick@free.fr> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <200710181011.56463.baldrick@free.fr> Message-ID: Hi Duncan, >> When ObjC is using SJLJ exceptions, don't create an unwind basic >> block > > is this to avoid calling "unwind resume"? Do SJLJ exceptions actually > work with ObjC - I thought LLVM support was needed for sjlj exceptions > (I only looked at 4.2 though). > Yes, it's to avoid calling the "unwind resume". Non-64-bit Objective- C uses the "old" sjlj-style exceptions. As far as I know, llvm-gcc 4.0 handles the sjlj exceptions alright -- obj-act.c creates the code to emulate sjlj calls, so there's nothing special going on. I haven't looked at 4.2 yet, so it may need tweaking there. -bw From baldrick at free.fr Thu Oct 18 03:45:08 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 18 Oct 2007 10:45:08 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <16e5fdf90710171515y146cfde4n252baeaabb6f32c7@mail.gmail.com> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <16e5fdf90710171515y146cfde4n252baeaabb6f32c7@mail.gmail.com> Message-ID: <200710181045.08484.baldrick@free.fr> > > Thanks Bill, the patch looks fine. This needs a testcase and needs > > to be applied to 4.2 if it has the same problem, > > > Will do. In 4.2 the unwind-resume function is configurable. For objc with SJLJ exceptions it should be _Unwind_SjLj_Resume. If this is not correct for objc, this can be changed in objc_init_exceptions. Ciao, Duncan. From isanbard at gmail.com Thu Oct 18 03:56:40 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 01:56:40 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710181045.08484.baldrick@free.fr> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <16e5fdf90710171515y146cfde4n252baeaabb6f32c7@mail.gmail.com> <200710181045.08484.baldrick@free.fr> Message-ID: On Oct 18, 2007, at 1:45 AM, Duncan Sands wrote: >>> Thanks Bill, the patch looks fine. This needs a testcase and needs >>> to be applied to 4.2 if it has the same problem, >>> >> Will do. > > In 4.2 the unwind-resume function is configurable. For objc with > SJLJ > exceptions it should be _Unwind_SjLj_Resume. If this is not > correct for > objc, this can be changed in objc_init_exceptions. > In the case of this fix, we don't want to use even _Unwind_SjLj_Resume (it's what I tried initially and got the same type of error). -bw From baldrick at free.fr Thu Oct 18 04:14:35 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 18 Oct 2007 11:14:35 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <200710181045.08484.baldrick@free.fr> Message-ID: <200710181114.35882.baldrick@free.fr> On Thursday 18 October 2007 10:56:40 Bill Wendling wrote: > On Oct 18, 2007, at 1:45 AM, Duncan Sands wrote: > > >>> Thanks Bill, the patch looks fine. This needs a testcase and needs > >>> to be applied to 4.2 if it has the same problem, > >>> > >> Will do. > > > > In 4.2 the unwind-resume function is configurable. For objc with > > SJLJ > > exceptions it should be _Unwind_SjLj_Resume. If this is not > > correct for > > objc, this can be changed in objc_init_exceptions. > > > In the case of this fix, we don't want to use even > _Unwind_SjLj_Resume (it's what I tried initially and got the same > type of error). So how do you continue unwinding exceptions? If code should never get to the unwind block then you can always make the unwind-resume function be a call to abort() for objc with sjlj. That said, I suggest you read the comments in ada/raise.c starting from line 368 (llvm-gcc-4.0). I would be amazed if sjlj really works without proper tables, except in easy cases. Best wishes, Duncan. From gordonhenriksen at mac.com Thu Oct 18 06:31:21 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 18 Oct 2007 11:31:21 -0000 Subject: [llvm-commits] [llvm] r43121 - /llvm/trunk/include/llvm/Target/TargetMachineRegistry.h Message-ID: <200710181131.l9IBVLe3000696@zion.cs.uiuc.edu> Author: gordon Date: Thu Oct 18 06:31:21 2007 New Revision: 43121 URL: http://llvm.org/viewvc/llvm-project?rev=43121&view=rev Log: Missing 'public' keyword. Modified: llvm/trunk/include/llvm/Target/TargetMachineRegistry.h Modified: llvm/trunk/include/llvm/Target/TargetMachineRegistry.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachineRegistry.h?rev=43121&r1=43120&r2=43121&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetMachineRegistry.h (original) +++ llvm/trunk/include/llvm/Target/TargetMachineRegistry.h Thu Oct 18 06:31:21 2007 @@ -48,7 +48,7 @@ static const char *descof(const entry &Entry) { return Entry.ShortDesc; } }; - struct TargetMachineRegistry : Registry { + struct TargetMachineRegistry : public Registry { /// getClosestStaticTargetForModule - Given an LLVM module, pick the best /// target that is compatible with the module. If no close target can be /// found, this returns null and sets the Error string to a reason. From gordonhenriksen at mac.com Thu Oct 18 06:53:05 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 18 Oct 2007 11:53:05 -0000 Subject: [llvm-commits] [llvm] r43122 - /llvm/trunk/lib/Target/TargetMachineRegistry.cpp Message-ID: <200710181153.l9IBr5ur001500@zion.cs.uiuc.edu> Author: gordon Date: Thu Oct 18 06:53:05 2007 New Revision: 43122 URL: http://llvm.org/viewvc/llvm-project?rev=43122&view=rev Log: Work around downrev gccs which do not inherit visibility of the Registry<>::iterator member class. Modified: llvm/trunk/lib/Target/TargetMachineRegistry.cpp Modified: llvm/trunk/lib/Target/TargetMachineRegistry.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachineRegistry.cpp?rev=43122&r1=43121&r2=43122&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachineRegistry.cpp (original) +++ llvm/trunk/lib/Target/TargetMachineRegistry.cpp Thu Oct 18 06:53:05 2007 @@ -32,7 +32,7 @@ TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M, std::string &Error) { std::vector > UsableTargets; - for (iterator I = begin(), E = end(); I != E; ++I) + for (Registry::iterator I = begin(), E = end(); I != E; ++I) if (unsigned Qual = I->ModuleMatchQualityFn(M)) UsableTargets.push_back(std::make_pair(Qual, &*I)); @@ -60,7 +60,7 @@ const TargetMachineRegistry::entry * TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) { std::vector > UsableTargets; - for (iterator I = begin(), E = end(); I != E; ++I) + for (Registry::iterator I = begin(), E = end(); I != E; ++I) if (unsigned Qual = I->JITMatchQualityFn()) UsableTargets.push_back(std::make_pair(Qual, &*I)); From hartmut.kaiser at gmail.com Thu Oct 18 07:31:51 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Thu, 18 Oct 2007 12:31:51 -0000 Subject: [llvm-commits] [llvm] r43123 - /llvm/trunk/win32/Support/Support.vcproj Message-ID: <200710181231.l9ICVpN9004047@zion.cs.uiuc.edu> Author: hkaiser Date: Thu Oct 18 07:31:51 2007 New Revision: 43123 URL: http://llvm.org/viewvc/llvm-project?rev=43123&view=rev Log: Updated VC++ build system Modified: llvm/trunk/win32/Support/Support.vcproj Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=43123&r1=43122&r2=43123&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Thu Oct 18 07:31:51 2007 @@ -276,6 +276,10 @@ > + + From hartmut.kaiser at gmail.com Thu Oct 18 07:47:23 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Thu, 18 Oct 2007 07:47:23 -0500 Subject: [llvm-commits] [llvm] r43115 - in /llvm/trunk: include/llvm/Analysis/DominatorInternals.h include/llvm/Analysis/Dominators.h lib/Transforms/Utils/CodeExtractor.cpp lib/Transforms/Utils/LoopSimplify.cpp In-Reply-To: <200710180513.l9I5DrOv008090@zion.cs.uiuc.edu> References: <200710180513.l9I5DrOv008090@zion.cs.uiuc.edu> Message-ID: <033b01c81185$082e1720$0701a8c0@slartibartfast> Owen, Everything seems to be fine now. Thanks! Regards Hartmut > -----Original Message----- > From: llvm-commits-bounces at cs.uiuc.edu > [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Owen Anderson > Sent: Thursday, October 18, 2007 12:14 AM > To: llvm-commits at cs.uiuc.edu > Subject: [llvm-commits] [llvm] r43115 - in /llvm/trunk: > include/llvm/Analysis/DominatorInternals.h > include/llvm/Analysis/Dominators.h > lib/Transforms/Utils/CodeExtractor.cpp > lib/Transforms/Utils/LoopSimplify.cpp > > Author: resistor > Date: Thu Oct 18 00:13:52 2007 > New Revision: 43115 > > URL: http://llvm.org/viewvc/llvm-project?rev=43115&view=rev > Log: > Move Split<...>() into DomTreeBase. This should make the > #include's of DominatorInternals.h in CodeExtractor and > LoopSimplify unnecessary. > > Hartmut, could you confirm that this fixes the issues you were seeing? > > Modified: > llvm/trunk/include/llvm/Analysis/DominatorInternals.h > llvm/trunk/include/llvm/Analysis/Dominators.h > llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp > llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp > > Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/An alysis/DominatorInternals.h?rev=43115&r1=43114&r2=43115> &view=diff > > ============================================================== > ================ > --- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original) > +++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Thu Oct 18 > +++ 00:13:52 2007 > @@ -303,93 +303,6 @@ > DT.DFSInfoValid = false; > } > > -// NewBB is split and now it has one successor. Update > dominator tree to -// reflect this change. > -template > -void Split(DominatorTreeBase& DT, > - typename GraphT::NodeType* NewBB) { > - assert(std::distance(GraphT::child_begin(NewBB), > GraphT::child_end(NewBB)) == 1 > - && "NewBB should have a single successor!"); > - typename GraphT::NodeType* NewBBSucc = *GraphT::child_begin(NewBB); > - > - std::vector PredBlocks; > - for (typename GraphTraits >::ChildIteratorType PI = > - GraphTraits >::child_begin(NewBB), > - PE = GraphTraits >::child_end(NewBB); > PI != PE; ++PI) > - PredBlocks.push_back(*PI); > - > - assert(!PredBlocks.empty() && "No predblocks??"); > - > - // The newly inserted basic block will dominate existing > basic blocks iff the > - // PredBlocks dominate all of the non-pred blocks. If > all predblocks dominate > - // the non-pred blocks, then they all must be the same block! > - // > - bool NewBBDominatesNewBBSucc = true; > - { > - typename GraphT::NodeType* OnePred = PredBlocks[0]; > - unsigned i = 1, e = PredBlocks.size(); > - for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) { > - assert(i != e && "Didn't find reachable pred?"); > - OnePred = PredBlocks[i]; > - } > - > - for (; i != e; ++i) > - if (PredBlocks[i] != OnePred && > DT.isReachableFromEntry(OnePred)) { > - NewBBDominatesNewBBSucc = false; > - break; > - } > - > - if (NewBBDominatesNewBBSucc) > - for (typename GraphTraits > >::ChildIteratorType PI = > - GraphTraits >::child_begin(NewBBSucc), > - E = GraphTraits > >::child_end(NewBBSucc); PI != E; ++PI) > - if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { > - NewBBDominatesNewBBSucc = false; > - break; > - } > - } > - > - // The other scenario where the new block can dominate its > successors are when > - // all predecessors of NewBBSucc that are not NewBB are > dominated by NewBBSucc > - // already. > - if (!NewBBDominatesNewBBSucc) { > - NewBBDominatesNewBBSucc = true; > - for (typename GraphTraits > >::ChildIteratorType PI = > - GraphTraits >::child_begin(NewBBSucc), > - E = GraphTraits > >::child_end(NewBBSucc); PI != E; ++PI) > - if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { > - NewBBDominatesNewBBSucc = false; > - break; > - } > - } > - > - // Find NewBB's immediate dominator and create new > dominator tree node for > - // NewBB. > - BasicBlock *NewBBIDom = 0; > - unsigned i = 0; > - for (i = 0; i < PredBlocks.size(); ++i) > - if (DT.isReachableFromEntry(PredBlocks[i])) { > - NewBBIDom = PredBlocks[i]; > - break; > - } > - assert(i != PredBlocks.size() && "No reachable preds?"); > - for (i = i + 1; i < PredBlocks.size(); ++i) { > - if (DT.isReachableFromEntry(PredBlocks[i])) > - NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, > PredBlocks[i]); > - } > - assert(NewBBIDom && "No immediate dominator found??"); > - > - // Create the new dominator tree node... and set the idom of NewBB. > - DomTreeNode *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom); > - > - // If NewBB strictly dominates other blocks, then it is > now the immediate > - // dominator of NewBBSucc. Update the dominator tree as > appropriate. > - if (NewBBDominatesNewBBSucc) { > - DomTreeNode *NewBBSuccNode = DT.getNode(NewBBSucc); > - DT.changeImmediateDominator(NewBBSuccNode, NewBBNode); > - } > -} > - > } > > #endif > > Modified: llvm/trunk/include/llvm/Analysis/Dominators.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/An alysis/Dominators.h?rev=43115&r1=43114&r2=43115&view=diff > > ============================================================== > ================ > --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) > +++ llvm/trunk/include/llvm/Analysis/Dominators.h Thu Oct 18 00:13:52 > +++ 2007 > @@ -202,6 +202,93 @@ > Vertex.clear(); > RootNode = 0; > } > + > + // NewBB is split and now it has one successor. Update > dominator tree > + to // reflect this change. > + template > + void Split(DominatorTreeBase& DT, > + typename GraphT::NodeType* NewBB) { > + assert(std::distance(GraphT::child_begin(NewBB), > GraphT::child_end(NewBB)) == 1 > + && "NewBB should have a single successor!"); > + typename GraphT::NodeType* NewBBSucc = > *GraphT::child_begin(NewBB); > + > + std::vector PredBlocks; > + for (typename GraphTraits >::ChildIteratorType PI = > + GraphTraits >::child_begin(NewBB), > + PE = GraphTraits >::child_end(NewBB); PI > != PE; ++PI) > + PredBlocks.push_back(*PI); > + > + assert(!PredBlocks.empty() && "No predblocks??"); > + > + // The newly inserted basic block will dominate > existing basic blocks iff the > + // PredBlocks dominate all of the non-pred blocks. If > all predblocks dominate > + // the non-pred blocks, then they all must be the same block! > + // > + bool NewBBDominatesNewBBSucc = true; > + { > + typename GraphT::NodeType* OnePred = PredBlocks[0]; > + unsigned i = 1, e = PredBlocks.size(); > + for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) { > + assert(i != e && "Didn't find reachable pred?"); > + OnePred = PredBlocks[i]; > + } > + > + for (; i != e; ++i) > + if (PredBlocks[i] != OnePred && > DT.isReachableFromEntry(OnePred)) { > + NewBBDominatesNewBBSucc = false; > + break; > + } > + > + if (NewBBDominatesNewBBSucc) > + for (typename GraphTraits > >::ChildIteratorType PI = > + GraphTraits >::child_begin(NewBBSucc), > + E = GraphTraits > >::child_end(NewBBSucc); PI != E; ++PI) > + if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { > + NewBBDominatesNewBBSucc = false; > + break; > + } > + } > + > + // The other scenario where the new block can dominate > its successors are when > + // all predecessors of NewBBSucc that are not NewBB are > dominated by NewBBSucc > + // already. > + if (!NewBBDominatesNewBBSucc) { > + NewBBDominatesNewBBSucc = true; > + for (typename GraphTraits >::ChildIteratorType PI = > + GraphTraits >::child_begin(NewBBSucc), > + E = GraphTraits > >::child_end(NewBBSucc); PI != E; ++PI) > + if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) { > + NewBBDominatesNewBBSucc = false; > + break; > + } > + } > + > + // Find NewBB's immediate dominator and create new > dominator tree node for > + // NewBB. > + BasicBlock *NewBBIDom = 0; > + unsigned i = 0; > + for (i = 0; i < PredBlocks.size(); ++i) > + if (DT.isReachableFromEntry(PredBlocks[i])) { > + NewBBIDom = PredBlocks[i]; > + break; > + } > + assert(i != PredBlocks.size() && "No reachable preds?"); > + for (i = i + 1; i < PredBlocks.size(); ++i) { > + if (DT.isReachableFromEntry(PredBlocks[i])) > + NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, > PredBlocks[i]); > + } > + assert(NewBBIDom && "No immediate dominator found??"); > + > + // Create the new dominator tree node... and set the > idom of NewBB. > + DomTreeNode *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom); > + > + // If NewBB strictly dominates other blocks, then it is > now the immediate > + // dominator of NewBBSucc. Update the dominator tree as > appropriate. > + if (NewBBDominatesNewBBSucc) { > + DomTreeNode *NewBBSuccNode = DT.getNode(NewBBSucc); > + DT.changeImmediateDominator(NewBBSuccNode, NewBBNode); > + } > + } > > public: > DominatorTreeBase(intptr_t ID, bool isPostDom) @@ -425,6 +512,15 @@ > assert(getNode(BB) && "Removing node that isn't in > dominator tree."); > DomTreeNodes.erase(BB); > } > + > + /// splitBlock - BB is split and now it has one successor. Update > + dominator /// tree to reflect this change. > + void splitBlock(NodeT* NewBB) { > + if (this->IsPostDominators) > + Split, GraphTraits > > >(*this, NewBB); > + else > + Split >(*this, NewBB); } > > /// print - Convert to human readable form > /// > @@ -471,21 +567,6 @@ > friend void Calculate(DominatorTreeBase GraphT::NodeType>& DT, > Function& F); > > - template > - friend void Split(DominatorTreeBase& DT, > - typename GraphT::NodeType* NewBB); > - > -public: > - /// splitBlock - BB is split and now it has one successor. > Update dominator > - /// tree to reflect this change. > - void splitBlock(NodeT* NewBB) { > - if (this->IsPostDominators) > - Split, GraphTraits > > >(*this, NewBB); > - else > - Split >(*this, NewBB); > - } > - > -protected: > /// updateDFSNumbers - Assign In and Out numbers to the > nodes while walking > /// dominator tree in dfs order. > void updateDFSNumbers() { > > Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ Utils/CodeExtractor.cpp?rev=43115&r1=43114&r2=43115&view=diff > > ============================================================== > ================ > --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Thu Oct 18 > +++ 00:13:52 2007 > @@ -21,7 +21,6 @@ > #include "llvm/Module.h" > #include "llvm/Pass.h" > #include "llvm/Analysis/Dominators.h" > -#include "llvm/Analysis/DominatorInternals.h" > #include "llvm/Analysis/LoopInfo.h" > #include "llvm/Analysis/Verifier.h" > #include "llvm/Transforms/Utils/BasicBlockUtils.h" > > Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ Utils/LoopSimplify.cpp?rev=43115&r1=43114&r2=43115&view=diff > > ============================================================== > ================ > --- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Thu Oct > 18 00:13:52 > +++ 2007 > @@ -40,7 +40,6 @@ > #include "llvm/Type.h" > #include "llvm/Analysis/AliasAnalysis.h" > #include "llvm/Analysis/Dominators.h" > -#include "llvm/Analysis/DominatorInternals.h" > #include "llvm/Analysis/LoopInfo.h" > #include "llvm/Support/CFG.h" > #include "llvm/Support/Compiler.h" > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu Oct 18 10:50:03 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 08:50:03 -0700 Subject: [llvm-commits] [llvm] r43120 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll In-Reply-To: <200710180832.l9I8WfGI024162@zion.cs.uiuc.edu> References: <200710180832.l9I8WfGI024162@zion.cs.uiuc.edu> Message-ID: <77530149-0699-4D31-BBCC-28E1E60C46A7@apple.com> On Oct 18, 2007, at 1:32 AM, Bill Wendling wrote: > Author: void > Date: Thu Oct 18 03:32:37 2007 > New Revision: 43120 > > URL: http://llvm.org/viewvc/llvm-project?rev=43120&view=rev > Log: > Pointer arithmetic should be done with the index the same size as > the pointer. Nice catch Bill. Should this use sign extend or zero extend if the value is too small? It seems like zext would be more appropriate, -Chris > > Added: > llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ > SelectionDAG/LegalizeDAG.cpp?rev=43120&r1=43119&r2=43120&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 18 > 03:32:37 2007 > @@ -4134,6 +4134,13 @@ > unsigned EltSize = MVT::getSizeInBits(Op.getValueType())/8; > Idx = DAG.getNode(ISD::MUL, Idx.getValueType(), Idx, > DAG.getConstant(EltSize, Idx.getValueType())); > + > + if (MVT::getSizeInBits(Idx.getValueType()) > > + MVT::getSizeInBits(TLI.getPointerTy())) > + Idx = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), StackPtr); > + else > + Idx = DAG.getNode(ISD::SIGN_EXTEND, TLI.getPointerTy(), > StackPtr); > + > StackPtr = DAG.getNode(ISD::ADD, Idx.getValueType(), Idx, > StackPtr); > > Op = DAG.getLoad(Op.getValueType(), Ch, StackPtr, NULL, 0); > > Added: llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ > PowerPC/2007-10-18-PtrArithmetic.ll?rev=43120&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll > (added) > +++ llvm/trunk/test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll Thu > Oct 18 03:32:37 2007 > @@ -0,0 +1,22 @@ > +; RUN: llvm-as < %s | llc -march=ppc64 -mattr=+altivec > + %struct.inoutprops = type <{ i8, [3 x i8] }> > + > +define void @bork(float* %argA, float* %argB, float* %res, i8 % > inoutspec.0) { > +entry: > + %.mask = and i8 %inoutspec.0, -16 ; [#uses=1] > + %tmp6 = icmp eq i8 %.mask, 16 ; [#uses=1] > + br i1 %tmp6, label %cond_true, label %UnifiedReturnBlock > + > +cond_true: ; preds = %entry > + %tmp89 = bitcast float* %res to <4 x i32>* ; <<4 x i32>*> [#uses=1] > + %tmp1011 = bitcast float* %argA to <4 x i32>* ; <<4 x i32>*> > [#uses=1] > + %tmp14 = load <4 x i32>* %tmp1011, align 16 ; <<4 x i32>> [#uses=1] > + %tmp1516 = bitcast float* %argB to <4 x i32>* ; <<4 x i32>*> > [#uses=1] > + %tmp18 = load <4 x i32>* %tmp1516, align 16 ; <<4 x i32>> [#uses=1] > + %tmp19 = sdiv <4 x i32> %tmp14, %tmp18 ; <<4 x i32>> [#uses=1] > + store <4 x i32> %tmp19, <4 x i32>* %tmp89, align 16 > + ret void > + > +UnifiedReturnBlock: ; preds = %entry > + ret void > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu Oct 18 10:51:11 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 08:51:11 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710181114.35882.baldrick@free.fr> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <200710181045.08484.baldrick@free.fr> <200710181114.35882.baldrick@free.fr> Message-ID: <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> >> In the case of this fix, we don't want to use even >> _Unwind_SjLj_Resume (it's what I tried initially and got the same >> type of error). > > So how do you continue unwinding exceptions? If code should never > get to the unwind block then you can always make the unwind-resume > function be a call to abort() for objc with sjlj. That said, I > suggest you read the comments in ada/raise.c starting from line 368 > (llvm-gcc-4.0). I would be amazed if sjlj really works without > proper tables, except in easy cases. I think the objc front-end is emitting the setjmp/longjmp calls itself directly, not relying on the rest of the GCC EH mechanisms... -Chris From sabre at nondot.org Thu Oct 18 10:54:46 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 15:54:46 -0000 Subject: [llvm-commits] [llvm] r43126 - /llvm/trunk/utils/TableGen/Makefile Message-ID: <200710181554.l9IFskU3012716@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 10:54:45 2007 New Revision: 43126 URL: http://llvm.org/viewvc/llvm-project?rev=43126&view=rev Log: tblgen uses dynamic_cast heavily, so it needs rtti info Modified: llvm/trunk/utils/TableGen/Makefile Modified: llvm/trunk/utils/TableGen/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Makefile?rev=43126&r1=43125&r2=43126&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Makefile (original) +++ llvm/trunk/utils/TableGen/Makefile Thu Oct 18 10:54:45 2007 @@ -14,6 +14,7 @@ EXTRA_DIST = FileLexer.cpp.cvs FileLexer.l.cvs \ FileParser.cpp.cvs FileParser.h.cvs FileParser.y.cvs REQUIRES_EH := 1 +REQUIRES_RTTI := 1 include $(LEVEL)/Makefile.common From sabre at nondot.org Thu Oct 18 10:57:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 15:57:29 -0000 Subject: [llvm-commits] [llvm] r43127 - /llvm/trunk/lib/Support/Makefile Message-ID: <200710181557.l9IFvTxN012803@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 10:57:29 2007 New Revision: 43127 URL: http://llvm.org/viewvc/llvm-project?rev=43127&view=rev Log: This requires rtti info because tblgen uses commandline, and tblgen requires rtti. Modified: llvm/trunk/lib/Support/Makefile Modified: llvm/trunk/lib/Support/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Makefile?rev=43127&r1=43126&r2=43127&view=diff ============================================================================== --- llvm/trunk/lib/Support/Makefile (original) +++ llvm/trunk/lib/Support/Makefile Thu Oct 18 10:57:29 2007 @@ -1,4 +1,4 @@ -##===- lib/Support/Makefile ------------------------------*- Makefile -*-===## +##===- lib/Support/Makefile --------------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -11,4 +11,7 @@ LIBRARYNAME = LLVMSupport BUILD_ARCHIVE = 1 +## FIXME: This only requires RTTI because tblgen uses it. Fix that. +REQUIRES_RTTI = 1 + include $(LEVEL)/Makefile.common From sabre at nondot.org Thu Oct 18 11:10:18 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 16:10:18 -0000 Subject: [llvm-commits] [llvm] r43128 - /llvm/trunk/include/llvm/PassSupport.h Message-ID: <200710181610.l9IGAIWZ013244@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 11:10:17 2007 New Revision: 43128 URL: http://llvm.org/viewvc/llvm-project?rev=43128&view=rev Log: update comment. Modified: llvm/trunk/include/llvm/PassSupport.h Modified: llvm/trunk/include/llvm/PassSupport.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=43128&r1=43127&r2=43128&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassSupport.h (original) +++ llvm/trunk/include/llvm/PassSupport.h Thu Oct 18 11:10:17 2007 @@ -64,7 +64,7 @@ /// const char *getPassArgument() const { return PassArgument; } - /// getTypeInfo - Return the type_info object for the pass... + /// getTypeInfo - Return the id object for the pass... /// TODO : Rename intptr_t getTypeInfo() const { return PassID; } From sabre at nondot.org Thu Oct 18 11:10:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 16:10:48 -0000 Subject: [llvm-commits] [llvm] r43129 - /llvm/trunk/lib/VMCore/Instructions.cpp Message-ID: <200710181610.l9IGAmmo013266@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 11:10:48 2007 New Revision: 43129 URL: http://llvm.org/viewvc/llvm-project?rev=43129&view=rev Log: fix typo Modified: llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=43129&r1=43128&r2=43129&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Oct 18 11:10:48 2007 @@ -601,7 +601,7 @@ Amt = ConstantInt::get(Type::Int32Ty, 1); else { assert(!isa(Amt) && - "Passed basic block into allocation size parameter! Ue other ctor"); + "Passed basic block into allocation size parameter! Use other ctor"); assert(Amt->getType() == Type::Int32Ty && "Malloc/Allocation array size is not a 32-bit integer!"); } From sabre at nondot.org Thu Oct 18 11:11:18 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 16:11:18 -0000 Subject: [llvm-commits] [llvm] r43130 - /llvm/trunk/lib/VMCore/Pass.cpp Message-ID: <200710181611.l9IGBIte013291@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 11:11:18 2007 New Revision: 43130 URL: http://llvm.org/viewvc/llvm-project?rev=43130&view=rev Log: Reduce reliance on rtti info Modified: llvm/trunk/lib/VMCore/Pass.cpp Modified: llvm/trunk/lib/VMCore/Pass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=43130&r1=43129&r2=43130&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Pass.cpp (original) +++ llvm/trunk/lib/VMCore/Pass.cpp Thu Oct 18 11:11:18 2007 @@ -18,7 +18,6 @@ #include "llvm/ModuleProvider.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/TypeInfo.h" #include #include using namespace llvm; @@ -49,7 +48,7 @@ const char *Pass::getPassName() const { if (const PassInfo *PI = getPassInfo()) return PI->getPassName(); - return typeid(*this).name(); + return "Unnamed pass: implement Pass::getPassName()"; } // print - Print out the internal state of the pass. This is called by Analyze From sabre at nondot.org Thu Oct 18 11:12:54 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 16:12:54 -0000 Subject: [llvm-commits] [llvm] r43131 - /llvm/trunk/include/llvm/Support/TypeInfo.h Message-ID: <200710181612.l9IGCsJL013355@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 11:12:54 2007 New Revision: 43131 URL: http://llvm.org/viewvc/llvm-project?rev=43131&view=rev Log: remove dead file Removed: llvm/trunk/include/llvm/Support/TypeInfo.h Removed: llvm/trunk/include/llvm/Support/TypeInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TypeInfo.h?rev=43130&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/TypeInfo.h (original) +++ llvm/trunk/include/llvm/Support/TypeInfo.h (removed) @@ -1,76 +0,0 @@ -//===- llvm/Support/TypeInfo.h - Support for type_info objects -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This class makes std::type_info objects behave like first class objects that -// can be put in maps and hashtables. This code is based off of code in the -// Loki C++ library from the Modern C++ Design book. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_TYPEINFO_H -#define LLVM_SUPPORT_TYPEINFO_H - -#include - -namespace llvm { - -struct TypeInfo { - TypeInfo() { // needed for containers - struct Nil {}; // Anonymous class distinct from all others... - Info = &typeid(Nil); - } - - TypeInfo(const std::type_info &ti) : Info(&ti) { // non-explicit - } - - // Access for the wrapped std::type_info - const std::type_info &get() const { - return *Info; - } - - // Compatibility functions - bool before(const TypeInfo &rhs) const { - return Info->before(*rhs.Info) != 0; - } - const char *getClassName() const { - return Info->name(); - } - -private: - const std::type_info *Info; -}; - -// Comparison operators -inline bool operator==(const TypeInfo &lhs, const TypeInfo &rhs) { - return lhs.get() == rhs.get(); -} - -inline bool operator<(const TypeInfo &lhs, const TypeInfo &rhs) { - return lhs.before(rhs); -} - -inline bool operator!=(const TypeInfo &lhs, const TypeInfo &rhs) { - return !(lhs == rhs); -} - -inline bool operator>(const TypeInfo &lhs, const TypeInfo &rhs) { - return rhs < lhs; -} - -inline bool operator<=(const TypeInfo &lhs, const TypeInfo &rhs) { - return !(lhs > rhs); -} - -inline bool operator>=(const TypeInfo &lhs, const TypeInfo &rhs) { - return !(lhs < rhs); -} - -} // End llvm namespace - -#endif From sabre at nondot.org Thu Oct 18 11:26:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 16:26:25 -0000 Subject: [llvm-commits] [llvm] r43133 - /llvm/trunk/lib/VMCore/Constants.cpp Message-ID: <200710181626.l9IGQP7o013876@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 11:26:24 2007 New Revision: 43133 URL: http://llvm.org/viewvc/llvm-project?rev=43133&view=rev Log: this doesn't need dynamic_cast. Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=43133&r1=43132&r2=43133&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Thu Oct 18 11:26:24 2007 @@ -580,7 +580,7 @@ } unsigned ConstantExpr::getPredicate() const { assert(getOpcode() == Instruction::FCmp || getOpcode() == Instruction::ICmp); - return dynamic_cast(this)->predicate; + return ((const CompareConstantExpr*)this)->predicate; } Constant *ConstantExpr::getShl(Constant *C1, Constant *C2) { return get(Instruction::Shl, C1, C2); From dpatel at apple.com Thu Oct 18 11:36:16 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 18 Oct 2007 09:36:16 -0700 Subject: [llvm-commits] [llvm] r43083 - in /llvm/trunk: lib/Transforms/IPO/RaiseAllocations.cpp test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll In-Reply-To: <200710181007.26325.baldrick@free.fr> References: <200710172012.l9HKCwoJ015392@zion.cs.uiuc.edu> <200710181007.26325.baldrick@free.fr> Message-ID: <4B75DE21-653F-4BFF-8811-1E9F6155FE1A@apple.com> On Oct 18, 2007, at 1:07 AM, Duncan Sands wrote: > Hi Devang, > >> Do not raise free() call that is called through invoke instruction. > why not? As far as I know free cannot raise an exception, If this is guaranteed then raiseallocs needs to do cleanup and break link between bb with inovke .. at free(..) and corresponding unwind block (remove PHI nodes' incoming edge). > and we > don't support trapping exceptions for the moment. > > Ciao, > > Duncan. - Devang From dalej at apple.com Thu Oct 18 11:57:42 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 18 Oct 2007 16:57:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43134 - in /llvm-gcc-4.0/trunk/gcc/config/rs6000: darwin-ldouble.c darwin-libgcc.10.4.ver darwin-libgcc.10.5.ver darwin.h Message-ID: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> Author: johannes Date: Thu Oct 18 11:57:42 2007 New Revision: 43134 URL: http://llvm.org/viewvc/llvm-project?rev=43134&view=rev Log: Enable 128-bit long double on PPC darwin. Remove hacks in library functions and build which worked around its absence. This changes the ABI. Also note that some functions in libgcc now have a different interface, so make sure you build and pick up the right ones. Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-ldouble.c llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin.h Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-ldouble.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-ldouble.c?rev=43134&r1=43133&r2=43134&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-ldouble.c (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-ldouble.c Thu Oct 18 11:57:42 2007 @@ -147,11 +147,7 @@ /* Sum terms of two highest orders. */ /* Use fused multiply-add to get low part of a * c. */ -/* APPLE LOCAL begin LLVM */ -#ifndef __llvm__ /* FIXME: no long double support! */ asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); -#endif -/* APPLE LOCAL end LLVM */ v = a*d; w = b*c; tau += v + w; /* Add in other second-order terms. */ @@ -184,11 +180,7 @@ numerically necessary. */ /* Use fused multiply-add to get low part of c * t. */ -/* APPLE LOCAL begin LLVM */ -#ifndef __llvm__ /* FIXME: no long double support! */ asm ("fmsub %0,%1,%2,%3" : "=f"(sigma) : "f"(c), "f"(t), "f"(s)); -#endif -/* APPLE LOCAL end LLVM */ v = a - s; tau = ((v-sigma)+w)/c; /* Correction to t. */ Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver?rev=43134&r1=43133&r2=43134&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver Thu Oct 18 11:57:42 2007 @@ -36,18 +36,15 @@ ___ffsdi2 ___fixdfdi ___fixsfdi -# APPLE LOCAL LLVM FIXME! -#___fixtfdi +___fixtfdi ___fixunsdfdi ___fixunsdfsi ___fixunssfdi ___fixunssfsi -# APPLE LOCAL LLVM FIXME! -#___fixunstfdi +___fixunstfdi ___floatdidf ___floatdisf -# APPLE LOCAL LLVM FIXME! -#___floatditf +___floatditf ___gcc_personality_v0 ___gcc_qadd ___gcc_qdiv Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver?rev=43134&r1=43133&r2=43134&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver Thu Oct 18 11:57:42 2007 @@ -34,24 +34,20 @@ ___divdc3 ___divdi3 ___divsc3 -# APPLE LOCAL LLVM FIXME! -#___divtc3 +___divtc3 ___enable_execute_stack ___ffsdi2 ___fixdfdi ___fixsfdi -# APPLE LOCAL LLVM FIXME! -#___fixtfdi +___fixtfdi ___fixunsdfdi ___fixunsdfsi ___fixunssfdi ___fixunssfsi -# APPLE LOCAL LLVM FIXME! -#___fixunstfdi +___fixunstfdi ___floatdidf ___floatdisf -# APPLE LOCAL LLVM FIXME! -#___floatditf +___floatditf ___gcc_personality_v0 ___gcc_qadd ___gcc_qdiv @@ -62,8 +58,7 @@ ___muldc3 ___muldi3 ___mulsc3 -# APPLE LOCAL LLVM FIXME! -#___multc3 +___multc3 ___mulvdi3 ___mulvsi3 ___negdi2 @@ -75,8 +70,7 @@ ___popcountsi2 ___powidf2 ___powisf2 -# APPLE LOCAL LLVM FIXME! -#___powitf2 +___powitf2 ___register_frame ___register_frame_info ___register_frame_info_bases Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin.h?rev=43134&r1=43133&r2=43134&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/darwin.h Thu Oct 18 11:57:42 2007 @@ -170,15 +170,7 @@ consistency; arithmetic will work even if libc and libm support is not available. */ -/* APPLE LOCAL begin LLVM */ -#ifndef ENABLE_LLVM #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 -#else -/* FIXME: no long double support yet! */ -#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64 -#endif -/* APPLE LOCAL end LLVM */ - /* We want -fPIC by default, unless we're using -static to compile for the kernel or some such. */ From dalej at apple.com Thu Oct 18 12:12:35 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 18 Oct 2007 17:12:35 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43135 - in /llvm-gcc-4.2/trunk/gcc: config/rs6000/darwin-ldouble.c config/rs6000/darwin-libgcc.10.4.ver config/rs6000/darwin-libgcc.10.5.ver config/rs6000/darwin.h llvm-convert.cpp Message-ID: <200710181712.l9IHCZo8015591@zion.cs.uiuc.edu> Author: johannes Date: Thu Oct 18 12:12:34 2007 New Revision: 43135 URL: http://llvm.org/viewvc/llvm-project?rev=43135&view=rev Log: Enable 128-bit long double on PPC darwin. Remove hacks in library functions and build which worked around its absence. This changes the ABI. Also note that some functions in libgcc now have a different interface, so make sure you build and pick up the right ones. Make double constants work on big-endian host/big-endian target (cross compile to the other endianness is broken). Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-ldouble.c llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-ldouble.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-ldouble.c?rev=43135&r1=43134&r2=43135&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-ldouble.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-ldouble.c Thu Oct 18 12:12:34 2007 @@ -165,11 +165,7 @@ /* Use fused multiply-add to get low part of a * c. */ #ifndef _SOFT_FLOAT -/* LLVM LOCAL begin */ -#ifndef __llvm__ /* FIXME: no long double support! */ asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); -#endif -/* LLVM LOCAL end */ #else tau = fmsub (a, c, t); #endif @@ -206,11 +202,7 @@ /* Use fused multiply-add to get low part of c * t. */ #ifndef _SOFT_FLOAT -/* LLVM LOCAL begin */ -#ifndef __llvm__ /* FIXME: no long double support! */ asm ("fmsub %0,%1,%2,%3" : "=f"(sigma) : "f"(c), "f"(t), "f"(s)); -#endif -/* LLVM LOCAL end */ #else sigma = fmsub (c, t, s); #endif Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver?rev=43135&r1=43134&r2=43135&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.4.ver Thu Oct 18 12:12:34 2007 @@ -35,18 +35,15 @@ ___ffsdi2 ___fixdfdi ___fixsfdi -# LLVM LOCAL FIXME! -#___fixtfdi +___fixtfdi ___fixunsdfdi ___fixunsdfsi ___fixunssfdi ___fixunssfsi -# LLVM LOCAL FIXME! -#___fixunstfdi +___fixunstfdi ___floatdidf ___floatdisf -# LLVM LOCAL FIXME! -#___floatditf +___floatditf ___gcc_personality_v0 ___gcc_qadd ___gcc_qdiv Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver?rev=43135&r1=43134&r2=43135&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin-libgcc.10.5.ver Thu Oct 18 12:12:34 2007 @@ -34,24 +34,20 @@ ___divdc3 ___divdi3 ___divsc3 -# LLVM LOCAL FIXME! -#___divtc3 +___divtc3 ___enable_execute_stack ___ffsdi2 ___fixdfdi ___fixsfdi -# LLVM LOCAL FIXME! -#___fixtfdi +___fixtfdi ___fixunsdfdi ___fixunsdfsi ___fixunssfdi ___fixunssfsi -# LLVM LOCAL FIXME! -#___fixunstfdi +___fixunstfdi ___floatdidf ___floatdisf -# LLVM LOCAL FIXME! -#___floatditf +___floatditf ___floatundidf ___floatundisf ___floatunditf @@ -65,8 +61,7 @@ ___muldc3 ___muldi3 ___mulsc3 -# LLVM LOCAL FIXME! -#___multc3 +___multc3 ___mulvdi3 ___mulvsi3 ___negdi2 @@ -78,8 +73,7 @@ ___popcountsi2 ___powidf2 ___powisf2 -# LLVM LOCAL FIXME! -#___powitf2 +___powitf2 ___register_frame ___register_frame_info ___register_frame_info_bases Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h?rev=43135&r1=43134&r2=43135&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Thu Oct 18 12:12:34 2007 @@ -95,15 +95,7 @@ consistency; arithmetic will work even if libc and libm support is not available. */ -/* LLVM LOCAL begin */ -#ifndef ENABLE_LLVM #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 -#else -/* FIXME: no long double support yet! */ -#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 64 -#endif -/* LLVM LOCAL end */ - /* We want -fPIC by default, unless we're using -static to compile for the kernel or some such. */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43135&r1=43134&r2=43135&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Oct 18 12:12:34 2007 @@ -5236,10 +5236,11 @@ UArr[0] = RealArr[0]; // Long -> int convert UArr[1] = RealArr[1]; - // FIXME: verify on big-endian targets and cross from big- to little- endian - // targets - if (FLOAT_WORDS_BIG_ENDIAN) - std::swap(UArr[0], UArr[1]); + // We want to switch the words of UArr if host and target endianness + // do not match. FLOAT_WORDS_BIG_ENDIAN describes the target endianness. + // The host's used to be available in HOST_WORDS_BIG_ENDIAN, but the gcc + // maintainers removed this in a fit of cleanliness between 4.0 + // and 4.2. For now, host and target endianness must match. return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat((float)V) : APFloat(V)); From dpatel at apple.com Thu Oct 18 12:54:49 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 18 Oct 2007 17:54:49 -0000 Subject: [llvm-commits] [llvm] r43136 - /llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Message-ID: <200710181754.l9IHsnbT017330@zion.cs.uiuc.edu> Author: dpatel Date: Thu Oct 18 12:54:49 2007 New Revision: 43136 URL: http://llvm.org/viewvc/llvm-project?rev=43136&view=rev Log: Fix test. Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m?rev=43136&r1=43135&r2=43136&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m (original) +++ llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Thu Oct 18 12:54:49 2007 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -x objective-c -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o - t.m | not grep Unwind_Resume +// RUN: %llvmgcc -x objective-c %s -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o t.m | not grep Unwind_Resume #import From isanbard at gmail.com Thu Oct 18 12:58:07 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 10:58:07 -0700 Subject: [llvm-commits] [llvm] r43120 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll In-Reply-To: <77530149-0699-4D31-BBCC-28E1E60C46A7@apple.com> References: <200710180832.l9I8WfGI024162@zion.cs.uiuc.edu> <77530149-0699-4D31-BBCC-28E1E60C46A7@apple.com> Message-ID: <16e5fdf90710181058x7cd3c581v8085738dff509626@mail.gmail.com> On 10/18/07, Chris Lattner wrote: > > On Oct 18, 2007, at 1:32 AM, Bill Wendling wrote: > > > Author: void > > Date: Thu Oct 18 03:32:37 2007 > > New Revision: 43120 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=43120&view=rev > > Log: > > Pointer arithmetic should be done with the index the same size as > > the pointer. > > Nice catch Bill. Should this use sign extend or zero extend if the > value is too small? It seems like zext would be more appropriate, > There was a similar case before with CFA_OFFSET that I tackled before. I went back and forth with Anton a few times and he came up with essentially the patch you saw there: http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-August/010424.html I was thinking about sign-extend vs. zero-extend afterwards and I think the reason behind the sign-extend is to allow for negative indexes. Does that sound reasonable? -bw From isanbard at gmail.com Thu Oct 18 13:00:01 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 11:00:01 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <200710181045.08484.baldrick@free.fr> <200710181114.35882.baldrick@free.fr> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> Message-ID: <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> On 10/18/07, Chris Lattner wrote: > >> In the case of this fix, we don't want to use even > >> _Unwind_SjLj_Resume (it's what I tried initially and got the same > >> type of error). > > > > So how do you continue unwinding exceptions? If code should never > > get to the unwind block then you can always make the unwind-resume > > function be a call to abort() for objc with sjlj. That said, I > > suggest you read the comments in ada/raise.c starting from line 368 > > (llvm-gcc-4.0). I would be amazed if sjlj really works without > > proper tables, except in easy cases. > > I think the objc front-end is emitting the setjmp/longjmp calls > itself directly, not relying on the rest of the GCC EH mechanisms... > Yes. That's my understanding. If you look at obj-act.c:next_sjlj_build_try_catch_finally(), it has a big comment showing what it converts try-catch-finalize to. -bw From isanbard at gmail.com Thu Oct 18 13:26:42 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 18:26:42 -0000 Subject: [llvm-commits] [llvm] r43140 - /llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Message-ID: <200710181826.l9IIQg9C018685@zion.cs.uiuc.edu> Author: void Date: Thu Oct 18 13:26:40 2007 New Revision: 43140 URL: http://llvm.org/viewvc/llvm-project?rev=43140&view=rev Log: Fix the command line. Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m?rev=43140&r1=43139&r2=43140&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m (original) +++ llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Thu Oct 18 13:26:40 2007 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -x objective-c %s -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o t.m | not grep Unwind_Resume +// RUN: %llvmgcc -x objective-c %s -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o - | not grep Unwind_Resume #import From sabre at nondot.org Thu Oct 18 13:49:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 18 Oct 2007 18:49:29 -0000 Subject: [llvm-commits] [llvm] r43141 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll Message-ID: <200710181849.l9IInTan019720@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 13:49:29 2007 New Revision: 43141 URL: http://llvm.org/viewvc/llvm-project?rev=43141&view=rev Log: Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll by fixing some obviously broken code :( Added: llvm/trunk/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=43141&r1=43140&r2=43141&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Thu Oct 18 13:49:29 2007 @@ -168,7 +168,7 @@ CallSite CS = CallSite::get(Fn.use_back()); Instruction *Call = CS.getInstruction(); - // Loop over the operands, dropping extraneous ones at the end of the list. + // Pass all the same arguments. Args.assign(CS.arg_begin(), CS.arg_begin()+NumArgs); Instruction *New; @@ -185,13 +185,13 @@ Args.clear(); if (!Call->use_empty()) - Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); + Call->replaceAllUsesWith(New); New->takeName(Call); // Finally, remove the old call from the program, reducing the use-count of // F. - Call->getParent()->getInstList().erase(Call); + Call->eraseFromParent(); } // Since we have now created the new function, splice the body of the old Added: llvm/trunk/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll?rev=43141&view=auto ============================================================================== --- llvm/trunk/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll (added) +++ llvm/trunk/test/Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll Thu Oct 18 13:49:29 2007 @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep {ret i32 0} +; PR1735 + +define internal i32 @test(i32 %A, ...) { + ret i32 %A +} + +define i32 @foo() { + %A = call i32(i32, ...)* @test(i32 1) + ret i32 %A +} + From christopher.lamb at gmail.com Thu Oct 18 14:28:55 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Thu, 18 Oct 2007 19:28:55 -0000 Subject: [llvm-commits] [llvm] r43144 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.h Message-ID: <200710181928.l9IJStlm021475@zion.cs.uiuc.edu> Author: clamb Date: Thu Oct 18 14:28:55 2007 New Revision: 43144 URL: http://llvm.org/viewvc/llvm-project?rev=43144&view=rev Log: Fix a typo Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=43144&r1=43143&r2=43144&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Oct 18 14:28:55 2007 @@ -132,7 +132,7 @@ unsigned OpNum, MachineInstr* LoadMI) const; - /// unfoldMemoryOperand - Separate a single instruction which folded a load or a + /// unfoldMemoryOperand - Separate a single instruction which folded a load or /// a store or a load and a store into two or more instruction. If this is /// possible, returns true as well as the new instructions by reference. bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, From christopher.lamb at gmail.com Thu Oct 18 14:29:45 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Thu, 18 Oct 2007 19:29:45 -0000 Subject: [llvm-commits] [llvm] r43145 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Message-ID: <200710181929.l9IJTjTm021527@zion.cs.uiuc.edu> Author: clamb Date: Thu Oct 18 14:29:45 2007 New Revision: 43145 URL: http://llvm.org/viewvc/llvm-project?rev=43145&view=rev Log: Fix a misnamed parameter. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=43145&r1=43144&r2=43145&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Thu Oct 18 14:29:45 2007 @@ -173,7 +173,7 @@ virtual bool SubsumesPredicate(const std::vector &Pred1, - const std::vector &Pred1) const; + const std::vector &Pred2) const; virtual bool DefinesPredicate(MachineInstr *MI, std::vector &Pred) const; From christopher.lamb at gmail.com Thu Oct 18 14:31:38 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Thu, 18 Oct 2007 19:31:38 -0000 Subject: [llvm-commits] [llvm] r43146 - /llvm/trunk/include/llvm/ADT/StringExtras.h Message-ID: <200710181931.l9IJVcns021620@zion.cs.uiuc.edu> Author: clamb Date: Thu Oct 18 14:31:38 2007 New Revision: 43146 URL: http://llvm.org/viewvc/llvm-project?rev=43146&view=rev Log: Add an uppercase conversion utility function. Modified: llvm/trunk/include/llvm/ADT/StringExtras.h Modified: llvm/trunk/include/llvm/ADT/StringExtras.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=43146&r1=43145&r2=43146&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringExtras.h (original) +++ llvm/trunk/include/llvm/ADT/StringExtras.h Thu Oct 18 14:31:38 2007 @@ -109,6 +109,14 @@ return result; } +static inline std::string UppercaseString(const std::string &S) { + std::string result(S); + for (unsigned i = 0; i < S.length(); ++i) + if (islower(result[i])) + result[i] = char(toupper(result[i])); + return result; +} + /// StringsEqualNoCase - Return true if the two strings are equal, ignoring /// case. static inline bool StringsEqualNoCase(const std::string &LHS, From resistor at mac.com Thu Oct 18 14:39:33 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 18 Oct 2007 19:39:33 -0000 Subject: [llvm-commits] [llvm] r43147 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200710181939.l9IJdXUZ021866@zion.cs.uiuc.edu> Author: resistor Date: Thu Oct 18 14:39:33 2007 New Revision: 43147 URL: http://llvm.org/viewvc/llvm-project?rev=43147&view=rev Log: Allow GVN to eliminate redundant calls to functions without side effects. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=43147&r1=43146&r2=43147&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Oct 18 14:39:33 2007 @@ -21,13 +21,14 @@ #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Value.h" -#include "llvm/Analysis/Dominators.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/Dominators.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" @@ -51,7 +52,7 @@ FCMPULT, FCMPULE, FCMPUNE, EXTRACT, INSERT, SHUFFLE, SELECT, TRUNC, ZEXT, SEXT, FPTOUI, FPTOSI, UITOFP, SITOFP, FPTRUNC, FPEXT, - PTRTOINT, INTTOPTR, BITCAST, GEP, EMPTY, + PTRTOINT, INTTOPTR, BITCAST, GEP, CALL, EMPTY, TOMBSTONE }; ExpressionOpcode opcode; @@ -60,6 +61,7 @@ uint32_t secondVN; uint32_t thirdVN; SmallVector varargs; + Value* function; Expression() { } Expression(ExpressionOpcode o) : opcode(o) { } @@ -71,6 +73,8 @@ return true; else if (type != other.type) return false; + else if (function != other.function) + return false; else if (firstVN != other.firstVN) return false; else if (secondVN != other.secondVN) @@ -96,6 +100,8 @@ return false; else if (type != other.type) return true; + else if (function != other.function) + return true; else if (firstVN != other.firstVN) return true; else if (secondVN != other.secondVN) @@ -119,6 +125,7 @@ private: DenseMap valueNumbering; DenseMap expressionNumbering; + AliasAnalysis* AA; uint32_t nextValueNumber; @@ -133,14 +140,16 @@ Expression create_expression(SelectInst* V); Expression create_expression(CastInst* C); Expression create_expression(GetElementPtrInst* G); + Expression create_expression(CallInst* C); public: - ValueTable() { nextValueNumber = 1; } + ValueTable() : nextValueNumber(1) { } uint32_t lookup_or_add(Value* V); uint32_t lookup(Value* V) const; void add(Value* V, uint32_t num); void clear(); void erase(Value* v); unsigned size(); + void setAliasAnalysis(AliasAnalysis* A) { AA = A; } }; } @@ -169,6 +178,10 @@ E = e.varargs.end(); I != E; ++I) hash = *I + hash * 37; + hash = (unsigned)((uintptr_t)e.function >> 4) ^ + (unsigned)((uintptr_t)e.function >> 9) + + hash * 37; + return hash; } static bool isEqual(const Expression &LHS, const Expression &RHS) { @@ -325,12 +338,30 @@ } } +Expression ValueTable::create_expression(CallInst* C) { + Expression e; + + e.type = C->getType(); + e.firstVN = 0; + e.secondVN = 0; + e.thirdVN = 0; + e.function = C->getCalledFunction(); + e.opcode = Expression::CALL; + + for (CallInst::op_iterator I = C->op_begin()+1, E = C->op_end(); + I != E; ++I) + e.varargs.push_back(lookup_or_add(*I)); + + return e; +} + Expression ValueTable::create_expression(BinaryOperator* BO) { Expression e; e.firstVN = lookup_or_add(BO->getOperand(0)); e.secondVN = lookup_or_add(BO->getOperand(1)); e.thirdVN = 0; + e.function = 0; e.type = BO->getType(); e.opcode = getOpcode(BO); @@ -343,6 +374,7 @@ e.firstVN = lookup_or_add(C->getOperand(0)); e.secondVN = lookup_or_add(C->getOperand(1)); e.thirdVN = 0; + e.function = 0; e.type = C->getType(); e.opcode = getOpcode(C); @@ -355,6 +387,7 @@ e.firstVN = lookup_or_add(C->getOperand(0)); e.secondVN = 0; e.thirdVN = 0; + e.function = 0; e.type = C->getType(); e.opcode = getOpcode(C); @@ -367,6 +400,7 @@ e.firstVN = lookup_or_add(S->getOperand(0)); e.secondVN = lookup_or_add(S->getOperand(1)); e.thirdVN = lookup_or_add(S->getOperand(2)); + e.function = 0; e.type = S->getType(); e.opcode = Expression::SHUFFLE; @@ -379,6 +413,7 @@ e.firstVN = lookup_or_add(E->getOperand(0)); e.secondVN = lookup_or_add(E->getOperand(1)); e.thirdVN = 0; + e.function = 0; e.type = E->getType(); e.opcode = Expression::EXTRACT; @@ -391,6 +426,7 @@ e.firstVN = lookup_or_add(I->getOperand(0)); e.secondVN = lookup_or_add(I->getOperand(1)); e.thirdVN = lookup_or_add(I->getOperand(2)); + e.function = 0; e.type = I->getType(); e.opcode = Expression::INSERT; @@ -403,6 +439,7 @@ e.firstVN = lookup_or_add(I->getCondition()); e.secondVN = lookup_or_add(I->getTrueValue()); e.thirdVN = lookup_or_add(I->getFalseValue()); + e.function = 0; e.type = I->getType(); e.opcode = Expression::SELECT; @@ -415,6 +452,7 @@ e.firstVN = lookup_or_add(G->getPointerOperand()); e.secondVN = 0; e.thirdVN = 0; + e.function = 0; e.type = G->getType(); e.opcode = Expression::GEP; @@ -436,8 +474,26 @@ if (VI != valueNumbering.end()) return VI->second; - - if (BinaryOperator* BO = dyn_cast(V)) { + if (CallInst* C = dyn_cast(V)) { + if (C->getCalledFunction() && + AA->doesNotAccessMemory(C->getCalledFunction())) { + Expression e = create_expression(C); + + DenseMap::iterator EI = expressionNumbering.find(e); + if (EI != expressionNumbering.end()) { + valueNumbering.insert(std::make_pair(V, EI->second)); + return EI->second; + } else { + expressionNumbering.insert(std::make_pair(e, nextValueNumber)); + valueNumbering.insert(std::make_pair(V, nextValueNumber)); + + return nextValueNumber++; + } + } else { + valueNumbering.insert(std::make_pair(V, nextValueNumber)); + return nextValueNumber++; + } + } else if (BinaryOperator* BO = dyn_cast(V)) { Expression e = create_expression(BO); DenseMap::iterator EI = expressionNumbering.find(e); @@ -654,6 +710,8 @@ AU.setPreservesCFG(); AU.addRequired(); AU.addRequired(); + AU.addRequired(); + AU.addPreserved(); AU.addPreserved(); } @@ -996,6 +1054,8 @@ // function. // bool GVN::runOnFunction(Function& F) { + VN.setAliasAnalysis(&getAnalysis()); + bool changed = false; bool shouldContinue = true; From dpatel at apple.com Thu Oct 18 14:52:33 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 18 Oct 2007 19:52:33 -0000 Subject: [llvm-commits] [llvm] r43148 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200710181952.l9IJqX3a022273@zion.cs.uiuc.edu> Author: dpatel Date: Thu Oct 18 14:52:32 2007 New Revision: 43148 URL: http://llvm.org/viewvc/llvm-project?rev=43148&view=rev Log: Try again. Instead of loading small global string from memory, use integer constant. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=43148&r1=43147&r2=43148&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 18 14:52:32 2007 @@ -8941,10 +8941,43 @@ /// InstCombineLoadCast - Fold 'load (cast P)' -> cast (load P)' when possible. -static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) { +static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI, + const TargetData *TD) { User *CI = cast(LI.getOperand(0)); Value *CastOp = CI->getOperand(0); + if (ConstantExpr *CE = dyn_cast(CI)) { + // Instead of loading constant c string, use corresponding integer value + // directly if string length is small enough. + const std::string &Str = CE->getOperand(0)->getStringValue(); + if (!Str.empty()) { + unsigned len = Str.length(); + const Type *Ty = cast(CE->getType())->getElementType(); + unsigned numBits = Ty->getPrimitiveSizeInBits(); + // Replace LI with immediate integer store. + if ((numBits >> 3) == len + 1) { + APInt StrVal(numBits, 0); + APInt SingleChar(numBits, 0); + if (TD->isLittleEndian()) { + for (signed i = len-1; i >= 0; i--) { + SingleChar = (uint64_t) Str[i]; + StrVal = (StrVal << 8) | SingleChar; + } + } else { + for (unsigned i = 0; i < len; i++) { + SingleChar = (uint64_t) Str[i]; + StrVal = (StrVal << 8) | SingleChar; + } + // Append NULL at the end. + SingleChar = 0; + StrVal = (StrVal << 8) | SingleChar; + } + Value *NL = ConstantInt::get(StrVal); + return IC.ReplaceInstUsesWith(LI, NL); + } + } + } + const Type *DestPTy = cast(CI->getType())->getElementType(); if (const PointerType *SrcTy = dyn_cast(CastOp->getType())) { const Type *SrcPTy = SrcTy->getElementType(); @@ -9050,7 +9083,7 @@ // load (cast X) --> cast (load X) iff safe if (isa(Op)) - if (Instruction *Res = InstCombineLoadCast(*this, LI)) + if (Instruction *Res = InstCombineLoadCast(*this, LI, TD)) return Res; // None of the following transforms are legal for volatile loads. @@ -9114,7 +9147,7 @@ } } else if (CE->isCast()) { - if (Instruction *Res = InstCombineLoadCast(*this, LI)) + if (Instruction *Res = InstCombineLoadCast(*this, LI, TD)) return Res; } } From clattner at apple.com Thu Oct 18 15:04:24 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 13:04:24 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43134 - in /llvm-gcc-4.0/trunk/gcc/config/rs6000: darwin-ldouble.c darwin-libgcc.10.4.ver darwin-libgcc.10.5.ver darwin.h In-Reply-To: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> References: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> Message-ID: On Oct 18, 2007, at 9:57 AM, Dale Johannesen wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=43134&view=rev > Log: > Enable 128-bit long double on PPC darwin. > Remove hacks in library functions and build which > worked around its absence. Nice! Many llvm local changes going away, > /* Use fused multiply-add to get low part of a * c. */ > -/* APPLE LOCAL begin LLVM */ > -#ifndef __llvm__ /* FIXME: no long double support! */ > asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); > -#endif Have you tested to see if long double works with inline asm? -Chris From dalej at apple.com Thu Oct 18 16:09:34 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 18 Oct 2007 14:09:34 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43134 - in /llvm-gcc-4.0/trunk/gcc/config/rs6000: darwin-ldouble.c darwin-libgcc.10.4.ver darwin-libgcc.10.5.ver darwin.h In-Reply-To: References: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> Message-ID: <06DDC2DD-261F-443A-ABAA-8CEAC20FAD4E@apple.com> On Oct 18, 2007, at 1:04 PM, Chris Lattner wrote: >> /* Use fused multiply-add to get low part of a * c. */ >> -/* APPLE LOCAL begin LLVM */ >> -#ifndef __llvm__ /* FIXME: no long double support! */ >> asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); >> -#endif > > Have you tested to see if long double works with inline asm? No; there are no long double instructions, so I'm not sure how you would write such a thing in inline asm. (The asm in the fix above breaks the long double into two doubles explicitly, and I'd expect that to be the common practice). From evan.cheng at apple.com Thu Oct 18 16:29:24 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 21:29:24 -0000 Subject: [llvm-commits] [llvm] r43150 - in /llvm/trunk: include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200710182129.l9ILTOIO027255@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 18 16:29:24 2007 New Revision: 43150 URL: http://llvm.org/viewvc/llvm-project?rev=43150&view=rev Log: Use SmallVectorImpl instead of SmallVector with hardcoded size in MRegister public interface. Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/MRegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/MRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -508,9 +508,9 @@ const TargetRegisterClass *RC) const = 0; virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const = 0; + SmallVectorImpl &NewMIs) const = 0; virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, @@ -518,9 +518,9 @@ const TargetRegisterClass *RC) const = 0; virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const = 0; + SmallVectorImpl &NewMIs) const =0; virtual void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, @@ -568,12 +568,12 @@ /// possible, returns true as well as the new instructions by reference. virtual bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, unsigned Reg, bool UnfoldLoad, bool UnfoldStore, - SmallVector &NewMIs) const{ + SmallVectorImpl &NewMIs) const{ return false; } virtual bool unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, - SmallVector &NewNodes) const { + SmallVectorImpl &NewNodes) const { return false; } Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -183,9 +183,9 @@ } void ARMRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == ARM::GPRRegisterClass) { ARMFunctionInfo *AFI = MF.getInfo(); @@ -239,9 +239,9 @@ } void ARMRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == ARM::GPRRegisterClass) { ARMFunctionInfo *AFI = MF.getInfo(); Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -52,9 +52,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, @@ -62,9 +62,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, unsigned SrcReg, Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -83,9 +83,9 @@ } void AlphaRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == Alpha::F4RCRegisterClass) Opc = Alpha::STS; @@ -128,9 +128,9 @@ } void AlphaRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == Alpha::F4RCRegisterClass) Opc = Alpha::LDS; Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -34,9 +34,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, @@ -44,9 +44,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; MachineInstr* foldMemoryOperand(MachineInstr *MI, unsigned OpNum, int FrameIndex) const; Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -61,9 +61,9 @@ } void IA64RegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == IA64::FPRegisterClass) { Opc = IA64::STF8; @@ -113,9 +113,9 @@ } void IA64RegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == IA64::FPRegisterClass) { Opc = IA64::LDF8; Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h (original) +++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -35,9 +35,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, @@ -45,9 +45,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -96,9 +96,9 @@ } void MipsRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { if (RC != Mips::CPURegsRegisterClass) assert(0 && "Can't store this register"); MachineInstrBuilder MIB = BuildMI(TII.get(Mips::SW)) @@ -128,9 +128,9 @@ } void MipsRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { if (RC != Mips::CPURegsRegisterClass) assert(0 && "Can't load this register"); MachineInstrBuilder MIB = BuildMI(TII.get(Mips::LW), DestReg); Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -38,9 +38,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, @@ -48,9 +48,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, const MachineInstr *Orig) const; Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -106,7 +106,7 @@ static void StoreRegToStackSlot(const TargetInstrInfo &TII, unsigned SrcReg, int FrameIdx, const TargetRegisterClass *RC, - SmallVector &NewMIs) { + SmallVectorImpl &NewMIs) { if (RC == PPC::GPRCRegisterClass) { if (SrcReg != PPC::LR) { NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STW)) @@ -182,9 +182,9 @@ } void PPCRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { if (Addr[0].isFrameIndex()) { StoreRegToStackSlot(TII, SrcReg, Addr[0].getFrameIndex(), RC, NewMIs); return; @@ -223,7 +223,7 @@ static void LoadRegFromStackSlot(const TargetInstrInfo &TII, unsigned DestReg, int FrameIdx, const TargetRegisterClass *RC, - SmallVector &NewMIs) { + SmallVectorImpl &NewMIs) { if (RC == PPC::GPRCRegisterClass) { if (DestReg != PPC::LR) { NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::LWZ), DestReg), @@ -291,9 +291,9 @@ } void PPCRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { if (Addr[0].isFrameIndex()) { LoadRegFromStackSlot(TII, DestReg, Addr[0].getFrameIndex(), RC, NewMIs); return; Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -41,9 +41,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, @@ -51,9 +51,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, unsigned SrcReg, Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -49,9 +49,9 @@ } void SparcRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == SP::IntRegsRegisterClass) Opc = SP::STri; @@ -91,9 +91,9 @@ } void SparcRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = 0; if (RC == SP::IntRegsRegisterClass) Opc = SP::LDri; Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -36,9 +36,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, @@ -46,9 +46,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, unsigned SrcReg, Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Oct 18 16:29:24 2007 @@ -806,9 +806,9 @@ } void X86RegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = getStoreRegOpcode(RC); MachineInstrBuilder MIB = BuildMI(TII.get(Opc)); for (unsigned i = 0, e = Addr.size(); i != e; ++i) @@ -862,9 +862,9 @@ } void X86RegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { unsigned Opc = getLoadRegOpcode(RC); MachineInstrBuilder MIB = BuildMI(TII.get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) @@ -1119,7 +1119,7 @@ bool X86RegisterInfo::unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, unsigned Reg, bool UnfoldLoad, bool UnfoldStore, - SmallVector &NewMIs) const { + SmallVectorImpl &NewMIs) const { DenseMap >::iterator I = MemOp2RegOpTable.find((unsigned*)MI->getOpcode()); if (I == MemOp2RegOpTable.end()) @@ -1199,7 +1199,7 @@ bool X86RegisterInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, - SmallVector &NewNodes) const { + SmallVectorImpl &NewNodes) const { if (!N->isTargetOpcode()) return false; Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=43150&r1=43149&r2=43150&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Oct 18 16:29:24 2007 @@ -89,9 +89,9 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, @@ -99,9 +99,9 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVector Addr, + SmallVectorImpl Addr, const TargetRegisterClass *RC, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, @@ -137,10 +137,10 @@ /// possible, returns true as well as the new instructions by reference. bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, unsigned Reg, bool UnfoldLoad, bool UnfoldStore, - SmallVector &NewMIs) const; + SmallVectorImpl &NewMIs) const; bool unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, - SmallVector &NewNodes) const; + SmallVectorImpl &NewNodes) const; /// getCalleeSavedRegs - Return a null-terminated list of all of the /// callee-save registers on this target. From evan.cheng at apple.com Thu Oct 18 17:40:57 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 22:40:57 -0000 Subject: [llvm-commits] [llvm] r43153 - in /llvm/trunk: include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200710182240.l9IMewhY031178@zion.cs.uiuc.edu> Author: evancheng Date: Thu Oct 18 17:40:57 2007 New Revision: 43153 URL: http://llvm.org/viewvc/llvm-project?rev=43153&view=rev Log: - Added getOpcodeAfterMemoryUnfold(). It doesn't unfold an instruction, but only returns the opcode of the instruction post unfolding. - Fix some copy+paste bugs. Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/MRegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/MRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -508,7 +508,7 @@ const TargetRegisterClass *RC) const = 0; virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const = 0; @@ -518,7 +518,7 @@ const TargetRegisterClass *RC) const = 0; virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const =0; @@ -577,6 +577,14 @@ return false; } + /// getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new + /// instruction after load / store are unfolded from the specified opcode. + /// It returns zero if the specified unfolding is impossible. + virtual unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, + bool UnfoldLoad, bool UnfoldStore) const { + return 0; + } + /// targetHandlesStackFrameRounding - Returns true if the target is /// responsible for rounding up the stack frame (probably at emitPrologue /// time). Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -183,7 +183,7 @@ } void ARMRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; @@ -239,7 +239,7 @@ } void ARMRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -52,7 +52,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -62,7 +62,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -83,7 +83,7 @@ } void AlphaRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; @@ -128,7 +128,7 @@ } void AlphaRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; Modified: llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaRegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -34,7 +34,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -44,7 +44,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -61,7 +61,7 @@ } void IA64RegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; @@ -113,7 +113,7 @@ } void IA64RegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; Modified: llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h (original) +++ llvm/trunk/lib/Target/IA64/IA64RegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -35,7 +35,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -45,7 +45,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -96,7 +96,7 @@ } void MipsRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { if (RC != Mips::CPURegsRegisterClass) @@ -128,7 +128,7 @@ } void MipsRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { if (RC != Mips::CPURegsRegisterClass) Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -38,7 +38,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -48,7 +48,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -182,7 +182,7 @@ } void PPCRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { if (Addr[0].isFrameIndex()) { @@ -291,7 +291,7 @@ } void PPCRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { if (Addr[0].isFrameIndex()) { Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -41,7 +41,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -51,7 +51,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -49,7 +49,7 @@ } void SparcRegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; @@ -91,7 +91,7 @@ } void SparcRegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = 0; Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -36,7 +36,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -46,7 +46,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Oct 18 17:40:57 2007 @@ -806,7 +806,7 @@ } void X86RegisterInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = getStoreRegOpcode(RC); @@ -862,7 +862,7 @@ } void X86RegisterInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = getLoadRegOpcode(RC); @@ -1273,6 +1273,20 @@ return true; } +unsigned X86RegisterInfo::getOpcodeAfterMemoryUnfold(unsigned Opc, + bool UnfoldLoad, bool UnfoldStore) const { + DenseMap >::iterator I = + MemOp2RegOpTable.find((unsigned*)Opc); + if (I == MemOp2RegOpTable.end()) + return 0; + bool HasLoad = I->second.second & (1 << 4); + bool HasStore = I->second.second & (1 << 5); + if (UnfoldLoad && !HasLoad) + return 0; + if (UnfoldStore && !HasStore) + return 0; + return I->second.first; +} const unsigned * X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=43153&r1=43152&r2=43153&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Oct 18 17:40:57 2007 @@ -89,7 +89,7 @@ const TargetRegisterClass *RC) const; void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -99,7 +99,7 @@ const TargetRegisterClass *RC) const; void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl Addr, + SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const; @@ -142,6 +142,12 @@ bool unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, SmallVectorImpl &NewNodes) const; + /// getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new + /// instruction after load / store are unfolded from the specified opcode. + /// It returns zero if the specified unfolding is impossible. + unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, + bool UnfoldLoad, bool UnfoldStore) const; + /// getCalleeSavedRegs - Return a null-terminated list of all of the /// callee-save registers on this target. const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const; From clattner at apple.com Thu Oct 18 17:51:27 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 15:51:27 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43134 - in /llvm-gcc-4.0/trunk/gcc/config/rs6000: darwin-ldouble.c darwin-libgcc.10.4.ver darwin-libgcc.10.5.ver darwin.h In-Reply-To: <06DDC2DD-261F-443A-ABAA-8CEAC20FAD4E@apple.com> References: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> <06DDC2DD-261F-443A-ABAA-8CEAC20FAD4E@apple.com> Message-ID: <4CB33D2E-2B92-42D9-BC33-227ED176775C@apple.com> On Oct 18, 2007, at 2:09 PM, Dale Johannesen wrote: > > On Oct 18, 2007, at 1:04 PM, Chris Lattner wrote: >>> /* Use fused multiply-add to get low part of a * c. */ >>> -/* APPLE LOCAL begin LLVM */ >>> -#ifndef __llvm__ /* FIXME: no long double support! */ >>> asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); >>> -#endif >> >> Have you tested to see if long double works with inline asm? > > No; there are no long double instructions, so I'm not sure how you > would write such a thing in inline asm. > (The asm in the fix above breaks the long double into two doubles > explicitly, and I'd expect that to be the common practice). Yep, tha'ts what I mean: when the above gets broken into the two component registers, do they come through correctly in the .s file? -Chris From clattner at apple.com Thu Oct 18 17:53:21 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 15:53:21 -0700 Subject: [llvm-commits] [llvm] r43150 - in /llvm/trunk: include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ In-Reply-To: <200710182129.l9ILTOIO027255@zion.cs.uiuc.edu> References: <200710182129.l9ILTOIO027255@zion.cs.uiuc.edu> Message-ID: <177FDE72-1BDF-446C-85C8-FD2BE48654AD@apple.com> > URL: http://llvm.org/viewvc/llvm-project?rev=43150&view=rev > Log: > Use SmallVectorImpl instead of SmallVector with hardcoded size in > MRegister public interface. Cool, one additional thing: > +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Thu Oct 18 > 16:29:24 2007 > @@ -508,9 +508,9 @@ > const TargetRegisterClass *RC) > const = 0; > > virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, > - SmallVector Addr, > + SmallVectorImpl Addr, This should pass the vector by reference to avoid slicing in this case and for performance. > virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, > + SmallVectorImpl Addr, Likewise -Chris From dalej at apple.com Thu Oct 18 18:00:13 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 18 Oct 2007 16:00:13 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43134 - in /llvm-gcc-4.0/trunk/gcc/config/rs6000: darwin-ldouble.c darwin-libgcc.10.4.ver darwin-libgcc.10.5.ver darwin.h In-Reply-To: <4CB33D2E-2B92-42D9-BC33-227ED176775C@apple.com> References: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> <06DDC2DD-261F-443A-ABAA-8CEAC20FAD4E@apple.com> <4CB33D2E-2B92-42D9-BC33-227ED176775C@apple.com> Message-ID: <7902E52A-A5F4-4A66-81D2-79246652200D@apple.com> On Oct 18, 2007, at 3:51 PM, Chris Lattner wrote: > > On Oct 18, 2007, at 2:09 PM, Dale Johannesen wrote: > >> >> On Oct 18, 2007, at 1:04 PM, Chris Lattner wrote: >>>> /* Use fused multiply-add to get low part of a * c. */ >>>> -/* APPLE LOCAL begin LLVM */ >>>> -#ifndef __llvm__ /* FIXME: no long double support! */ >>>> asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); >>>> -#endif >>> >>> Have you tested to see if long double works with inline asm? >> >> No; there are no long double instructions, so I'm not sure how you >> would write such a thing in inline asm. >> (The asm in the fix above breaks the long double into two doubles >> explicitly, and I'd expect that to be the common practice). > > Yep, tha'ts what I mean: when the above gets broken into the two > component registers, do they come through correctly in the .s file? The above does not get broken into component registers by the compiler. Those are double variables and double registers. The function is declared as taking 4 double arguments. The excuse for this in the code is /* All these routines actually take two long doubles as parameters, but GCC currently generates poor code when a union is used to turn a long double into a pair of doubles. */ but the inability to reference long doubles in asm's may have had something to do with it also. From clattner at apple.com Thu Oct 18 17:58:16 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 15:58:16 -0700 Subject: [llvm-commits] [llvm] r43120 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll In-Reply-To: <16e5fdf90710181058x7cd3c581v8085738dff509626@mail.gmail.com> References: <200710180832.l9I8WfGI024162@zion.cs.uiuc.edu> <77530149-0699-4D31-BBCC-28E1E60C46A7@apple.com> <16e5fdf90710181058x7cd3c581v8085738dff509626@mail.gmail.com> Message-ID: <86E4B181-014C-4FD5-8A3D-B9A550184E08@apple.com> On Oct 18, 2007, at 10:58 AM, Bill Wendling wrote: > On 10/18/07, Chris Lattner wrote: >> >> On Oct 18, 2007, at 1:32 AM, Bill Wendling wrote: >> >>> Author: void >>> Date: Thu Oct 18 03:32:37 2007 >>> New Revision: 43120 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=43120&view=rev >>> Log: >>> Pointer arithmetic should be done with the index the same size as >>> the pointer. >> >> Nice catch Bill. Should this use sign extend or zero extend if the >> value is too small? It seems like zext would be more appropriate, >> > There was a similar case before with CFA_OFFSET that I tackled before. > I went back and forth with Anton a few times and he came up with > essentially the patch you saw there: > > http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-August/010424.html > > I was thinking about sign-extend vs. zero-extend afterwards and I > think the reason behind the sign-extend is to allow for negative > indexes. Does that sound reasonable? Negative indices aren't allowed in EXTRAACT_VECTOR_ELT. -Chris From dalej at apple.com Thu Oct 18 19:59:19 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 19 Oct 2007 00:59:19 -0000 Subject: [llvm-commits] [llvm] r43160 - in /llvm/trunk: include/llvm/CodeGen/RuntimeLibcalls.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200710190059.l9J0xJJ6007036@zion.cs.uiuc.edu> Author: johannes Date: Thu Oct 18 19:59:18 2007 New Revision: 43160 URL: http://llvm.org/viewvc/llvm-project?rev=43160&view=rev Log: More ppcf128 issues (maybe the last)? Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h?rev=43160&r1=43159&r2=43160&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h (original) +++ llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h Thu Oct 18 19:59:18 2007 @@ -20,6 +20,10 @@ /// RTLIB::Libcall enum - This enum defines all of the runtime library calls /// the backend can emit. The various long double types cannot be merged, /// because 80-bit library functions use "xf" and 128-bit use "tf". + /// + /// When adding PPCF128 functions here, note that their names generally need + /// to be overridden for Darwin with the xxx$LDBL128 form. See + /// PPCISelLowering.cpp. /// enum Libcall { // Integer Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43160&r1=43159&r2=43160&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Oct 18 19:59:18 2007 @@ -3493,7 +3493,7 @@ return DAG.getNode(ISD::FP_EXTEND, VT, N0); // fold (fpext (load x)) -> (fpext (fpround (extload x))) - if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() && + if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() && VT != MVT::ppcf128 && (!AfterLegalize||TLI.isLoadXLegal(ISD::EXTLOAD, N0.getValueType()))) { LoadSDNode *LN0 = cast(N0); SDOperand ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, VT, LN0->getChain(), Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=43160&r1=43159&r2=43160&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Thu Oct 18 19:59:18 2007 @@ -341,6 +341,13 @@ setTargetDAGCombine(ISD::BR_CC); setTargetDAGCombine(ISD::BSWAP); + // Darwin long double math library functions have $LDBL128 appended. + if (TM.getSubtarget().isDarwin()) { + setLibcallName(RTLIB::SQRT_PPCF128, "sqrtl$LDBL128"); + setLibcallName(RTLIB::POW_PPCF128, "powl$LDBL128"); + setLibcallName(RTLIB::REM_PPCF128, "fmodl$LDBL128"); + } + computeRegisterProperties(); } From isanbard at gmail.com Thu Oct 18 20:10:50 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 01:10:50 -0000 Subject: [llvm-commits] [llvm] r43161 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200710190110.l9J1AofZ007597@zion.cs.uiuc.edu> Author: void Date: Thu Oct 18 20:10:49 2007 New Revision: 43161 URL: http://llvm.org/viewvc/llvm-project?rev=43161&view=rev Log: Negative indices aren't allowed here. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43161&r1=43160&r2=43161&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 18 20:10:49 2007 @@ -4139,7 +4139,7 @@ MVT::getSizeInBits(TLI.getPointerTy())) Idx = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), StackPtr); else - Idx = DAG.getNode(ISD::SIGN_EXTEND, TLI.getPointerTy(), StackPtr); + Idx = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), StackPtr); StackPtr = DAG.getNode(ISD::ADD, Idx.getValueType(), Idx, StackPtr); From isanbard at gmail.com Thu Oct 18 20:10:54 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 18:10:54 -0700 Subject: [llvm-commits] [llvm] r43120 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/PowerPC/2007-10-18-PtrArithmetic.ll In-Reply-To: <86E4B181-014C-4FD5-8A3D-B9A550184E08@apple.com> References: <200710180832.l9I8WfGI024162@zion.cs.uiuc.edu> <77530149-0699-4D31-BBCC-28E1E60C46A7@apple.com> <16e5fdf90710181058x7cd3c581v8085738dff509626@mail.gmail.com> <86E4B181-014C-4FD5-8A3D-B9A550184E08@apple.com> Message-ID: <16e5fdf90710181810j4c5e2a7bqc54a8e1786dde9c0@mail.gmail.com> Okay. Fixed. :-) -bw On 10/18/07, Chris Lattner wrote: > > On Oct 18, 2007, at 10:58 AM, Bill Wendling wrote: > > > On 10/18/07, Chris Lattner wrote: > >> > >> On Oct 18, 2007, at 1:32 AM, Bill Wendling wrote: > >> > >>> Author: void > >>> Date: Thu Oct 18 03:32:37 2007 > >>> New Revision: 43120 > >>> > >>> URL: http://llvm.org/viewvc/llvm-project?rev=43120&view=rev > >>> Log: > >>> Pointer arithmetic should be done with the index the same size as > >>> the pointer. > >> > >> Nice catch Bill. Should this use sign extend or zero extend if the > >> value is too small? It seems like zext would be more appropriate, > >> > > There was a similar case before with CFA_OFFSET that I tackled before. > > I went back and forth with Anton a few times and he came up with > > essentially the patch you saw there: > > > > http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-August/010424.html > > > > I was thinking about sign-extend vs. zero-extend afterwards and I > > think the reason behind the sign-extend is to allow for negative > > indexes. Does that sound reasonable? > > Negative indices aren't allowed in EXTRAACT_VECTOR_ELT. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dpatel at apple.com Thu Oct 18 20:28:02 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 19 Oct 2007 01:28:02 -0000 Subject: [llvm-commits] [llvm] r43162 - /llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll Message-ID: <200710190128.l9J1S2fv008457@zion.cs.uiuc.edu> Author: dpatel Date: Thu Oct 18 20:28:02 2007 New Revision: 43162 URL: http://llvm.org/viewvc/llvm-project?rev=43162&view=rev Log: New test. Added: llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll Added: llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll?rev=43162&view=auto ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll (added) +++ llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll Thu Oct 18 20:28:02 2007 @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -x objective-c -c %s -o /dev/null + at protocol O + at end + at interface O < O > { +} + at end +struct A { +}; + at protocol AB +- (unsigned) ver; + at end + at interface AGy:O < AB > { +} + at end + at implementation AGy +- (unsigned) ver { +} + at end + From dpatel at apple.com Thu Oct 18 20:28:43 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 19 Oct 2007 01:28:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r43163 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Message-ID: <200710190128.l9J1SiYc008506@zion.cs.uiuc.edu> Author: dpatel Date: Thu Oct 18 20:28:43 2007 New Revision: 43163 URL: http://llvm.org/viewvc/llvm-project?rev=43163&view=rev Log: Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071015/054686.html Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=43163&r1=43162&r2=43163&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Thu Oct 18 20:28:43 2007 @@ -11047,8 +11047,12 @@ meth_var_types), eltlist); - eltlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), eltlist); - + /* LLVM LOCAL begin */ + eltlist = tree_cons (NULL_TREE, + convert (objc_method_list_ptr, + build_int_cst (NULL_TREE, 0)), + eltlist); + /* LLVM LOCAL end */ initlist = tree_cons (NULL_TREE, objc_build_constructor (type, nreverse (eltlist)), From isanbard at gmail.com Thu Oct 18 20:35:32 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 18 Oct 2007 18:35:32 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43163 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c In-Reply-To: <200710190128.l9J1SiYc008506@zion.cs.uiuc.edu> References: <200710190128.l9J1SiYc008506@zion.cs.uiuc.edu> Message-ID: <16e5fdf90710181835h3b591b63k16c0a5144a64ba81@mail.gmail.com> On 10/18/07, Devang Patel wrote: > Author: dpatel > Date: Thu Oct 18 20:28:43 2007 > New Revision: 43163 > > URL: http://llvm.org/viewvc/llvm-project?rev=43163&view=rev > Log: > Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071015/054686.html > > Modified: > llvm-gcc-4.0/trunk/gcc/objc/objc-act.c > My guess is that this will also have to go into 4.2... -bw From evan.cheng at apple.com Thu Oct 18 20:43:18 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 18 Oct 2007 18:43:18 -0700 Subject: [llvm-commits] [llvm] r43150 - in /llvm/trunk: include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ In-Reply-To: <177FDE72-1BDF-446C-85C8-FD2BE48654AD@apple.com> References: <200710182129.l9ILTOIO027255@zion.cs.uiuc.edu> <177FDE72-1BDF-446C-85C8-FD2BE48654AD@apple.com> Message-ID: <8582950C-4328-4EC3-92B0-0B17F48691A5@apple.com> On Oct 18, 2007, at 3:53 PM, Chris Lattner wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=43150&view=rev >> Log: >> Use SmallVectorImpl instead of SmallVector with hardcoded size in >> MRegister public interface. > > Cool, one additional thing: > >> +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Thu Oct 18 >> 16:29:24 2007 >> @@ -508,9 +508,9 @@ >> const TargetRegisterClass *RC) >> const = 0; >> >> virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, >> - SmallVector Addr, >> + SmallVectorImpl Addr, > > This should pass the vector by reference to avoid slicing in this > case and for performance. It was a copy and paste bug that's already fixed in a subsequent patch. Evan > > >> virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, >> + SmallVectorImpl Addr, > > Likewise > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu Oct 18 21:43:13 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 19:43:13 -0700 Subject: [llvm-commits] [llvm] r43150 - in /llvm/trunk: include/llvm/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ In-Reply-To: <8582950C-4328-4EC3-92B0-0B17F48691A5@apple.com> References: <200710182129.l9ILTOIO027255@zion.cs.uiuc.edu> <177FDE72-1BDF-446C-85C8-FD2BE48654AD@apple.com> <8582950C-4328-4EC3-92B0-0B17F48691A5@apple.com> Message-ID: <20E1E64B-3180-4B4B-82D1-37C106B71904@apple.com> On Oct 18, 2007, at 6:43 PM, Evan Cheng wrote: >> >>> +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Thu Oct 18 >>> 16:29:24 2007 >>> @@ -508,9 +508,9 @@ >>> const TargetRegisterClass *RC) >>> const = 0; >>> >>> virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, >>> - SmallVector Addr, >>> + SmallVectorImpl Addr, >> >> This should pass the vector by reference to avoid slicing in this >> case and for performance. > > It was a copy and paste bug that's already fixed in a subsequent > patch. Thanks Evan! -Chris From clattner at apple.com Thu Oct 18 21:44:20 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 18 Oct 2007 19:44:20 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43134 - in /llvm-gcc-4.0/trunk/gcc/config/rs6000: darwin-ldouble.c darwin-libgcc.10.4.ver darwin-libgcc.10.5.ver darwin.h In-Reply-To: <7902E52A-A5F4-4A66-81D2-79246652200D@apple.com> References: <200710181657.l9IGvhxt015054@zion.cs.uiuc.edu> <06DDC2DD-261F-443A-ABAA-8CEAC20FAD4E@apple.com> <4CB33D2E-2B92-42D9-BC33-227ED176775C@apple.com> <7902E52A-A5F4-4A66-81D2-79246652200D@apple.com> Message-ID: <4B10BB4D-901B-4F91-8C3C-A7584B400E9E@apple.com> On Oct 18, 2007, at 4:00 PM, Dale Johannesen wrote: > > On Oct 18, 2007, at 3:51 PM, Chris Lattner wrote: > >> >> On Oct 18, 2007, at 2:09 PM, Dale Johannesen wrote: >> >>> >>> On Oct 18, 2007, at 1:04 PM, Chris Lattner wrote: >>>>> /* Use fused multiply-add to get low part of a * c. */ >>>>> -/* APPLE LOCAL begin LLVM */ >>>>> -#ifndef __llvm__ /* FIXME: no long double support! */ >>>>> asm ("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); >>>>> -#endif >>>> >>>> Have you tested to see if long double works with inline asm? >>> >>> No; there are no long double instructions, so I'm not sure how you >>> would write such a thing in inline asm. >>> (The asm in the fix above breaks the long double into two doubles >>> explicitly, and I'd expect that to be the common practice). >> >> Yep, tha'ts what I mean: when the above gets broken into the two >> component registers, do they come through correctly in the .s file? > > The above does not get broken into component registers by the > compiler. > Those are double variables and double registers. The function is > declared > as taking 4 double arguments. The excuse for this in the code is > > /* All these routines actually take two long doubles as parameters, > but GCC currently generates poor code when a union is used to turn > a long double into a pair of doubles. */ > > but the inability to reference long doubles in asm's may have had > something > to do with it also. Ah, ok. Thanks Dale, -Chris From sabre at nondot.org Thu Oct 18 22:29:26 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 03:29:26 -0000 Subject: [llvm-commits] [llvm] r43164 - /llvm/trunk/lib/Target/ARM/README.txt Message-ID: <200710190329.l9J3TRu2014342@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 22:29:26 2007 New Revision: 43164 URL: http://llvm.org/viewvc/llvm-project?rev=43164&view=rev Log: Add an easy microoptimization I noticed. Modified: llvm/trunk/lib/Target/ARM/README.txt Modified: llvm/trunk/lib/Target/ARM/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/README.txt?rev=43164&r1=43163&r2=43164&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/README.txt (original) +++ llvm/trunk/lib/Target/ARM/README.txt Thu Oct 18 22:29:26 2007 @@ -573,3 +573,22 @@ bx lr //===---------------------------------------------------------------------===// + +Easy ARM microoptimization (with -mattr=+vfp2): + +define i64 @i(double %X) { + %Y = bitcast double %X to i64 + ret i64 %Y +} + +compiles into: + +_i: + fmdrr d0, r0, r1 + fmrrd r0, r1, d0 + bx lr + +This just needs a target-specific dag combine to merge the two ARMISD nodes. + + +//===---------------------------------------------------------------------===// From sabre at nondot.org Thu Oct 18 22:31:45 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 03:31:45 -0000 Subject: [llvm-commits] [llvm] r43165 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200710190331.l9J3Vk3l014433@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 22:31:45 2007 New Revision: 43165 URL: http://llvm.org/viewvc/llvm-project?rev=43165&view=rev Log: add a new target hook. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=43165&r1=43164&r2=43165&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Thu Oct 18 22:31:45 2007 @@ -885,6 +885,15 @@ /// implement this. The default implementation of this aborts. virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); + /// ExpandOperation - This callback is invoked for operations that are + /// unsupported by the target, which are registered to use 'custom' lowering, + /// and whose result type needs to be expanded. + /// + /// If the target has no operations that require custom lowering, it need not + /// implement this. The default implementation of this aborts. + virtual std::pair + ExpandOperation(SDOperand Op, SelectionDAG &DAG); + /// IsEligibleForTailCallOptimization - Check whether the call is eligible for /// tail call optimization. Targets which want to do tail call optimization /// should override this function. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=43165&r1=43164&r2=43165&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Oct 18 22:31:45 2007 @@ -4134,6 +4134,14 @@ return SDOperand(); } +std::pair +TargetLowering::ExpandOperation(SDOperand Op, SelectionDAG &DAG) { + assert(0 && "ExpandOperation not implemented for this target!"); + abort(); + return std::pair(); +} + + SDOperand TargetLowering::CustomPromoteOperation(SDOperand Op, SelectionDAG &DAG) { assert(0 && "CustomPromoteOperation not implemented for this target!"); From sabre at nondot.org Thu Oct 18 22:33:17 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 03:33:17 -0000 Subject: [llvm-commits] [llvm] r43166 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710190333.l9J3XH2K014544@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 22:33:14 2007 New Revision: 43166 URL: http://llvm.org/viewvc/llvm-project?rev=43166&view=rev Log: add expand support for bit_convert result, even allowing custom expansion. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43166&r1=43165&r2=43166&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 22:33:14 2007 @@ -119,7 +119,9 @@ void GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); void SetExpandedOp(SDOperand Op, SDOperand Lo, SDOperand Hi); - + + SDOperand CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT); + // Result Promotion. void PromoteResult(SDNode *N, unsigned ResNo); SDOperand PromoteResult_UNDEF(SDNode *N); @@ -141,6 +143,7 @@ void ExpandResult_ANY_EXTEND (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_ZERO_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SIGN_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_BIT_CONVERT(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_LOAD (LoadSDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -414,6 +417,17 @@ MarkNewNodes(Hi.Val); } +SDOperand DAGTypeLegalizer::CreateStackStoreLoad(SDOperand Op, + MVT::ValueType DestVT) { + // Create the stack frame object. + SDOperand FIPtr = DAG.CreateStackTemporary(DestVT); + + // Emit a store to the stack slot. + SDOperand Store = DAG.getStore(DAG.getEntryNode(), Op, FIPtr, NULL, 0); + // Result is a load from the stack slot. + return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); +} + //===----------------------------------------------------------------------===// // Result Promotion //===----------------------------------------------------------------------===// @@ -604,6 +618,7 @@ case ISD::ANY_EXTEND: ExpandResult_ANY_EXTEND(N, Lo, Hi); break; case ISD::ZERO_EXTEND: ExpandResult_ZERO_EXTEND(N, Lo, Hi); break; case ISD::SIGN_EXTEND: ExpandResult_SIGN_EXTEND(N, Lo, Hi); break; + case ISD::BIT_CONVERT: ExpandResult_BIT_CONVERT(N, Lo, Hi); break; case ISD::LOAD: ExpandResult_LOAD(cast(N), Lo, Hi); break; case ISD::AND: @@ -677,6 +692,24 @@ DAG.getConstant(LoSize-1, TLI.getShiftAmountTy())); } +void DAGTypeLegalizer::ExpandResult_BIT_CONVERT(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + MVT::ValueType VT = N->getValueType(0); + if (TLI.getOperationAction(ISD::BIT_CONVERT, VT) == TargetLowering::Custom){ + // If the target wants to, allow it to lower this itself. + std::pair P = + TLI.ExpandOperation(SDOperand(N, 0), DAG); + if (P.first.Val) { + Lo = P.first; + Hi = P.second; + return; + } + } + + // Lower the bit-convert to a store/load from the stack, then expand the load. + SDOperand Op = CreateStackStoreLoad(N->getOperand(0), VT); + ExpandResult_LOAD(cast(Op.Val), Lo, Hi); +} void DAGTypeLegalizer::ExpandResult_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi) { From sabre at nondot.org Thu Oct 18 22:58:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 03:58:25 -0000 Subject: [llvm-commits] [llvm] r43167 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710190358.l9J3wPGm015877@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 22:58:25 2007 New Revision: 43167 URL: http://llvm.org/viewvc/llvm-project?rev=43167&view=rev Log: Make use of TLI.ExpandOperation, remove softfloat stuff. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43167&r1=43166&r2=43167&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 22:58:25 2007 @@ -725,19 +725,6 @@ if (ExtType == ISD::NON_EXTLOAD) { Lo = DAG.getLoad(NVT, Ch, Ptr, N->getSrcValue(), SVOffset, isVolatile, Alignment); - if (VT == MVT::f32 || VT == MVT::f64) { - assert(0 && "FIXME: softfp should use promotion!"); -#if 0 - // f32->i32 or f64->i64 one to one expansion. - // Remember that we legalized the chain. - AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Lo.getValue(1))); - // Recursively expand the new load. - if (getTypeAction(NVT) == Expand) - ExpandOp(Lo, Lo, Hi); - break; -#endif - } - // Increment the pointer to the other half. unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8; Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, @@ -756,19 +743,6 @@ } else { MVT::ValueType EVT = N->getLoadedVT(); - if (VT == MVT::f64 && EVT == MVT::f32) { - assert(0 && "FIXME: softfp should use promotion!"); -#if 0 - // f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND - SDOperand Load = DAG.getLoad(EVT, Ch, Ptr, N->getSrcValue(), - SVOffset, isVolatile, Alignment); - // Remember that we legalized the chain. - AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Load.getValue(1))); - ExpandOp(DAG.getNode(ISD::FP_EXTEND, VT, Load), Lo, Hi); - break; -#endif - } - if (EVT == NVT) Lo = DAG.getLoad(NVT, Ch, Ptr, N->getSrcValue(), SVOffset, isVolatile, Alignment); @@ -843,13 +817,11 @@ // If the target wants to custom expand this, let them. if (TLI.getOperationAction(N->getOpcode(), VT) == TargetLowering::Custom) { - SDOperand Op = TLI.LowerOperation(SDOperand(N, 0), DAG); - // FIXME: Do a replace all uses with here! - assert(0 && "Custom not impl yet!"); - if (Op.Val) { -#if 0 - ExpandOp(Op, Lo, Hi); -#endif + std::pair Ret = + TLI.ExpandOperation(SDOperand(N, 0), DAG); + if (Ret.first.Val) { + Lo = Ret.first; + Hi = Ret.second; return; } } @@ -905,13 +877,11 @@ // If the target wants to custom expand this, let them. if (TLI.getOperationAction(ISD::MUL, VT) == TargetLowering::Custom) { - SDOperand New = TLI.LowerOperation(SDOperand(N, 0), DAG); - if (New.Val) { - // FIXME: Do a replace all uses with here! - assert(0 && "Custom not impl yet!"); -#if 0 - ExpandOp(New, Lo, Hi); -#endif + std::pair Ret = + TLI.ExpandOperation(SDOperand(N, 0), DAG); + if (Ret.first.Val) { + Lo = Ret.first; + Hi = Ret.second; return; } } @@ -990,15 +960,11 @@ // If the target wants custom lowering, do so. if (TLI.getOperationAction(N->getOpcode(), VT) == TargetLowering::Custom) { - SDOperand Op = TLI.LowerOperation(SDOperand(N, 0), DAG); - if (Op.Val) { - // Now that the custom expander is done, expand the result, which is - // still VT. - // FIXME: Do a replace all uses with here! - abort(); -#if 0 - ExpandOp(Op, Lo, Hi); -#endif + std::pair Ret = + TLI.ExpandOperation(SDOperand(N, 0), DAG); + if (Ret.first.Val) { + Lo = Ret.first; + Hi = Ret.second; return; } } From sabre at nondot.org Thu Oct 18 23:08:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 04:08:29 -0000 Subject: [llvm-commits] [llvm] r43168 - /llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200710190408.l9J48T00016275@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 23:08:28 2007 New Revision: 43168 URL: http://llvm.org/viewvc/llvm-project?rev=43168&view=rev Log: comment fixes Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=43168&r1=43167&r2=43168&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Thu Oct 18 23:08:28 2007 @@ -231,12 +231,12 @@ } if (TM.getSubtarget().use64BitRegs()) { - // 64 bit PowerPC implementations can support i64 types directly + // 64-bit PowerPC implementations can support i64 types directly addRegisterClass(MVT::i64, PPC::G8RCRegisterClass); // BUILD_PAIR can't be handled natively, and should be expanded to shl/or setOperationAction(ISD::BUILD_PAIR, MVT::i64, Expand); } else { - // 32 bit PowerPC wants to expand i64 shifts itself. + // 32-bit PowerPC wants to expand i64 shifts itself. setOperationAction(ISD::SHL_PARTS, MVT::i32, Custom); setOperationAction(ISD::SRA_PARTS, MVT::i32, Custom); setOperationAction(ISD::SRL_PARTS, MVT::i32, Custom); @@ -2105,7 +2105,7 @@ assert(Op.getValueType() == MVT::ppcf128); SDNode *Node = Op.Val; assert(Node->getOperand(0).getValueType() == MVT::ppcf128); - assert(Node->getOperand(0).Val->getOpcode()==ISD::BUILD_PAIR); + assert(Node->getOperand(0).Val->getOpcode() == ISD::BUILD_PAIR); SDOperand Lo = Node->getOperand(0).Val->getOperand(0); SDOperand Hi = Node->getOperand(0).Val->getOperand(1); From sabre at nondot.org Thu Oct 18 23:14:36 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 04:14:36 -0000 Subject: [llvm-commits] [llvm] r43169 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710190414.l9J4EaMQ016489@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 23:14:36 2007 New Revision: 43169 URL: http://llvm.org/viewvc/llvm-project?rev=43169&view=rev Log: implement support for custom expansion of any node type, in one place. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43169&r1=43168&r2=43169&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 23:14:36 2007 @@ -603,6 +603,22 @@ DEBUG(cerr << "Expand node result: "; N->dump(&DAG); cerr << "\n"); SDOperand Lo, Hi; Lo = Hi = SDOperand(); + + // If this is a single-result node, see if the target wants to custom expand + // it. + if (N->getNumValues() == 1 && + TLI.getOperationAction(N->getOpcode(), + N->getValueType(0)) == TargetLowering::Custom) { + // If the target wants to, allow it to lower this itself. + std::pair P = + TLI.ExpandOperation(SDOperand(N, 0), DAG); + if (P.first.Val) { + Lo = P.first; + Hi = P.second; + return; + } + } + switch (N->getOpcode()) { default: #ifndef NDEBUG @@ -694,20 +710,8 @@ void DAGTypeLegalizer::ExpandResult_BIT_CONVERT(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType VT = N->getValueType(0); - if (TLI.getOperationAction(ISD::BIT_CONVERT, VT) == TargetLowering::Custom){ - // If the target wants to, allow it to lower this itself. - std::pair P = - TLI.ExpandOperation(SDOperand(N, 0), DAG); - if (P.first.Val) { - Lo = P.first; - Hi = P.second; - return; - } - } - // Lower the bit-convert to a store/load from the stack, then expand the load. - SDOperand Op = CreateStackStoreLoad(N->getOperand(0), VT); + SDOperand Op = CreateStackStoreLoad(N->getOperand(0), N->getValueType(0)); ExpandResult_LOAD(cast(Op.Val), Lo, Hi); } @@ -875,17 +879,6 @@ MVT::ValueType VT = N->getValueType(0); MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); - // If the target wants to custom expand this, let them. - if (TLI.getOperationAction(ISD::MUL, VT) == TargetLowering::Custom) { - std::pair Ret = - TLI.ExpandOperation(SDOperand(N, 0), DAG); - if (Ret.first.Val) { - Lo = Ret.first; - Hi = Ret.second; - return; - } - } - bool HasMULHS = TLI.isOperationLegal(ISD::MULHS, NVT); bool HasMULHU = TLI.isOperationLegal(ISD::MULHU, NVT); bool HasSMUL_LOHI = TLI.isOperationLegal(ISD::SMUL_LOHI, NVT); @@ -958,17 +951,6 @@ SDOperand &Lo, SDOperand &Hi) { MVT::ValueType VT = N->getValueType(0); - // If the target wants custom lowering, do so. - if (TLI.getOperationAction(N->getOpcode(), VT) == TargetLowering::Custom) { - std::pair Ret = - TLI.ExpandOperation(SDOperand(N, 0), DAG); - if (Ret.first.Val) { - Lo = Ret.first; - Hi = Ret.second; - return; - } - } - // If we can emit an efficient shift operation, do so now. Check to see if // the RHS is a constant. if (ConstantSDNode *CN = dyn_cast(N->getOperand(1))) From sabre at nondot.org Thu Oct 18 23:32:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 04:32:48 -0000 Subject: [llvm-commits] [llvm] r43170 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710190432.l9J4Wm0t017463@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 23:32:47 2007 New Revision: 43170 URL: http://llvm.org/viewvc/llvm-project?rev=43170&view=rev Log: Implement expansion of SINT_TO_FP and UINT_TO_FP operands. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43170&r1=43169&r2=43170&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 23:32:47 2007 @@ -14,6 +14,8 @@ #define DEBUG_TYPE "legalize-types" #include "llvm/CodeGen/SelectionDAG.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Target/TargetLowering.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/Compiler.h" @@ -175,6 +177,8 @@ // Operand Expansion. bool ExpandOperand(SDNode *N, unsigned OperandNo); SDOperand ExpandOperand_TRUNCATE(SDNode *N); + SDOperand ExpandOperand_UINT_TO_FP(SDOperand Source, MVT::ValueType DestTy); + SDOperand ExpandOperand_SINT_TO_FP(SDOperand Source, MVT::ValueType DestTy); SDOperand ExpandOperand_EXTRACT_ELEMENT(SDNode *N); SDOperand ExpandOperand_SETCC(SDNode *N); SDOperand ExpandOperand_STORE(StoreSDNode *N, unsigned OpNo); @@ -1358,6 +1362,12 @@ abort(); case ISD::TRUNCATE: Res = ExpandOperand_TRUNCATE(N); break; + case ISD::SINT_TO_FP: + Res = ExpandOperand_SINT_TO_FP(N->getOperand(0), N->getValueType(0)); + break; + case ISD::UINT_TO_FP: + Res = ExpandOperand_UINT_TO_FP(N->getOperand(0), N->getValueType(0)); + break; case ISD::EXTRACT_ELEMENT: Res = ExpandOperand_EXTRACT_ELEMENT(N); break; case ISD::SETCC: Res = ExpandOperand_SETCC(N); break; @@ -1391,6 +1401,85 @@ return DAG.getNode(ISD::TRUNCATE, N->getValueType(0), InL); } +SDOperand DAGTypeLegalizer::ExpandOperand_SINT_TO_FP(SDOperand Source, + MVT::ValueType DestTy) { + // We know the destination is legal, but that the input needs to be expanded. + assert(Source.getValueType() == MVT::i64 && "Only handle expand from i64!"); + + // Check to see if the target has a custom way to lower this. If so, use it. + switch (TLI.getOperationAction(ISD::SINT_TO_FP, Source.getValueType())) { + default: assert(0 && "This action not implemented for this operation!"); + case TargetLowering::Legal: + case TargetLowering::Expand: + break; // This case is handled below. + case TargetLowering::Custom: + SDOperand NV = TLI.LowerOperation(DAG.getNode(ISD::SINT_TO_FP, DestTy, + Source), DAG); + if (NV.Val) return NV; + break; // The target lowered this. + } + + RTLIB::Libcall LC; + if (DestTy == MVT::f32) + LC = RTLIB::SINTTOFP_I64_F32; + else { + assert(DestTy == MVT::f64 && "Unknown fp value type!"); + LC = RTLIB::SINTTOFP_I64_F64; + } + + assert(0 && "FIXME: no libcalls yet!"); + abort(); +#if 0 + assert(TLI.getLibcallName(LC) && "Don't know how to expand this SINT_TO_FP!"); + Source = DAG.getNode(ISD::SINT_TO_FP, DestTy, Source); + SDOperand UnusedHiPart; + return ExpandLibCall(TLI.getLibcallName(LC), Source.Val, true, UnusedHiPart); +#endif +} + +SDOperand DAGTypeLegalizer::ExpandOperand_UINT_TO_FP(SDOperand Source, + MVT::ValueType DestTy) { + // We know the destination is legal, but that the input needs to be expanded. + assert(getTypeAction(Source.getValueType()) == Expand && + "This is not an expansion!"); + assert(Source.getValueType() == MVT::i64 && "Only handle expand from i64!"); + + // If this is unsigned, and not supported, first perform the conversion to + // signed, then adjust the result if the sign bit is set. + SDOperand SignedConv = ExpandOperand_SINT_TO_FP(Source, DestTy); + + // The 64-bit value loaded will be incorrectly if the 'sign bit' of the + // incoming integer is set. To handle this, we dynamically test to see if + // it is set, and, if so, add a fudge factor. + SDOperand Lo, Hi; + GetExpandedOp(Source, Lo, Hi); + + SDOperand SignSet = DAG.getSetCC(TLI.getSetCCResultTy(), Hi, + DAG.getConstant(0, Hi.getValueType()), + ISD::SETLT); + SDOperand Zero = getIntPtrConstant(0), Four = getIntPtrConstant(4); + SDOperand CstOffset = DAG.getNode(ISD::SELECT, Zero.getValueType(), + SignSet, Four, Zero); + uint64_t FF = 0x5f800000ULL; + if (TLI.isLittleEndian()) FF <<= 32; + Constant *FudgeFactor = ConstantInt::get(Type::Int64Ty, FF); + + SDOperand CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy()); + CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); + SDOperand FudgeInReg; + if (DestTy == MVT::f32) + FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, NULL, 0); + else if (MVT::getSizeInBits(DestTy) > MVT::getSizeInBits(MVT::f32)) + // FIXME: Avoid the extend by construction the right constantpool? + FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, DestTy, DAG.getEntryNode(), + CPIdx, NULL, 0, MVT::f32); + else + assert(0 && "Unexpected conversion"); + + return DAG.getNode(ISD::FADD, DestTy, SignedConv, FudgeInReg); +} + + SDOperand DAGTypeLegalizer::ExpandOperand_EXTRACT_ELEMENT(SDNode *N) { SDOperand Lo, Hi; GetExpandedOp(N->getOperand(0), Lo, Hi); From sabre at nondot.org Thu Oct 18 23:46:46 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 04:46:46 -0000 Subject: [llvm-commits] [llvm] r43171 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710190446.l9J4kkXp018139@zion.cs.uiuc.edu> Author: lattner Date: Thu Oct 18 23:46:45 2007 New Revision: 43171 URL: http://llvm.org/viewvc/llvm-project?rev=43171&view=rev Log: Implement a few new operations. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43171&r1=43170&r2=43171&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 23:46:45 2007 @@ -146,9 +146,11 @@ void ExpandResult_ZERO_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SIGN_EXTEND(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_BIT_CONVERT(SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_SIGN_EXTEND_INREG(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_LOAD (LoadSDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_ADDSUBC (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SELECT (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -177,6 +179,7 @@ // Operand Expansion. bool ExpandOperand(SDNode *N, unsigned OperandNo); SDOperand ExpandOperand_TRUNCATE(SDNode *N); + SDOperand ExpandOperand_BIT_CONVERT(SDNode *N); SDOperand ExpandOperand_UINT_TO_FP(SDOperand Source, MVT::ValueType DestTy); SDOperand ExpandOperand_SINT_TO_FP(SDOperand Source, MVT::ValueType DestTy); SDOperand ExpandOperand_EXTRACT_ELEMENT(SDNode *N); @@ -639,11 +642,13 @@ case ISD::ZERO_EXTEND: ExpandResult_ZERO_EXTEND(N, Lo, Hi); break; case ISD::SIGN_EXTEND: ExpandResult_SIGN_EXTEND(N, Lo, Hi); break; case ISD::BIT_CONVERT: ExpandResult_BIT_CONVERT(N, Lo, Hi); break; + case ISD::SIGN_EXTEND_INREG: ExpandResult_SIGN_EXTEND_INREG(N, Lo, Hi); break; case ISD::LOAD: ExpandResult_LOAD(cast(N), Lo, Hi); break; case ISD::AND: case ISD::OR: case ISD::XOR: ExpandResult_Logical(N, Lo, Hi); break; + case ISD::BSWAP: ExpandResult_BSWAP(N, Lo, Hi); break; case ISD::ADD: case ISD::SUB: ExpandResult_ADDSUB(N, Lo, Hi); break; case ISD::ADDC: @@ -719,6 +724,22 @@ ExpandResult_LOAD(cast(Op.Val), Lo, Hi); } +void DAGTypeLegalizer:: +ExpandResult_SIGN_EXTEND_INREG(SDNode *N, SDOperand &Lo, SDOperand &Hi) { + GetExpandedOp(N->getOperand(0), Lo, Hi); + + // sext_inreg the low part if needed. + Lo = DAG.getNode(ISD::SIGN_EXTEND_INREG, Lo.getValueType(), Lo, + N->getOperand(1)); + + // The high part gets the sign extension from the lo-part. This handles + // things like sextinreg V:i64 from i8. + Hi = DAG.getNode(ISD::SRA, Hi.getValueType(), Lo, + DAG.getConstant(MVT::getSizeInBits(Hi.getValueType())-1, + TLI.getShiftAmountTy())); +} + + void DAGTypeLegalizer::ExpandResult_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi) { MVT::ValueType VT = N->getValueType(0); @@ -792,6 +813,14 @@ Hi = DAG.getNode(N->getOpcode(), LL.getValueType(), LH, RH); } +void DAGTypeLegalizer::ExpandResult_BSWAP(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + GetExpandedOp(N->getOperand(0), Hi, Lo); // Note swapped operands. + Lo = DAG.getNode(ISD::BSWAP, Lo.getValueType(), Lo); + Hi = DAG.getNode(ISD::BSWAP, Hi.getValueType(), Hi); +} + + void DAGTypeLegalizer::ExpandResult_SELECT(SDNode *N, SDOperand &Lo, SDOperand &Hi) { SDOperand LL, LH, RL, RH; @@ -1362,6 +1391,8 @@ abort(); case ISD::TRUNCATE: Res = ExpandOperand_TRUNCATE(N); break; + case ISD::BIT_CONVERT: Res = ExpandOperand_BIT_CONVERT(N); break; + case ISD::SINT_TO_FP: Res = ExpandOperand_SINT_TO_FP(N->getOperand(0), N->getValueType(0)); break; @@ -1401,6 +1432,10 @@ return DAG.getNode(ISD::TRUNCATE, N->getValueType(0), InL); } +SDOperand DAGTypeLegalizer::ExpandOperand_BIT_CONVERT(SDNode *N) { + return CreateStackStoreLoad(N->getOperand(0), N->getValueType(0)); +} + SDOperand DAGTypeLegalizer::ExpandOperand_SINT_TO_FP(SDOperand Source, MVT::ValueType DestTy) { // We know the destination is legal, but that the input needs to be expanded. From baldrick at free.fr Fri Oct 19 03:24:31 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 10:24:31 +0200 Subject: [llvm-commits] [llvm] r43165 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <200710190331.l9J3Vk3l014433@zion.cs.uiuc.edu> References: <200710190331.l9J3Vk3l014433@zion.cs.uiuc.edu> Message-ID: <200710191024.31665.baldrick@free.fr> Hi Chris, > + /// ExpandOperation - This callback is invoked for operations that are > + /// unsupported by the target, which are registered to use 'custom' lowering, > + /// and whose result type needs to be expanded. how about calling this ExpandOperationResult or CustomExpandResult or something like that? Ciao, Duncan. From baldrick at free.fr Fri Oct 19 03:26:21 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 10:26:21 +0200 Subject: [llvm-commits] [llvm] r43169 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp In-Reply-To: <200710190414.l9J4EaMQ016489@zion.cs.uiuc.edu> References: <200710190414.l9J4EaMQ016489@zion.cs.uiuc.edu> Message-ID: <200710191026.21856.baldrick@free.fr> > implement support for custom expansion of any node type, in one place. Yay! From baldrick at free.fr Fri Oct 19 03:31:52 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 10:31:52 +0200 Subject: [llvm-commits] [llvm] r43171 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp In-Reply-To: <200710190446.l9J4kkXp018139@zion.cs.uiuc.edu> References: <200710190446.l9J4kkXp018139@zion.cs.uiuc.edu> Message-ID: <200710191031.52183.baldrick@free.fr> Hi Chris, > +void DAGTypeLegalizer:: > +ExpandResult_SIGN_EXTEND_INREG(SDNode *N, SDOperand &Lo, SDOperand &Hi) { > + GetExpandedOp(N->getOperand(0), Lo, Hi); > + > + // sext_inreg the low part if needed. > + Lo = DAG.getNode(ISD::SIGN_EXTEND_INREG, Lo.getValueType(), Lo, > + N->getOperand(1)); > + > + // The high part gets the sign extension from the lo-part. This handles > + // things like sextinreg V:i64 from i8. > + Hi = DAG.getNode(ISD::SRA, Hi.getValueType(), Lo, > + DAG.getConstant(MVT::getSizeInBits(Hi.getValueType())-1, > + TLI.getShiftAmountTy())); > +} doesn't this assume that the type being extended is smaller than or equal to the type of Lo? For example, will this work for i64 from i63? Ciao, Duncan. From isanbard at gmail.com Fri Oct 19 03:37:10 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 01:37:10 -0700 Subject: [llvm-commits] ranlib problems Message-ID: <93C53C95-B732-4DF8-B736-7027392FC76B@gmail.com> Hi all, Is anyone seeing this? ar cru /Users/wendling/llvm/llvm.obj/Debug/lib/libLLVMSystem.a /Users/ wendling/llvm/llvm.obj/lib/System/Debug/Alarm.o /Users/wendling/llvm/ llvm.obj/lib/System/Debug/Disassembler.o /Users/wendling/llvm/ llvm.obj/lib/System/Debug/DynamicLibrary.o /Users/wendling/llvm/ llvm.obj/lib/System/Debug/IncludeFile.o /Users/wendling/llvm/llvm.obj/ lib/System/Debug/MappedFile.o /Users/wendling/llvm/llvm.obj/lib/ System/Debug/Memory.o /Users/wendling/llvm/llvm.obj/lib/System/Debug/ Mutex.o /Users/wendling/llvm/llvm.obj/lib/System/Debug/Path.o /Users/ wendling/llvm/llvm.obj/lib/System/Debug/Process.o /Users/wendling/ llvm/llvm.obj/lib/System/Debug/Program.o /Users/wendling/llvm/ llvm.obj/lib/System/Debug/Signals.o /Users/wendling/llvm/llvm.obj/lib/ System/Debug/TimeValue.o /Users/wendling/llvm/llvm.obj/lib/System/ Debug/ltdl.o ranlib: unrecognized option `-q' Try `ranlib --help' for more information. ar: internal ranlib command failed make[1]: *** [/Users/wendling/llvm/llvm.obj/Debug/lib/ libLLVMSystem.a] Error 1 make: *** [all] Error 1 This is new... -bw From baldrick at free.fr Fri Oct 19 03:36:03 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 10:36:03 +0200 Subject: [llvm-commits] [llvm] r43083 - in /llvm/trunk: lib/Transforms/IPO/RaiseAllocations.cpp test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll In-Reply-To: <4B75DE21-653F-4BFF-8811-1E9F6155FE1A@apple.com> References: <200710172012.l9HKCwoJ015392@zion.cs.uiuc.edu> <200710181007.26325.baldrick@free.fr> <4B75DE21-653F-4BFF-8811-1E9F6155FE1A@apple.com> Message-ID: <200710191036.03419.baldrick@free.fr> Hi Devang, > >> Do not raise free() call that is called through invoke instruction. > > > why not? As far as I know free cannot raise an exception, > > If this is guaranteed then raiseallocs needs to do cleanup and break > link between bb with inovke .. at free(..) and corresponding unwind block > (remove PHI nodes' incoming edge). it is not clear to me whether we are allowed to assume that free is the standard C free (likewise for malloc). If we are, then I think it would be better to raise calls to them, fixing up the unwind edge if they were invokes. > > and we > > don't support trapping exceptions for the moment. Ciao, Duncan. From baldrick at free.fr Fri Oct 19 05:21:13 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 12:21:13 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> Message-ID: <200710191221.14487.baldrick@free.fr> Hi Bill, > > I think the objc front-end is emitting the setjmp/longjmp calls > > itself directly, not relying on the rest of the GCC EH mechanisms... > > > Yes. That's my understanding. If you look at > obj-act.c:next_sjlj_build_try_catch_finally(), it has a big comment > showing what it converts try-catch-finalize to. I see. I wanted to examine how llvm-gcc-4.2 and mainline handle the testcase 2007-10-17-SJLJExceptions.m, but it doesn't compile with either: $ gcc-4.2 -x objective-c 2007-10-17-SJLJExceptions.m -O2 -fexceptions -S -o - .file "2007-10-17-SJLJExceptions.m" 2007-10-17-SJLJExceptions.m:3:34: error: Foundation/Foundation.h: No such file or directory 2007-10-17-SJLJExceptions.m:5: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token 2007-10-17-SJLJExceptions.m:7: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?bork? Ciao, Duncan. PS: the run line has "-arch i386". Is that right? My compiler doesn't recognize it. From rafael.espindola at gmail.com Fri Oct 19 05:41:12 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 19 Oct 2007 10:41:12 -0000 Subject: [llvm-commits] [llvm] r43172 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/byval3.ll test/CodeGen/X86/byval4.ll Message-ID: <200710191041.l9JAfDho008612@zion.cs.uiuc.edu> Author: rafael Date: Fri Oct 19 05:41:11 2007 New Revision: 43172 URL: http://llvm.org/viewvc/llvm-project?rev=43172&view=rev Log: Add support for byval function whose argument is not 32 bit aligned. To do this it is necessary to add a "always inline" argument to the memcpy node. For completeness I have also added this node to memmove and memset. I have also added getMem* functions, because the extra argument makes it cumbersome to use getNode and because I get confused by it :-) Added: llvm/trunk/test/CodeGen/X86/byval4.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/byval3.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Oct 19 05:41:11 2007 @@ -307,7 +307,19 @@ SDOperand N5); SDOperand getNode(unsigned Opcode, SDVTList VTs, const SDOperand *Ops, unsigned NumOps); - + + SDOperand getMemcpy(SDOperand Chain, SDOperand Dest, SDOperand Src, + SDOperand Size, SDOperand Align, + SDOperand AlwaysInline); + + SDOperand getMemmove(SDOperand Chain, SDOperand Dest, SDOperand Src, + SDOperand Size, SDOperand Align, + SDOperand AlwaysInline); + + SDOperand getMemset(SDOperand Chain, SDOperand Dest, SDOperand Src, + SDOperand Size, SDOperand Align, + SDOperand AlwaysInline); + /// getSetCC - Helper function to make it easier to build SetCC's if you just /// have an ISD::CondCode instead of an SDOperand. /// Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Oct 19 05:41:11 2007 @@ -485,10 +485,10 @@ // it returns an output chain. STACKRESTORE, - // MEMSET/MEMCPY/MEMMOVE - The first operand is the chain, and the rest - // correspond to the operands of the LLVM intrinsic functions. The only - // result is a token chain. The alignment argument is guaranteed to be a - // Constant node. + // MEMSET/MEMCPY/MEMMOVE - The first operand is the chain. The following + // correspond to the operands of the LLVM intrinsic functions and the last + // one is AlwaysInline. The only result is a token chain. The alignment + // argument is guaranteed to be a Constant node. MEMSET, MEMMOVE, MEMCPY, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 19 05:41:11 2007 @@ -2506,18 +2506,31 @@ break; } + SDOperand Tmp6; + switch (getTypeAction(Node->getOperand(5).getValueType())) { // bool + case Expand: assert(0 && "Cannot expand this yet!"); + case Legal: + Tmp6 = LegalizeOp(Node->getOperand(5)); + break; + case Promote: + Tmp6 = PromoteOp(Node->getOperand(5)); + break; + } + switch (TLI.getOperationAction(Node->getOpcode(), MVT::Other)) { default: assert(0 && "This action not implemented for this operation!"); case TargetLowering::Custom: isCustom = true; // FALLTHROUGH - case TargetLowering::Legal: - Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3, Tmp4, Tmp5); + case TargetLowering::Legal: { + SDOperand Ops[] = { Tmp1, Tmp2, Tmp3, Tmp4, Tmp5, Tmp6 }; + Result = DAG.UpdateNodeOperands(Result, Ops, 6); if (isCustom) { Tmp1 = TLI.LowerOperation(Result, DAG); if (Tmp1.Val) Result = Tmp1; } break; + } case TargetLowering::Expand: { // Otherwise, the target does not support this operation. Lower the // operation to an explicit libcall as appropriate. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 19 05:41:11 2007 @@ -2269,6 +2269,30 @@ return getNode(Opcode, VT, Ops, 5); } +SDOperand SelectionDAG::getMemcpy(SDOperand Chain, SDOperand Dest, + SDOperand Src, SDOperand Size, + SDOperand Align, + SDOperand AlwaysInline) { + SDOperand Ops[] = { Chain, Dest, Src, Size, Align, AlwaysInline }; + return getNode(ISD::MEMCPY, MVT::Other, Ops, 6); +} + +SDOperand SelectionDAG::getMemmove(SDOperand Chain, SDOperand Dest, + SDOperand Src, SDOperand Size, + SDOperand Align, + SDOperand AlwaysInline) { + SDOperand Ops[] = { Chain, Dest, Src, Size, Align, AlwaysInline }; + return getNode(ISD::MEMMOVE, MVT::Other, Ops, 6); +} + +SDOperand SelectionDAG::getMemset(SDOperand Chain, SDOperand Dest, + SDOperand Src, SDOperand Size, + SDOperand Align, + SDOperand AlwaysInline) { + SDOperand Ops[] = { Chain, Dest, Src, Size, Align, AlwaysInline }; + return getNode(ISD::MEMSET, MVT::Other, Ops, 6); +} + SDOperand SelectionDAG::getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, const Value *SV, int SVOffset, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 19 05:41:11 2007 @@ -4367,7 +4367,22 @@ } } - DAG.setRoot(DAG.getNode(Op, MVT::Other, getRoot(), Op1, Op2, Op3, Op4)); + SDOperand AlwaysInline = DAG.getConstant(0, MVT::i1); + SDOperand Node; + switch(Op) { + default: + assert(0 && "Unknown Op"); + case ISD::MEMCPY: + Node = DAG.getMemcpy(getRoot(), Op1, Op2, Op3, Op4, AlwaysInline); + break; + case ISD::MEMMOVE: + Node = DAG.getMemmove(getRoot(), Op1, Op2, Op3, Op4, AlwaysInline); + break; + case ISD::MEMSET: + Node = DAG.getMemset(getRoot(), Op1, Op2, Op3, Op4, AlwaysInline); + break; + } + DAG.setRoot(Node); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Oct 19 05:41:11 2007 @@ -1246,9 +1246,10 @@ SDOperand AlignNode = DAG.getConstant(Align, MVT::i32); SDOperand SizeNode = DAG.getConstant(Size, MVT::i32); + SDOperand AlwaysInline = DAG.getConstant(1, MVT::i1); - return DAG.getNode(ISD::MEMCPY, MVT::Other, Chain, PtrOff, Arg, SizeNode, - AlignNode); + return DAG.getMemcpy(Chain, PtrOff, Arg, SizeNode, AlignNode, + AlwaysInline); } else { return DAG.getStore(Chain, Arg, PtrOff, NULL, 0); } @@ -4472,9 +4473,23 @@ SDOperand SourceOp = Op.getOperand(2); SDOperand CountOp = Op.getOperand(3); SDOperand AlignOp = Op.getOperand(4); + SDOperand AlwaysInlineOp = Op.getOperand(5); + + bool AlwaysInline = (bool)cast(AlwaysInlineOp)->getValue(); unsigned Align = (unsigned)cast(AlignOp)->getValue(); if (Align == 0) Align = 1; + // If size is unknown, call memcpy. + ConstantSDNode *I = dyn_cast(CountOp); + if (!I) { + assert(!AlwaysInline && "Cannot inline copy of unknown size"); + return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); + } + unsigned Size = I->getValue(); + + if (AlwaysInline) + return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); + // The libc version is likely to be faster for the following cases. It can // use the address value and run time information about the CPU. // With glibc 2.6.1 on a core 2, coping an array of 100M longs was 30% faster @@ -4483,13 +4498,7 @@ if ((Align & 3) != 0) return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); - // If size is unknown, call memcpy. - ConstantSDNode *I = dyn_cast(CountOp); - if (!I) - return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); - // If size is more than the threshold, call memcpy. - unsigned Size = I->getValue(); if (Size > Subtarget->getMinRepStrSizeThreshold()) return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); Modified: llvm/trunk/test/CodeGen/X86/byval3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/byval3.ll?rev=43172&r1=43171&r2=43172&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/byval3.ll (original) +++ llvm/trunk/test/CodeGen/X86/byval3.ll Fri Oct 19 05:41:11 2007 @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86-64 | grep rep.movsl | count 2 +; RUN: llvm-as < %s | llc -march=x86 | grep rep.movsl | count 2 %struct.s = type { i32, i32, i32, i32, i32, i32 } Added: llvm/trunk/test/CodeGen/X86/byval4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/byval4.ll?rev=43172&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/byval4.ll (added) +++ llvm/trunk/test/CodeGen/X86/byval4.ll Fri Oct 19 05:41:11 2007 @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep rep.movsl | count 2 +; RUN: llvm-as < %s | llc -march=x86 | grep rep.movsw | count 2 + +%struct.s = type { i16, i16, i16, i16, i16, i16 } + + +define void @g(i16 signext %a1, i16 signext %a2, i16 signext %a3, + i16 signext %a4, i16 signext %a5, i16 signext %a6) { +entry: + %a = alloca %struct.s, align 16 + %tmp = getelementptr %struct.s* %a, i32 0, i32 0 + store i16 %a1, i16* %tmp, align 16 + %tmp2 = getelementptr %struct.s* %a, i32 0, i32 1 + store i16 %a2, i16* %tmp2, align 16 + %tmp4 = getelementptr %struct.s* %a, i32 0, i32 2 + store i16 %a3, i16* %tmp4, align 16 + %tmp6 = getelementptr %struct.s* %a, i32 0, i32 3 + store i16 %a4, i16* %tmp6, align 16 + %tmp8 = getelementptr %struct.s* %a, i32 0, i32 4 + store i16 %a5, i16* %tmp8, align 16 + %tmp10 = getelementptr %struct.s* %a, i32 0, i32 5 + store i16 %a6, i16* %tmp10, align 16 + call void @f( %struct.s* %a byval ) + call void @f( %struct.s* %a byval ) + ret void +} + +declare void @f(%struct.s* byval) From rafael.espindola at gmail.com Fri Oct 19 06:29:25 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 19 Oct 2007 11:29:25 -0000 Subject: [llvm-commits] [llvm] r43173 - /llvm/trunk/test/CodeGen/X86/byval5.ll Message-ID: <200710191129.l9JBTPvB010720@zion.cs.uiuc.edu> Author: rafael Date: Fri Oct 19 06:29:21 2007 New Revision: 43173 URL: http://llvm.org/viewvc/llvm-project?rev=43173&view=rev Log: Test byval with a 8 bit aligned struct Added: llvm/trunk/test/CodeGen/X86/byval5.ll Added: llvm/trunk/test/CodeGen/X86/byval5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/byval5.ll?rev=43173&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/byval5.ll (added) +++ llvm/trunk/test/CodeGen/X86/byval5.ll Fri Oct 19 06:29:21 2007 @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep rep.movsl | count 2 +; RUN: llvm-as < %s | llc -march=x86 | grep rep.movsb | count 2 + +%struct.s = type { i8, i8, i8, i8, i8, i8 } + + +define void @g(i8 signext %a1, i8 signext %a2, i8 signext %a3, + i8 signext %a4, i8 signext %a5, i8 signext %a6) { +entry: + %a = alloca %struct.s + %tmp = getelementptr %struct.s* %a, i32 0, i32 0 + store i8 %a1, i8* %tmp, align 8 + %tmp2 = getelementptr %struct.s* %a, i32 0, i32 1 + store i8 %a2, i8* %tmp2, align 8 + %tmp4 = getelementptr %struct.s* %a, i32 0, i32 2 + store i8 %a3, i8* %tmp4, align 8 + %tmp6 = getelementptr %struct.s* %a, i32 0, i32 3 + store i8 %a4, i8* %tmp6, align 8 + %tmp8 = getelementptr %struct.s* %a, i32 0, i32 4 + store i8 %a5, i8* %tmp8, align 8 + %tmp10 = getelementptr %struct.s* %a, i32 0, i32 5 + store i8 %a6, i8* %tmp10, align 8 + call void @f( %struct.s* %a byval ) + call void @f( %struct.s* %a byval ) + ret void +} + +declare void @f(%struct.s* byval) From baldrick at free.fr Fri Oct 19 08:05:41 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 13:05:41 -0000 Subject: [llvm-commits] [llvm] r43174 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200710191305.l9JD5fOQ014805@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 19 08:05:40 2007 New Revision: 43174 URL: http://llvm.org/viewvc/llvm-project?rev=43174&view=rev Log: If the value types are equal then this routine asserts in later checks rather than producing the ordinary load it is supposed to. Avoid all such hassles by directly returning an ordinary load in this case. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=43174&r1=43173&r2=43174&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 19 08:05:40 2007 @@ -2340,7 +2340,7 @@ // If they are asking for an extending load from/to the same thing, return a // normal load. if (VT == EVT) - ExtType = ISD::NON_EXTLOAD; + return getLoad(VT, Chain, Ptr, SV, SVOffset, isVolatile, Alignment); if (MVT::isVector(VT)) assert(EVT == MVT::getVectorElementType(VT) && "Invalid vector extload!"); From baldrick at free.fr Fri Oct 19 08:06:18 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 13:06:18 -0000 Subject: [llvm-commits] [llvm] r43175 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710191306.l9JD6ItW014856@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 19 08:06:17 2007 New Revision: 43175 URL: http://llvm.org/viewvc/llvm-project?rev=43175&view=rev Log: Support for expanding ADDE and SUBE. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43175&r1=43174&r2=43175&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Oct 19 08:06:17 2007 @@ -153,6 +153,7 @@ void ExpandResult_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_ADDSUBC (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandResult_ADDSUBE (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SELECT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_SELECT_CC (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandResult_MUL (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -653,6 +654,8 @@ case ISD::SUB: ExpandResult_ADDSUB(N, Lo, Hi); break; case ISD::ADDC: case ISD::SUBC: ExpandResult_ADDSUBC(N, Lo, Hi); break; + case ISD::ADDE: + case ISD::SUBE: ExpandResult_ADDSUBE(N, Lo, Hi); break; case ISD::SELECT: ExpandResult_SELECT(N, Lo, Hi); break; case ISD::SELECT_CC: ExpandResult_SELECT_CC(N, Lo, Hi); break; case ISD::MUL: ExpandResult_MUL(N, Lo, Hi); break; @@ -907,6 +910,25 @@ ReplaceLegalValueWith(SDOperand(N, 1), Hi.getValue(1)); } +void DAGTypeLegalizer::ExpandResult_ADDSUBE(SDNode *N, + SDOperand &Lo, SDOperand &Hi) { + // Expand the subcomponents. + SDOperand LHSL, LHSH, RHSL, RHSH; + GetExpandedOp(N->getOperand(0), LHSL, LHSH); + GetExpandedOp(N->getOperand(1), RHSL, RHSH); + SDVTList VTList = DAG.getVTList(LHSL.getValueType(), MVT::Flag); + SDOperand LoOps[3] = { LHSL, RHSL, N->getOperand(2) }; + SDOperand HiOps[3] = { LHSH, RHSH }; + + Lo = DAG.getNode(N->getOpcode(), VTList, LoOps, 3); + HiOps[2] = Lo.getValue(1); + Hi = DAG.getNode(N->getOpcode(), VTList, HiOps, 3); + + // Legalized the flag result - switch anything that used the old flag to + // use the new one. + ReplaceLegalValueWith(SDOperand(N, 1), Hi.getValue(1)); +} + void DAGTypeLegalizer::ExpandResult_MUL(SDNode *N, SDOperand &Lo, SDOperand &Hi) { MVT::ValueType VT = N->getValueType(0); From rafael.espindola at gmail.com Fri Oct 19 09:35:18 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 19 Oct 2007 14:35:18 -0000 Subject: [llvm-commits] [llvm] r43176 - in /llvm/trunk/lib/Target/ARM: ARMISelLowering.cpp ARMISelLowering.h Message-ID: <200710191435.l9JEZIAM018674@zion.cs.uiuc.edu> Author: rafael Date: Fri Oct 19 09:35:17 2007 New Revision: 43176 URL: http://llvm.org/viewvc/llvm-project?rev=43176&view=rev Log: split LowerMEMCPY into LowerMEMCPYCall and LowerMEMCPYInline in the ARM backend. Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=43176&r1=43175&r2=43176&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Fri Oct 19 09:35:17 2007 @@ -1288,40 +1288,73 @@ } SDOperand ARMTargetLowering::LowerMEMCPY(SDOperand Op, SelectionDAG &DAG) { - SDOperand Chain = Op.getOperand(0); - SDOperand Dest = Op.getOperand(1); - SDOperand Src = Op.getOperand(2); - SDOperand Count = Op.getOperand(3); - unsigned Align = - (unsigned)cast(Op.getOperand(4))->getValue(); + SDOperand ChainOp = Op.getOperand(0); + SDOperand DestOp = Op.getOperand(1); + SDOperand SourceOp = Op.getOperand(2); + SDOperand CountOp = Op.getOperand(3); + SDOperand AlignOp = Op.getOperand(4); + SDOperand AlwaysInlineOp = Op.getOperand(5); + + bool AlwaysInline = (bool)cast(AlwaysInlineOp)->getValue(); + unsigned Align = (unsigned)cast(AlignOp)->getValue(); if (Align == 0) Align = 1; - ConstantSDNode *I = dyn_cast(Count); - // Just call memcpy if: - // not 4-byte aligned - // size is unknown - // size is >= the threshold. - if ((Align & 3) != 0 || - !I || - I->getValue() >= 64 || - (I->getValue() & 3) != 0) { - MVT::ValueType IntPtr = getPointerTy(); - TargetLowering::ArgListTy Args; - TargetLowering::ArgListEntry Entry; - Entry.Ty = getTargetData()->getIntPtrType(); - Entry.Node = Op.getOperand(1); Args.push_back(Entry); - Entry.Node = Op.getOperand(2); Args.push_back(Entry); - Entry.Node = Op.getOperand(3); Args.push_back(Entry); - std::pair CallResult = + // If size is unknown, call memcpy. + ConstantSDNode *I = dyn_cast(CountOp); + if (!I) { + assert(!AlwaysInline && "Cannot inline copy of unknown size"); + return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); + } + unsigned Size = I->getValue(); + + if (AlwaysInline) + return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); + + // The libc version is likely to be faster for the following cases. It can + // use the address value and run time information about the CPU. + // With glibc 2.6.1 on a core 2, coping an array of 100M longs was 30% faster + + // If not DWORD aligned, call memcpy. + if ((Align & 3) != 0) + return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); + + // If size is more than the threshold, call memcpy. + // if (Size > Subtarget->getMinRepStrSizeThreshold()) + if (Size >= 64) + return LowerMEMCPYCall(ChainOp, DestOp, SourceOp, CountOp, DAG); + + return LowerMEMCPYInline(ChainOp, DestOp, SourceOp, Size, Align, DAG); +} + +SDOperand ARMTargetLowering::LowerMEMCPYCall(SDOperand Chain, + SDOperand Dest, + SDOperand Source, + SDOperand Count, + SelectionDAG &DAG) { + MVT::ValueType IntPtr = getPointerTy(); + TargetLowering::ArgListTy Args; + TargetLowering::ArgListEntry Entry; + Entry.Ty = getTargetData()->getIntPtrType(); + Entry.Node = Dest; Args.push_back(Entry); + Entry.Node = Source; Args.push_back(Entry); + Entry.Node = Count; Args.push_back(Entry); + std::pair CallResult = LowerCallTo(Chain, Type::VoidTy, false, false, CallingConv::C, false, DAG.getExternalSymbol("memcpy", IntPtr), Args, DAG); - return CallResult.second; - } + return CallResult.second; +} + +SDOperand ARMTargetLowering::LowerMEMCPYInline(SDOperand Chain, + SDOperand Dest, + SDOperand Source, + unsigned Size, + unsigned Align, + SelectionDAG &DAG) { - // Otherwise do repeated 4-byte loads and stores. To be improved. - assert((I->getValue() & 3) == 0); + // Do repeated 4-byte loads and stores. To be improved. + assert((Size& 3) == 0); assert((Align & 3) == 0); - unsigned NumMemOps = I->getValue() >> 2; + unsigned NumMemOps = Size >> 2; unsigned EmittedNumMemOps = 0; unsigned SrcOff = 0, DstOff = 0; MVT::ValueType VT = MVT::i32; @@ -1337,7 +1370,7 @@ unsigned i; for (i=0; i References: <93C53C95-B732-4DF8-B736-7027392FC76B@gmail.com> Message-ID: <8D7E2661-315E-4ABF-BD8D-E0A17CBEFA75@apple.com> On Oct 19, 2007, at 1:37 AM, Bill Wendling wrote: > Hi all, > > Is anyone seeing this? > > ar cru /Users/wendling/llvm/llvm.obj/Debug/lib/libLLVMSystem.a /Users/ > wendling/llvm/llvm.obj/lib/System/Debug/Alarm.o /Users/wendling/llvm/ > llvm.obj/lib/System/Debug/Disassembler.o /Users/wendling/llvm/ > llvm.obj/lib/System/Debug/DynamicLibrary.o /Users/wendling/llvm/ > llvm.obj/lib/System/Debug/IncludeFile.o /Users/wendling/llvm/llvm.obj/ > lib/System/Debug/MappedFile.o /Users/wendling/llvm/llvm.obj/lib/ > System/Debug/Memory.o /Users/wendling/llvm/llvm.obj/lib/System/Debug/ > Mutex.o /Users/wendling/llvm/llvm.obj/lib/System/Debug/Path.o /Users/ > wendling/llvm/llvm.obj/lib/System/Debug/Process.o /Users/wendling/ > llvm/llvm.obj/lib/System/Debug/Program.o /Users/wendling/llvm/ > llvm.obj/lib/System/Debug/Signals.o /Users/wendling/llvm/llvm.obj/lib/ > System/Debug/TimeValue.o /Users/wendling/llvm/llvm.obj/lib/System/ > Debug/ltdl.o > ranlib: unrecognized option `-q' > Try `ranlib --help' for more information. > ar: internal ranlib command failed > make[1]: *** [/Users/wendling/llvm/llvm.obj/Debug/lib/ > libLLVMSystem.a] Error 1 > make: *** [all] Error 1 This sounds like your cc tools are messed up somehow. Alternatively, perhaps a .o or .a file is corrupt? -Chris From clattner at apple.com Fri Oct 19 10:16:38 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 19 Oct 2007 08:16:38 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200710191221.14487.baldrick@free.fr> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> <200710191221.14487.baldrick@free.fr> Message-ID: On Oct 19, 2007, at 3:21 AM, Duncan Sands wrote: > Hi Bill, > >>> I think the objc front-end is emitting the setjmp/longjmp calls >>> itself directly, not relying on the rest of the GCC EH mechanisms... >>> >> Yes. That's my understanding. If you look at >> obj-act.c:next_sjlj_build_try_catch_finally(), it has a big comment >> showing what it converts try-catch-finalize to. > > I see. I wanted to examine how llvm-gcc-4.2 and mainline handle > the testcase > 2007-10-17-SJLJExceptions.m, but it doesn't compile with either: > > $ gcc-4.2 -x objective-c 2007-10-17-SJLJExceptions.m -O2 - > fexceptions -S -o - > .file "2007-10-17-SJLJExceptions.m" > 2007-10-17-SJLJExceptions.m:3:34: error: Foundation/Foundation.h: > No such file or directory > 2007-10-17-SJLJExceptions.m:5: error: expected ?=?, ?,?, ?;?, ?asm? > or ?__attribute__? before ?*? token > 2007-10-17-SJLJExceptions.m:7: error: expected ?=?, ?,?, ?;?, ?asm? > or ?__attribute__? before ?bork? > > Ciao, > > Duncan. > > PS: the run line has "-arch i386". Is that right? My compiler > doesn't recognize it. "-arch i386" is an apple-ism, and Foundation.h is part of the mac system libraries. Bill, can you please adjust the test to not include a foundation header? -Chris From clattner at apple.com Fri Oct 19 10:18:43 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 19 Oct 2007 08:18:43 -0700 Subject: [llvm-commits] [llvm] r43083 - in /llvm/trunk: lib/Transforms/IPO/RaiseAllocations.cpp test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll In-Reply-To: <200710191036.03419.baldrick@free.fr> References: <200710172012.l9HKCwoJ015392@zion.cs.uiuc.edu> <200710181007.26325.baldrick@free.fr> <4B75DE21-653F-4BFF-8811-1E9F6155FE1A@apple.com> <200710191036.03419.baldrick@free.fr> Message-ID: <7F489F08-9ECF-4FE3-AC7E-161C0735AD9C@apple.com> On Oct 19, 2007, at 1:36 AM, Duncan Sands wrote: > Hi Devang, > >>>> Do not raise free() call that is called through invoke instruction. >> >>> why not? As far as I know free cannot raise an exception, >> >> If this is guaranteed then raiseallocs needs to do cleanup and break >> link between bb with inovke .. at free(..) and corresponding unwind >> block >> (remove PHI nodes' incoming edge). > > it is not clear to me whether we are allowed to assume that free is > the > standard C free (likewise for malloc). If we are, then I think it > would > be better to raise calls to them, fixing up the unwind edge if they > were > invokes. In general, we want to limit this. However, raiseallocations in general assumes that malloc and free are builtins. Something like - fbuiltins should not run the pass. I think it would be safe for it to raise an invoke of malloc or free into a call, simply deleting the unwind edge. -Chris From clattner at apple.com Fri Oct 19 10:21:28 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 19 Oct 2007 08:21:28 -0700 Subject: [llvm-commits] [llvm] r43171 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp In-Reply-To: <200710191031.52183.baldrick@free.fr> References: <200710190446.l9J4kkXp018139@zion.cs.uiuc.edu> <200710191031.52183.baldrick@free.fr> Message-ID: <28072F1F-0B36-41E5-BE95-1F80A196B132@apple.com> On Oct 19, 2007, at 1:31 AM, Duncan Sands wrote: > Hi Chris, > >> +void DAGTypeLegalizer:: >> +ExpandResult_SIGN_EXTEND_INREG(SDNode *N, SDOperand &Lo, >> SDOperand &Hi) { >> + GetExpandedOp(N->getOperand(0), Lo, Hi); >> + >> + // sext_inreg the low part if needed. >> + Lo = DAG.getNode(ISD::SIGN_EXTEND_INREG, Lo.getValueType(), Lo, >> + N->getOperand(1)); >> + >> + // The high part gets the sign extension from the lo-part. >> This handles >> + // things like sextinreg V:i64 from i8. >> + Hi = DAG.getNode(ISD::SRA, Hi.getValueType(), Lo, >> + DAG.getConstant(MVT::getSizeInBits >> (Hi.getValueType())-1, >> + TLI.getShiftAmountTy())); >> +} > > doesn't this assume that the type being extended is smaller than or > equal to > the type of Lo? Yes, I think so. I just brought it over unmodified from legalizedag.cpp > For example, will this work for i64 from i63? Probably not, who does that stuff? :) Assuming an expansion from i64 to 2x i32, the code above will work for sextinreg amounts between 1 and 32. For greater amounts, the top part should get a sextinreg, and the bottom part should or togther the top and bottom shifted parts, similar to a expanded shift. -Chris From sabre at nondot.org Fri Oct 19 10:28:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 19 Oct 2007 15:28:48 -0000 Subject: [llvm-commits] [llvm] r43177 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200710191528.l9JFSm5e020838@zion.cs.uiuc.edu> Author: lattner Date: Fri Oct 19 10:28:47 2007 New Revision: 43177 URL: http://llvm.org/viewvc/llvm-project?rev=43177&view=rev Log: rename ExpandOperation to ExpandOperationResult, as suggested by Duncan Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=43177&r1=43176&r2=43177&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Oct 19 10:28:47 2007 @@ -885,14 +885,14 @@ /// implement this. The default implementation of this aborts. virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - /// ExpandOperation - This callback is invoked for operations that are + /// ExpandOperationResult - This callback is invoked for operations that are /// unsupported by the target, which are registered to use 'custom' lowering, /// and whose result type needs to be expanded. /// /// If the target has no operations that require custom lowering, it need not /// implement this. The default implementation of this aborts. virtual std::pair - ExpandOperation(SDOperand Op, SelectionDAG &DAG); + ExpandOperationResult(SDNode *N, SelectionDAG &DAG); /// IsEligibleForTailCallOptimization - Check whether the call is eligible for /// tail call optimization. Targets which want to do tail call optimization Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43177&r1=43176&r2=43177&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Oct 19 10:28:47 2007 @@ -618,8 +618,7 @@ TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == TargetLowering::Custom) { // If the target wants to, allow it to lower this itself. - std::pair P = - TLI.ExpandOperation(SDOperand(N, 0), DAG); + std::pair P = TLI.ExpandOperationResult(N, DAG); if (P.first.Val) { Lo = P.first; Hi = P.second; @@ -852,20 +851,6 @@ void DAGTypeLegalizer::ExpandResult_ADDSUB(SDNode *N, SDOperand &Lo, SDOperand &Hi) { - MVT::ValueType VT = N->getValueType(0); - - // If the target wants to custom expand this, let them. - if (TLI.getOperationAction(N->getOpcode(), VT) == - TargetLowering::Custom) { - std::pair Ret = - TLI.ExpandOperation(SDOperand(N, 0), DAG); - if (Ret.first.Val) { - Lo = Ret.first; - Hi = Ret.second; - return; - } - } - // Expand the subcomponents. SDOperand LHSL, LHSH, RHSL, RHSH; GetExpandedOp(N->getOperand(0), LHSL, LHSH); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=43177&r1=43176&r2=43177&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 19 10:28:47 2007 @@ -4135,7 +4135,7 @@ } std::pair -TargetLowering::ExpandOperation(SDOperand Op, SelectionDAG &DAG) { +TargetLowering::ExpandOperationResult(SDNode *N, SelectionDAG &DAG) { assert(0 && "ExpandOperation not implemented for this target!"); abort(); return std::pair(); From cmdkeen at gmx.de Fri Oct 19 10:30:45 2007 From: cmdkeen at gmx.de (Jan Rehders) Date: Fri, 19 Oct 2007 17:30:45 +0200 Subject: [llvm-commits] Updated llvm-mode.el Message-ID: Hi, I noticed that the llvm-mode.el in utils/emacs was pretty outdated so I updated it. Changes: - removed int, short types etc. and added i[0-0]+ - added some new keywords like define/declare - added ";" as comment delimeter so you can use comment-region etc. in .ll files - changed all keywords etc. from keyword to \\bkeyword\\b so that the float in "@printfloat" won't get highlighted as a type anymore I hope anyone finds this useful. Permission to add to llvm it under the necessary licence is of course granted greetings, Jan PS: I'm not on the llvm-commits list, if you reply please also CC me -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-mode.el Type: application/octet-stream Size: 5350 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071019/4926a1df/attachment.obj From hartmut.kaiser at gmail.com Fri Oct 19 10:51:20 2007 From: hartmut.kaiser at gmail.com (Hartmut Kaiser) Date: Fri, 19 Oct 2007 15:51:20 -0000 Subject: [llvm-commits] [llvm] r43180 - /llvm/trunk/win32/Support/Support.vcproj Message-ID: <200710191551.l9JFpKnS022293@zion.cs.uiuc.edu> Author: hkaiser Date: Fri Oct 19 10:51:20 2007 New Revision: 43180 URL: http://llvm.org/viewvc/llvm-project?rev=43180&view=rev Log: Updated VC++ build system Modified: llvm/trunk/win32/Support/Support.vcproj Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=43180&r1=43179&r2=43180&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Fri Oct 19 10:51:20 2007 @@ -431,10 +431,6 @@ RelativePath="..\..\include\llvm\Support\type_traits.h" > - - Author: lattner Date: Fri Oct 19 11:47:35 2007 New Revision: 43181 URL: http://llvm.org/viewvc/llvm-project?rev=43181&view=rev Log: Fix a really nasty vector miscompilation bill recently introduced. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43181&r1=43180&r2=43181&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 19 11:47:35 2007 @@ -4150,9 +4150,9 @@ if (MVT::getSizeInBits(Idx.getValueType()) > MVT::getSizeInBits(TLI.getPointerTy())) - Idx = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), StackPtr); + Idx = DAG.getNode(ISD::TRUNCATE, TLI.getPointerTy(), Idx); else - Idx = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), StackPtr); + Idx = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), Idx); StackPtr = DAG.getNode(ISD::ADD, Idx.getValueType(), Idx, StackPtr); From asl at math.spbu.ru Fri Oct 19 11:54:13 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 19 Oct 2007 16:54:13 -0000 Subject: [llvm-commits] [llvm] r43182 - /llvm/trunk/utils/emacs/llvm-mode.el Message-ID: <200710191654.l9JGsDRV025793@zion.cs.uiuc.edu> Author: asl Date: Fri Oct 19 11:54:13 2007 New Revision: 43182 URL: http://llvm.org/viewvc/llvm-project?rev=43182&view=rev Log: Update this file for 2.0 syntax. Contributed by Jan Rehders Modified: llvm/trunk/utils/emacs/llvm-mode.el Modified: llvm/trunk/utils/emacs/llvm-mode.el URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/llvm-mode.el?rev=43182&r1=43181&r2=43182&view=diff ============================================================================== --- llvm/trunk/utils/emacs/llvm-mode.el (original) +++ llvm/trunk/utils/emacs/llvm-mode.el Fri Oct 19 11:54:13 2007 @@ -1,6 +1,6 @@ ;; Maintainer: The LLVM team, http://llvm.org/ ;; Description: Major mode for the LLVM assembler language. -;; Updated: 2003-06-02 +;; Updated: 2007-09-19 ;; Create mode-specific tables. (defvar llvm-mode-syntax-table nil @@ -18,24 +18,24 @@ '("\"[^\"]+\"" . font-lock-string-face) ;; Unnamed variable slots '("%[-]?[0-9]+" . font-lock-variable-name-face) + ;; Types + '("\\bvoid\\b\\|\\bi[0-9]+\\b\\|\\float\\b\\|\\bdouble\\b\\|\\btype\\b\\|\\blabel\\b\\|\\bopaque\\b" . font-lock-type-face) ;; Integer literals - '("[-]?[0-9]+" . font-lock-preprocessor-face) + '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face) ;; Floating point constants - '("[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?" . font-lock-preprocessor-face) + '("\\b[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?\\b" . font-lock-preprocessor-face) ;; Hex constants - '("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face) + '("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face) ;; Keywords - '("begin\\|end\\|true\\|false\\|zeroinitializer\\|declare\\|global\\|constant\\|const\\|internal\\|linkonce\\|weak\\|appending\\|uninitialized\\|implementation\\|\\.\\.\\.\\|null\\|undef\\|to\\|except\\|not\\|target\\|endian\\|little\\|big\\|pointersize\\|deplibs\\|volatile\\|fastcc\\|coldcc\\|cc" . font-lock-keyword-face) - ;; Types - '("void\\|bool\\|sbyte\\|ubyte\\|u?short\\|u?int\\|u?long\\|float\\|double\\|type\\|label\\|opaque" . font-lock-type-face) + '("\\bbegin\\b\\|\\bend\\b\\|\\btrue\\b\\|\\bfalse\\b\\|\\bzeroinitializer\\b\\|\\bdeclare\\b\\|\\bdefine\\b\\|\\bglobal\\b\\|\\bconstant\\b\\|\\bconst\\b\\|\\binternal\\b\\|\\blinkonce\\b\\|\\bweak\\b\\|\\bappending\\b\\|\\buninitialized\\b\\|\\bimplementation\\b\\|\\b\\.\\.\\.\\b\\|\\bnull\\b\\|\\bundef\\b\\|\\bto\\b\\|\\bexcept\\b\\|\\bnot\\b\\|\\btarget\\b\\|\\bendian\\b\\|\\blittle\\b\\|\\bbig\\b\\|\\bpointersize\\b\\|\\bdeplibs\\b\\|\\bvolatile\\b\\|\\bfastcc\\b\\|\\bcoldcc\\b\\|\\bcc\\b" . font-lock-keyword-face) ;; Arithmetic and Logical Operators - '("add\\|sub\\|mul\\|div\\|rem\\|and\\|or\\|xor\\|set\\(ne\\|eq\\|lt\\|gt\\|le\\|ge\\)" . font-lock-keyword-face) + '("\\badd\\b\\|\\bsub\\b\\|\\bmul\\b\\|\\bdiv\\b\\|\\brem\\b\\|\\band\\b\\|\\bor\\b\\|\\bxor\\b\\|\\bset\\(ne\\b\\|\\beq\\b\\|\\blt\\b\\|\\bgt\\b\\|\\ble\\b\\|\\bge\\b\\)" . font-lock-keyword-face) ;; Special instructions - '("phi\\|tail\\|call\\|cast\\|select\\|to\\|shl\\|shr\\|vaarg\\|vanext" . font-lock-keyword-face) + '("\\bphi\\b\\|\\btail\\b\\|\\bcall\\b\\|\\bcast\\b\\|\\bselect\\b\\|\\bto\\b\\|\\bshl\\b\\|\\bshr\\b\\|\\bvaarg\\b\\|\\bvanext\\b" . font-lock-keyword-face) ;; Control instructions - '("ret\\|br\\|switch\\|invoke\\|unwind\\|unreachable" . font-lock-keyword-face) + '("\\bret\\b\\|\\bbr\\b\\|\\bswitch\\b\\|\\binvoke\\b\\|\\bunwind\\b\\|\\bunreachable\\b" . font-lock-keyword-face) ;; Memory operators - '("malloc\\|alloca\\|free\\|load\\|store\\|getelementptr" . font-lock-keyword-face) + '("\\bmalloc\\b\\|\\balloca\\b\\|\\bfree\\b\\|\\bload\\b\\|\\bstore\\b\\|\\bgetelementptr\\b" . font-lock-keyword-face) ) "Syntax highlighting for LLVM" ) @@ -116,6 +116,7 @@ (setq local-abbrev-table llvm-mode-abbrev-table) (set-syntax-table llvm-mode-syntax-table) + (setq comment-start ";") (run-hooks 'llvm-mode-hook)) ; Finally, this permits the user to ; customize the mode with a hook. From asl at math.spbu.ru Fri Oct 19 11:53:15 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 19 Oct 2007 20:53:15 +0400 Subject: [llvm-commits] Updated llvm-mode.el In-Reply-To: References: Message-ID: <1192812795.10535.1.camel@asl.dorms.spbu.ru> Hello, Jan > I noticed that the llvm-mode.el in utils/emacs was pretty outdated so > I updated it. Thanks, new file works like a charm. I commited it as r43182 -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From dpatel at apple.com Fri Oct 19 12:11:01 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 19 Oct 2007 17:11:01 -0000 Subject: [llvm-commits] [llvm] r43183 - /llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Message-ID: <200710191711.l9JHB17M026475@zion.cs.uiuc.edu> Author: dpatel Date: Fri Oct 19 12:11:01 2007 New Revision: 43183 URL: http://llvm.org/viewvc/llvm-project?rev=43183&view=rev Log: This test now passes. Modified: llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Modified: llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll?rev=43183&r1=43182&r2=43183&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll Fri Oct 19 12:11:01 2007 @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call ; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | not grep xyz -; XFAIL: * + @.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1] define void @foo(i8* %P) { From isanbard at gmail.com Fri Oct 19 12:59:24 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 10:59:24 -0700 Subject: [llvm-commits] ranlib problems In-Reply-To: <8D7E2661-315E-4ABF-BD8D-E0A17CBEFA75@apple.com> References: <93C53C95-B732-4DF8-B736-7027392FC76B@gmail.com> <8D7E2661-315E-4ABF-BD8D-E0A17CBEFA75@apple.com> Message-ID: <16e5fdf90710191059t3a09b0afv8859bed192b25a31@mail.gmail.com> On 10/19/07, Chris Lattner wrote: > > This sounds like your cc tools are messed up somehow. Alternatively, > perhaps a .o or .a file is corrupt? > This is my home machine, which I haven't changed or updated the cc tools for. I tried blowing the build tree away. It was late last night, so I didn't look too deeply into it... -bw From isanbard at gmail.com Fri Oct 19 13:17:49 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 11:17:49 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> <200710191221.14487.baldrick@free.fr> Message-ID: <16e5fdf90710191117l34a29f16pec100a136781d42f@mail.gmail.com> On 10/19/07, Chris Lattner wrote: > > On Oct 19, 2007, at 3:21 AM, Duncan Sands wrote: > > > Hi Bill, > > > >>> I think the objc front-end is emitting the setjmp/longjmp calls > >>> itself directly, not relying on the rest of the GCC EH mechanisms... > >>> > >> Yes. That's my understanding. If you look at > >> obj-act.c:next_sjlj_build_try_catch_finally(), it has a big comment > >> showing what it converts try-catch-finalize to. > > > > I see. I wanted to examine how llvm-gcc-4.2 and mainline handle > > the testcase > > 2007-10-17-SJLJExceptions.m, but it doesn't compile with either: > > > > $ gcc-4.2 -x objective-c 2007-10-17-SJLJExceptions.m -O2 - > > fexceptions -S -o - > > .file "2007-10-17-SJLJExceptions.m" > > 2007-10-17-SJLJExceptions.m:3:34: error: Foundation/Foundation.h: > > No such file or directory > > 2007-10-17-SJLJExceptions.m:5: error: expected '=', ',', ';', 'asm' > > or '__attribute__' before '*' token > > 2007-10-17-SJLJExceptions.m:7: error: expected '=', ',', ';', 'asm' > > or '__attribute__' before 'bork' > > > > Ciao, > > > > Duncan. > > > > PS: the run line has "-arch i386". Is that right? My compiler > > doesn't recognize it. > > "-arch i386" is an apple-ism, and Foundation.h is part of the mac > system libraries. Bill, can you please adjust the test to not > include a foundation header? > I'll give it a shot. I'm not an Objective C expert by any stretch. :-) Is there a platform-neutral equivalent flag that does with "-arch i386" does? -bw From dpatel at apple.com Fri Oct 19 13:27:28 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 19 Oct 2007 11:27:28 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <16e5fdf90710191117l34a29f16pec100a136781d42f@mail.gmail.com> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> <200710191221.14487.baldrick@free.fr> <16e5fdf90710191117l34a29f16pec100a136781d42f@mail.gmail.com> Message-ID: <9A78FD91-9F0D-4FB7-9B05-679E3EE6D609@apple.com> On Oct 19, 2007, at 11:17 AM, Bill Wendling wrote: >> "-arch i386" is an apple-ism, and Foundation.h is part of the mac >> system libraries. Bill, can you please adjust the test to not >> include a foundation header? >> > I'll give it a shot. I'm not an Objective C expert by any stretch. :-) > Is there a platform-neutral equivalent flag that does with "-arch > i386" does? No. There is not any need for such thing on other targets, because they don't have universal compiler binaries. "-arch i386" selects compiler that targets i386, on other targets you select it by invoking appropriate gcc driver yourself. Why do you want to restrict this test for "-arch i386" ? How do you restrict an llvm code generation test for an architecture ? - Devang From isanbard at gmail.com Fri Oct 19 13:36:04 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 18:36:04 -0000 Subject: [llvm-commits] [llvm] r43184 - /llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Message-ID: <200710191836.l9JIa4W8031417@zion.cs.uiuc.edu> Author: void Date: Fri Oct 19 13:36:04 2007 New Revision: 43184 URL: http://llvm.org/viewvc/llvm-project?rev=43184&view=rev Log: Remove the Foundation.h file because not everyone has that. Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m?rev=43184&r1=43183&r2=43184&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m (original) +++ llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Fri Oct 19 13:36:04 2007 @@ -1,18 +1,23 @@ -// RUN: %llvmgcc -x objective-c %s -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o - | not grep Unwind_Resume +#import -#import - -static NSMutableArray *anArray = nil; + at interface Foo { + char c; + short s; + int i; + long l; + float f; + double d; +} +-(Foo*)retain; + at end -CFArrayRef bork(void) { - CFArrayRef result = NULL; - NSAutoreleasePool *pool = [NSAutoreleasePool new]; - @try { - result = CFRetain(anArray); - } @catch(id any) { - NSLog(@"Swallowed exception %@", any); - } +struct Foo *bork(Foo *FooArray) { + struct Foo *result = 0; + @try { + result = [FooArray retain]; + } @catch(id any) { + printf("hello world\n"); + } - [pool release]; - return result; + return result; } From isanbard at gmail.com Fri Oct 19 13:37:38 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 11:37:38 -0700 Subject: [llvm-commits] [llvm] r43181 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp In-Reply-To: <200710191647.l9JGlaQP025502@zion.cs.uiuc.edu> References: <200710191647.l9JGlaQP025502@zion.cs.uiuc.edu> Message-ID: <16e5fdf90710191137n10543f74kd91c532459042bc6@mail.gmail.com> On 10/19/07, Chris Lattner wrote: > Author: lattner > Date: Fri Oct 19 11:47:35 2007 > New Revision: 43181 > > URL: http://llvm.org/viewvc/llvm-project?rev=43181&view=rev > Log: > Fix a really nasty vector miscompilation bill recently introduced. > :-( -bw From isanbard at gmail.com Fri Oct 19 13:40:54 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 18:40:54 -0000 Subject: [llvm-commits] [llvm] r43185 - /llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Message-ID: <200710191840.l9JIesOk031620@zion.cs.uiuc.edu> Author: void Date: Fri Oct 19 13:40:53 2007 New Revision: 43185 URL: http://llvm.org/viewvc/llvm-project?rev=43185&view=rev Log: Now with RUN line! Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m?rev=43185&r1=43184&r2=43185&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m (original) +++ llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Fri Oct 19 13:40:53 2007 @@ -1,3 +1,4 @@ +// RUN: %llvmgcc -x objective-c %s -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o - | not grep Unwind_Resume #import @interface Foo { From isanbard at gmail.com Fri Oct 19 13:42:12 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 11:42:12 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <9A78FD91-9F0D-4FB7-9B05-679E3EE6D609@apple.com> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> <200710191221.14487.baldrick@free.fr> <16e5fdf90710191117l34a29f16pec100a136781d42f@mail.gmail.com> <9A78FD91-9F0D-4FB7-9B05-679E3EE6D609@apple.com> Message-ID: <16e5fdf90710191142v68f41e6bg7c04a3f1393dd927@mail.gmail.com> On 10/19/07, Devang Patel wrote: > > On Oct 19, 2007, at 11:17 AM, Bill Wendling wrote: > > >> "-arch i386" is an apple-ism, and Foundation.h is part of the mac > >> system libraries. Bill, can you please adjust the test to not > >> include a foundation header? > >> > > I'll give it a shot. I'm not an Objective C expert by any stretch. :-) > > Is there a platform-neutral equivalent flag that does with "-arch > > i386" does? > > > No. There is not any need for such thing on other targets, because > they don't have universal compiler binaries. > > "-arch i386" selects compiler that targets i386, on other targets you > select it by invoking appropriate gcc driver yourself. > > Why do you want to restrict this test for "-arch i386" ? How do you > restrict an llvm code generation test for an architecture ? > On 64-bit platforms, it's reasonable for it to use Unwind_Resume. So I wanted to make sure that it really only tested this condition on 32-bit systems... -bw From isanbard at gmail.com Fri Oct 19 13:49:16 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 18:49:16 -0000 Subject: [llvm-commits] [llvm] r43186 - /llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Message-ID: <200710191849.l9JInGxO032000@zion.cs.uiuc.edu> Author: void Date: Fri Oct 19 13:49:16 2007 New Revision: 43186 URL: http://llvm.org/viewvc/llvm-project?rev=43186&view=rev Log: Removed "-arch i386" by popular demand... Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Modified: llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m?rev=43186&r1=43185&r2=43186&view=diff ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m (original) +++ llvm/trunk/test/FrontendObjC/2007-10-17-SJLJExceptions.m Fri Oct 19 13:49:16 2007 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -x objective-c %s -arch i386 -pipe -std=gnu99 -O2 -fexceptions -S -o - | not grep Unwind_Resume +// RUN: %llvmgcc -x objective-c %s -pipe -std=gnu99 -O2 -fexceptions -S -o - | not grep Unwind_Resume #import @interface Foo { From baldrick at free.fr Fri Oct 19 14:21:35 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 21:21:35 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r43098 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> References: <200710172210.l9HMAEaH020606@zion.cs.uiuc.edu> <0267DEC0-7FA3-431D-8377-F0E6CD8AADF4@apple.com> <16e5fdf90710181100j5094467fydee9aafe526643f0@mail.gmail.com> Message-ID: <200710192121.36162.baldrick@free.fr> Hi Bill, > Yes. That's my understanding. If you look at > obj-act.c:next_sjlj_build_try_catch_finally(), it has a big comment > showing what it converts try-catch-finalize to. thanks for fixing the test case. I looked in the tree dumps and I didn't see any of the stuff mentioned in that comment... The good news is that Unwind_Resume is not present at -O2. But maybe we just got lucky with this testcase. The bad news is that Unwind_Resume is declared (but not used) at -O0. I think this is because as soon as there is any exception handling, llvm-convert declares a bunch of helpful functions including Unwind_Resume even if they are not used. That should be easy to fix (I'll prepare a patch). Ciao, Duncan. From baldrick at free.fr Fri Oct 19 15:03:03 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 20:03:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r43187 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h Message-ID: <200710192003.l9JK33cd003947@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 19 15:03:02 2007 New Revision: 43187 URL: http://llvm.org/viewvc/llvm-project?rev=43187&view=rev Log: Only declare the exception handling personality and unwind resume functions if they are actually used. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43187&r1=43186&r2=43187&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Oct 19 15:03:02 2007 @@ -369,8 +369,6 @@ FuncEHException = 0; FuncEHSelector = 0; FuncEHGetTypeID = 0; - FuncEHPersonality = 0; - FuncUnwindResume = 0; NumAddressTakenBlocks = 0; IndirectGotoBlock = 0; @@ -1793,14 +1791,6 @@ (IntPtr == Type::Int32Ty ? Intrinsic::eh_typeid_for_i32 : Intrinsic::eh_typeid_for_i64)); - - assert(llvm_eh_personality_libfunc - && "no exception handling personality function!"); - FuncEHPersonality = DECL_LLVM(llvm_eh_personality_libfunc); - - assert(llvm_unwind_resume_libfunc - && "no unwind resume function!"); - FuncUnwindResume = DECL_LLVM(llvm_unwind_resume_libfunc); } /// getPostPad - Return the post landing pad for the given exception handling @@ -1844,7 +1834,10 @@ // The exception and the personality function. Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr")); - Args.push_back(CastToType(Instruction::BitCast, FuncEHPersonality, + assert(llvm_eh_personality_libfunc + && "no exception handling personality function!"); + Args.push_back(CastToType(Instruction::BitCast, + DECL_LLVM(llvm_eh_personality_libfunc), PointerType::get(Type::Int8Ty))); // Add selections for each handler. @@ -2041,7 +2034,8 @@ EmitBlock(UnwindBB); // Fetch and store exception handler. Value *Arg = Builder.CreateLoad(ExceptionValue, "eh_ptr"); - Builder.CreateCall(FuncUnwindResume, Arg); + assert(llvm_unwind_resume_libfunc && "no unwind resume function!"); + Builder.CreateCall(DECL_LLVM(llvm_unwind_resume_libfunc), Arg); Builder.CreateUnreachable(); } } Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=43187&r1=43186&r2=43187&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Fri Oct 19 15:03:02 2007 @@ -284,12 +284,6 @@ /// FuncEHGetTypeID - Function used to return type id for give typeinfo. Function *FuncEHGetTypeID; - /// FuncEHPersonality - Function providing the exception handling personality. - Value *FuncEHPersonality; - - /// FuncUnwindResume - Function used to continue exception unwinding. - Value *FuncUnwindResume; - /// NumAddressTakenBlocks - Count the number of labels whose addresses are /// taken. uint64_t NumAddressTakenBlocks; From dalej at apple.com Fri Oct 19 15:29:01 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 19 Oct 2007 20:29:01 -0000 Subject: [llvm-commits] [llvm] r43189 - in /llvm/trunk/lib/CodeGen/SelectionDAG: DAGCombiner.cpp LegalizeDAG.cpp Message-ID: <200710192029.l9JKT1Zx005739@zion.cs.uiuc.edu> Author: johannes Date: Fri Oct 19 15:29:00 2007 New Revision: 43189 URL: http://llvm.org/viewvc/llvm-project?rev=43189&view=rev Log: Redo "last ppc long double fix" as Chris wants. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43189&r1=43188&r2=43189&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Oct 19 15:29:00 2007 @@ -3493,7 +3493,7 @@ return DAG.getNode(ISD::FP_EXTEND, VT, N0); // fold (fpext (load x)) -> (fpext (fpround (extload x))) - if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() && VT != MVT::ppcf128 && + if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() && (!AfterLegalize||TLI.isLoadXLegal(ISD::EXTLOAD, N0.getValueType()))) { LoadSDNode *LN0 = cast(N0); SDOperand ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, VT, LN0->getChain(), Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43189&r1=43188&r2=43189&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 19 15:29:00 2007 @@ -5443,7 +5443,8 @@ } else { MVT::ValueType EVT = LD->getLoadedVT(); - if (VT == MVT::f64 && EVT == MVT::f32) { + if ((VT == MVT::f64 && EVT == MVT::f32) || + (VT == MVT::ppcf128 && (EVT==MVT::f64 || EVT==MVT::f32))) { // f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND SDOperand Load = DAG.getLoad(EVT, Ch, Ptr, LD->getSrcValue(), SVOffset, isVolatile, Alignment); From baldrick at free.fr Fri Oct 19 15:29:48 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 19 Oct 2007 20:29:48 -0000 Subject: [llvm-commits] [llvm] r43190 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710192029.l9JKTmqr005790@zion.cs.uiuc.edu> Author: baldrick Date: Fri Oct 19 15:29:48 2007 New Revision: 43190 URL: http://llvm.org/viewvc/llvm-project?rev=43190&view=rev Log: Add support for a few more nodes. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43190&r1=43189&r2=43190&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Oct 19 15:29:48 2007 @@ -134,6 +134,9 @@ SDOperand PromoteResult_SETCC(SDNode *N); SDOperand PromoteResult_LOAD(LoadSDNode *N); SDOperand PromoteResult_SimpleIntBinOp(SDNode *N); + SDOperand PromoteResult_SHL(SDNode *N); + SDOperand PromoteResult_SRA(SDNode *N); + SDOperand PromoteResult_SRL(SDNode *N); SDOperand PromoteResult_SELECT (SDNode *N); SDOperand PromoteResult_SELECT_CC(SDNode *N); @@ -168,13 +171,14 @@ SDOperand PromoteOperand_ANY_EXTEND(SDNode *N); SDOperand PromoteOperand_ZERO_EXTEND(SDNode *N); SDOperand PromoteOperand_SIGN_EXTEND(SDNode *N); + SDOperand PromoteOperand_TRUNCATE(SDNode *N); SDOperand PromoteOperand_FP_EXTEND(SDNode *N); SDOperand PromoteOperand_FP_ROUND(SDNode *N); SDOperand PromoteOperand_SELECT(SDNode *N, unsigned OpNo); SDOperand PromoteOperand_BRCOND(SDNode *N, unsigned OpNo); SDOperand PromoteOperand_BR_CC(SDNode *N, unsigned OpNo); SDOperand PromoteOperand_STORE(StoreSDNode *N, unsigned OpNo); - + void PromoteSetCCOperands(SDOperand &LHS,SDOperand &RHS, ISD::CondCode Code); // Operand Expansion. @@ -458,23 +462,27 @@ abort(); case ISD::UNDEF: Result = PromoteResult_UNDEF(N); break; case ISD::Constant: Result = PromoteResult_Constant(N); break; - + case ISD::TRUNCATE: Result = PromoteResult_TRUNCATE(N); break; case ISD::SIGN_EXTEND: case ISD::ZERO_EXTEND: case ISD::ANY_EXTEND: Result = PromoteResult_INT_EXTEND(N); break; case ISD::FP_ROUND: Result = PromoteResult_FP_ROUND(N); break; - + case ISD::SETCC: Result = PromoteResult_SETCC(N); break; case ISD::LOAD: Result = PromoteResult_LOAD(cast(N)); break; - + case ISD::AND: case ISD::OR: case ISD::XOR: case ISD::ADD: case ISD::SUB: case ISD::MUL: Result = PromoteResult_SimpleIntBinOp(N); break; - + + case ISD::SHL: Result = PromoteResult_SHL(N); break; + case ISD::SRA: Result = PromoteResult_SRA(N); break; + case ISD::SRL: Result = PromoteResult_SRL(N); break; + case ISD::SELECT: Result = PromoteResult_SELECT(N); break; case ISD::SELECT_CC: Result = PromoteResult_SELECT_CC(N); break; @@ -586,6 +594,28 @@ return DAG.getNode(N->getOpcode(), LHS.getValueType(), LHS, RHS); } +SDOperand DAGTypeLegalizer::PromoteResult_SHL(SDNode *N) { + return DAG.getNode(ISD::SHL, TLI.getTypeToTransformTo(N->getValueType(0)), + GetPromotedOp(N->getOperand(0)), N->getOperand(1)); +} + +SDOperand DAGTypeLegalizer::PromoteResult_SRA(SDNode *N) { + // The input value must be properly sign extended. + MVT::ValueType VT = N->getValueType(0); + MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); + SDOperand Res = GetPromotedOp(N->getOperand(0)); + Res = DAG.getNode(ISD::SIGN_EXTEND_INREG, NVT, Res, DAG.getValueType(VT)); + return DAG.getNode(ISD::SRA, NVT, Res, N->getOperand(1)); +} + +SDOperand DAGTypeLegalizer::PromoteResult_SRL(SDNode *N) { + // The input value must be properly zero extended. + MVT::ValueType VT = N->getValueType(0); + MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); + SDOperand Res = DAG.getZeroExtendInReg(GetPromotedOp(N->getOperand(0)), VT); + return DAG.getNode(ISD::SRL, NVT, Res, N->getOperand(1)); +} + SDOperand DAGTypeLegalizer::PromoteResult_SELECT(SDNode *N) { SDOperand LHS = GetPromotedOp(N->getOperand(1)); SDOperand RHS = GetPromotedOp(N->getOperand(2)); @@ -1209,6 +1239,7 @@ case ISD::ANY_EXTEND: Res = PromoteOperand_ANY_EXTEND(N); break; case ISD::ZERO_EXTEND: Res = PromoteOperand_ZERO_EXTEND(N); break; case ISD::SIGN_EXTEND: Res = PromoteOperand_SIGN_EXTEND(N); break; + case ISD::TRUNCATE: Res = PromoteOperand_TRUNCATE(N); break; case ISD::FP_EXTEND: Res = PromoteOperand_FP_EXTEND(N); break; case ISD::FP_ROUND: Res = PromoteOperand_FP_ROUND(N); break; @@ -1257,10 +1288,16 @@ Op, DAG.getValueType(N->getOperand(0).getValueType())); } +SDOperand DAGTypeLegalizer::PromoteOperand_TRUNCATE(SDNode *N) { + SDOperand Op = GetPromotedOp(N->getOperand(0)); + return DAG.getNode(ISD::TRUNCATE, N->getValueType(0), Op); +} + SDOperand DAGTypeLegalizer::PromoteOperand_FP_EXTEND(SDNode *N) { SDOperand Op = GetPromotedOp(N->getOperand(0)); return DAG.getNode(ISD::FP_EXTEND, N->getValueType(0), Op); } + SDOperand DAGTypeLegalizer::PromoteOperand_FP_ROUND(SDNode *N) { SDOperand Op = GetPromotedOp(N->getOperand(0)); return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Op); From isanbard at gmail.com Fri Oct 19 16:09:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 19 Oct 2007 21:09:55 -0000 Subject: [llvm-commits] [llvm] r43191 - in /llvm/trunk: lib/CodeGen/BranchFolding.cpp test/CFrontend/2007-10-15-VoidPtr.c test/Transforms/BranchFolding/ test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll Message-ID: <200710192109.l9JL9uN2008645@zion.cs.uiuc.edu> Author: void Date: Fri Oct 19 16:09:55 2007 New Revision: 43191 URL: http://llvm.org/viewvc/llvm-project?rev=43191&view=rev Log: Don't branch fold inline asm statements. Added: llvm/trunk/test/Transforms/BranchFolding/ llvm/trunk/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=43191&r1=43190&r2=43191&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Fri Oct 19 16:09:55 2007 @@ -271,7 +271,8 @@ unsigned TailLen = 0; while (I1 != MBB1->begin() && I2 != MBB2->begin()) { --I1; --I2; - if (!I1->isIdenticalTo(I2)) { + if (!I1->isIdenticalTo(I2) || + I1->getOpcode() == TargetInstrInfo::INLINEASM) { ++I1; ++I2; break; } Modified: llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c?rev=43191&r1=43190&r2=43191&view=diff ============================================================================== --- llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c (original) +++ llvm/trunk/test/CFrontend/2007-10-15-VoidPtr.c Fri Oct 19 16:09:55 2007 @@ -1,5 +1,4 @@ -// RUN: llvm-gcc -S %s -o /dev/null +// RUN: %llvmgcc -S %s -o /dev/null void bork(void **data) { (*(unsigned short *) (&(data[37])[927]) = 0); } - Added: llvm/trunk/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll?rev=43191&view=auto ============================================================================== --- llvm/trunk/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll (added) +++ llvm/trunk/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll Fri Oct 19 16:09:55 2007 @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | opt -std-compile-opts -o - | llc -o - | grep bork_directive | wc -l | grep 2 + +;; We don't want branch folding to fold asm directives. + +define void @bork(i32 %param) { +entry: + %tmp = icmp eq i32 %param, 0 + br i1 %tmp, label %cond_true, label %cond_false + +cond_true: + call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 ) + ret void + +cond_false: + call void asm sideeffect ".foo_directive ${0:c}:${1:c}", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 ) + call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 ) + ret void +} From evan.cheng at apple.com Fri Oct 19 16:23:23 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 19 Oct 2007 21:23:23 -0000 Subject: [llvm-commits] [llvm] r43192 - in /llvm/trunk: include/llvm/Target/MRegisterInfo.h lib/CodeGen/VirtRegMap.cpp lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrX86-64.td lib/Target/X86/X86RegisterInfo.cpp lib/Target/X86/X86RegisterInfo.h Message-ID: <200710192123.l9JLNNbT009983@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 19 16:23:22 2007 New Revision: 43192 URL: http://llvm.org/viewvc/llvm-project?rev=43192&view=rev Log: Local spiller optimization: Turn a store folding instruction into a load folding instruction. e.g. xorl %edi, %eax movl %eax, -32(%ebp) movl -36(%ebp), %eax orl %eax, -32(%ebp) => xorl %edi, %eax orl -36(%ebp), %eax mov %eax, -32(%ebp) This enables the unfolding optimization for a subsequent instruction which will also eliminate the newly introduced store instruction. Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h llvm/trunk/lib/CodeGen/VirtRegMap.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.h Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/MRegisterInfo.h?rev=43192&r1=43191&r2=43192&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/MRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Fri Oct 19 16:23:22 2007 @@ -563,6 +563,14 @@ return 0; } + /// getOpcodeAfterMemoryFold - Returns the opcode of the would be new + /// instruction after load / store is folded into an instruction of the + /// specified opcode. It returns zero if the specified unfolding is not + /// possible. + virtual unsigned getOpcodeAfterMemoryFold(unsigned Opc, unsigned OpNum) const{ + return 0; + } + /// unfoldMemoryOperand - Separate a single instruction which folded a load or /// a a store or a load and a store into two or more instruction. If this is /// possible, returns true as well as the new instructions by reference. @@ -578,8 +586,9 @@ } /// getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new - /// instruction after load / store are unfolded from the specified opcode. - /// It returns zero if the specified unfolding is impossible. + /// instruction after load / store are unfolded from an instruction of the + /// specified opcode. It returns zero if the specified unfolding is not + /// possible. virtual unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, bool UnfoldLoad, bool UnfoldStore) const { return 0; Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=43192&r1=43191&r2=43192&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Fri Oct 19 16:23:22 2007 @@ -242,6 +242,8 @@ //===----------------------------------------------------------------------===// namespace { + class AvailableSpills; + /// LocalSpiller - This spiller does a simple pass over the machine basic /// block to attempt to keep spills in registers as much as possible for /// blocks that have low register pressure (the vreg may be spilled due to @@ -270,6 +272,12 @@ return true; } private: + bool PrepForUnfoldOpti(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MII, + std::vector &MaybeDeadStores, + AvailableSpills &Spills, BitVector &RegKills, + std::vector &KillOps, + VirtRegMap &VRM); void RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM); }; } @@ -357,7 +365,7 @@ void disallowClobberPhysReg(unsigned PhysReg); /// ClobberPhysReg - This is called when the specified physreg changes - /// value. We use this to invalidate any info about stuff we thing lives in + /// value. We use this to invalidate any info about stuff that lives in /// it and any of its aliases. void ClobberPhysReg(unsigned PhysReg); @@ -450,7 +458,7 @@ /// marked kill, then invalidate the information. static void InvalidateKills(MachineInstr &MI, BitVector &RegKills, std::vector &KillOps, - SmallVector *KillRegs = NULL) { + SmallVector *KillRegs = NULL) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); if (!MO.isRegister() || !MO.isUse() || !MO.isKill()) @@ -723,6 +731,112 @@ }; } +/// PrepForUnfoldOpti - Turn a store folding instruction into a load folding +/// instruction. e.g. +/// xorl %edi, %eax +/// movl %eax, -32(%ebp) +/// movl -36(%ebp), %eax +/// orl %eax, -32(%ebp) +/// ==> +/// xorl %edi, %eax +/// orl -36(%ebp), %eax +/// mov %eax, -32(%ebp) +/// This enables unfolding optimization for a subsequent instruction which will +/// also eliminate the newly introduced store instruction. +bool LocalSpiller::PrepForUnfoldOpti(MachineBasicBlock &MBB, + MachineBasicBlock::iterator &MII, + std::vector &MaybeDeadStores, + AvailableSpills &Spills, + BitVector &RegKills, + std::vector &KillOps, + VirtRegMap &VRM) { + MachineFunction &MF = *MBB.getParent(); + MachineInstr &MI = *MII; + unsigned UnfoldedOpc = 0; + unsigned UnfoldPR = 0; + unsigned UnfoldVR = 0; + int FoldedSS = VirtRegMap::NO_STACK_SLOT; + VirtRegMap::MI2VirtMapTy::const_iterator I, End; + for (tie(I, End) = VRM.getFoldedVirts(&MI); I != End; ++I) { + // Only transform a MI that folds a single register. + if (UnfoldedOpc) + return false; + UnfoldVR = I->second.first; + VirtRegMap::ModRef MR = I->second.second; + if (VRM.isAssignedReg(UnfoldVR)) + continue; + // If this reference is not a use, any previous store is now dead. + // Otherwise, the store to this stack slot is not dead anymore. + FoldedSS = VRM.getStackSlot(UnfoldVR); + MachineInstr* DeadStore = MaybeDeadStores[FoldedSS]; + if (DeadStore && (MR & VirtRegMap::isModRef)) { + unsigned PhysReg = Spills.getSpillSlotOrReMatPhysReg(FoldedSS); + if (!PhysReg || + DeadStore->findRegisterUseOperandIdx(PhysReg, true) == -1) + continue; + UnfoldPR = PhysReg; + UnfoldedOpc = MRI->getOpcodeAfterMemoryUnfold(MI.getOpcode(), + false, true); + } + } + + if (!UnfoldedOpc) + return false; + + for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI.getOperand(i); + if (!MO.isRegister() || MO.getReg() == 0 || !MO.isUse()) + continue; + unsigned VirtReg = MO.getReg(); + if (MRegisterInfo::isPhysicalRegister(VirtReg) || + RegMap->isSubRegister(VirtReg)) + continue; + if (VRM.isAssignedReg(VirtReg)) { + unsigned PhysReg = VRM.getPhys(VirtReg); + if (PhysReg && MRI->regsOverlap(PhysReg, UnfoldPR)) + return false; + } else if (VRM.isReMaterialized(VirtReg)) + continue; + int SS = VRM.getStackSlot(VirtReg); + unsigned PhysReg = Spills.getSpillSlotOrReMatPhysReg(SS); + if (PhysReg) { + if (MRI->regsOverlap(PhysReg, UnfoldPR)) + return false; + continue; + } + PhysReg = VRM.getPhys(VirtReg); + if (!MRI->regsOverlap(PhysReg, UnfoldPR)) + continue; + + // Ok, we'll need to reload the value into a register which makes + // it impossible to perform the store unfolding optimization later. + // Let's see if it is possible to fold the load if the store is + // unfolded. This allows us to perform the store unfolding + // optimization. + SmallVector NewMIs; + if (MRI->unfoldMemoryOperand(MF, &MI, UnfoldVR, false, false, NewMIs)) { + assert(NewMIs.size() == 1); + MachineInstr *NewMI = NewMIs.back(); + NewMIs.clear(); + unsigned Idx = NewMI->findRegisterUseOperandIdx(VirtReg); + MachineInstr *FoldedMI = MRI->foldMemoryOperand(NewMI, Idx, SS); + if (FoldedMI) { + if (VRM.hasPhys(UnfoldVR)) + assert(VRM.getPhys(UnfoldVR) == UnfoldPR); + else + VRM.assignVirt2Phys(UnfoldVR, UnfoldPR); + + VRM.virtFolded(VirtReg, FoldedMI, VirtRegMap::isRef); + MII = MBB.insert(MII, FoldedMI); + VRM.RemoveFromFoldedVirtMap(&MI); + MBB.erase(&MI); + return true; + } + delete NewMI; + } + } + return false; +} /// rewriteMBB - Keep track of which spills are available even after the /// register allocator is done with them. If possible, avoid reloading vregs. @@ -754,28 +868,21 @@ for (MachineBasicBlock::iterator MII = MBB.begin(), E = MBB.end(); MII != E; ) { - MachineInstr &MI = *MII; MachineBasicBlock::iterator NextMII = MII; ++NextMII; - VirtRegMap::MI2VirtMapTy::const_iterator I, End; + VirtRegMap::MI2VirtMapTy::const_iterator I, End; bool Erased = false; bool BackTracked = false; + if (PrepForUnfoldOpti(MBB, MII, + MaybeDeadStores, Spills, RegKills, KillOps, VRM)) + NextMII = next(MII); /// ReusedOperands - Keep track of operand reuse in case we need to undo /// reuse. + MachineInstr &MI = *MII; ReuseInfo ReusedOperands(MI, MRI); - // Loop over all of the implicit defs, clearing them from our available - // sets. const TargetInstrDescriptor *TID = MI.getInstrDescriptor(); - if (TID->ImplicitDefs) { - const unsigned *ImpDef = TID->ImplicitDefs; - for ( ; *ImpDef; ++ImpDef) { - MF.setPhysRegUsed(*ImpDef); - ReusedOperands.markClobbered(*ImpDef); - Spills.ClobberPhysReg(*ImpDef); - } - } // Process all of the spilled uses and all non spilled reg references. for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { @@ -788,7 +895,6 @@ // Ignore physregs for spilling, but remember that it is used by this // function. MF.setPhysRegUsed(VirtReg); - ReusedOperands.markClobbered(VirtReg); continue; } @@ -826,7 +932,7 @@ unsigned PhysReg = Spills.getSpillSlotOrReMatPhysReg(SSorRMId); if (!PhysReg && DoReMat) { // This use is rematerializable. But perhaps the value is available in - // stack if the definition is not deleted. If so, check if we can + // a register if the definition is not deleted. If so, check if we can // reuse the value. ReuseSlot = VRM.getStackSlot(VirtReg); if (ReuseSlot != VirtRegMap::NO_STACK_SLOT) @@ -857,7 +963,6 @@ // aren't allowed to modify the reused register. If none of these cases // apply, reuse it. bool CanReuse = true; - int ti = TID->getOperandConstraint(i, TOI::TIED_TO); if (ti != -1 && MI.getOperand(ti).isRegister() && @@ -911,8 +1016,8 @@ if (DeadStore) { DOUT << "Removed dead store:\t" << *DeadStore; InvalidateKills(*DeadStore, RegKills, KillOps); - MBB.erase(DeadStore); VRM.RemoveFromFoldedVirtMap(DeadStore); + MBB.erase(DeadStore); MaybeDeadStores[ReuseSlot] = NULL; ++NumDSE; } @@ -977,7 +1082,7 @@ DOUT << '\t' << *prior(MII); ++NumReused; continue; - } // is (PhysReg) + } // if (PhysReg) // Otherwise, reload it and remember that we have it. PhysReg = VRM.getPhys(VirtReg); @@ -1023,12 +1128,11 @@ // If we have folded references to memory operands, make sure we clear all // physical registers that may contain the value of the spilled virtual // register - SmallSet FoldedSS; + SmallSet FoldedSS; for (tie(I, End) = VRM.getFoldedVirts(&MI); I != End; ++I) { - DOUT << "Folded vreg: " << I->second.first << " MR: " - << I->second.second; unsigned VirtReg = I->second.first; VirtRegMap::ModRef MR = I->second.second; + DOUT << "Folded vreg: " << VirtReg << " MR: " << MR; if (VRM.isAssignedReg(VirtReg)) { DOUT << ": No stack slot!\n"; continue; @@ -1084,9 +1188,9 @@ // Otherwise, the store to this stack slot is not dead anymore. MachineInstr* DeadStore = MaybeDeadStores[SS]; if (DeadStore) { - bool isDead = true; + bool isDead = !(MR & VirtRegMap::isRef); MachineInstr *NewStore = NULL; - if (MR & VirtRegMap::isRef) { + if (MR & VirtRegMap::isMod) { unsigned PhysReg = Spills.getSpillSlotOrReMatPhysReg(SS); SmallVector NewMIs; if (PhysReg && @@ -1101,8 +1205,8 @@ --NextMII; --NextMII; // backtrack to the unfolded instruction. BackTracked = true; - } else - isDead = false; + isDead = true; + } } if (isDead) { // Previous store is dead. @@ -1156,132 +1260,132 @@ // Process all of the spilled defs. for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (MO.isRegister() && MO.getReg() && MO.isDef()) { - unsigned VirtReg = MO.getReg(); + if (!(MO.isRegister() && MO.getReg() && MO.isDef())) + continue; - if (!MRegisterInfo::isVirtualRegister(VirtReg)) { - // Check to see if this is a noop copy. If so, eliminate the - // instruction before considering the dest reg to be changed. - unsigned Src, Dst; - if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { - ++NumDCE; - DOUT << "Removing now-noop copy: " << MI; - MBB.erase(&MI); - Erased = true; - VRM.RemoveFromFoldedVirtMap(&MI); - Spills.disallowClobberPhysReg(VirtReg); - goto ProcessNextInst; - } + unsigned VirtReg = MO.getReg(); + if (!MRegisterInfo::isVirtualRegister(VirtReg)) { + // Check to see if this is a noop copy. If so, eliminate the + // instruction before considering the dest reg to be changed. + unsigned Src, Dst; + if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { + ++NumDCE; + DOUT << "Removing now-noop copy: " << MI; + MBB.erase(&MI); + Erased = true; + VRM.RemoveFromFoldedVirtMap(&MI); + Spills.disallowClobberPhysReg(VirtReg); + goto ProcessNextInst; + } - // If it's not a no-op copy, it clobbers the value in the destreg. - Spills.ClobberPhysReg(VirtReg); - ReusedOperands.markClobbered(VirtReg); + // If it's not a no-op copy, it clobbers the value in the destreg. + Spills.ClobberPhysReg(VirtReg); + ReusedOperands.markClobbered(VirtReg); - // Check to see if this instruction is a load from a stack slot into - // a register. If so, this provides the stack slot value in the reg. - int FrameIdx; - if (unsigned DestReg = TII->isLoadFromStackSlot(&MI, FrameIdx)) { - assert(DestReg == VirtReg && "Unknown load situation!"); - - // If it is a folded reference, then it's not safe to clobber. - bool Folded = FoldedSS.count(FrameIdx); - // Otherwise, if it wasn't available, remember that it is now! - Spills.addAvailable(FrameIdx, &MI, DestReg, !Folded); - goto ProcessNextInst; - } - - continue; + // Check to see if this instruction is a load from a stack slot into + // a register. If so, this provides the stack slot value in the reg. + int FrameIdx; + if (unsigned DestReg = TII->isLoadFromStackSlot(&MI, FrameIdx)) { + assert(DestReg == VirtReg && "Unknown load situation!"); + + // If it is a folded reference, then it's not safe to clobber. + bool Folded = FoldedSS.count(FrameIdx); + // Otherwise, if it wasn't available, remember that it is now! + Spills.addAvailable(FrameIdx, &MI, DestReg, !Folded); + goto ProcessNextInst; } + + continue; + } - bool DoReMat = VRM.isReMaterialized(VirtReg); - if (DoReMat) - ReMatDefs.insert(&MI); - - // The only vregs left are stack slot definitions. - int StackSlot = VRM.getStackSlot(VirtReg); - const TargetRegisterClass *RC = RegMap->getRegClass(VirtReg); - - // If this def is part of a two-address operand, make sure to execute - // the store from the correct physical register. - unsigned PhysReg; - int TiedOp = MI.getInstrDescriptor()->findTiedToSrcOperand(i); - if (TiedOp != -1) - PhysReg = MI.getOperand(TiedOp).getReg(); - else { - PhysReg = VRM.getPhys(VirtReg); - if (ReusedOperands.isClobbered(PhysReg)) { - // Another def has taken the assigned physreg. It must have been a - // use&def which got it due to reuse. Undo the reuse! - PhysReg = ReusedOperands.GetRegForReload(PhysReg, &MI, + bool DoReMat = VRM.isReMaterialized(VirtReg); + if (DoReMat) + ReMatDefs.insert(&MI); + + // The only vregs left are stack slot definitions. + int StackSlot = VRM.getStackSlot(VirtReg); + const TargetRegisterClass *RC = RegMap->getRegClass(VirtReg); + + // If this def is part of a two-address operand, make sure to execute + // the store from the correct physical register. + unsigned PhysReg; + int TiedOp = MI.getInstrDescriptor()->findTiedToSrcOperand(i); + if (TiedOp != -1) + PhysReg = MI.getOperand(TiedOp).getReg(); + else { + PhysReg = VRM.getPhys(VirtReg); + if (ReusedOperands.isClobbered(PhysReg)) { + // Another def has taken the assigned physreg. It must have been a + // use&def which got it due to reuse. Undo the reuse! + PhysReg = ReusedOperands.GetRegForReload(PhysReg, &MI, Spills, MaybeDeadStores, RegKills, KillOps, VRM); - } } + } - MF.setPhysRegUsed(PhysReg); - ReusedOperands.markClobbered(PhysReg); - MI.getOperand(i).setReg(PhysReg); - if (!MO.isDead()) { - MRI->storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot, RC); - DOUT << "Store:\t" << *next(MII); - - // If there is a dead store to this stack slot, nuke it now. - MachineInstr *&LastStore = MaybeDeadStores[StackSlot]; - if (LastStore) { - DOUT << "Removed dead store:\t" << *LastStore; - ++NumDSE; - SmallVector KillRegs; - InvalidateKills(*LastStore, RegKills, KillOps, &KillRegs); - MachineBasicBlock::iterator PrevMII = LastStore; - bool CheckDef = PrevMII != MBB.begin(); - if (CheckDef) - --PrevMII; - MBB.erase(LastStore); - VRM.RemoveFromFoldedVirtMap(LastStore); - if (CheckDef) { - // Look at defs of killed registers on the store. Mark the defs - // as dead since the store has been deleted and they aren't - // being reused. - for (unsigned j = 0, ee = KillRegs.size(); j != ee; ++j) { - bool HasOtherDef = false; - if (InvalidateRegDef(PrevMII, MI, KillRegs[j], HasOtherDef)) { - MachineInstr *DeadDef = PrevMII; - if (ReMatDefs.count(DeadDef) && !HasOtherDef) { - // FIXME: This assumes a remat def does not have side - // effects. - MBB.erase(DeadDef); - VRM.RemoveFromFoldedVirtMap(DeadDef); - ++NumDRM; - } + MF.setPhysRegUsed(PhysReg); + ReusedOperands.markClobbered(PhysReg); + MI.getOperand(i).setReg(PhysReg); + if (!MO.isDead()) { + MRI->storeRegToStackSlot(MBB, next(MII), PhysReg, StackSlot, RC); + DOUT << "Store:\t" << *next(MII); + + // If there is a dead store to this stack slot, nuke it now. + MachineInstr *&LastStore = MaybeDeadStores[StackSlot]; + if (LastStore) { + DOUT << "Removed dead store:\t" << *LastStore; + ++NumDSE; + SmallVector KillRegs; + InvalidateKills(*LastStore, RegKills, KillOps, &KillRegs); + MachineBasicBlock::iterator PrevMII = LastStore; + bool CheckDef = PrevMII != MBB.begin(); + if (CheckDef) + --PrevMII; + MBB.erase(LastStore); + VRM.RemoveFromFoldedVirtMap(LastStore); + if (CheckDef) { + // Look at defs of killed registers on the store. Mark the defs + // as dead since the store has been deleted and they aren't + // being reused. + for (unsigned j = 0, ee = KillRegs.size(); j != ee; ++j) { + bool HasOtherDef = false; + if (InvalidateRegDef(PrevMII, MI, KillRegs[j], HasOtherDef)) { + MachineInstr *DeadDef = PrevMII; + if (ReMatDefs.count(DeadDef) && !HasOtherDef) { + // FIXME: This assumes a remat def does not have side + // effects. + MBB.erase(DeadDef); + VRM.RemoveFromFoldedVirtMap(DeadDef); + ++NumDRM; } } } } - LastStore = next(MII); + } + LastStore = next(MII); - // If the stack slot value was previously available in some other - // register, change it now. Otherwise, make the register available, - // in PhysReg. - Spills.ModifyStackSlotOrReMat(StackSlot); - Spills.ClobberPhysReg(PhysReg); - Spills.addAvailable(StackSlot, LastStore, PhysReg); - ++NumStores; - - // Check to see if this is a noop copy. If so, eliminate the - // instruction before considering the dest reg to be changed. - { - unsigned Src, Dst; - if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { - ++NumDCE; - DOUT << "Removing now-noop copy: " << MI; - MBB.erase(&MI); - Erased = true; - VRM.RemoveFromFoldedVirtMap(&MI); - UpdateKills(*LastStore, RegKills, KillOps); - goto ProcessNextInst; - } + // If the stack slot value was previously available in some other + // register, change it now. Otherwise, make the register available, + // in PhysReg. + Spills.ModifyStackSlotOrReMat(StackSlot); + Spills.ClobberPhysReg(PhysReg); + Spills.addAvailable(StackSlot, LastStore, PhysReg); + ++NumStores; + + // Check to see if this is a noop copy. If so, eliminate the + // instruction before considering the dest reg to be changed. + { + unsigned Src, Dst; + if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) { + ++NumDCE; + DOUT << "Removing now-noop copy: " << MI; + MBB.erase(&MI); + Erased = true; + VRM.RemoveFromFoldedVirtMap(&MI); + UpdateKills(*LastStore, RegKills, KillOps); + goto ProcessNextInst; } - } - } + } + } } ProcessNextInst: if (!Erased && !BackTracked) Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=43192&r1=43191&r2=43192&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Oct 19 16:23:22 2007 @@ -1062,9 +1062,11 @@ def INC8m : I<0xFE, MRM0m, (outs), (ins i8mem :$dst), "inc{b}\t$dst", [(store (add (loadi8 addr:$dst), 1), addr:$dst)]>; def INC16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst", - [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, OpSize; + [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, + OpSize, Requires<[In32BitMode]>; def INC32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst", - [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>; + [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>, + Requires<[In32BitMode]>; } let CodeSize = 2 in @@ -1082,9 +1084,11 @@ def DEC8m : I<0xFE, MRM1m, (outs), (ins i8mem :$dst), "dec{b}\t$dst", [(store (add (loadi8 addr:$dst), -1), addr:$dst)]>; def DEC16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst", - [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, OpSize; + [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, + OpSize, Requires<[In32BitMode]>; def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", - [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>; + [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>, + Requires<[In32BitMode]>; } } // Defs = [EFLAGS] Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=43192&r1=43191&r2=43192&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Oct 19 16:23:22 2007 @@ -461,6 +461,23 @@ [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In64BitMode]>; } // isConvertibleToThreeAddress + +// These are duplicates of their 32-bit counterparts. Only needed so X86 knows +// how to unfold them. +let isTwoAddress = 0, CodeSize = 2 in { + def INC64_16m : I<0xFF, MRM0m, (outs), (ins i16mem:$dst), "inc{w}\t$dst", + [(store (add (loadi16 addr:$dst), 1), addr:$dst)]>, + OpSize, Requires<[In64BitMode]>; + def INC64_32m : I<0xFF, MRM0m, (outs), (ins i32mem:$dst), "inc{l}\t$dst", + [(store (add (loadi32 addr:$dst), 1), addr:$dst)]>, + Requires<[In64BitMode]>; + def DEC64_16m : I<0xFF, MRM1m, (outs), (ins i16mem:$dst), "dec{w}\t$dst", + [(store (add (loadi16 addr:$dst), -1), addr:$dst)]>, + OpSize, Requires<[In64BitMode]>; + def DEC64_32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", + [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>, + Requires<[In64BitMode]>; +} } // Defs = [EFLAGS], CodeSize Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=43192&r1=43191&r2=43192&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Oct 19 16:23:22 2007 @@ -97,14 +97,14 @@ { X86::AND8rr, X86::AND8mr }, { X86::DEC16r, X86::DEC16m }, { X86::DEC32r, X86::DEC32m }, - { X86::DEC64_16r, X86::DEC16m }, - { X86::DEC64_32r, X86::DEC32m }, + { X86::DEC64_16r, X86::DEC64_16m }, + { X86::DEC64_32r, X86::DEC64_32m }, { X86::DEC64r, X86::DEC64m }, { X86::DEC8r, X86::DEC8m }, { X86::INC16r, X86::INC16m }, { X86::INC32r, X86::INC32m }, - { X86::INC64_16r, X86::INC16m }, - { X86::INC64_32r, X86::INC32m }, + { X86::INC64_16r, X86::INC64_16m }, + { X86::INC64_32r, X86::INC64_32m }, { X86::INC64r, X86::INC64m }, { X86::INC8r, X86::INC8m }, { X86::NEG16r, X86::NEG16m }, @@ -981,10 +981,9 @@ static MachineInstr *FuseTwoAddrInst(unsigned Opcode, SmallVector &MOs, MachineInstr *MI, const TargetInstrInfo &TII) { - unsigned NumOps = TII.getNumOperands(MI->getOpcode())-2; - // Create the base instruction with the memory operand as the first part. - MachineInstrBuilder MIB = BuildMI(TII.get(Opcode)); + MachineInstr *NewMI = new MachineInstr(TII.get(Opcode), true); + MachineInstrBuilder MIB(NewMI); unsigned NumAddrOps = MOs.size(); for (unsigned i = 0; i != NumAddrOps; ++i) MIB = X86InstrAddOperand(MIB, MOs[i]); @@ -992,17 +991,23 @@ MIB.addImm(1).addReg(0).addImm(0); // Loop over the rest of the ri operands, converting them over. + unsigned NumOps = TII.getNumOperands(MI->getOpcode())-2; for (unsigned i = 0; i != NumOps; ++i) { MachineOperand &MO = MI->getOperand(i+2); MIB = X86InstrAddOperand(MIB, MO); } + for (unsigned i = NumOps+2, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + MIB = X86InstrAddOperand(MIB, MO); + } return MIB; } static MachineInstr *FuseInst(unsigned Opcode, unsigned OpNo, SmallVector &MOs, MachineInstr *MI, const TargetInstrInfo &TII) { - MachineInstrBuilder MIB = BuildMI(TII.get(Opcode)); + MachineInstr *NewMI = new MachineInstr(TII.get(Opcode), true); + MachineInstrBuilder MIB(NewMI); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); @@ -1036,7 +1041,6 @@ MachineInstr* X86RegisterInfo::foldMemoryOperand(MachineInstr *MI, unsigned i, SmallVector &MOs) const { - // Table (and size) to search const DenseMap *OpcodeTablePtr = NULL; bool isTwoAddrFold = false; unsigned NumOps = TII.getNumOperands(MI->getOpcode()); @@ -1117,6 +1121,49 @@ return foldMemoryOperand(MI, OpNum, MOs); } +unsigned X86RegisterInfo::getOpcodeAfterMemoryFold(unsigned Opc, + unsigned OpNum) const { + // Check switch flag + if (NoFusing) return 0; + const DenseMap *OpcodeTablePtr = NULL; + unsigned NumOps = TII.getNumOperands(Opc); + bool isTwoAddr = NumOps > 1 && + TII.getOperandConstraint(Opc, 1, TOI::TIED_TO) != -1; + + // Folding a memory location into the two-address part of a two-address + // instruction is different than folding it other places. It requires + // replacing the *two* registers with the memory location. + if (isTwoAddr && NumOps >= 2 && OpNum < 2) { + OpcodeTablePtr = &RegOp2MemOpTable2Addr; + } else if (OpNum == 0) { // If operand 0 + switch (Opc) { + case X86::MOV16r0: + return X86::MOV16mi; + case X86::MOV32r0: + return X86::MOV32mi; + case X86::MOV64r0: + return X86::MOV64mi32; + case X86::MOV8r0: + return X86::MOV8mi; + default: break; + } + OpcodeTablePtr = &RegOp2MemOpTable0; + } else if (OpNum == 1) { + OpcodeTablePtr = &RegOp2MemOpTable1; + } else if (OpNum == 2) { + OpcodeTablePtr = &RegOp2MemOpTable2; + } + + if (OpcodeTablePtr) { + // Find the Opcode to fuse + DenseMap::iterator I = + OpcodeTablePtr->find((unsigned*)Opc); + if (I != OpcodeTablePtr->end()) + return I->second; + } + return 0; +} + bool X86RegisterInfo::unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, unsigned Reg, bool UnfoldLoad, bool UnfoldStore, SmallVectorImpl &NewMIs) const { @@ -1126,14 +1173,14 @@ return false; unsigned Opc = I->second.first; unsigned Index = I->second.second & 0xf; - bool HasLoad = I->second.second & (1 << 4); - bool HasStore = I->second.second & (1 << 5); - if (UnfoldLoad && !HasLoad) + bool FoldedLoad = I->second.second & (1 << 4); + bool FoldedStore = I->second.second & (1 << 5); + if (UnfoldLoad && !FoldedLoad) return false; - HasLoad &= UnfoldLoad; - if (UnfoldStore && !HasStore) + UnfoldLoad &= FoldedLoad; + if (UnfoldStore && !FoldedStore) return false; - HasStore &= UnfoldStore; + UnfoldStore &= FoldedStore; const TargetInstrDescriptor &TID = TII.get(Opc); const TargetOperandInfo &TOI = TID.OpInfo[Index]; @@ -1156,9 +1203,9 @@ } // Emit the load instruction. - if (HasLoad) { + if (UnfoldLoad) { loadRegFromAddr(MF, Reg, AddrOps, RC, NewMIs); - if (HasStore) { + if (UnfoldStore) { // Address operands cannot be marked isKill. for (unsigned i = 1; i != 5; ++i) { MachineOperand &MO = NewMIs[0]->getOperand(i); @@ -1169,15 +1216,11 @@ } // Emit the data processing instruction. - MachineInstr *DataMI = new MachineInstr (TID, true); + MachineInstr *DataMI = new MachineInstr(TID, true); MachineInstrBuilder MIB(DataMI); - const TargetRegisterClass *DstRC = 0; - if (HasStore) { - const TargetOperandInfo &DstTOI = TID.OpInfo[0]; - DstRC = (DstTOI.Flags & M_LOOK_UP_PTR_REG_CLASS) - ? TII.getPointerRegClass() : getRegClass(DstTOI.RegClass); + + if (FoldedStore) MIB.addReg(Reg, true); - } for (unsigned i = 0, e = BeforeOps.size(); i != e; ++i) MIB = X86InstrAddOperand(MIB, BeforeOps[i]); MIB.addReg(Reg); @@ -1190,8 +1233,12 @@ NewMIs.push_back(MIB); // Emit the store instruction. - if (HasStore) + if (UnfoldStore) { + const TargetOperandInfo &DstTOI = TID.OpInfo[0]; + const TargetRegisterClass *DstRC = (DstTOI.Flags & M_LOOK_UP_PTR_REG_CLASS) + ? TII.getPointerRegClass() : getRegClass(DstTOI.RegClass); storeRegToAddr(MF, Reg, AddrOps, DstRC, NewMIs); + } return true; } @@ -1209,8 +1256,8 @@ return false; unsigned Opc = I->second.first; unsigned Index = I->second.second & 0xf; - bool HasLoad = I->second.second & (1 << 4); - bool HasStore = I->second.second & (1 << 5); + bool FoldedLoad = I->second.second & (1 << 4); + bool FoldedStore = I->second.second & (1 << 5); const TargetInstrDescriptor &TID = TII.get(Opc); const TargetOperandInfo &TOI = TID.OpInfo[Index]; const TargetRegisterClass *RC = (TOI.Flags & M_LOOK_UP_PTR_REG_CLASS) @@ -1233,7 +1280,7 @@ // Emit the load instruction. SDNode *Load = 0; - if (HasLoad) { + if (FoldedLoad) { MVT::ValueType VT = *RC->vt_begin(); Load = DAG.getTargetNode(getLoadRegOpcode(RC), VT, MVT::Other, &AddrOps[0], AddrOps.size()); @@ -1261,7 +1308,7 @@ NewNodes.push_back(NewNode); // Emit the store instruction. - if (HasStore) { + if (FoldedStore) { AddrOps.pop_back(); AddrOps.push_back(SDOperand(NewNode, 0)); AddrOps.push_back(Chain); @@ -1279,11 +1326,11 @@ MemOp2RegOpTable.find((unsigned*)Opc); if (I == MemOp2RegOpTable.end()) return 0; - bool HasLoad = I->second.second & (1 << 4); - bool HasStore = I->second.second & (1 << 5); - if (UnfoldLoad && !HasLoad) + bool FoldedLoad = I->second.second & (1 << 4); + bool FoldedStore = I->second.second & (1 << 5); + if (UnfoldLoad && !FoldedLoad) return 0; - if (UnfoldStore && !HasStore) + if (UnfoldStore && !FoldedStore) return 0; return I->second.first; } Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=43192&r1=43191&r2=43192&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Fri Oct 19 16:23:22 2007 @@ -132,6 +132,12 @@ unsigned OpNum, MachineInstr* LoadMI) const; + /// getOpcodeAfterMemoryFold - Returns the opcode of the would be new + /// instruction after load / store is folded into an instruction of the + /// specified opcode. It returns zero if the specified unfolding is not + /// possible. + unsigned getOpcodeAfterMemoryFold(unsigned Opc, unsigned OpNum) const; + /// unfoldMemoryOperand - Separate a single instruction which folded a load or /// a store or a load and a store into two or more instruction. If this is /// possible, returns true as well as the new instructions by reference. @@ -143,8 +149,9 @@ SmallVectorImpl &NewNodes) const; /// getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new - /// instruction after load / store are unfolded from the specified opcode. - /// It returns zero if the specified unfolding is impossible. + /// instruction after load / store are unfolded from an instruction of the + /// specified opcode. It returns zero if the specified unfolding is not + /// possible. unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, bool UnfoldLoad, bool UnfoldStore) const; From evan.cheng at apple.com Fri Oct 19 17:05:00 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 19 Oct 2007 22:05:00 -0000 Subject: [llvm-commits] [llvm] r43193 - /llvm/trunk/test/CodeGen/X86/2007-10-19-SpillerUnfold.ll Message-ID: <200710192205.l9JM50Dq012493@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 19 17:05:00 2007 New Revision: 43193 URL: http://llvm.org/viewvc/llvm-project?rev=43193&view=rev Log: New test case. Added: llvm/trunk/test/CodeGen/X86/2007-10-19-SpillerUnfold.ll Added: llvm/trunk/test/CodeGen/X86/2007-10-19-SpillerUnfold.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-10-19-SpillerUnfold.ll?rev=43193&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-10-19-SpillerUnfold.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-10-19-SpillerUnfold.ll Fri Oct 19 17:05:00 2007 @@ -0,0 +1,84 @@ +; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | grep inc | not grep PTR + +define i16 @t(i32* %bitptr, i32* %source, i8** %byteptr, i32 %scale, i32 %round) signext { +entry: + br label %bb + +bb: ; preds = %cond_next391, %entry + %cnt.0 = phi i32 [ 0, %entry ], [ %tmp422445, %cond_next391 ] ; [#uses=1] + %v.1 = phi i32 [ undef, %entry ], [ %tmp411, %cond_next391 ] ; [#uses=0] + br i1 false, label %cond_true, label %cond_next127 + +cond_true: ; preds = %bb + store i8* null, i8** %byteptr, align 4 + store i8* null, i8** %byteptr, align 4 + br label %cond_next127 + +cond_next127: ; preds = %cond_true, %bb + %tmp151 = add i32 0, %round ; [#uses=1] + %tmp153 = ashr i32 %tmp151, %scale ; [#uses=2] + %tmp154155 = trunc i32 %tmp153 to i16 ; [#uses=1] + %tmp154155156 = sext i16 %tmp154155 to i32 ; [#uses=1] + %tmp158 = xor i32 %tmp154155156, %tmp153 ; [#uses=1] + %tmp160 = or i32 %tmp158, %cnt.0 ; [#uses=1] + %tmp171 = load i32* %bitptr, align 4 ; [#uses=1] + %tmp180181 = sext i16 0 to i32 ; [#uses=3] + %tmp183 = add i32 %tmp160, 1 ; [#uses=1] + br i1 false, label %cond_true188, label %cond_next245 + +cond_true188: ; preds = %cond_next127 + ret i16 0 + +cond_next245: ; preds = %cond_next127 + %tmp249 = ashr i32 %tmp180181, 8 ; [#uses=1] + %tmp250 = add i32 %tmp171, %tmp249 ; [#uses=1] + %tmp253444 = lshr i32 %tmp180181, 4 ; [#uses=1] + %tmp254 = and i32 %tmp253444, 15 ; [#uses=1] + %tmp256 = and i32 %tmp180181, 15 ; [#uses=2] + %tmp264 = icmp ugt i32 %tmp250, 15 ; [#uses=1] + br i1 %tmp264, label %cond_true267, label %cond_next391 + +cond_true267: ; preds = %cond_next245 + store i8* null, i8** %byteptr, align 4 + store i8* null, i8** %byteptr, align 4 + br i1 false, label %cond_true289, label %cond_next327 + +cond_true289: ; preds = %cond_true267 + ret i16 0 + +cond_next327: ; preds = %cond_true267 + br i1 false, label %cond_true343, label %cond_next385 + +cond_true343: ; preds = %cond_next327 + %tmp345 = load i8** %byteptr, align 4 ; [#uses=1] + store i8* null, i8** %byteptr, align 4 + br i1 false, label %cond_next385, label %cond_true352 + +cond_true352: ; preds = %cond_true343 + store i8* %tmp345, i8** %byteptr, align 4 + br i1 false, label %cond_true364, label %cond_next385 + +cond_true364: ; preds = %cond_true352 + ret i16 0 + +cond_next385: ; preds = %cond_true352, %cond_true343, %cond_next327 + br label %cond_next391 + +cond_next391: ; preds = %cond_next385, %cond_next245 + %tmp393 = load i32* %source, align 4 ; [#uses=1] + %tmp395 = load i32* %bitptr, align 4 ; [#uses=2] + %tmp396 = shl i32 %tmp393, %tmp395 ; [#uses=1] + %tmp398 = sub i32 32, %tmp256 ; [#uses=1] + %tmp405 = lshr i32 %tmp396, 31 ; [#uses=1] + %tmp406 = add i32 %tmp405, -1 ; [#uses=1] + %tmp409 = lshr i32 %tmp406, %tmp398 ; [#uses=1] + %tmp411 = sub i32 0, %tmp409 ; [#uses=1] + %tmp422445 = add i32 %tmp254, %tmp183 ; [#uses=2] + %tmp426447 = add i32 %tmp395, %tmp256 ; [#uses=1] + store i32 %tmp426447, i32* %bitptr, align 4 + %tmp429448 = icmp ult i32 %tmp422445, 63 ; [#uses=1] + br i1 %tmp429448, label %bb, label %UnifiedReturnBlock + +UnifiedReturnBlock: ; preds = %cond_next391 + ret i16 0 +} From evan.cheng at apple.com Fri Oct 19 18:50:59 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 19 Oct 2007 23:50:59 -0000 Subject: [llvm-commits] [llvm] r43194 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200710192350.l9JNoxQR018710@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 19 18:50:58 2007 New Revision: 43194 URL: http://llvm.org/viewvc/llvm-project?rev=43194&view=rev Log: Resolve unfold tables ambiguity. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=43194&r1=43193&r2=43194&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Oct 19 18:50:58 2007 @@ -324,9 +324,10 @@ unsigned FoldedLoad = OpTbl0[i][2]; // Index 0, folded load or store. unsigned AuxInfo = 0 | (FoldedLoad << 4) | ((FoldedLoad^1) << 5); - if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, + if (RegOp != X86::FsMOVAPDrr && RegOp != X86::FsMOVAPSrr) + if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, std::make_pair(RegOp, AuxInfo)))) - AmbEntries.push_back(MemOp); + AmbEntries.push_back(MemOp); } static const unsigned OpTbl1[][2] = { @@ -449,9 +450,10 @@ if (!RegOp2MemOpTable1.insert(std::make_pair((unsigned*)RegOp, MemOp))) assert(false && "Duplicated entries?"); unsigned AuxInfo = 1 | (1 << 4); // Index 1, folded load - if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, + if (RegOp != X86::FsMOVAPDrr && RegOp != X86::FsMOVAPSrr) + if (!MemOp2RegOpTable.insert(std::make_pair((unsigned*)MemOp, std::make_pair(RegOp, AuxInfo)))) - AmbEntries.push_back(MemOp); + AmbEntries.push_back(MemOp); } static const unsigned OpTbl2[][2] = { @@ -648,8 +650,7 @@ } // Remove ambiguous entries. - for (unsigned i = 0, e = AmbEntries.size(); i != e; ++i) - MemOp2RegOpTable.erase((unsigned*)AmbEntries[i]); + assert(AmbEntries.empty() && "Duplicated entries in unfolding maps?"); } // getX86RegNum - This function maps LLVM register identifiers to their X86 From dalej at apple.com Fri Oct 19 19:07:54 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 20 Oct 2007 00:07:54 -0000 Subject: [llvm-commits] [llvm] r43195 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200710200007.l9K07sR9020003@zion.cs.uiuc.edu> Author: johannes Date: Fri Oct 19 19:07:52 2007 New Revision: 43195 URL: http://llvm.org/viewvc/llvm-project?rev=43195&view=rev Log: Fix a few places vector operations were not getting the operand's type from the right place. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=43195&r1=43194&r2=43195&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Oct 19 19:07:52 2007 @@ -1919,8 +1919,9 @@ Result = LegalizeOp(Result); } else { SDNode *InVal = Tmp2.Val; - unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); - MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); + int InIx = Tmp2.ResNo; + unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(InIx)); + MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(InIx)); // Figure out if there is a simple type corresponding to this Vector // type. If so, convert to the vector type. @@ -2114,8 +2115,9 @@ // in the high half of the vector. if (MVT::isVector(ST->getValue().getValueType())) { SDNode *InVal = ST->getValue().Val; - unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); - MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); + int InIx = ST->getValue().ResNo; + unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(InIx)); + MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(InIx)); // Figure out if there is a simple type corresponding to this Vector // type. If so, convert to the vector type. @@ -3260,8 +3262,9 @@ // The input has to be a vector type, we have to either scalarize it, pack // it, or convert it based on whether the input vector type is legal. SDNode *InVal = Node->getOperand(0).Val; - unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); - MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); + int InIx = Node->getOperand(0).ResNo; + unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(InIx)); + MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(InIx)); // Figure out if there is a simple type corresponding to this Vector // type. If so, convert to the vector type. From evan.cheng at apple.com Fri Oct 19 23:01:47 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 20 Oct 2007 04:01:47 -0000 Subject: [llvm-commits] [llvm] r43196 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200710200401.l9K41m50000973@zion.cs.uiuc.edu> Author: evancheng Date: Fri Oct 19 23:01:47 2007 New Revision: 43196 URL: http://llvm.org/viewvc/llvm-project?rev=43196&view=rev Log: Added missing curly braces which renders the if clause useless in debug build. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=43196&r1=43195&r2=43196&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Fri Oct 19 23:01:47 2007 @@ -171,7 +171,7 @@ // If this instruction is potentially convertible to a true // three-address instruction, - if (TID->Flags & M_CONVERTIBLE_TO_3_ADDR) + if (TID->Flags & M_CONVERTIBLE_TO_3_ADDR) { // FIXME: This assumes there are no more operands which are tied // to another register. #ifndef NDEBUG @@ -188,6 +188,7 @@ // Done with this instruction. break; } + } } InstructionRearranged: From sabre at nondot.org Fri Oct 19 23:07:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 20 Oct 2007 04:07:07 -0000 Subject: [llvm-commits] [llvm] r43197 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710200407.l9K477YA001255@zion.cs.uiuc.edu> Author: lattner Date: Fri Oct 19 23:07:07 2007 New Revision: 43197 URL: http://llvm.org/viewvc/llvm-project?rev=43197&view=rev Log: Implement promote and expand for operands of memcpy and friends. This fixes CodeGen/X86/mem*.ll. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43197&r1=43196&r2=43197&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Oct 19 23:07:07 2007 @@ -119,10 +119,20 @@ } void SetPromotedOp(SDOperand Op, SDOperand Result); + /// GetPromotedZExtOp - Get a promoted operand and zero extend it to the final + /// size. + SDOperand GetPromotedZExtOp(SDOperand Op) { + MVT::ValueType OldVT = Op.getValueType(); + Op = GetPromotedOp(Op); + return DAG.getZeroExtendInReg(Op, OldVT); + } + void GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); void SetExpandedOp(SDOperand Op, SDOperand Lo, SDOperand Hi); + // Common routines. SDOperand CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT); + SDOperand HandleMemIntrinsic(SDNode *N); // Result Promotion. void PromoteResult(SDNode *N, unsigned ResNo); @@ -440,6 +450,52 @@ return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); } + +/// HandleMemIntrinsic - This handles memcpy/memset/memmove with invalid +/// operands. This promotes or expands the operands as required. +SDOperand DAGTypeLegalizer::HandleMemIntrinsic(SDNode *N) { + // The chain and pointer [operands #0 and #1] are always valid types. + SDOperand Chain = N->getOperand(0); + SDOperand Ptr = N->getOperand(1); + SDOperand Op2 = N->getOperand(2); + + // Op #2 is either a value (memset) or a pointer. Promote it if required. + switch (getTypeAction(Op2.getValueType())) { + default: assert(0 && "Unknown action for pointer/value operand"); + case Legal: break; + case Promote: Op2 = GetPromotedOp(Op2); break; + } + + // The length could have any action required. + SDOperand Length = N->getOperand(3); + switch (getTypeAction(Length.getValueType())) { + default: assert(0 && "Unknown action for memop operand"); + case Legal: break; + case Promote: Length = GetPromotedZExtOp(Length); break; + case Expand: + SDOperand Dummy; // discard the high part. + GetExpandedOp(Length, Length, Dummy); + break; + } + + SDOperand Align = N->getOperand(4); + switch (getTypeAction(Align.getValueType())) { + default: assert(0 && "Unknown action for memop operand"); + case Legal: break; + case Promote: Align = GetPromotedZExtOp(Align); break; + } + + SDOperand AlwaysInline = N->getOperand(5); + switch (getTypeAction(AlwaysInline.getValueType())) { + default: assert(0 && "Unknown action for memop operand"); + case Legal: break; + case Promote: AlwaysInline = GetPromotedZExtOp(AlwaysInline); break; + } + + SDOperand Ops[] = { Chain, Ptr, Op2, Length, Align, AlwaysInline }; + return DAG.UpdateNodeOperands(SDOperand(N, 0), Ops, 6); +} + //===----------------------------------------------------------------------===// // Result Promotion //===----------------------------------------------------------------------===// @@ -1249,6 +1305,9 @@ case ISD::STORE: Res = PromoteOperand_STORE(cast(N), OpNo); break; + case ISD::MEMSET: + case ISD::MEMCPY: + case ISD::MEMMOVE: Res = HandleMemIntrinsic(N); break; } // If the result is null, the sub-method took care of registering results etc. @@ -1447,6 +1506,9 @@ case ISD::SETCC: Res = ExpandOperand_SETCC(N); break; case ISD::STORE: Res = ExpandOperand_STORE(cast(N), OpNo); break; + case ISD::MEMSET: + case ISD::MEMCPY: + case ISD::MEMMOVE: Res = HandleMemIntrinsic(N); break; } // If the result is null, the sub-method took care of registering results etc. From sabre at nondot.org Fri Oct 19 23:09:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 20 Oct 2007 04:09:48 -0000 Subject: [llvm-commits] [llvm] r43198 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710200409.l9K49mJh001461@zion.cs.uiuc.edu> Author: lattner Date: Fri Oct 19 23:09:48 2007 New Revision: 43198 URL: http://llvm.org/viewvc/llvm-project?rev=43198&view=rev Log: simplify some code. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43198&r1=43197&r2=43198&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Oct 19 23:09:48 2007 @@ -668,7 +668,7 @@ // The input value must be properly zero extended. MVT::ValueType VT = N->getValueType(0); MVT::ValueType NVT = TLI.getTypeToTransformTo(VT); - SDOperand Res = DAG.getZeroExtendInReg(GetPromotedOp(N->getOperand(0)), VT); + SDOperand Res = GetPromotedZExtOp(N->getOperand(0)); return DAG.getNode(ISD::SRL, NVT, Res, N->getOperand(1)); } From sabre at nondot.org Fri Oct 19 23:32:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 20 Oct 2007 04:32:38 -0000 Subject: [llvm-commits] [llvm] r43199 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Message-ID: <200710200432.l9K4WcvY002508@zion.cs.uiuc.edu> Author: lattner Date: Fri Oct 19 23:32:38 2007 New Revision: 43199 URL: http://llvm.org/viewvc/llvm-project?rev=43199&view=rev Log: Add result promotion of FP_TO_*INT, fixing CodeGen/X86/trunc-to-bool.ll with the new legalizer. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43199&r1=43198&r2=43199&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Fri Oct 19 23:32:38 2007 @@ -141,6 +141,7 @@ SDOperand PromoteResult_TRUNCATE(SDNode *N); SDOperand PromoteResult_INT_EXTEND(SDNode *N); SDOperand PromoteResult_FP_ROUND(SDNode *N); + SDOperand PromoteResult_FP_TO_XINT(SDNode *N); SDOperand PromoteResult_SETCC(SDNode *N); SDOperand PromoteResult_LOAD(LoadSDNode *N); SDOperand PromoteResult_SimpleIntBinOp(SDNode *N); @@ -524,7 +525,8 @@ case ISD::ZERO_EXTEND: case ISD::ANY_EXTEND: Result = PromoteResult_INT_EXTEND(N); break; case ISD::FP_ROUND: Result = PromoteResult_FP_ROUND(N); break; - + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: Result = PromoteResult_FP_TO_XINT(N); break; case ISD::SETCC: Result = PromoteResult_SETCC(N); break; case ISD::LOAD: Result = PromoteResult_LOAD(cast(N)); break; @@ -620,6 +622,32 @@ N->getOperand(0), DAG.getValueType(N->getValueType(0))); } +SDOperand DAGTypeLegalizer::PromoteResult_FP_TO_XINT(SDNode *N) { + SDOperand Op = N->getOperand(0); + // If the operand needed to be promoted, do so now. + if (getTypeAction(Op.getValueType()) == Promote) + // The input result is prerounded, so we don't have to do anything special. + Op = GetPromotedOp(Op); + + unsigned NewOpc = N->getOpcode(); + MVT::ValueType NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + + // If we're promoting a UINT to a larger size, check to see if the new node + // will be legal. If it isn't, check to see if FP_TO_SINT is legal, since + // we can use that instead. This allows us to generate better code for + // FP_TO_UINT for small destination sizes on targets where FP_TO_UINT is not + // legal, such as PowerPC. + if (N->getOpcode() == ISD::FP_TO_UINT) { + if (!TLI.isOperationLegal(ISD::FP_TO_UINT, NVT) && + (TLI.isOperationLegal(ISD::FP_TO_SINT, NVT) || + TLI.getOperationAction(ISD::FP_TO_SINT, NVT)==TargetLowering::Custom)) + NewOpc = ISD::FP_TO_SINT; + } + + return DAG.getNode(NewOpc, NVT, Op); +} + + SDOperand DAGTypeLegalizer::PromoteResult_SETCC(SDNode *N) { assert(isTypeLegal(TLI.getSetCCResultTy()) && "SetCC type is not legal??"); return DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), N->getOperand(0), From resistor at mac.com Sat Oct 20 00:23:07 2007 From: resistor at mac.com (Owen Anderson) Date: Sat, 20 Oct 2007 05:23:07 -0000 Subject: [llvm-commits] [llvm] r43200 - in /llvm/trunk/docs/tutorial: ./ Tutorial1.html index.html Message-ID: <200710200523.l9K5N7r5005265@zion.cs.uiuc.edu> Author: resistor Date: Sat Oct 20 00:23:06 2007 New Revision: 43200 URL: http://llvm.org/viewvc/llvm-project?rev=43200&view=rev Log: Add the beginnings of an LLVM tutorial. If anyone has suggestions, comments, or would like to contribute, let me know! Added: llvm/trunk/docs/tutorial/ llvm/trunk/docs/tutorial/Tutorial1.html llvm/trunk/docs/tutorial/index.html Added: llvm/trunk/docs/tutorial/Tutorial1.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/Tutorial1.html?rev=43200&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/Tutorial1.html (added) +++ llvm/trunk/docs/tutorial/Tutorial1.html Sat Oct 20 00:23:06 2007 @@ -0,0 +1,175 @@ + + + + + LLVM Tutorial 1: A First Function + + + + + + + + +
      LLVM Tutorial 1: A First Function
      + +
      +

      Written by Owen Anderson

      +
      + +
      + +

      For starters, lets consider a relatively straightforward function that takes three integer parameters and returns an arithmetic combination of them. This is nice and simple, especially since it involves no control flow:

      + +
      +
      +  int mul_add(int x, int y, int z) {
      +      return x * y + z;
      +  }
      +
      +
      + +

      As a preview, the LLVM IR we???re going to end up generating for this function will look like:

      + +
      +
      +  define i32 @mul_add(i32 %x, i32 %y, i32 %z) {
      +  entry:
      +  	%tmp = mul i32 %x, %y
      +  	%tmp2 = add i32 %tmp, %z
      +  	ret i32 %tmp2
      +  }
      +
      +
      + +

      Before going any further in this tutorial, you should look through the LLVM Language Reference Manual and convince yourself that the above LLVM IR is actually equivalent to the original function. Once you???re satisfied with that, let???s move on to actually generating it programmatically!

      + +

      ... STUFF ABOUT HEADERS ...

      + +

      Now, let???s get started on our real program. Here???s what our basic main() will look like:

      + +
      +
      +using namespace llvm;
      +
      +Module* makeLLVMModule();
      +
      +int main(int argc, char**argv) {
      +  Module* Mod = makeLLVMModule();
      +
      +  verifyModule(*Mod, PrintMessageAction);
      +
      +  PassManager PM;
      +  PM.add(new PrintModulePass(&llvm::cout));
      +  PM.run(*Mod);
      +
      +  return 0;
      +}
      +
      +
      + +

      The first segment is pretty simple: it creates an LLVM ???module.??? In LLVM, a module represents a single unit of code that is to be processed together. A module contains things like global variables and function declarations and implementations. Here, we???ve declared a makeLLVMModule() function to do the real work of creating the module. Don???t worry, we???ll be looking at that one next!

      + +

      The second segment runs the LLVM module verifier on our newly created module. While this probably isn???t really necessary for a simple module like this one, it???s always a good idea, especially if you???re generating LLVM IR based on some input. The verifier will print an error message if your LLVM module is malformed in any way.

      + +

      Finally, we instantiate an LLVM PassManager and run the PrintModulePass on our module. LLVM uses an explicit pass infrastructure to manage optimizations and various other things. A PassManager, as should be obvious from its name, manages passes: it is responsible for scheduling them, invoking them, and insuring the proper disposal after we???re done with them. For this example, we???re just using a trivial pass that prints out our module in textual form.

      + +

      Now onto the interesting part: creating a populating a module. Here???s the first chunk of our createLLVMModule():

      + +
      +
      +Module* makeLLVMModule() {
      +  // Module Construction
      +  Module* mod = new Module("test");
      +
      +
      + +

      Exciting, isn???t it!? All we???re doing here is instantiating a module and giving it a name. The name isn???t particularly important unless you???re going to be dealing with multiple modules at once.

      + +
      +
      +  // Create a prototype for our function
      +  std::vector<const Type*>argTypes;
      +  argTypes.push_back(IntegerType::get(32));
      +  argTypes.push_back(IntegerType::get(32));
      +  argTypes.push_back(IntegerType::get(32));
      +
      +  FunctionType* functionSig = FunctionType::get(
      +  /*return type*/ IntegerType::get(32),
      +  /*arg types*/   argTypes,
      +  /*varargs*/     false,
      +  /*arg attrs*/   FuncTy_0_PAL);
      +
      +
      + +

      LLVM has a strong type system, including types for functions. So, before we can create our function, we need to create a FunctionType object to represent our function???s type. There are four things that go into defining a FunctionType: the return type, the arguments??? types, whether the function is varargs, and any attributes attached to the arguments. If you don???t understand the latter two, don???t worry. They???re not important for now.

      + +

      We construct our FunctionType by first creating a std::vector of Type???s to hold to types of the arguments. In the case of our mul_add function, that means three 32-bit integers. Then, we pass in the return type (another 32-bit integer), our list of argument types, and the varargs and attributes, and we???ve got ourselves a FunctionType.

      + +

      Now that we have a FunctionType, of course, it would be nice to use it for something...

      + +
      +
      +  Function* mul_add = new Function(
      +  /*func type*/ functionSig,
      +  /*linkage*/   GlobalValue::ExternalLinkage,
      +  /*name*/      "mul_add",
      +  /*module*/    mod);
      +  
      +  mul_add->setCallingConv(CallingConv::C);
      +
      +
      + +

      Creating a function is as easy as calling its constructor and passing the appropriate parameters. The first parameter is the function type that we created earlier. The second is the function???s linkage type. This one is important for optimization and linking, but for now we???ll just play it safe and give it external linkage. If you don???t know what to choose, external is probably your safest bet.

      + +

      The third and fourth parameters give the function a name and add it to our module, respectively. In addition, we set the calling convention for our new function to be the C calling convention. This isn???t strictly necessary, but it insures that our new function will interoperate properly with C code, which is a good thing.

      + +
      +
      +  Function::arg_iterator args = mul_add->arg_begin();
      +  Value* x = args++;
      +  x->setName("x");
      +  Value* y = args++;
      +  y->setName("y");
      +  Value* z = args++;
      +  z->setName("z");
      +
      +
      + +

      While we???re setting up our function, let???s also give names to the parameters. This also isn???t strictly necessary (LLVM will generate names for them if you don???t specify them), but it???ll make looking at our output somewhat more pleasant. To name the parameters, we iterator over the arguments of our function, and call setName() on them. We???ll also keep the pointer to x, y, and z around, since we???ll need them when we get around to creating instructions.

      + +

      Great! We have a function now. But what good is a function if it has no body? Before we start working on a body for our new function, we need to recall some details of the LLVM IR. The IR, being an abstract assembly language, represents control flow using jumps (we call them branches), both conditional and unconditional. The straight-line sequences of code between branches are called basic blocks, or just blocks. To create a body for our function, we fill it with blocks!

      + +
      +
      +  BasicBlock* block = new BasicBlock("entry", mul_add);
      +  LLVMBuilder builder(block);
      +
      +
      + +

      We create a new basic block, as you might expect, by calling its constructor. All we need to tell it is its name and the function to which it belongs. In addition, we???re creating an LLVMBuilder object, which is a convenience interface for creating instructions and appending them to the end of a block. Instructions can be created through their constructors as well, but some of their interfaces are quite complicated. Unless you need a lot of control, using LLVMBuilder will make your life simpler.

      + +
      +
      +  Value* tmp = builder.CreateBinOp(Instruction::Mul,
      +                                    x, y, "tmp");
      +  Value* tmp2 = builder.CreateBinOp(Instruction::Add,
      +                                    tmp, z, "tmp2");
      +
      +  builder.CreateRet(tmp2);
      +}
      +
      +
      + +

      The final step in creating our function is to create the instructions that make it up. Our mul_add function is composed of just three instructions: a multiply, an add, and a return. LLVMBuilder gives us a simple interface for constructing these instructions and appending them to the ???entry??? block. Each of the calls to LLVMBuilder returns a Value* that represents the value yielded by the instruction. You???ll also notice that, above, x, y, and z are also Value*???s, so it???s clear that instructions operate on Value*???s.

      + +

      And that???s it! Now you can compile and run your code, and get a wonder textual print out of the LLVM IR we saw at the beginning.

      + +

      ... SECTION ABOUT USING llvm-config TO GET THE NECESSARY COMPILER FLAGS TO COMPILE YOUR CODE ...

      + +
      + + + \ No newline at end of file Added: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43200&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/index.html (added) +++ llvm/trunk/docs/tutorial/index.html Sat Oct 20 00:23:06 2007 @@ -0,0 +1,32 @@ + + + + LLVM Tutorial: Table of Contents + + + + + + + + +
      LLVM Tutorial: Table of Contents
      + +
        +
      1. An Introduction to LLVM: Basic Concepts and Design
      2. +
      3. Basic Tutorials +
          +
        1. Tutorial 1: A First Function
        2. +
        3. Tutorial 2: A More Complicated Function
        4. +
        5. Tutorial 3: Reading and Writing Bitcode
        6. +
        7. Tutorial 4: Running Optimizations
        8. +
        9. Tutorial 5: Invoking the JIT
        10. +
        +
      4. +
      5. Example: Using LLVM to execute a simple language in JIT
      6. +
      + + + \ No newline at end of file From resistor at mac.com Sat Oct 20 00:40:47 2007 From: resistor at mac.com (Owen Anderson) Date: Sat, 20 Oct 2007 05:40:47 -0000 Subject: [llvm-commits] [llvm] r43201 - /llvm/trunk/docs/tutorial/Tutorial1.html Message-ID: <200710200540.l9K5elCw006272@zion.cs.uiuc.edu> Author: resistor Date: Sat Oct 20 00:40:47 2007 New Revision: 43201 URL: http://llvm.org/viewvc/llvm-project?rev=43201&view=rev Log: Use getOrInsertFunction() in tutorial 1. This makes for shorter, simpler, and better example code. Modified: llvm/trunk/docs/tutorial/Tutorial1.html Modified: llvm/trunk/docs/tutorial/Tutorial1.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/Tutorial1.html?rev=43201&r1=43200&r2=43201&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/Tutorial1.html (original) +++ llvm/trunk/docs/tutorial/Tutorial1.html Sat Oct 20 00:40:47 2007 @@ -90,41 +90,22 @@
      -  // Create a prototype for our function
      -  std::vector<const Type*>argTypes;
      -  argTypes.push_back(IntegerType::get(32));
      -  argTypes.push_back(IntegerType::get(32));
      -  argTypes.push_back(IntegerType::get(32));
      -
      -  FunctionType* functionSig = FunctionType::get(
      -  /*return type*/ IntegerType::get(32),
      -  /*arg types*/   argTypes,
      -  /*varargs*/     false,
      -  /*arg attrs*/   FuncTy_0_PAL);
      -
      -
      - -

      LLVM has a strong type system, including types for functions. So, before we can create our function, we need to create a FunctionType object to represent our function???s type. There are four things that go into defining a FunctionType: the return type, the arguments??? types, whether the function is varargs, and any attributes attached to the arguments. If you don???t understand the latter two, don???t worry. They???re not important for now.

      - -

      We construct our FunctionType by first creating a std::vector of Type???s to hold to types of the arguments. In the case of our mul_add function, that means three 32-bit integers. Then, we pass in the return type (another 32-bit integer), our list of argument types, and the varargs and attributes, and we???ve got ourselves a FunctionType.

      - -

      Now that we have a FunctionType, of course, it would be nice to use it for something...

      - -
      -
      -  Function* mul_add = new Function(
      -  /*func type*/ functionSig,
      -  /*linkage*/   GlobalValue::ExternalLinkage,
      -  /*name*/      "mul_add",
      -  /*module*/    mod);
      +  Constant* c->getOrInsertFunction("mul_add",
      +  /*ret type*/                     IntegerType::get(32),
      +  /*args*/                         IntegerType::get(32),
      +                                   IntegerType::get(32),
      +                                   IntegerType::get(32));
         
      +  Function* mul_add = cast<Function>(c);
         mul_add->setCallingConv(CallingConv::C);
       
      -

      Creating a function is as easy as calling its constructor and passing the appropriate parameters. The first parameter is the function type that we created earlier. The second is the function???s linkage type. This one is important for optimization and linking, but for now we???ll just play it safe and give it external linkage. If you don???t know what to choose, external is probably your safest bet.

      +

      We construct our Function by calling getOrInsertFunction() on our module, passing in the name, return type, and argument types of the function. In the case of our mul_add function, that means one 32-bit integer for the return value, and three 32-bit integers for the arguments.

      -

      The third and fourth parameters give the function a name and add it to our module, respectively. In addition, we set the calling convention for our new function to be the C calling convention. This isn???t strictly necessary, but it insures that our new function will interoperate properly with C code, which is a good thing.

      +

      You'll notice that getOrInsertFunction doesn't actually return a Function*. This is because, if the function already existed, but with a different prototype, getOrInsertFunction will return a cast of the existing function to the desired prototype. Since we know that there's not already a mul_add function, we can safely just cast c to a Function*. + +

      In addition, we set the calling convention for our new function to be the C calling convention. This isn???t strictly necessary, but it insures that our new function will interoperate properly with C code, which is a good thing.

      
      
      
      
      From resistor at mac.com  Sat Oct 20 00:41:39 2007
      From: resistor at mac.com (Owen Anderson)
      Date: Sat, 20 Oct 2007 05:41:39 -0000
      Subject: [llvm-commits] [llvm] r43202 -
      	/llvm/trunk/docs/tutorial/Tutorial1.html
      Message-ID: <200710200541.l9K5fda7006333@zion.cs.uiuc.edu>
      
      Author: resistor
      Date: Sat Oct 20 00:41:39 2007
      New Revision: 43202
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43202&view=rev
      Log:
      Fix some weird indenting in code.
      
      Modified:
          llvm/trunk/docs/tutorial/Tutorial1.html
      
      Modified: llvm/trunk/docs/tutorial/Tutorial1.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/Tutorial1.html?rev=43202&r1=43201&r2=43202&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/tutorial/Tutorial1.html (original)
      +++ llvm/trunk/docs/tutorial/Tutorial1.html Sat Oct 20 00:41:39 2007
      @@ -25,9 +25,9 @@
       
       
      -  int mul_add(int x, int y, int z) {
      -      return x * y + z;
      -  }
      +int mul_add(int x, int y, int z) {
      +  return x * y + z;
      +}
       
      @@ -35,12 +35,12 @@
      -  define i32 @mul_add(i32 %x, i32 %y, i32 %z) {
      -  entry:
      -  	%tmp = mul i32 %x, %y
      -  	%tmp2 = add i32 %tmp, %z
      -  	ret i32 %tmp2
      -  }
      +define i32 @mul_add(i32 %x, i32 %y, i32 %z) {
      +entry:
      +  %tmp = mul i32 %x, %y
      +  %tmp2 = add i32 %tmp, %z
      +  ret i32 %tmp2
      +}
       
      From resistor at mac.com Sat Oct 20 01:12:33 2007 From: resistor at mac.com (Owen Anderson) Date: Sat, 20 Oct 2007 06:12:33 -0000 Subject: [llvm-commits] [llvm] r43203 - /llvm/trunk/docs/tutorial/Tutorial1.html Message-ID: <200710200612.l9K6CXiV008320@zion.cs.uiuc.edu> Author: resistor Date: Sat Oct 20 01:12:33 2007 New Revision: 43203 URL: http://llvm.org/viewvc/llvm-project?rev=43203&view=rev Log: Some improvements based on feedback from Anders. Modified: llvm/trunk/docs/tutorial/Tutorial1.html Modified: llvm/trunk/docs/tutorial/Tutorial1.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/Tutorial1.html?rev=43203&r1=43202&r2=43203&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/Tutorial1.html (original) +++ llvm/trunk/docs/tutorial/Tutorial1.html Sat Oct 20 01:12:33 2007 @@ -44,7 +44,7 @@
      -

      Before going any further in this tutorial, you should look through the LLVM Language Reference Manual and convince yourself that the above LLVM IR is actually equivalent to the original function. Once you???re satisfied with that, let???s move on to actually generating it programmatically!

      +

      If you're unsure what the above code says, skim through the LLVM Language Reference Manual and convince yourself that the above LLVM IR is actually equivalent to the original function. Once you???re satisfied with that, let???s move on to actually generating it programmatically!

      ... STUFF ABOUT HEADERS ...

      @@ -76,7 +76,7 @@

      Finally, we instantiate an LLVM PassManager and run the PrintModulePass on our module. LLVM uses an explicit pass infrastructure to manage optimizations and various other things. A PassManager, as should be obvious from its name, manages passes: it is responsible for scheduling them, invoking them, and insuring the proper disposal after we???re done with them. For this example, we???re just using a trivial pass that prints out our module in textual form.

      -

      Now onto the interesting part: creating a populating a module. Here???s the first chunk of our createLLVMModule():

      +

      Now onto the interesting part: creating a populating a module. Here???s the first chunk of our makeLLVMModule():

      
      
      
      
      From baldrick at free.fr  Sat Oct 20 03:53:54 2007
      From: baldrick at free.fr (Duncan Sands)
      Date: Sat, 20 Oct 2007 10:53:54 +0200
      Subject: [llvm-commits] [llvm] r43191 - in /llvm/trunk:
      	lib/CodeGen/BranchFolding.cpp test/CFrontend/2007-10-15-VoidPtr.c
      	test/Transforms/BranchFolding/
      	test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll
      In-Reply-To: <200710192109.l9JL9uN2008645@zion.cs.uiuc.edu>
      References: <200710192109.l9JL9uN2008645@zion.cs.uiuc.edu>
      Message-ID: <200710201053.59713.baldrick@free.fr>
      
      > Don't branch fold inline asm statements.
      
      I'm curious to know why not...  I didn't understand the
      problem with the testcase.
      
      Duncan.
      
      
      
      From isanbard at gmail.com  Sat Oct 20 04:02:58 2007
      From: isanbard at gmail.com (Bill Wendling)
      Date: Sat, 20 Oct 2007 02:02:58 -0700
      Subject: [llvm-commits] [llvm] r43191 - in /llvm/trunk:
      	lib/CodeGen/BranchFolding.cpp test/CFrontend/2007-10-15-VoidPtr.c
      	test/Transforms/BranchFolding/
      	test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll
      In-Reply-To: <200710201053.59713.baldrick@free.fr>
      References: <200710192109.l9JL9uN2008645@zion.cs.uiuc.edu>
      	<200710201053.59713.baldrick@free.fr>
      Message-ID: 
      
      On Oct 20, 2007, at 1:53 AM, Duncan Sands wrote:
      
      >> Don't branch fold inline asm statements.
      >
      > I'm curious to know why not...  I didn't understand the
      > problem with the testcase.
      >
      There are a few projects that depend upon a specific ordering of asm  
      directives. Chris and I believe that they're going about it wrongly  
      -- i.e., they shouldn't be relying upon asm blocks not being moved  
      around. However, in the meantime, this will work for them.
      
      -bw
      
      
      
      From clattner at apple.com  Sat Oct 20 12:29:22 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Sat, 20 Oct 2007 10:29:22 -0700
      Subject: [llvm-commits] [llvm] r43191 - in /llvm/trunk:
      	lib/CodeGen/BranchFolding.cpp test/CFrontend/2007-10-15-VoidPtr.c
      	test/Transforms/BranchFolding/
      	test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll
      In-Reply-To: 
      References: <200710192109.l9JL9uN2008645@zion.cs.uiuc.edu>
      	<200710201053.59713.baldrick@free.fr>
      	
      Message-ID: 
      
      
      On Oct 20, 2007, at 2:02 AM, Bill Wendling wrote:
      
      > On Oct 20, 2007, at 1:53 AM, Duncan Sands wrote:
      >
      >>> Don't branch fold inline asm statements.
      >>
      >> I'm curious to know why not...  I didn't understand the
      >> problem with the testcase.
      >>
      > There are a few projects that depend upon a specific ordering of asm
      > directives. Chris and I believe that they're going about it wrongly
      > -- i.e., they shouldn't be relying upon asm blocks not being moved   
      > around. However, in the meantime, this will work for them.
      
      This is just a really ugly compatibility hack.  Apparently GCC  
      doesn't do cross jumping of inline asm statements as much as we do,  
      and we've hit a significant body of code that depends on this not  
      happening.
      
      The code in question is clearly broken, but at this point, I think  
      it's important for LLVM to be "bug compatible" with GCC if it doesn't  
      cost much.  In this case, we only lose tail merging of inline asm  
      statements, which impacts code size but not performance.
      
      Bill, can you please put a big fixme above that, describing the issue  
      in a sentence or two?
      
      Thanks,
      
      -Chris
      
      
      
      
      From dalej at apple.com  Sat Oct 20 13:49:28 2007
      From: dalej at apple.com (Dale Johannesen)
      Date: Sat, 20 Oct 2007 11:49:28 -0700
      Subject: [llvm-commits] [llvm] r43191 - in /llvm/trunk:
      	lib/CodeGen/BranchFolding.cpp test/CFrontend/2007-10-15-VoidPtr.c
      	test/Transforms/BranchFolding/
      	test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll
      In-Reply-To: 
      References: <200710192109.l9JL9uN2008645@zion.cs.uiuc.edu>
      	<200710201053.59713.baldrick@free.fr>
      	
      	
      Message-ID: <5821B330-4E5F-451E-A751-9318E2AA1728@apple.com>
      
      
      On Oct 20, 2007, at 10:29 AM, Chris Lattner wrote:
      > This is just a really ugly compatibility hack.  Apparently GCC
      > doesn't do cross jumping of inline asm statements as much as we do,
      > and we've hit a significant body of code that depends on this not
      > happening.
      >
      > The code in question is clearly broken, but at this point, I think
      > it's important for LLVM to be "bug compatible" with GCC if it doesn't
      > cost much.  In this case, we only lose tail merging of inline asm
      > statements, which impacts code size but not performance.
      
      Bill's change is not clearly the wrong thing.  People using asm's are  
      generally trying to do something they can't do more  
      straightforwardly; they know what code they want the compiler to  
      produce, and regard writing asm's as an exercise in coercing the  
      compiler into producing it.  (They should be writing in assembler  
      IMO, but gcc decided years ago to support asm, and we're all stuck  
      with it now.)  Before moving to llvm, I was maintaining gcc for some  
      time; I never had anybody complain their asm's were not optimized  
      enough, and I got many complaints that asm's were optimized too much.
      
      
      
      From sabre at nondot.org  Sat Oct 20 17:57:57 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Sat, 20 Oct 2007 22:57:57 -0000
      Subject: [llvm-commits] [llvm] r43204 -
      	/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
      Message-ID: <200710202257.l9KMvvFq027865@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sat Oct 20 17:57:56 2007
      New Revision: 43204
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43204&view=rev
      Log:
      Add promote operand support for [su]int_to_fp.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43204&r1=43203&r2=43204&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Sat Oct 20 17:57:56 2007
      @@ -185,6 +185,7 @@
         SDOperand PromoteOperand_TRUNCATE(SDNode *N);
         SDOperand PromoteOperand_FP_EXTEND(SDNode *N);
         SDOperand PromoteOperand_FP_ROUND(SDNode *N);
      +  SDOperand PromoteOperand_INT_TO_FP(SDNode *N);
         SDOperand PromoteOperand_SELECT(SDNode *N, unsigned OpNo);
         SDOperand PromoteOperand_BRCOND(SDNode *N, unsigned OpNo);
         SDOperand PromoteOperand_BR_CC(SDNode *N, unsigned OpNo);
      @@ -1326,6 +1327,8 @@
         case ISD::TRUNCATE:    Res = PromoteOperand_TRUNCATE(N); break;
         case ISD::FP_EXTEND:   Res = PromoteOperand_FP_EXTEND(N); break;
         case ISD::FP_ROUND:    Res = PromoteOperand_FP_ROUND(N); break;
      +  case ISD::SINT_TO_FP:
      +  case ISD::UINT_TO_FP:  Res = PromoteOperand_INT_TO_FP(N); break;
           
         case ISD::SELECT:      Res = PromoteOperand_SELECT(N, OpNo); break;
         case ISD::BRCOND:      Res = PromoteOperand_BRCOND(N, OpNo); break;
      @@ -1390,6 +1393,18 @@
         return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Op);
       }
       
      +SDOperand DAGTypeLegalizer::PromoteOperand_INT_TO_FP(SDNode *N) {
      +  SDOperand In = GetPromotedOp(N->getOperand(0));
      +  MVT::ValueType OpVT = N->getOperand(0).getValueType();
      +  if (N->getOpcode() == ISD::UINT_TO_FP)
      +    In = DAG.getZeroExtendInReg(In, OpVT);
      +  else
      +    In = DAG.getNode(ISD::SIGN_EXTEND_INREG, In.getValueType(),
      +                     In, DAG.getValueType(OpVT));
      +  
      +  return DAG.UpdateNodeOperands(SDOperand(N, 0), In);
      +}
      +
       
       SDOperand DAGTypeLegalizer::PromoteOperand_SELECT(SDNode *N, unsigned OpNo) {
         assert(OpNo == 0 && "Only know how to promote condition");
      
      
      
      
      From dalej at apple.com  Sat Oct 20 20:07:44 2007
      From: dalej at apple.com (Dale Johannesen)
      Date: Sun, 21 Oct 2007 01:07:44 -0000
      Subject: [llvm-commits] [llvm] r43205 -
      	/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      Message-ID: <200710210107.l9L17itQ032082@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Sat Oct 20 20:07:44 2007
      New Revision: 43205
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43205&view=rev
      Log:
      Allow for copysign having f80 second argument.
      Fixes 5550319.
      
      
      Modified:
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=43205&r1=43204&r2=43205&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Oct 20 20:07:44 2007
      @@ -4040,6 +4040,15 @@
           SrcVT = VT;
           SrcTy = MVT::getTypeForValueType(SrcVT);
         }
      +  // And if it is bigger, shrink it first.
      +  if (MVT::getSizeInBits(SrcVT) > MVT::getSizeInBits(VT)) {
      +    Op1 = DAG.getNode(ISD::FP_ROUND, VT, Op1);
      +    SrcVT = VT;
      +    SrcTy = MVT::getTypeForValueType(SrcVT);
      +  }
      +
      +  // At this point the operands and the result should have the same
      +  // type, and that won't be f80 since that is not custom lowered.
       
         // First get the sign bit of second operand.
         std::vector CV;
      
      
      
      
      From sabre at nondot.org  Sun Oct 21 17:57:12 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Sun, 21 Oct 2007 22:57:12 -0000
      Subject: [llvm-commits] [llvm] r43206 - in /llvm/trunk:
       include/llvm/ExecutionEngine/ExecutionEngine.h
       lib/ExecutionEngine/ExecutionEngine.cpp
      Message-ID: <200710212257.l9LMvCsr016264@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Oct 21 17:57:11 2007
      New Revision: 43206
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43206&view=rev
      Log:
      Add a convenience method for creating EE's.
      
      Modified:
          llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
          llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      
      Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=43206&r1=43205&r2=43206&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
      +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Sun Oct 21 17:57:11 2007
      @@ -108,11 +108,17 @@
         Function *FindFunctionNamed(const char *FnName);
         
         /// create - This is the factory method for creating an execution engine which
      -  /// is appropriate for the current machine.
      +  /// is appropriate for the current machine.  This takes ownership of the
      +  /// module provider.
         static ExecutionEngine *create(ModuleProvider *MP,
                                        bool ForceInterpreter = false,
                                        std::string *ErrorStr = 0);
       
      +  /// create - This is the factory method for creating an execution engine which
      +  /// is appropriate for the current machine.  This takes ownership of the
      +  /// module.
      +  static ExecutionEngine *create(Module *M);
      +  
         /// runFunction - Execute the specified function with the specified arguments,
         /// and return the result.
         ///
      
      Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=43206&r1=43205&r2=43206&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sun Oct 21 17:57:11 2007
      @@ -328,6 +328,10 @@
         return EE;
       }
       
      +ExecutionEngine *ExecutionEngine::create(Module *M) {
      +  return create(new ExistingModuleProvider(M));
      +}
      +
       /// getPointerToGlobal - This returns the address of the specified global
       /// value.  This may involve code generation if it's a function.
       ///
      
      
      
      
      From sabre at nondot.org  Sun Oct 21 17:58:11 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Sun, 21 Oct 2007 22:58:11 -0000
      Subject: [llvm-commits] [llvm] r43207 -
      	/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      Message-ID: <200710212258.l9LMwBvj016308@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Oct 21 17:58:11 2007
      New Revision: 43207
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43207&view=rev
      Log:
      LoadLibraryPermanently doesn't throw.
      
      Modified:
          llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      
      Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=43207&r1=43206&r2=43207&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sun Oct 21 17:58:11 2007
      @@ -319,9 +319,9 @@
         if (EE) {
           // Make sure we can resolve symbols in the program as well. The zero arg
           // to the function tells DynamicLibrary to load the program, not a library.
      -    try {
      -      sys::DynamicLibrary::LoadLibraryPermanently(0);
      -    } catch (...) {
      +    if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr)) {
      +      delete EE;
      +      return 0;
           }
         }
       
      
      
      
      
      From asl at math.spbu.ru  Sun Oct 21 18:05:16 2007
      From: asl at math.spbu.ru (Anton Korobeynikov)
      Date: Sun, 21 Oct 2007 23:05:16 -0000
      Subject: [llvm-commits] [llvm] r43208 - in /llvm/trunk:
       include/llvm/Transforms/Utils/Local.h lib/Transforms/Scalar/Reg2Mem.cpp
       lib/Transforms/Utils/DemoteRegToStack.cpp
      Message-ID: <200710212305.l9LN5HGR016623@zion.cs.uiuc.edu>
      
      Author: asl
      Date: Sun Oct 21 18:05:16 2007
      New Revision: 43208
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43208&view=rev
      Log:
      Reg2Mem cleanup and optimizations:
       - enable phi instructions demotion to stack
       - create alloca instructions in the entry block
      
      Modified:
          llvm/trunk/include/llvm/Transforms/Utils/Local.h
          llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp
          llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp
      
      Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=43208&r1=43207&r2=43208&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Transforms/Utils/Local.h (original)
      +++ llvm/trunk/include/llvm/Transforms/Utils/Local.h Sun Oct 21 18:05:16 2007
      @@ -78,12 +78,13 @@
       /// invalidating the SSA information for the value.  It returns the pointer to
       /// the alloca inserted to create a stack slot for X.
       ///
      -AllocaInst *DemoteRegToStack(Instruction &X, bool VolatileLoads = false);
      +AllocaInst *DemoteRegToStack(Instruction &X, bool VolatileLoads = false,
      +                             Instruction *AllocaPoint = NULL);
       
       /// DemotePHIToStack - This function takes a virtual register computed by a phi
       /// node and replaces it with a slot in the stack frame, allocated via alloca.
       /// The phi node is deleted and it returns the pointer to the alloca inserted. 
      -AllocaInst *DemotePHIToStack(PHINode *P);
      +AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = NULL);
       
       } // End llvm namespace
       
      
      Modified: llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp?rev=43208&r1=43207&r2=43208&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/Reg2Mem.cpp Sun Oct 21 18:05:16 2007
      @@ -26,10 +26,12 @@
       #include "llvm/Instructions.h"
       #include "llvm/ADT/Statistic.h"
       #include "llvm/Support/Compiler.h"
      +#include "llvm/Support/CFG.h"
       #include 
       using namespace llvm;
       
      -STATISTIC(NumDemoted, "Number of registers demoted");
      +STATISTIC(NumRegsDemoted, "Number of registers demoted");
      +STATISTIC(NumPhisDemoted, "Number of phi-nodes demoted");
       
       namespace {
         struct VISIBILITY_HIDDEN RegToMem : public FunctionPass {
      @@ -43,8 +45,8 @@
       
          bool valueEscapes(Instruction* i) {
             BasicBlock* bb = i->getParent();
      -      for(Value::use_iterator ii = i->use_begin(), ie = i->use_end();
      -          ii != ie; ++ii)
      +      for (Value::use_iterator ii = i->use_begin(), ie = i->use_end();
      +           ii != ie; ++ii)
               if (cast(*ii)->getParent() != bb ||
                   isa(*ii))
                 return true;
      @@ -53,26 +55,57 @@
       
           virtual bool runOnFunction(Function &F) {
             if (!F.isDeclaration()) {
      -        //give us a clean block
      -        BasicBlock* bbold = &F.getEntryBlock();
      -        BasicBlock* bbnew = new BasicBlock("allocablock", &F, 
      -                                           &F.getEntryBlock());
      -        new BranchInst(bbold, bbnew);
      +        // Insert all new allocas into entry block.
      +        BasicBlock* BBEntry = &F.getEntryBlock();
      +        assert(pred_begin(BBEntry) == pred_end(BBEntry) &&
      +               "Entry block to function must not have predecessors!");
      +
      +        // Find first non-alloca instruction and create insertion point. This is
      +        // safe if block is well-formed: it always have terminator, otherwise
      +        // we'll get and assertion.
      +        BasicBlock::iterator I = BBEntry->begin();
      +        while (isa(I)) ++I;
      +
      +        CastInst *AllocaInsertionPoint =
      +          CastInst::create(Instruction::BitCast,
      +                           Constant::getNullValue(Type::Int32Ty), Type::Int32Ty,
      +                           "reg2mem alloca point", I);
       
      -        //find the instructions
      +        // Find the escaped instructions. But don't create stack slots for
      +        // allocas in entry block.
               std::list worklist;
               for (Function::iterator ibb = F.begin(), ibe = F.end();
                    ibb != ibe; ++ibb)
                 for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end();
                      iib != iie; ++iib) {
      -            if(valueEscapes(iib))
      +            if (!(isa(iib) && iib->getParent() == BBEntry) &&
      +                valueEscapes(iib)) {
                     worklist.push_front(&*iib);
      +            }
                 }
      -        //demote escaped instructions
      -        NumDemoted += worklist.size();
      +
      +        // Demote escaped instructions
      +        NumRegsDemoted += worklist.size();
               for (std::list::iterator ilb = worklist.begin(), 
                      ile = worklist.end(); ilb != ile; ++ilb)
      -          DemoteRegToStack(**ilb, false);
      +          DemoteRegToStack(**ilb, false, AllocaInsertionPoint);
      +
      +        worklist.clear();
      +
      +        // Find all phi's
      +        for (Function::iterator ibb = F.begin(), ibe = F.end();
      +             ibb != ibe; ++ibb)
      +          for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end();
      +               iib != iie; ++iib)
      +            if (isa(iib))
      +              worklist.push_front(&*iib);
      +
      +        // Demote phi nodes
      +        NumPhisDemoted += worklist.size();
      +        for (std::list::iterator ilb = worklist.begin(), 
      +               ile = worklist.end(); ilb != ile; ++ilb)
      +          DemotePHIToStack(cast(*ilb), AllocaInsertionPoint);
      +
               return true;
             }
             return false;
      
      Modified: llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp?rev=43208&r1=43207&r2=43208&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp (original)
      +++ llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp Sun Oct 21 18:05:16 2007
      @@ -29,14 +29,23 @@
       /// invalidating the SSA information for the value.  It returns the pointer to
       /// the alloca inserted to create a stack slot for I.
       ///
      -AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads) {
      -  if (I.use_empty()) return 0;                // nothing to do!
      -
      +AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
      +                                   Instruction *AllocaPoint) {
      +  if (I.use_empty()) {
      +    I.eraseFromParent();
      +    return 0;
      +  }
      +  
         // Create a stack slot to hold the value.
      -  Function *F = I.getParent()->getParent();
      -  AllocaInst *Slot = new AllocaInst(I.getType(), 0, I.getName(),
      -                                    F->getEntryBlock().begin());
      -
      +  AllocaInst *Slot;
      +  if (AllocaPoint) {
      +    Slot = new AllocaInst(I.getType(), 0, I.getName()+".reg2mem", AllocaPoint);
      +  } else {
      +    Function *F = I.getParent()->getParent();
      +    Slot = new AllocaInst(I.getType(), 0, I.getName()+".reg2mem",
      +                          F->getEntryBlock().begin());
      +  }
      +  
         // Change all of the users of the instruction to read from the stack slot
         // instead.
         while (!I.use_empty()) {
      @@ -98,16 +107,21 @@
       /// DemotePHIToStack - This function takes a virtual register computed by a phi
       /// node and replaces it with a slot in the stack frame, allocated via alloca.
       /// The phi node is deleted and it returns the pointer to the alloca inserted.
      -AllocaInst* llvm::DemotePHIToStack(PHINode *P) {
      +AllocaInst* llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
         if (P->use_empty()) {
           P->eraseFromParent();    
           return 0;                
         }
      -  
      +
         // Create a stack slot to hold the value.
      -  Function *F = P->getParent()->getParent();
      -  AllocaInst *Slot = new AllocaInst(P->getType(), 0, P->getName(),
      -                                    F->getEntryBlock().begin());
      +  AllocaInst *Slot;
      +  if (AllocaPoint) {
      +    Slot = new AllocaInst(P->getType(), 0, P->getName()+".reg2mem", AllocaPoint);
      +  } else {
      +    Function *F = P->getParent()->getParent();
      +    Slot = new AllocaInst(P->getType(), 0, P->getName()+".reg2mem",
      +                          F->getEntryBlock().begin());
      +  }
         
         // Iterate over each operand, insert store in each predecessor.
         for (unsigned i = 0, e = P->getNumIncomingValues(); i < e; ++i) {
      
      
      
      
      From sabre at nondot.org  Sun Oct 21 21:39:47 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Mon, 22 Oct 2007 02:39:47 -0000
      Subject: [llvm-commits] [llvm] r43209 -
      	/llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp
      Message-ID: <200710220239.l9M2dl5W027374@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Oct 21 21:39:47 2007
      New Revision: 43209
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43209&view=rev
      Log:
      llvm-gcc3 is dead, along with it __main.
      
      Modified:
          llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp
      
      Modified: llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp?rev=43209&r1=43208&r2=43209&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp Sun Oct 21 21:39:47 2007
      @@ -62,14 +62,6 @@
       };
       #endif // __linux__
       
      -// __mainFunc - If the program does not have a linked in __main function, allow
      -// it to run, but print a warning.
      -static void __mainFunc() {
      -  fprintf(stderr, "WARNING: Program called __main but was not linked to "
      -          "libcrtend.a.\nThis probably won't hurt anything unless the "
      -          "program is written in C++.\n");
      -}
      -
       // jit_exit - Used to intercept the "exit" library call.
       static void jit_exit(int Status) {
         runAtExitHandlers();   // Run atexit handlers...
      @@ -95,10 +87,6 @@
         if (Name == "exit") return (void*)(intptr_t)&jit_exit;
         if (Name == "atexit") return (void*)(intptr_t)&jit_atexit;
       
      -  // If the program does not have a linked in __main function, allow it to run,
      -  // but print a warning.
      -  if (Name == "__main") return (void*)(intptr_t)&__mainFunc;
      -
         const char *NameStr = Name.c_str();
         // If this is an asm specifier, skip the sentinal.
         if (NameStr[0] == 1) ++NameStr;
      
      
      
      
      From sabre at nondot.org  Sun Oct 21 21:50:12 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Mon, 22 Oct 2007 02:50:12 -0000
      Subject: [llvm-commits] [llvm] r43210 - in /llvm/trunk:
       include/llvm/ExecutionEngine/ExecutionEngine.h
       lib/ExecutionEngine/ExecutionEngine.cpp
       lib/ExecutionEngine/JIT/Intercept.cpp
      Message-ID: <200710220250.l9M2oCsJ027815@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Oct 21 21:50:12 2007
      New Revision: 43210
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43210&view=rev
      Log:
      add a mechanism for the JIT to invoke a function to lazily create functions as they are referenced.
      
      Modified:
          llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
          llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
          llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp
      
      Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=43210&r1=43209&r2=43210&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
      +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Sun Oct 21 21:50:12 2007
      @@ -64,6 +64,7 @@
         const TargetData *TD;
         ExecutionEngineState state;
         bool LazyCompilationDisabled;
      +
       protected:
         /// Modules - This is a list of ModuleProvider's that we are JIT'ing from.  We
         /// use a smallvector to optimize for the case where there is only one module.
      @@ -78,7 +79,11 @@
         // at startup time if they are linked in.
         typedef ExecutionEngine *(*EECtorFn)(ModuleProvider*, std::string*);
         static EECtorFn JITCtor, InterpCtor;
      -    
      +
      +  /// LazyFunctionCreator - If an unknown function is needed, this function
      +  /// pointer is invoked to create it. If this returns null, the JIT will abort.
      +  void* (*LazyFunctionCreator)(const std::string &);
      +  
       public:
         /// lock - This lock is protects the ExecutionEngine, JIT, JITResolver and
         /// JITEmitter classes.  It must be held while changing the internal state of
      @@ -218,6 +223,14 @@
         bool isLazyCompilationDisabled() const {
           return LazyCompilationDisabled;
         }
      +  
      +  
      +  /// InstallLazyFunctionCreator - If an unknown function is needed, the
      +  /// specified function pointer is invoked to create it.  If it returns null,
      +  /// the JIT will abort.
      +  void InstallLazyFunctionCreator(void* (*P)(const std::string &)) {
      +    LazyFunctionCreator = P;
      +  }
       
       protected:
         void emitGlobals();
      
      Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=43210&r1=43209&r2=43210&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sun Oct 21 21:50:12 2007
      @@ -33,13 +33,13 @@
       ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0;
       ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0;
       
      -ExecutionEngine::ExecutionEngine(ModuleProvider *P) {
      +ExecutionEngine::ExecutionEngine(ModuleProvider *P) : LazyFunctionCreator(0) {
         LazyCompilationDisabled = false;
         Modules.push_back(P);
         assert(P && "ModuleProvider is null?");
       }
       
      -ExecutionEngine::ExecutionEngine(Module *M) {
      +ExecutionEngine::ExecutionEngine(Module *M) : LazyFunctionCreator(0) {
         LazyCompilationDisabled = false;
         assert(M && "Module is null?");
         Modules.push_back(new ExistingModuleProvider(M));
      
      Modified: llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp?rev=43210&r1=43209&r2=43210&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/JIT/Intercept.cpp Sun Oct 21 21:50:12 2007
      @@ -101,6 +101,11 @@
           Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr+1);
           if (Ptr) return Ptr;
         }
      +  
      +  /// If a LazyFunctionCreator is installed, use it to get/create the function. 
      +  if (LazyFunctionCreator)
      +    if (void *RP = LazyFunctionCreator(Name))
      +      return RP;
       
         cerr << "ERROR: Program used external function '" << Name
              << "' which could not be resolved!\n";
      
      
      
      
      From evan.cheng at apple.com  Sun Oct 21 22:01:44 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Mon, 22 Oct 2007 03:01:44 -0000
      Subject: [llvm-commits] [llvm] r43211 -
      	/llvm/trunk/lib/CodeGen/VirtRegMap.cpp
      Message-ID: <200710220301.l9M31iAr028275@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Sun Oct 21 22:01:44 2007
      New Revision: 43211
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43211&view=rev
      Log:
      - Only perform the unfolding optimization when the folding in question is modref.
      - Remove a bogus assertion.
      
      Modified:
          llvm/trunk/lib/CodeGen/VirtRegMap.cpp
      
      Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=43211&r1=43210&r2=43211&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
      +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Sun Oct 21 22:01:44 2007
      @@ -821,11 +821,8 @@
             unsigned Idx = NewMI->findRegisterUseOperandIdx(VirtReg);
             MachineInstr *FoldedMI = MRI->foldMemoryOperand(NewMI, Idx, SS);
             if (FoldedMI) {
      -        if (VRM.hasPhys(UnfoldVR))
      -          assert(VRM.getPhys(UnfoldVR) == UnfoldPR);
      -        else
      +        if (!VRM.hasPhys(UnfoldVR))
                 VRM.assignVirt2Phys(UnfoldVR, UnfoldPR);
      -
               VRM.virtFolded(VirtReg, FoldedMI, VirtRegMap::isRef);
               MII = MBB.insert(MII, FoldedMI);
               VRM.RemoveFromFoldedVirtMap(&MI);
      @@ -1190,7 +1187,7 @@
             if (DeadStore) {
               bool isDead = !(MR & VirtRegMap::isRef);
               MachineInstr *NewStore = NULL;
      -        if (MR & VirtRegMap::isMod) {
      +        if (MR & VirtRegMap::isModRef) {
                 unsigned PhysReg = Spills.getSpillSlotOrReMatPhysReg(SS);
                 SmallVector NewMIs;
                 if (PhysReg &&
      
      
      
      
      From evan.cheng at apple.com  Sun Oct 21 22:03:21 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Mon, 22 Oct 2007 03:03:21 -0000
      Subject: [llvm-commits] [llvm] r43212 -
      	/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
      Message-ID: <200710220303.l9M33Lbp028337@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Sun Oct 21 22:03:20 2007
      New Revision: 43212
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43212&view=rev
      Log:
      Fix an unfolding bug.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=43212&r1=43211&r2=43212&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Sun Oct 21 22:03:20 2007
      @@ -1224,7 +1224,8 @@
           MIB.addReg(Reg, true);
         for (unsigned i = 0, e = BeforeOps.size(); i != e; ++i)
           MIB = X86InstrAddOperand(MIB, BeforeOps[i]);
      -  MIB.addReg(Reg);
      +  if (FoldedLoad)
      +    MIB.addReg(Reg);
         for (unsigned i = 0, e = AfterOps.size(); i != e; ++i)
           MIB = X86InstrAddOperand(MIB, AfterOps[i]);
         for (unsigned i = 0, e = ImpOps.size(); i != e; ++i) {
      
      
      
      
      From sabre at nondot.org  Sun Oct 21 22:12:26 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Mon, 22 Oct 2007 03:12:26 -0000
      Subject: [llvm-commits] [llvm] r43213 - in /llvm/trunk/docs/tutorial:
       JITTutorial1.html Tutorial1.html index.html
      Message-ID: <200710220312.l9M3CR2E028678@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Oct 21 22:12:24 2007
      New Revision: 43213
      
      URL: http://llvm.org/viewvc/llvm-project?rev=43213&view=rev
      Log:
      rename tutorial 1 -> JITTutorial1, make unimplemented links not be dead links.
      
      Added:
          llvm/trunk/docs/tutorial/JITTutorial1.html
            - copied unchanged from r43212, llvm/trunk/docs/tutorial/Tutorial1.html
      Removed:
          llvm/trunk/docs/tutorial/Tutorial1.html
      Modified:
          llvm/trunk/docs/tutorial/index.html
      
      Removed: llvm/trunk/docs/tutorial/Tutorial1.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/Tutorial1.html?rev=43212&view=auto
      
      ==============================================================================
      --- llvm/trunk/docs/tutorial/Tutorial1.html (original)
      +++ llvm/trunk/docs/tutorial/Tutorial1.html (removed)
      @@ -1,156 +0,0 @@
      -
      -
      -
      -
      -  LLVM Tutorial 1: A First Function
      -  
      -  
      -  
      -  
      -
      -
      -
      -
      -
      LLVM Tutorial 1: A First Function
      - -
      -

      Written by Owen Anderson

      -
      - -
      - -

      For starters, lets consider a relatively straightforward function that takes three integer parameters and returns an arithmetic combination of them. This is nice and simple, especially since it involves no control flow:

      - -
      -
      -int mul_add(int x, int y, int z) {
      -  return x * y + z;
      -}
      -
      -
      - -

      As a preview, the LLVM IR we???re going to end up generating for this function will look like:

      - -
      -
      -define i32 @mul_add(i32 %x, i32 %y, i32 %z) {
      -entry:
      -  %tmp = mul i32 %x, %y
      -  %tmp2 = add i32 %tmp, %z
      -  ret i32 %tmp2
      -}
      -
      -
      - -

      If you're unsure what the above code says, skim through the LLVM Language Reference Manual and convince yourself that the above LLVM IR is actually equivalent to the original function. Once you???re satisfied with that, let???s move on to actually generating it programmatically!

      - -

      ... STUFF ABOUT HEADERS ...

      - -

      Now, let???s get started on our real program. Here???s what our basic main() will look like:

      - -
      -
      -using namespace llvm;
      -
      -Module* makeLLVMModule();
      -
      -int main(int argc, char**argv) {
      -  Module* Mod = makeLLVMModule();
      -
      -  verifyModule(*Mod, PrintMessageAction);
      -
      -  PassManager PM;
      -  PM.add(new PrintModulePass(&llvm::cout));
      -  PM.run(*Mod);
      -
      -  return 0;
      -}
      -
      -
      - -

      The first segment is pretty simple: it creates an LLVM ???module.??? In LLVM, a module represents a single unit of code that is to be processed together. A module contains things like global variables and function declarations and implementations. Here, we???ve declared a makeLLVMModule() function to do the real work of creating the module. Don???t worry, we???ll be looking at that one next!

      - -

      The second segment runs the LLVM module verifier on our newly created module. While this probably isn???t really necessary for a simple module like this one, it???s always a good idea, especially if you???re generating LLVM IR based on some input. The verifier will print an error message if your LLVM module is malformed in any way.

      - -

      Finally, we instantiate an LLVM PassManager and run the PrintModulePass on our module. LLVM uses an explicit pass infrastructure to manage optimizations and various other things. A PassManager, as should be obvious from its name, manages passes: it is responsible for scheduling them, invoking them, and insuring the proper disposal after we???re done with them. For this example, we???re just using a trivial pass that prints out our module in textual form.

      - -

      Now onto the interesting part: creating a populating a module. Here???s the first chunk of our makeLLVMModule():

      - -
      -
      -Module* makeLLVMModule() {
      -  // Module Construction
      -  Module* mod = new Module("test");
      -
      -
      - -

      Exciting, isn???t it!? All we???re doing here is instantiating a module and giving it a name. The name isn???t particularly important unless you???re going to be dealing with multiple modules at once.

      - -
      -
      -  Constant* c->getOrInsertFunction("mul_add",
      -  /*ret type*/                     IntegerType::get(32),
      -  /*args*/                         IntegerType::get(32),
      -                                   IntegerType::get(32),
      -                                   IntegerType::get(32));
      -  
      -  Function* mul_add = cast<Function>(c);
      -  mul_add->setCallingConv(CallingConv::C);
      -
      -
      - -

      We construct our Function by calling getOrInsertFunction() on our module, passing in the name, return type, and argument types of the function. In the case of our mul_add function, that means one 32-bit integer for the return value, and three 32-bit integers for the arguments.

      - -

      You'll notice that getOrInsertFunction doesn't actually return a Function*. This is because, if the function already existed, but with a different prototype, getOrInsertFunction will return a cast of the existing function to the desired prototype. Since we know that there's not already a mul_add function, we can safely just cast c to a Function*. - -

      In addition, we set the calling convention for our new function to be the C calling convention. This isn???t strictly necessary, but it insures that our new function will interoperate properly with C code, which is a good thing.

      - -
      -
      -  Function::arg_iterator args = mul_add->arg_begin();
      -  Value* x = args++;
      -  x->setName("x");
      -  Value* y = args++;
      -  y->setName("y");
      -  Value* z = args++;
      -  z->setName("z");
      -
      -
      - -

      While we???re setting up our function, let???s also give names to the parameters. This also isn???t strictly necessary (LLVM will generate names for them if you don???t specify them), but it???ll make looking at our output somewhat more pleasant. To name the parameters, we iterator over the arguments of our function, and call setName() on them. We???ll also keep the pointer to x, y, and z around, since we???ll need them when we get around to creating instructions.

      - -

      Great! We have a function now. But what good is a function if it has no body? Before we start working on a body for our new function, we need to recall some details of the LLVM IR. The IR, being an abstract assembly language, represents control flow using jumps (we call them branches), both conditional and unconditional. The straight-line sequences of code between branches are called basic blocks, or just blocks. To create a body for our function, we fill it with blocks!

      - -
      -
      -  BasicBlock* block = new BasicBlock("entry", mul_add);
      -  LLVMBuilder builder(block);
      -
      -
      - -

      We create a new basic block, as you might expect, by calling its constructor. All we need to tell it is its name and the function to which it belongs. In addition, we???re creating an LLVMBuilder object, which is a convenience interface for creating instructions and appending them to the end of a block. Instructions can be created through their constructors as well, but some of their interfaces are quite complicated. Unless you need a lot of control, using LLVMBuilder will make your life simpler.

      - -
      -
      -  Value* tmp = builder.CreateBinOp(Instruction::Mul,
      -                                    x, y, "tmp");
      -  Value* tmp2 = builder.CreateBinOp(Instruction::Add,
      -                                    tmp, z, "tmp2");
      -
      -  builder.CreateRet(tmp2);
      -}
      -
      -
      - -

      The final step in creating our function is to create the instructions that make it up. Our mul_add function is composed of just three instructions: a multiply, an add, and a return. LLVMBuilder gives us a simple interface for constructing these instructions and appending them to the ???entry??? block. Each of the calls to LLVMBuilder returns a Value* that represents the value yielded by the instruction. You???ll also notice that, above, x, y, and z are also Value*???s, so it???s clear that instructions operate on Value*???s.

      - -

      And that???s it! Now you can compile and run your code, and get a wonder textual print out of the LLVM IR we saw at the beginning.

      - -

      ... SECTION ABOUT USING llvm-config TO GET THE NECESSARY COMPILER FLAGS TO COMPILE YOUR CODE ...

      - -
      - - - \ No newline at end of file Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43213&r1=43212&r2=43213&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Sun Oct 21 22:12:24 2007 @@ -18,11 +18,11 @@
    • An Introduction to LLVM: Basic Concepts and Design
    • Basic Tutorials
        -
      1. Tutorial 1: A First Function
      2. -
      3. Tutorial 2: A More Complicated Function
      4. -
      5. Tutorial 3: Reading and Writing Bitcode
      6. -
      7. Tutorial 4: Running Optimizations
      8. -
      9. Tutorial 5: Invoking the JIT
      10. +
      11. Tutorial 1: A First Function
      12. +
      13. Tutorial 2: A More Complicated Function
      14. +
      15. Tutorial 3: Reading and Writing Bitcode
      16. +
      17. Tutorial 4: Running Optimizations
      18. +
      19. Tutorial 5: Invoking the JIT
    • Example: Using LLVM to execute a simple language in JIT
    • From sabre at nondot.org Sun Oct 21 22:19:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 22 Oct 2007 03:19:07 -0000 Subject: [llvm-commits] [llvm] r43214 - /llvm/trunk/docs/tutorial/index.html Message-ID: <200710220319.l9M3J7a3028941@zion.cs.uiuc.edu> Author: lattner Date: Sun Oct 21 22:19:07 2007 New Revision: 43214 URL: http://llvm.org/viewvc/llvm-project?rev=43214&view=rev Log: add an outline for "part 2". Modified: llvm/trunk/docs/tutorial/index.html Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43214&r1=43213&r2=43214&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Sun Oct 21 22:19:07 2007 @@ -15,17 +15,26 @@
      LLVM Tutorial: Table of Contents
        -
      1. An Introduction to LLVM: Basic Concepts and Design
      2. -
      3. Basic Tutorials +
      4. An Introduction to LLVM: Basic Concepts and Design
      5. +
      6. Simple JIT Tutorials
          -
        1. Tutorial 1: A First Function
        2. -
        3. Tutorial 2: A More Complicated Function
        4. -
        5. Tutorial 3: Reading and Writing Bitcode
        6. -
        7. Tutorial 4: Running Optimizations
        8. -
        9. Tutorial 5: Invoking the JIT
        10. +
        11. A First Function
        12. +
        13. A More Complicated Function
        14. +
        15. Reading and Writing Bitcode
        16. +
        17. Running Optimizations
        18. +
        19. Invoking the JIT
      7. -
      8. Example: Using LLVM to execute a simple language in JIT
      9. +
      10. Implementing a simple language with LLVM +
          +
        1. The basic language, with its lexer
        2. +
        3. Implementing a Parser and AST
        4. +
        5. Implementing code generation to LLVM IR
        6. +
        7. Extending the language: if/then/else
        8. +
        9. Extending the language: operator overloading
        10. +
        11. Adding JIT codegen support
        12. +
        13. Thoughts and ideas for extensions
        14. +
      From sabre at nondot.org Sun Oct 21 23:32:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 22 Oct 2007 04:32:38 -0000 Subject: [llvm-commits] [llvm] r43215 - in /llvm/trunk/docs/tutorial: LangImpl1.html index.html Message-ID: <200710220432.l9M4WcVu032488@zion.cs.uiuc.edu> Author: lattner Date: Sun Oct 21 23:32:37 2007 New Revision: 43215 URL: http://llvm.org/viewvc/llvm-project?rev=43215&view=rev Log: add part 1, review appreciated. Added: llvm/trunk/docs/tutorial/LangImpl1.html Modified: llvm/trunk/docs/tutorial/index.html Added: llvm/trunk/docs/tutorial/LangImpl1.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl1.html?rev=43215&view=auto ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl1.html (added) +++ llvm/trunk/docs/tutorial/LangImpl1.html Sun Oct 21 23:32:37 2007 @@ -0,0 +1,263 @@ + + + + + Kaleidoscope: The basic language, with its lexer + + + + + + + +
      Kaleidoscope: The basic language, with its lexer
      + +
      +

      Written by Chris Lattner

      +
      + + + + + +
      + +

      Welcome to the "Implementing a language with LLVM" tutorial. This tutorial +will run through implementation of a simple language, showing how fun and easy +it can be. This tutorial will get you up and started and build a framework you +can extend to other languages and to play with other things. +

      + +
      + + + + + +
      + +

      This tutorial will be illustrated with a toy language that we'll call +"Kaleidoscope". +Kaleidoscope is a procedural language that allows you to define functions, use +conditionals, math, etc. Over the course of the tutorial, we'll extend +Kaleidoscope to support if/then/else, operator overloading, JIT compilation with +a simple command line interface, etc.

      + +

      Because we want to keep things simple, in Kaleidoscope the only datatype is a +64-bit floating point type (aka 'double' in C parlance). As such, all values +are implicitly double precision and the language doesn't require type +declarations. This gives the language a very nice and simple syntax. For +example, A simple example computes Fibonacci numbers, +which looks like this:

      + +
      +
      +# Compute the x'th fibonacci number.
      +def fib(x)
      +  if x < 3 then
      +    1
      +  else
      +    fib(x-1)+fib(x-2)
      +
      +# This expression will compute the 40th number.
      +fib(40)
      +
      +
      + +

      We also allow Kaleidoscope to call into standard library functions (this LLVM +JIT makes this completely trivial). This means that you can use the 'extern' +keyword to define a function before you use it (this is also useful for mutually +recursive functions). For example:

      + +
      +
      +extern sin(arg);
      +extern cos(arg);
      +extern atan2(arg1 arg2);
      +
      +atan2(sin(.4), cos(42))
      +
      +
      + +

      In the first incarnation of the language, we will only support basic +arithmetic: if/then/else will be added in a future installment. Another +interesting aspect of the first implementation is that it is a completely +functional language, which does not allow you to have side-effects etc. We will +eventually add side effects for those who prefer them.

      + +

      In order to make this tutorial +maximally understandable and hackable, we choose to implement everything in C++ +instead of using lexer and parser generators. LLVM obviously works just fine +with these tools, and choice of these tools doesn't impact overall design.

      + +

      A note about this tutorial: we expect you to extend the language and play +with it on your own. Take the code and go crazy hacking away at it. It can be +a lot of fun to play with languages!

      + +
      + + + + + +
      + +

      When it comes to implementing a language, the first thing needed is +the ability to process a text file and recognize what it says. The traditional +way to do this is to use a "lexer" (aka 'scanner') +to break the input up into "tokens". Each token returned by the lexer includes +a token code and potentially some metadata (e.g. the numeric value of a number). +First, we define the possibilities: +

      + +
      +
      +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
      +// of these for known things.
      +enum Token {
      +  tok_eof = -1,
      +
      +  // commands
      +  tok_def = -2, tok_extern = -3,
      +
      +  // primary
      +  tok_identifier = -4, tok_number = -5,
      +};
      +
      +static std::string IdentifierStr;  // Filled in if tok_identifier
      +static double NumVal;              // Filled in if tok_number
      +
      +
      + +

      Each token returned by our lexer will either be one of the Token enum values +or it will be an 'unknown' character like '+' which is returned as its ascii +value. If the current token is an identifier, the IdentifierStr +global variable holds the name of the identifier. If the current token is a +numeric literal (like 1.0), NumVal holds its value. Note that we use +global variables for simplicity, this is not the best choice for a real language +implementation :). +

      + +

      The actual implementation of the lexer is a single function gettok. +gettok is called to return the next token from standard input. Its +definition starts as:

      + +
      +
      +/// gettok - Return the next token from standard input.
      +static int gettok() {
      +  static int LastChar = ' ';
      +
      +  // Skip any whitespace.
      +  while (isspace(LastChar))
      +    LastChar = getchar();
      +
      +
      + +

      +gettok works by calling the C getchar() function to read +characters one at a time from standard input. It eats them as it recognizes +them and stores the last character read but not processed in LastChar. The +first thing that it has to do is ignore whitespace between tokens. This is +accomplished with the loop above.

      + +

      The next thing it needs to do is recognize identifiers, and specific keywords +like "def". Kaleidoscope does this with this simple loop:

      + +
      +
      +  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
      +    IdentifierStr = LastChar;
      +    while (isalnum((LastChar = getchar())))
      +      IdentifierStr += LastChar;
      +
      +    if (IdentifierStr == "def") return tok_def;
      +    if (IdentifierStr == "extern") return tok_extern;
      +    return tok_identifier;
      +  }
      +
      +
      + +

      Note that it sets the 'IdentifierStr' global whenever it lexes an +identifier. Also, since language keywords are matched by the same loop, we +handle them here inline. Numeric values are similar:

      + +
      +
      +  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
      +    std::string NumStr;
      +    do {
      +      NumStr += LastChar;
      +      LastChar = getchar();
      +    } while (isdigit(LastChar) || LastChar == '.');
      +
      +    NumVal = strtod(NumStr.c_str(), 0);
      +    return tok_number;
      +  }
      +
      +
      + +

      This is all pretty straight-forward code for processing input. When reading +a numeric value from input, we use the C strtod function to convert it +to a numeric value that we store in NumVal. Note that this isn't doing +sufficient error checking: it will incorrect read "1.23.45.67" and handle it as +if you typed in "1.23". Feel free to extend it :). Next we handle comments: +

      + +
      +
      +  if (LastChar == '#') {
      +    // Comment until end of line.
      +    do LastChar = getchar();
      +    while (LastChar != EOF && LastChar != '\n' & LastChar != '\r');
      +    
      +    if (LastChar != EOF)
      +      return gettok();
      +  }
      +
      +
      + +

      We handle comments by skipping to the end of the line and then returnning the +next comment. Finally, if the input doesn't match one of the above cases, it is +either an operator character like '+', the end of file. These are handled with +this code:

      + +
      +
      +  // Check for end of file.  Don't eat the EOF.
      +  if (LastChar == EOF)
      +    return tok_eof;
      +  
      +  // Otherwise, just return the character as its ascii value.
      +  int ThisChar = LastChar;
      +  LastChar = getchar();
      +  return ThisChar;
      +}
      +
      +
      + +

      With this, we have the complete lexer for the basic Kaleidoscope language. +Next we'll build a simple parser that uses this to +build an Abstract Syntax Tree. If you prefer, you can jump to the main tutorial index page. +

      + +
      + + +
      +
      + Valid CSS! + Valid HTML 4.01! + + Chris Lattner
      + The LLVM Compiler Infrastructure
      + Last modified: $Date: 2007-10-17 11:05:13 -0700 (Wed, 17 Oct 2007) $ +
      + + Modified: llvm/trunk/docs/tutorial/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/index.html?rev=43215&r1=43214&r2=43215&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/index.html (original) +++ llvm/trunk/docs/tutorial/index.html Sun Oct 21 23:32:37 2007 @@ -25,17 +25,18 @@
    • Invoking the JIT
    • -
    • Implementing a simple language with LLVM +
    • Implementing a language with LLVM: Kaleidoscope
      1. The basic language, with its lexer
      2. Implementing a Parser and AST
      3. Implementing code generation to LLVM IR
      4. +
      5. Adding JIT codegen support
      6. Extending the language: if/then/else
      7. Extending the language: operator overloading
      8. -
      9. Adding JIT codegen support
      10. +
      11. Extending the language: mutable variables
      12. Thoughts and ideas for extensions
    • - \ No newline at end of file + From baldrick at free.fr Sun Oct 21 12:34:12 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 21 Oct 2007 19:34:12 +0200 Subject: [llvm-commits] [llvm] r43171 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp In-Reply-To: <28072F1F-0B36-41E5-BE95-1F80A196B132@apple.com> References: <200710190446.l9J4kkXp018139@zion.cs.uiuc.edu> <200710191031.52183.baldrick@free.fr> <28072F1F-0B36-41E5-BE95-1F80A196B132@apple.com> Message-ID: <200710211934.13010.baldrick@free.fr> Hi Chris, > Assuming an expansion from i64 to 2x i32, the code above will work > for sextinreg amounts between 1 and 32. For greater amounts, the top > part should get a sextinreg, and the bottom part should or togther > the top and bottom shifted parts, similar to a expanded shift. not sure why you need to do something complicated for the bottom part. Consider sextinreg from i63 to i64. The operand expands to 2 x i32: Lo and Hi. It seems to me that nothing needs to be done to Lo, while Hi needs to undergo an sextinreg from i31 to i32. Ciao, Duncan.