From nicholas at mxc.ca Mon Feb 14 00:14:20 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 14 Feb 2011 06:14:20 -0000 Subject: [llvm-commits] [llvm] r125480 - /llvm/trunk/include/llvm/ADT/SCCIterator.h Message-ID: <20110214061420.9B03B2A6C12C@llvm.org> Author: nicholas Date: Mon Feb 14 00:14:20 2011 New Revision: 125480 URL: http://llvm.org/viewvc/llvm-project?rev=125480&view=rev Log: Fix typo in comment. Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=125480&r1=125479&r2=125480&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SCCIterator.h (original) +++ llvm/trunk/include/llvm/ADT/SCCIterator.h Mon Feb 14 00:14:20 2011 @@ -60,7 +60,7 @@ // First element is basic block pointer, second is the 'next child' to visit std::vector > VisitStack; - // MinVistNumStack - Stack holding the "min" values for each node in the DFS. + // MinVisitNumStack - Stack holding the "min" values for each node in the DFS. // This is used to track the minimum uplink values for all children of // the corresponding node on the VisitStack. std::vector MinVisitNumStack; From sabre at nondot.org Mon Feb 14 00:14:43 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Feb 2011 06:14:43 -0000 Subject: [llvm-commits] [llvm] r125481 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <20110214061443.2BA212A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 00:14:42 2011 New Revision: 125481 URL: http://llvm.org/viewvc/llvm-project?rev=125481&view=rev Log: fix two comment thinkos 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=125481&r1=125480&r2=125481&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Feb 14 00:14:42 2011 @@ -974,7 +974,7 @@ /// ISD::ADD with a ConstantSDNode on the right-hand side, or if it is an /// ISD::OR with a ConstantSDNode that is guaranteed to have the same /// semantics as an ADD. This handles the equivalence: - /// X|Cst == X+Cst iff X&~Cst = 0. + /// X|Cst == X+Cst iff X&Cst = 0. bool isBaseWithConstantOffset(SDValue Op) const; /// isKnownNeverNan - Test whether the given SDValue is known to never be NaN. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125481&r1=125480&r2=125481&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Feb 14 00:14:42 2011 @@ -2292,7 +2292,7 @@ /// ISD::ADD with a ConstantSDNode on the right-hand side, or if it is an /// ISD::OR with a ConstantSDNode that is guaranteed to have the same /// semantics as an ADD. This handles the equivalence: -/// X|Cst == X+Cst iff X&~Cst = 0. +/// X|Cst == X+Cst iff X&Cst = 0. bool SelectionDAG::isBaseWithConstantOffset(SDValue Op) const { if ((Op.getOpcode() != ISD::ADD && Op.getOpcode() != ISD::OR) || !isa(Op.getOperand(1))) From sabre at nondot.org Mon Feb 14 00:18:24 2011 From: sabre at nondot.org (Chris Lattner) Date: Sun, 13 Feb 2011 22:18:24 -0800 Subject: [llvm-commits] [llvm] r125470 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp test/Co In-Reply-To: References: Message-ID: <18DCC812-D733-495A-938B-9FA8E7B8849D@nondot.org> On Feb 13, 2011, at 2:45 PM, Frits van Bommel wrote: > On Sun, Feb 13, 2011 at 11:25 PM, Chris Lattner wrote: >> +/// isBaseWithConstantOffset - Return true if the specified operand is an >> +/// ISD::ADD with a ConstantSDNode on the right-hand side, or if it is an >> +/// ISD::OR with a ConstantSDNode that is guaranteed to have the same >> +/// semantics as an ADD. This handles the equivalence: >> +/// X|Cst == X+Cst iff X&~Cst = 0. > > I think you mean 'iff X&Cst == 0'. > Ditto for the header comment added in r125471. Sigh, yes. Fixed in r125481, thanks for the review! -Chris From sabre at nondot.org Mon Feb 14 00:30:46 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Feb 2011 06:30:46 -0000 Subject: [llvm-commits] [llvm] r125482 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp test/CodeGen/X86/sse2.ll Message-ID: <20110214063046.2D4FA2A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 00:30:45 2011 New Revision: 125482 URL: http://llvm.org/viewvc/llvm-project?rev=125482&view=rev Log: fix PR9210 by implementing some type legalization logic for vector fp conversions. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/trunk/test/CodeGen/X86/sse2.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=125482&r1=125481&r2=125482&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Feb 14 00:30:45 2011 @@ -587,6 +587,7 @@ SDValue SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *N); SDValue SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo); SDValue SplitVecOp_CONCAT_VECTORS(SDNode *N); + SDValue SplitVecOp_FP_ROUND(SDNode *N); //===--------------------------------------------------------------------===// // Vector Widening Support: LegalizeVectorTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=125482&r1=125481&r2=125482&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Mon Feb 14 00:30:45 2011 @@ -981,6 +981,7 @@ case ISD::EXTRACT_SUBVECTOR: Res = SplitVecOp_EXTRACT_SUBVECTOR(N); break; case ISD::EXTRACT_VECTOR_ELT:Res = SplitVecOp_EXTRACT_VECTOR_ELT(N); break; case ISD::CONCAT_VECTORS: Res = SplitVecOp_CONCAT_VECTORS(N); break; + case ISD::FP_ROUND: Res = SplitVecOp_FP_ROUND(N); break; case ISD::STORE: Res = SplitVecOp_STORE(cast(N), OpNo); break; @@ -992,6 +993,8 @@ case ISD::FP_TO_UINT: case ISD::SINT_TO_FP: case ISD::UINT_TO_FP: + case ISD::FP_EXTEND: + case ISD::FTRUNC: case ISD::TRUNCATE: case ISD::SIGN_EXTEND: case ISD::ZERO_EXTEND: @@ -1171,6 +1174,24 @@ &Elts[0], Elts.size()); } +SDValue DAGTypeLegalizer::SplitVecOp_FP_ROUND(SDNode *N) { + // The result has a legal vector type, but the input needs splitting. + EVT ResVT = N->getValueType(0); + SDValue Lo, Hi; + DebugLoc DL = N->getDebugLoc(); + GetSplitVector(N->getOperand(0), Lo, Hi); + EVT InVT = Lo.getValueType(); + + EVT OutVT = EVT::getVectorVT(*DAG.getContext(), ResVT.getVectorElementType(), + InVT.getVectorNumElements()); + + Lo = DAG.getNode(ISD::FP_ROUND, DL, OutVT, Lo, N->getOperand(1)); + Hi = DAG.getNode(ISD::FP_ROUND, DL, OutVT, Hi, N->getOperand(1)); + + return DAG.getNode(ISD::CONCAT_VECTORS, DL, ResVT, Lo, Hi); +} + + //===----------------------------------------------------------------------===// // Result Vector Widening @@ -1422,7 +1443,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_Convert(SDNode *N) { SDValue InOp = N->getOperand(0); - DebugLoc dl = N->getDebugLoc(); + DebugLoc DL = N->getDebugLoc(); EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); unsigned WidenNumElts = WidenVT.getVectorNumElements(); @@ -1438,8 +1459,11 @@ InOp = GetWidenedVector(N->getOperand(0)); InVT = InOp.getValueType(); InVTNumElts = InVT.getVectorNumElements(); - if (InVTNumElts == WidenNumElts) - return DAG.getNode(Opcode, dl, WidenVT, InOp); + if (InVTNumElts == WidenNumElts) { + if (N->getNumOperands() == 1) + return DAG.getNode(Opcode, DL, WidenVT, InOp); + return DAG.getNode(Opcode, DL, WidenVT, InOp, N->getOperand(1)); + } } if (TLI.isTypeLegal(InWidenVT)) { @@ -1456,16 +1480,20 @@ SDValue UndefVal = DAG.getUNDEF(InVT); for (unsigned i = 1; i != NumConcat; ++i) Ops[i] = UndefVal; - return DAG.getNode(Opcode, dl, WidenVT, - DAG.getNode(ISD::CONCAT_VECTORS, dl, InWidenVT, - &Ops[0], NumConcat)); + SDValue InVec = DAG.getNode(ISD::CONCAT_VECTORS, DL, InWidenVT, + &Ops[0], NumConcat); + if (N->getNumOperands() == 1) + return DAG.getNode(Opcode, DL, WidenVT, InVec); + return DAG.getNode(Opcode, DL, WidenVT, InVec, N->getOperand(1)); } if (InVTNumElts % WidenNumElts == 0) { + SDValue InVal = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, InWidenVT, + InOp, DAG.getIntPtrConstant(0)); // Extract the input and convert the shorten input vector. - return DAG.getNode(Opcode, dl, WidenVT, - DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, InWidenVT, - InOp, DAG.getIntPtrConstant(0))); + if (N->getNumOperands() == 1) + return DAG.getNode(Opcode, DL, WidenVT, InVal); + return DAG.getNode(Opcode, DL, WidenVT, InVal, N->getOperand(1)); } } @@ -1474,16 +1502,20 @@ EVT EltVT = WidenVT.getVectorElementType(); unsigned MinElts = std::min(InVTNumElts, WidenNumElts); unsigned i; - for (i=0; i < MinElts; ++i) - Ops[i] = DAG.getNode(Opcode, dl, EltVT, - DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, InEltVT, InOp, - DAG.getIntPtrConstant(i))); + for (i=0; i < MinElts; ++i) { + SDValue Val = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, InEltVT, InOp, + DAG.getIntPtrConstant(i)); + if (N->getNumOperands() == 1) + Ops[i] = DAG.getNode(Opcode, DL, EltVT, Val); + else + Ops[i] = DAG.getNode(Opcode, DL, EltVT, Val, N->getOperand(1)); + } SDValue UndefVal = DAG.getUNDEF(EltVT); for (; i < WidenNumElts; ++i) Ops[i] = UndefVal; - return DAG.getNode(ISD::BUILD_VECTOR, dl, WidenVT, &Ops[0], WidenNumElts); + return DAG.getNode(ISD::BUILD_VECTOR, DL, WidenVT, &Ops[0], WidenNumElts); } SDValue DAGTypeLegalizer::WidenVecRes_POWI(SDNode *N) { Modified: llvm/trunk/test/CodeGen/X86/sse2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse2.ll?rev=125482&r1=125481&r2=125482&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/sse2.ll (original) +++ llvm/trunk/test/CodeGen/X86/sse2.ll Mon Feb 14 00:30:45 2011 @@ -214,3 +214,11 @@ store <4 x float> %2, <4 x float> * undef ret void } + +; PR9210 +define <4 x float> @f(<4 x double>) nounwind { +entry: + %double2float.i = fptrunc <4 x double> %0 to <4 x float> + ret <4 x float> %double2float.i +} + From sabre at nondot.org Mon Feb 14 00:34:52 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Feb 2011 06:34:52 -0000 Subject: [llvm-commits] [www-releases] r125483 - /www-releases/trunk/download.html Message-ID: <20110214063452.CBBA22A6C12E@llvm.org> Author: lattner Date: Mon Feb 14 00:34:52 2011 New Revision: 125483 URL: http://llvm.org/viewvc/llvm-project?rev=125483&view=rev Log: The mac x86 binaries only run on x86-64 hosts. Modified: www-releases/trunk/download.html Modified: www-releases/trunk/download.html URL: http://llvm.org/viewvc/llvm-project/www-releases/trunk/download.html?rev=125483&r1=125482&r2=125483&view=diff ============================================================================== --- www-releases/trunk/download.html (original) +++ www-releases/trunk/download.html Mon Feb 14 00:34:52 2011 @@ -42,12 +42,12 @@
  • Clang Binaries for FreeBSD8/x86_64 (23M)
  • Clang Binaries for Linux/x86 (52M)
  • Clang Binaries for Linux/x86_64 (49M)
  • -
  • Clang Binaries for MacOS X/x86 (59M)
  • +
  • Clang Binaries for MacOS X/x86-64 (59M)
  • LLVM-GCC 4.2 Front End Binaries for FreeBSD8/x86 (32M)
  • LLVM-GCC 4.2 Front End Binaries for FreeBSD8/x86_64 (55M)
  • LLVM-GCC 4.2 Front End Binaries for Linux/x86 (55M)
  • LLVM-GCC 4.2 Front End Binaries for Linux/x86_64 (47M)
  • -
  • LLVM-GCC 4.2 Front End Binaries for MacOS X/x86 (Darwin 10 +
  • LLVM-GCC 4.2 Front End Binaries for MacOS X/x86-64 (Darwin 10 ) (40M)
  • LLVM-GCC 4.2 Front End Binaries for Mingw32/x86 (26M)
  • DragonEgg(193K)
  • From sabre at nondot.org Mon Feb 14 01:35:09 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Feb 2011 07:35:09 -0000 Subject: [llvm-commits] [llvm] r125486 - /llvm/trunk/include/llvm/ADT/ArrayRef.h Message-ID: <20110214073509.E7A4D2A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 01:35:09 2011 New Revision: 125486 URL: http://llvm.org/viewvc/llvm-project?rev=125486&view=rev Log: add a new ArrayRef class. This is intended to replace the idiom we use in many places where we pass a pointer and size to abstract APIs that can take C arrays, std::vector, SmallVector, etc. It is to arrays what StringRef is to strings. Added: llvm/trunk/include/llvm/ADT/ArrayRef.h Added: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=125486&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (added) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Feb 14 01:35:09 2011 @@ -0,0 +1,121 @@ +//===--- ArrayRef.h - Array Reference Wrapper -------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_ARRAYREF_H +#define LLVM_ADT_ARRAYREF_H + +#include "llvm/ADT/SmallVector.h" +#include + +namespace llvm { + class APInt; + + /// ArrayRef - Represent a constant reference to an array (0 or more elements + /// consequtively in memory), i.e. a start pointer and a length. It allows + /// various APIs to take consequtive elements easily and conveniently. + /// + /// This class does not own the underlying data, it is expected to be used in + /// situations where the data resides in some other buffer, whose lifetime + /// extends past that of the StringRef. For this reason, it is not in general + /// safe to store a ArrayRef. + /// + /// This is intended to be trivially copyable, so it should be passed by + /// value. + template + class ArrayRef { + public: + typedef const T *iterator; + typedef const T *const_iterator; + typedef size_t size_type; + + private: + /// The start of the array, in an external buffer. + const T *Data; + + /// The number of elements. + size_t Length; + + public: + /// @name Constructors + /// @{ + + /// Construct an empty ArrayRef. + /*implicit*/ ArrayRef() : Data(0), Length(0) {} + + /// Construct an ArrayRef from a single element. + /*implicit*/ ArrayRef(const T &OneElt) + : Data(&OneElt), Length(1) {} + + /// Construct an ArrayRef from a pointer and length. + /*implicit*/ ArrayRef(T *data, size_t length) + : Data(data), Length(length) {} + + /// Construct an ArrayRef from a SmallVector. + /*implicit*/ ArrayRef(const SmallVectorImpl &Vec) + : Data(Vec.data()), Length(Vec.size()) {} + + /// Construct an ArrayRef from a std::vector. + /*implicit*/ ArrayRef(const std::vector &Vec) + : Data(Vec.empty() ? (T*)0 : &Vec[0]), Length(Vec.size()) {} + + // TODO: C arrays. + + /// @} + /// @name Simple Operations + /// @{ + + iterator begin() const { return Data; } + iterator end() const { return Data + Length; } + + /// empty - Check if the string is empty. + bool empty() const { return Length == 0; } + + /// size - Get the string size. + size_t size() const { return Length; } + + /// front - Get the first element. + const T &front() const { + assert(!empty()); + return Data[0]; + } + + /// back - Get the last character in the string. + const T &back() const { + assert(!empty()); + return Data[Length-1]; + } + + /// @} + /// @name Operator Overloads + /// @{ + + char operator[](size_t Index) const { + assert(Index < Length && "Invalid index!"); + return Data[Index]; + } + + /// @} + /// @name Expensive Operations + /// @{ + + std::vector vec() const { + return std::vector(Data, Data+Length); + } + + /// @} + }; + + // ArrayRefs can be treated like a POD type. + template struct isPodLike; + template struct isPodLike > { + static const bool value = true; + }; +} + +#endif From sabre at nondot.org Mon Feb 14 01:55:32 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Feb 2011 07:55:32 -0000 Subject: [llvm-commits] [llvm] r125487 - in /llvm/trunk: include/llvm/ADT/ArrayRef.h include/llvm/Constants.h lib/Analysis/ConstantFolding.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp lib/Transforms/Scalar/ScalarReplAggregates.cpp lib/VMCore/AutoUpgrade.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp lib/VMCore/Core.cpp Message-ID: <20110214075532.BC0EE2A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 01:55:32 2011 New Revision: 125487 URL: http://llvm.org/viewvc/llvm-project?rev=125487&view=rev Log: Switch ConstantVector::get to use ArrayRef instead of a pointer+size idiom. Change various clients to simplify their code. Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h llvm/trunk/include/llvm/Constants.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/trunk/lib/VMCore/AutoUpgrade.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Feb 14 01:55:32 2011 @@ -17,8 +17,8 @@ class APInt; /// ArrayRef - Represent a constant reference to an array (0 or more elements - /// consequtively in memory), i.e. a start pointer and a length. It allows - /// various APIs to take consequtive elements easily and conveniently. + /// consecutively in memory), i.e. a start pointer and a length. It allows + /// various APIs to take consecutive elements easily and conveniently. /// /// This class does not own the underlying data, it is expected to be used in /// situations where the data resides in some other buffer, whose lifetime Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Mon Feb 14 01:55:32 2011 @@ -25,7 +25,7 @@ #include "llvm/OperandTraits.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/APFloat.h" -#include +#include "llvm/ADT/ArrayRef.h" namespace llvm { @@ -39,8 +39,6 @@ struct ConstantCreator; template struct ConvertConstantType; -template -class SmallVector; //===----------------------------------------------------------------------===// /// This is the shared class of boolean and integer constants. This class @@ -473,9 +471,9 @@ ConstantVector(const VectorType *T, const std::vector &Val); public: // ConstantVector accessors + static Constant *get(ArrayRef V); + // FIXME: Eliminate this constructor form. static Constant *get(const VectorType *T, const std::vector &V); - static Constant *get(const std::vector &V); - static Constant *get(Constant *const *Vals, unsigned NumVals); /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Feb 14 01:55:32 2011 @@ -54,7 +54,7 @@ // vector so the code below can handle it uniformly. if (isa(C) || isa(C)) { Constant *Ops = C; // don't take the address of C! - return FoldBitCast(ConstantVector::get(&Ops, 1), DestTy, TD); + return FoldBitCast(ConstantVector::get(Ops), DestTy, TD); } // If this is a bitcast from constant vector -> vector, fold it. @@ -167,7 +167,7 @@ } } - return ConstantVector::get(Result.data(), Result.size()); + return ConstantVector::get(Result); } Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Feb 14 01:55:32 2011 @@ -2079,7 +2079,7 @@ "vector element #" + Twine(i) + " is not of type '" + Elts[0]->getType()->getDescription()); - ID.ConstantVal = ConstantVector::get(Elts.data(), Elts.size()); + ID.ConstantVal = ConstantVector::get(Elts); ID.Kind = ValID::t_Constant; return false; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Feb 14 01:55:32 2011 @@ -298,7 +298,7 @@ NewC = ConstantStruct::get(Context, &NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); } else if (isa(UserC)) { - NewC = ConstantVector::get(&NewOps[0], NewOps.size()); + NewC = ConstantVector::get(NewOps); } else { assert(isa(UserC) && "Must be a ConstantExpr."); NewC = cast(UserC)->getWithOperands(&NewOps[0], Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 14 01:55:32 2011 @@ -2387,30 +2387,14 @@ void SelectionDAGBuilder::visitFSub(const User &I) { // -0.0 - X --> fneg const Type *Ty = I.getType(); - if (Ty->isVectorTy()) { - if (ConstantVector *CV = dyn_cast(I.getOperand(0))) { - const VectorType *DestTy = cast(I.getType()); - const Type *ElTy = DestTy->getElementType(); - unsigned VL = DestTy->getNumElements(); - std::vector NZ(VL, ConstantFP::getNegativeZero(ElTy)); - Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); - if (CV == CNZ) { - SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); - return; - } - } + if (isa(I.getOperand(0)) && + I.getOperand(0) == ConstantFP::getZeroValueForNegation(Ty)) { + SDValue Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2)); + return; } - if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) - if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { - SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); - return; - } - visitBinary(I, ISD::FSUB); } Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Feb 14 01:55:32 2011 @@ -2257,8 +2257,7 @@ if (Init->getType()->isArrayTy()) return ConstantArray::get(cast(InitTy), Elts); - else - return ConstantVector::get(&Elts[0], Elts.size()); + return ConstantVector::get(Elts); } } Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Mon Feb 14 01:55:32 2011 @@ -1037,11 +1037,8 @@ if (Pred == ICmpInst::ICMP_SLT && CmpLHS->getType() == DestTy) { const Type *EltTy = VTy->getElementType(); - // splat the shift constant to a cosntant vector - Constant *Sh = ConstantInt::get(EltTy, EltTy->getScalarSizeInBits()-1); - std::vector Elts(VTy->getNumElements(), Sh); - Constant *VSh = ConstantVector::get(Elts); - + // splat the shift constant to a constant vector. + Constant *VSh = ConstantInt::get(VTy, EltTy->getScalarSizeInBits()-1); Value *In = Builder->CreateAShr(CmpLHS, VSh,CmpLHS->getName()+".lobit"); return ReplaceInstUsesWith(CI, In); } @@ -1390,8 +1387,7 @@ ConstantInt::get(Int32Ty, SrcElts)); } - Constant *Mask = ConstantVector::get(ShuffleMask.data(), ShuffleMask.size()); - return new ShuffleVectorInst(InVal, V2, Mask); + return new ShuffleVectorInst(InVal, V2, ConstantVector::get(ShuffleMask)); } static bool isMultipleOfTypeSize(unsigned Value, const Type *Ty) { Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Feb 14 01:55:32 2011 @@ -1916,7 +1916,7 @@ if (EltTy != ValTy) { unsigned NumElts = cast(ValTy)->getNumElements(); SmallVector Elts(NumElts, StoreVal); - StoreVal = ConstantVector::get(&Elts[0], NumElts); + StoreVal = ConstantVector::get(Elts); } } new StoreInst(StoreVal, EltPtr, MI); Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Mon Feb 14 01:55:32 2011 @@ -859,7 +859,7 @@ for (unsigned i = 0; i != 8; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value *SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value *SV = ConstantVector::get(Indices); Rep = Builder.CreateShuffleVector(Op2, Op1, SV, "palignr"); Rep = Builder.CreateBitCast(Rep, F->getReturnType()); } @@ -915,7 +915,7 @@ for (unsigned i = 0; i != 16; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value *SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value *SV = ConstantVector::get(Indices); Rep = Builder.CreateShuffleVector(Op2, Op1, SV, "palignr"); Rep = Builder.CreateBitCast(Rep, F->getReturnType()); } Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Feb 14 01:55:32 2011 @@ -150,7 +150,7 @@ // This allows for other simplifications (although some of them // can only be handled by Analysis/ConstantFolding.cpp). if (isa(V) || isa(V)) - return ConstantExpr::getBitCast(ConstantVector::get(&V, 1), DestPTy); + return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy); } // Finally, implement bitcast folding now. The code below doesn't handle @@ -873,7 +873,7 @@ Result.push_back(InElt); } - return ConstantVector::get(&Result[0], Result.size()); + return ConstantVector::get(Result); } Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg, @@ -1947,11 +1947,11 @@ // If we can constant fold the comparison of each element, constant fold // the whole vector comparison. SmallVector ResElts; - for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) { - // Compare the elements, producing an i1 result or constant expr. + // Compare the elements, producing an i1 result or constant expr. + for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) ResElts.push_back(ConstantExpr::getCompare(pred, C1Elts[i], C2Elts[i])); - } - return ConstantVector::get(&ResElts[0], ResElts.size()); + + return ConstantVector::get(ResElts); } if (C1->getType()->isFloatingPointTy()) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Feb 14 01:55:32 2011 @@ -94,7 +94,7 @@ return ConstantInt::get(Ty->getContext(), APInt::getAllOnesValue(ITy->getBitWidth())); - std::vector Elts; + SmallVector Elts; const VectorType *VTy = cast(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); assert(Elts[0] && "Not a vector integer type!"); @@ -302,8 +302,8 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) - return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + return ConstantVector::get(SmallVector(VTy->getNumElements(), C)); return C; } @@ -329,7 +329,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + SmallVector(VTy->getNumElements(), C)); return C; } @@ -372,7 +372,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + SmallVector(VTy->getNumElements(), C)); return C; } @@ -387,7 +387,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + SmallVector(VTy->getNumElements(), C)); return C; } @@ -404,9 +404,9 @@ Constant *ConstantFP::getZeroValueForNegation(const Type* Ty) { if (const VectorType *PTy = dyn_cast(Ty)) if (PTy->getElementType()->isFloatingPointTy()) { - std::vector zeros(PTy->getNumElements(), + SmallVector zeros(PTy->getNumElements(), getNegativeZero(PTy->getElementType())); - return ConstantVector::get(PTy, zeros); + return ConstantVector::get(zeros); } if (Ty->isFloatingPointTy()) @@ -601,13 +601,12 @@ } // ConstantVector accessors. -Constant *ConstantVector::get(const VectorType* T, - const std::vector& V) { +Constant *ConstantVector::get(const VectorType *T, + const std::vector &V) { assert(!V.empty() && "Vectors can't be empty"); - LLVMContext &Context = T->getContext(); - LLVMContextImpl *pImpl = Context.pImpl; + LLVMContextImpl *pImpl = T->getContext().pImpl; - // If this is an all-undef or alll-zero vector, return a + // If this is an all-undef or all-zero vector, return a // ConstantAggregateZero or UndefValue. Constant *C = V[0]; bool isZero = C->isNullValue(); @@ -629,14 +628,10 @@ return pImpl->VectorConstants.getOrCreate(T, V); } -Constant *ConstantVector::get(const std::vector& V) { - assert(!V.empty() && "Cannot infer type if V is empty"); - return get(VectorType::get(V.front()->getType(),V.size()), V); -} - -Constant *ConstantVector::get(Constant *const* Vals, unsigned NumVals) { +Constant *ConstantVector::get(ArrayRef V) { // FIXME: make this the primary ctor method. - return get(std::vector(Vals, Vals+NumVals)); + assert(!V.empty() && "Vectors cannot be empty"); + return get(VectorType::get(V.front()->getType(), V.size()), V.vec()); } // Utility function for determining if a ConstantExpr is a CastOp or not. This Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=125487&r1=125486&r2=125487&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Mon Feb 14 01:55:32 2011 @@ -629,8 +629,8 @@ Packed); } LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) { - return wrap(ConstantVector::get( - unwrap(ScalarConstantVals, Size), Size)); + return wrap(ConstantVector::get(ArrayRef( + unwrap(ScalarConstantVals, Size), Size))); } /*--.. Constant expressions ................................................--*/ @@ -647,74 +647,62 @@ } LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNSWNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNSWNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNUWNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNUWNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getFNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getFNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNot( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNot(unwrap(ConstantVal))); } LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSub( - unwrap(LHSConstant), + return wrap(ConstantExpr::getSub(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWSub( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWSub(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWSub( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWSub(unwrap(LHSConstant), unwrap(RHSConstant))); } @@ -724,89 +712,75 @@ } LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getUDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getUDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getSDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getExactSDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getExactSDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getURem( - unwrap(LHSConstant), + return wrap(ConstantExpr::getURem(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSRem( - unwrap(LHSConstant), + return wrap(ConstantExpr::getSRem(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFRem( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFRem(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAnd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getAnd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getOr( - unwrap(LHSConstant), + return wrap(ConstantExpr::getOr(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getXor( - unwrap(LHSConstant), + return wrap(ConstantExpr::getXor(unwrap(LHSConstant), unwrap(RHSConstant))); } @@ -825,27 +799,23 @@ } LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getShl( - unwrap(LHSConstant), - unwrap(RHSConstant))); + return wrap(ConstantExpr::getShl(unwrap(LHSConstant), + unwrap(RHSConstant))); } LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getLShr( - unwrap(LHSConstant), + return wrap(ConstantExpr::getLShr(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAShr( - unwrap(LHSConstant), + return wrap(ConstantExpr::getAShr(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices) { - return wrap(ConstantExpr::getGetElementPtr( - unwrap(ConstantVal), + return wrap(ConstantExpr::getGetElementPtr(unwrap(ConstantVal), unwrap(ConstantIndices, NumIndices), NumIndices)); @@ -860,38 +830,32 @@ } LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getTrunc( - unwrap(ConstantVal), + return wrap(ConstantExpr::getTrunc(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExt( - unwrap(ConstantVal), + return wrap(ConstantExpr::getSExt(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExt( - unwrap(ConstantVal), + return wrap(ConstantExpr::getZExt(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPTrunc( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPTrunc(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPExtend( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPExtend(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getUIToFP( - unwrap(ConstantVal), + return wrap(ConstantExpr::getUIToFP(unwrap(ConstantVal), unwrap(ToType))); } @@ -906,92 +870,78 @@ } LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPToSI( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPToSI(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getPtrToInt( - unwrap(ConstantVal), + return wrap(ConstantExpr::getPtrToInt(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getIntToPtr( - unwrap(ConstantVal), + return wrap(ConstantExpr::getIntToPtr(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExtOrBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getZExtOrBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExtOrBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getSExtOrBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getTruncOrBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getTruncOrBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getPointerCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getPointerCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned) { - return wrap(ConstantExpr::getIntegerCast( - unwrap(ConstantVal), - unwrap(ToType), - isSigned)); + return wrap(ConstantExpr::getIntegerCast(unwrap(ConstantVal), + unwrap(ToType), isSigned)); } LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, LLVMValueRef ConstantIfTrue, LLVMValueRef ConstantIfFalse) { - return wrap(ConstantExpr::getSelect( - unwrap(ConstantCondition), + return wrap(ConstantExpr::getSelect(unwrap(ConstantCondition), unwrap(ConstantIfTrue), unwrap(ConstantIfFalse))); } LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getExtractElement( - unwrap(VectorConstant), + return wrap(ConstantExpr::getExtractElement(unwrap(VectorConstant), unwrap(IndexConstant))); } LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getInsertElement( - unwrap(VectorConstant), + return wrap(ConstantExpr::getInsertElement(unwrap(VectorConstant), unwrap(ElementValueConstant), unwrap(IndexConstant))); } @@ -999,24 +949,21 @@ LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant) { - return wrap(ConstantExpr::getShuffleVector( - unwrap(VectorAConstant), + return wrap(ConstantExpr::getShuffleVector(unwrap(VectorAConstant), unwrap(VectorBConstant), unwrap(MaskConstant))); } LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList, unsigned NumIdx) { - return wrap(ConstantExpr::getExtractValue( - unwrap(AggConstant), + return wrap(ConstantExpr::getExtractValue(unwrap(AggConstant), IdxList, NumIdx)); } LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef ElementValueConstant, unsigned *IdxList, unsigned NumIdx) { - return wrap(ConstantExpr::getInsertValue( - unwrap(AggConstant), + return wrap(ConstantExpr::getInsertValue(unwrap(AggConstant), unwrap(ElementValueConstant), IdxList, NumIdx)); } From fvbommel at gmail.com Mon Feb 14 03:38:17 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Mon, 14 Feb 2011 10:38:17 +0100 Subject: [llvm-commits] [llvm] r125486 - /llvm/trunk/include/llvm/ADT/ArrayRef.h In-Reply-To: <20110214073509.E7A4D2A6C12C@llvm.org> References: <20110214073509.E7A4D2A6C12C@llvm.org> Message-ID: On Mon, Feb 14, 2011 at 8:35 AM, Chris Lattner wrote: > + ?/// This class does not own the underlying data, it is expected to be used in > + ?/// situations where the data resides in some other buffer, whose lifetime > + ?/// extends past that of the StringRef. For this reason, it is not in general > + ?/// safe to store a ArrayRef. s/StringRef/ArrayRef/ > + ? ?/// empty - Check if the string is empty. > + ? ?/// size - Get the string size. > + ? ?/// back - Get the last character in the string. 3 x s/string/array/ From bruno.cardoso at gmail.com Mon Feb 14 07:09:44 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 14 Feb 2011 13:09:44 -0000 Subject: [llvm-commits] [llvm] r125489 - in /llvm/trunk: lib/Target/ARM/ lib/Target/ARM/AsmParser/ lib/Target/ARM/Disassembler/ lib/Target/ARM/InstPrinter/ test/MC/ARM/ test/MC/Disassembler/ARM/ utils/TableGen/ Message-ID: <20110214130944.8A2182A6C12C@llvm.org> Author: bruno Date: Mon Feb 14 07:09:44 2011 New Revision: 125489 URL: http://llvm.org/viewvc/llvm-project?rev=125489&view=rev Log: Fix encoding and add parsing support for the arm/thumb CPS instruction: - Add custom operand matching for imod and iflags. - Rename SplitMnemonicAndCC to SplitMnemonic since it splits more than CC from mnemonic. - While adding ".w" as an operand, don't change "Head" to avoid passing the wrong mnemonic to ParseOperand. - Add asm parser tests. - Add disassembler tests just to make sure it can catch all cps versions. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInfo.h llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp llvm/trunk/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h llvm/trunk/test/MC/ARM/arm_instructions.s llvm/trunk/test/MC/ARM/thumb.s llvm/trunk/test/MC/ARM/thumb2.s llvm/trunk/test/MC/Disassembler/ARM/arm-tests.txt llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt llvm/trunk/utils/TableGen/EDEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInfo.h?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInfo.h Mon Feb 14 07:09:44 2011 @@ -97,6 +97,36 @@ } } +namespace ARM_PROC { + enum IMod { + IE = 2, + ID = 3 + }; + + enum IFlags { + F = 1, + I = 2, + A = 4 + }; + + inline static const char *IFlagsToString(unsigned val) { + switch (val) { + default: llvm_unreachable("Unknown iflags operand"); + case F: return "f"; + case I: return "i"; + case A: return "a"; + } + } + + inline static const char *IModToString(unsigned val) { + switch (val) { + default: llvm_unreachable("Unknown imod operand"); + case IE: return "ie"; + case ID: return "id"; + } + } +} + namespace ARM_MB { // The Memory Barrier Option constants map directly to the 4-bit encoding of // the option field for memory barrier operations. Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Mon Feb 14 07:09:44 2011 @@ -155,6 +155,22 @@ let ParserMethod = "tryParseMemBarrierOptOperand"; } +def ProcIFlagsOperand : AsmOperandClass { + let Name = "ProcIFlags"; + let SuperClasses = []; + let ParserMethod = "tryParseProcIFlagsOperand"; +} + +// ARM imod and iflag operands, used only by the CPS instruction. +def imod_op : Operand { + let PrintMethod = "printCPSIMod"; +} + +def iflags_op : Operand { + let PrintMethod = "printCPSIFlag"; + let ParserMatchClass = ProcIFlagsOperand; +} + // ARM Predicate operand. Default to 14 = always (AL). Second part is CC // register whose default is 0 (no register). def pred : PredicateOperand, - Requires<[IsARM]> { +// Change Processor State is a system instruction -- for disassembly and +// parsing only. +// FIXME: Since the asm parser has currently no clean way to handle optional +// operands, create 3 versions of the same instruction. Once there's a clean +// framework to represent optional operands, change this behavior. +class CPS + : AXI<(outs), iops, MiscFrm, NoItinerary, !strconcat("cps", asm_ops), + [/* For disassembly only; pattern left blank */]>, Requires<[IsARM]> { + bits<2> imod; + bits<3> iflags; + bits<5> mode; + bit M; + let Inst{31-28} = 0b1111; let Inst{27-20} = 0b00010000; - let Inst{16} = 0; - let Inst{5} = 0; -} + let Inst{19-18} = imod; + let Inst{17} = M; // Enabled if mode is set; + let Inst{16} = 0; + let Inst{8-6} = iflags; + let Inst{5} = 0; + let Inst{4-0} = mode; +} + +let M = 1 in + def CPS3p : CPS<(ins imod_op:$imod, iflags_op:$iflags, i32imm:$mode), + "$imod\t$iflags, $mode">; +let mode = 0, M = 0 in + def CPS2p : CPS<(ins imod_op:$imod, iflags_op:$iflags), "$imod\t$iflags">; + +let imod = 0, iflags = 0, M = 1 in + def CPS1p : CPS<(ins i32imm:$mode), "\t$mode">; // Preload signals the memory system of possible future data/instruction access. // These are for disassembly only. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Feb 14 07:09:44 2011 @@ -266,21 +266,17 @@ } // Change Processor State is a system instruction -- for disassembly only. -// The singleton $opt operand contains the following information: -// -// opt{4-0} = mode ==> don't care -// opt{5} = changemode ==> 0 (false for 16-bit Thumb instr) -// opt{8-6} = AIF from Inst{2-0} -// opt{10-9} = 1:imod from Inst{4} with 0b10 as enable and 0b11 as disable -// -// The opt{4-0} and opt{5} sub-fields are to accommodate 32-bit Thumb and ARM -// CPS which has more options. -def tCPS : T1I<(outs), (ins cps_opt:$opt), NoItinerary, "cps$opt", - [/* For disassembly only; pattern left blank */]>, +def tCPS : T1I<(outs), (ins imod_op:$imod, iflags_op:$iflags), + NoItinerary, "cps$imod $iflags", + [/* For disassembly only; pattern left blank */]>, T1Misc<0b0110011> { // A8.6.38 & B6.1.1 - let Inst{3} = 0; - // FIXME: Finish encoding. + bit imod; + bits<3> iflags; + + let Inst{4} = imod; + let Inst{3} = 0; + let Inst{2-0} = iflags; } // For both thumb1 and thumb2. Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Feb 14 07:09:44 2011 @@ -3127,41 +3127,40 @@ let Inst{19-16} = func; } -// Change Processor State is a system instruction -- for disassembly only. -// The singleton $opt operand contains the following information: -// opt{4-0} = mode from Inst{4-0} -// opt{5} = changemode from Inst{17} -// opt{8-6} = AIF from Inst{8-6} -// opt{10-9} = imod from Inst{19-18} with 0b10 as enable and 0b11 as disable -def t2CPS : T2XI<(outs),(ins cps_opt:$opt), NoItinerary, "cps$opt", - [/* For disassembly only; pattern left blank */]> { +// Change Processor State is a system instruction -- for disassembly and +// parsing only. +// FIXME: Since the asm parser has currently no clean way to handle optional +// operands, create 3 versions of the same instruction. Once there's a clean +// framework to represent optional operands, change this behavior. +class t2CPS : T2XI<(outs), iops, NoItinerary, + !strconcat("cps", asm_op), + [/* For disassembly only; pattern left blank */]> { + bits<2> imod; + bits<3> iflags; + bits<5> mode; + bit M; + let Inst{31-27} = 0b11110; - let Inst{26} = 0; + let Inst{26} = 0; let Inst{25-20} = 0b111010; + let Inst{19-16} = 0b1111; let Inst{15-14} = 0b10; - let Inst{12} = 0; - - bits<11> opt; - - // mode number - let Inst{4-0} = opt{4-0}; - - // M flag - let Inst{8} = opt{5}; - - // F flag - let Inst{5} = opt{6}; - - // I flag - let Inst{6} = opt{7}; - - // A flag - let Inst{7} = opt{8}; - - // imod flag - let Inst{10-9} = opt{10-9}; + let Inst{12} = 0; + let Inst{10-9} = imod; + let Inst{8} = M; + let Inst{7-5} = iflags; + let Inst{4-0} = mode; } +let M = 1 in + def t2CPS3p : t2CPS<(ins imod_op:$imod, iflags_op:$iflags, i32imm:$mode), + "$imod.w\t$iflags, $mode">; +let mode = 0, M = 0 in + def t2CPS2p : t2CPS<(ins imod_op:$imod, iflags_op:$iflags), + "$imod.w\t$iflags">; +let imod = 0, iflags = 0, M = 1 in + def t2CPS1p : t2CPS<(ins i32imm:$mode), "\t$mode">; + // A6.3.4 Branches and miscellaneous control // Table A6-14 Change Processor State, and hint instructions // Helper class for disassembly only. Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Feb 14 07:09:44 2011 @@ -98,6 +98,8 @@ SmallVectorImpl&); OperandMatchResultTy tryParseMemBarrierOptOperand( SmallVectorImpl &); + OperandMatchResultTy tryParseProcIFlagsOperand( + SmallVectorImpl &); public: ARMAsmParser(const Target &T, MCAsmParser &_Parser, TargetMachine &_TM) @@ -126,6 +128,7 @@ Immediate, MemBarrierOpt, Memory, + ProcIFlags, Register, RegisterList, DPRRegisterList, @@ -150,6 +153,10 @@ } Cop; struct { + ARM_PROC::IFlags Val; + } IFlags; + + struct { const char *Data; unsigned Length; } Tok; @@ -215,6 +222,8 @@ case Memory: Mem = o.Mem; break; + case ProcIFlags: + IFlags = o.IFlags; } } @@ -259,6 +268,11 @@ return MBOpt.Val; } + ARM_PROC::IFlags getProcIFlags() const { + assert(Kind == ProcIFlags && "Invalid access!"); + return IFlags.Val; + } + /// @name Memory Operand Accessors /// @{ @@ -333,6 +347,7 @@ uint64_t Value = CE->getValue(); return ((Value & 0x3) == 0 && Value <= 124); } + bool isProcIFlags() const { return Kind == ProcIFlags; } void addExpr(MCInst &Inst, const MCExpr *Expr) const { // Add as immediates when possible. Null MCExpr = 0. @@ -433,6 +448,11 @@ Inst.addOperand(MCOperand::CreateImm(CE->getValue())); } + void addProcIFlagsOperands(MCInst &Inst, unsigned N) const { + assert(N == 1 && "Invalid number of operands!"); + Inst.addOperand(MCOperand::CreateImm(unsigned(getProcIFlags()))); + } + virtual void dump(raw_ostream &OS) const; static ARMOperand *CreateCondCode(ARMCC::CondCodes CC, SMLoc S) { @@ -556,6 +576,14 @@ Op->EndLoc = S; return Op; } + + static ARMOperand *CreateProcIFlags(ARM_PROC::IFlags IFlags, SMLoc S) { + ARMOperand *Op = new ARMOperand(ProcIFlags); + Op->IFlags.Val = IFlags; + Op->StartLoc = S; + Op->EndLoc = S; + return Op; + } }; } // end anonymous namespace. @@ -604,6 +632,15 @@ OS << " (writeback)"; OS << ">"; break; + case ProcIFlags: { + OS << "= 0; --i) + if (IFlags & (1 << i)) + OS << ARM_PROC::IFlagsToString(1 << i); + OS << ">"; + break; + } case Register: OS << ""; break; @@ -885,6 +922,35 @@ return MatchOperand_Success; } +/// ParseProcIFlagsOperand - Try to parse iflags from CPS instruction. +ARMAsmParser::OperandMatchResultTy ARMAsmParser:: +tryParseProcIFlagsOperand(SmallVectorImpl &Operands) { + SMLoc S = Parser.getTok().getLoc(); + const AsmToken &Tok = Parser.getTok(); + assert(Tok.is(AsmToken::Identifier) && "Token is not an Identifier"); + StringRef IFlagsStr = Tok.getString(); + + unsigned IFlags = 0; + for (int i = 0, e = IFlagsStr.size(); i != e; ++i) { + unsigned Flag = StringSwitch(IFlagsStr.substr(i, 1)) + .Case("a", ARM_PROC::A) + .Case("i", ARM_PROC::I) + .Case("f", ARM_PROC::F) + .Default(~0U); + + // If some specific iflag is already set, it means that some letter is + // present more than once, this is not acceptable. + if (Flag == ~0U || (IFlags & Flag)) + return MatchOperand_NoMatch; + + IFlags |= Flag; + } + + Parser.Lex(); // Eat identifier token. + Operands.push_back(ARMOperand::CreateProcIFlags((ARM_PROC::IFlags)IFlags, S)); + return MatchOperand_Success; +} + /// Parse an ARM memory expression, return false if successful else return true /// or an error. The first token must be a '[' when called. /// @@ -1254,11 +1320,13 @@ /// setting letters to form a canonical mnemonic and flags. // // FIXME: Would be nice to autogen this. -static StringRef SplitMnemonicAndCC(StringRef Mnemonic, - unsigned &PredicationCode, - bool &CarrySetting) { +static StringRef SplitMnemonic(StringRef Mnemonic, + unsigned &PredicationCode, + bool &CarrySetting, + unsigned &ProcessorIMod) { PredicationCode = ARMCC::AL; CarrySetting = false; + ProcessorIMod = 0; // Ignore some mnemonics we know aren't predicated forms. // @@ -1312,6 +1380,21 @@ CarrySetting = true; } + // The "cps" instruction can have a interrupt mode operand which is glued into + // the mnemonic. Check if this is the case, split it and parse the imod op + if (Mnemonic.startswith("cps")) { + // Split out any imod code. + unsigned IMod = + StringSwitch(Mnemonic.substr(Mnemonic.size()-2, 2)) + .Case("ie", ARM_PROC::IE) + .Case("id", ARM_PROC::ID) + .Default(~0U); + if (IMod != ~0U) { + Mnemonic = Mnemonic.slice(0, Mnemonic.size()-2); + ProcessorIMod = IMod; + } + } + return Mnemonic; } @@ -1342,7 +1425,7 @@ Mnemonic == "mcrr2" || Mnemonic == "cbz" || Mnemonic == "cdp2" || Mnemonic == "trap" || Mnemonic == "mrc2" || Mnemonic == "mrrc2" || Mnemonic == "dsb" || Mnemonic == "movs" || Mnemonic == "isb" || - Mnemonic == "clrex") { + Mnemonic == "clrex" || Mnemonic.startswith("cps")) { CanAcceptPredicationCode = false; } else { CanAcceptPredicationCode = true; @@ -1363,8 +1446,10 @@ // Split out the predication code and carry setting flag from the mnemonic. unsigned PredicationCode; + unsigned ProcessorIMod; bool CarrySetting; - Head = SplitMnemonicAndCC(Head, PredicationCode, CarrySetting); + Head = SplitMnemonic(Head, PredicationCode, CarrySetting, + ProcessorIMod); Operands.push_back(ARMOperand::CreateToken(Head, NameLoc)); @@ -1404,13 +1489,25 @@ // FIXME: Issue a nice error. } + // Add the processor imod operand, if necessary. + if (ProcessorIMod) { + Operands.push_back(ARMOperand::CreateImm( + MCConstantExpr::Create(ProcessorIMod, getContext()), + NameLoc, NameLoc)); + } else { + // This mnemonic can't ever accept a imod, but the user wrote + // one (or misspelled another mnemonic). + + // FIXME: Issue a nice error. + } + // Add the remaining tokens in the mnemonic. while (Next != StringRef::npos) { Start = Next; Next = Name.find('.', Start + 1); - Head = Name.slice(Start, Next); + StringRef ExtraToken = Name.slice(Start, Next); - Operands.push_back(ARMOperand::CreateToken(Head, NameLoc)); + Operands.push_back(ARMOperand::CreateToken(ExtraToken, NameLoc)); } // Read the remaining operands. Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp (original) +++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp Mon Feb 14 07:09:44 2011 @@ -2942,15 +2942,25 @@ return true; } - // CPS has a singleton $opt operand that contains the following information: - // opt{4-0} = mode from Inst{4-0} - // opt{5} = changemode from Inst{17} - // opt{8-6} = AIF from Inst{8-6} - // opt{10-9} = imod from Inst{19-18} with 0b10 as enable and 0b11 as disable - if (Opcode == ARM::CPS) { - unsigned Option = slice(insn, 4, 0) | slice(insn, 17, 17) << 5 | - slice(insn, 8, 6) << 6 | slice(insn, 19, 18) << 9; - MI.addOperand(MCOperand::CreateImm(Option)); + // FIXME: To enable correct asm parsing and disasm of CPS we need 3 different + // opcodes which match the same real instruction. This is needed since there's + // no current handling of optional arguments. Fix here when a better handling + // of optional arguments is implemented. + if (Opcode == ARM::CPS3p) { + MI.addOperand(MCOperand::CreateImm(slice(insn, 19, 18))); // imod + MI.addOperand(MCOperand::CreateImm(slice(insn, 8, 6))); // iflags + MI.addOperand(MCOperand::CreateImm(slice(insn, 4, 0))); // mode + NumOpsAdded = 3; + return true; + } + if (Opcode == ARM::CPS2p) { + MI.addOperand(MCOperand::CreateImm(slice(insn, 19, 18))); // imod + MI.addOperand(MCOperand::CreateImm(slice(insn, 8, 6))); // iflags + NumOpsAdded = 2; + return true; + } + if (Opcode == ARM::CPS1p) { + MI.addOperand(MCOperand::CreateImm(slice(insn, 4, 0))); // mode NumOpsAdded = 1; return true; } Modified: llvm/trunk/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h (original) +++ llvm/trunk/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h Mon Feb 14 07:09:44 2011 @@ -828,14 +828,13 @@ } // CPS has a singleton $opt operand that contains the following information: - // opt{4-0} = don't care - // opt{5} = 0 (false) - // opt{8-6} = AIF from Inst{2-0} - // opt{10-9} = 1:imod from Inst{4} with 0b10 as enable and 0b11 as disable + // The first op would be 0b10 as enable and 0b11 as disable in regular ARM, + // but in Thumb it's is 0 as enable and 1 as disable. So map it to ARM's + // default one. The second get the AIF flags from Inst{2-0}. if (Opcode == ARM::tCPS) { - unsigned Option = slice(insn, 2, 0) << 6 | slice(insn, 4, 4) << 9 | 1 << 10; - MI.addOperand(MCOperand::CreateImm(Option)); - NumOpsAdded = 1; + MI.addOperand(MCOperand::CreateImm(2 + slice(insn, 4, 4))); + MI.addOperand(MCOperand::CreateImm(slice(insn, 2, 0))); + NumOpsAdded = 2; return true; } @@ -1659,15 +1658,25 @@ break; } - // CPS has a singleton $opt operand that contains the following information: - // opt{4-0} = mode from Inst{4-0} - // opt{5} = changemode from Inst{8} - // opt{8-6} = AIF from Inst{7-5} - // opt{10-9} = imod from Inst{10-9} with 0b10 as enable and 0b11 as disable - if (Opcode == ARM::t2CPS) { - unsigned Option = slice(insn, 4, 0) | slice(insn, 8, 8) << 5 | - slice(insn, 7, 5) << 6 | slice(insn, 10, 9) << 9; - MI.addOperand(MCOperand::CreateImm(Option)); + // FIXME: To enable correct asm parsing and disasm of CPS we need 3 different + // opcodes which match the same real instruction. This is needed since there's + // no current handling of optional arguments. Fix here when a better handling + // of optional arguments is implemented. + if (Opcode == ARM::t2CPS3p) { + MI.addOperand(MCOperand::CreateImm(slice(insn, 10, 9))); // imod + MI.addOperand(MCOperand::CreateImm(slice(insn, 7, 5))); // iflags + MI.addOperand(MCOperand::CreateImm(slice(insn, 4, 0))); // mode + NumOpsAdded = 3; + return true; + } + if (Opcode == ARM::t2CPS2p) { + MI.addOperand(MCOperand::CreateImm(slice(insn, 10, 9))); // imod + MI.addOperand(MCOperand::CreateImm(slice(insn, 7, 5))); // iflags + NumOpsAdded = 2; + return true; + } + if (Opcode == ARM::t2CPS1p) { + MI.addOperand(MCOperand::CreateImm(slice(insn, 4, 0))); // mode NumOpsAdded = 1; return true; } Modified: llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp Mon Feb 14 07:09:44 2011 @@ -379,27 +379,19 @@ O << "le"; } -void ARMInstPrinter::printCPSOptionOperand(const MCInst *MI, unsigned OpNum, - raw_ostream &O) { +void ARMInstPrinter::printCPSIMod(const MCInst *MI, unsigned OpNum, + raw_ostream &O) { const MCOperand &Op = MI->getOperand(OpNum); - unsigned option = Op.getImm(); - unsigned mode = option & 31; - bool changemode = option >> 5 & 1; - unsigned AIF = option >> 6 & 7; - unsigned imod = option >> 9 & 3; - if (imod == 2) - O << "ie"; - else if (imod == 3) - O << "id"; - O << '\t'; - if (imod > 1) { - if (AIF & 4) O << 'a'; - if (AIF & 2) O << 'i'; - if (AIF & 1) O << 'f'; - if (AIF > 0 && changemode) O << ", "; - } - if (changemode) - O << '#' << mode; + O << ARM_PROC::IModToString(Op.getImm()); +} + +void ARMInstPrinter::printCPSIFlag(const MCInst *MI, unsigned OpNum, + raw_ostream &O) { + const MCOperand &Op = MI->getOperand(OpNum); + unsigned IFlags = Op.getImm(); + for (int i=2; i >= 0; --i) + if (IFlags & (1 << i)) + O << ARM_PROC::IFlagsToString(1 << i); } void ARMInstPrinter::printMSRMaskOperand(const MCInst *MI, unsigned OpNum, Modified: llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h (original) +++ llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h Mon Feb 14 07:09:44 2011 @@ -85,6 +85,8 @@ raw_ostream &O); void printSetendOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); + void printCPSIMod(const MCInst *MI, unsigned OpNum, raw_ostream &O); + void printCPSIFlag(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printCPSOptionOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printMSRMaskOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printNegZeroOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); Modified: llvm/trunk/test/MC/ARM/arm_instructions.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm_instructions.s?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/test/MC/ARM/arm_instructions.s (original) +++ llvm/trunk/test/MC/ARM/arm_instructions.s Mon Feb 14 07:09:44 2011 @@ -237,3 +237,12 @@ @ CHECK: dsb oshst @ encoding: [0x42,0xf0,0x7f,0xf5] dsb oshst +@ CHECK: cpsie aif @ encoding: [0xc0,0x01,0x08,0xf1] + cpsie aif + +@ CHECK: cps #15 @ encoding: [0x0f,0x00,0x02,0xf1] + cps #15 + +@ CHECK: cpsie if, #10 @ encoding: [0xca,0x00,0x0a,0xf1] + cpsie if, #10 + Modified: llvm/trunk/test/MC/ARM/thumb.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb.s?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/test/MC/ARM/thumb.s (original) +++ llvm/trunk/test/MC/ARM/thumb.s Mon Feb 14 07:09:44 2011 @@ -65,3 +65,6 @@ @ CHECK: wfi @ encoding: [0x30,0xbf] wfi + +@ CHECK: cpsie aif @ encoding: [0x67,0xb6] + cpsie aif Modified: llvm/trunk/test/MC/ARM/thumb2.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb2.s?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/test/MC/ARM/thumb2.s (original) +++ llvm/trunk/test/MC/ARM/thumb2.s Mon Feb 14 07:09:44 2011 @@ -252,3 +252,10 @@ @ CHECK: dsb oshst @ encoding: [0xbf,0xf3,0x42,0x8f] dsb oshst +@ CHECK: cpsie.w aif @ encoding: [0xaf,0xf3,0xe0,0x84] + cpsie.w aif +@ CHECK: cps #15 @ encoding: [0xaf,0xf3,0x0f,0x81] + cps #15 +@ CHECK: cpsie.w if, #10 @ encoding: [0xaf,0xf3,0x6a,0x85] + cpsie.w if, #10 + Modified: llvm/trunk/test/MC/Disassembler/ARM/arm-tests.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/arm-tests.txt?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/test/MC/Disassembler/ARM/arm-tests.txt (original) +++ llvm/trunk/test/MC/Disassembler/ARM/arm-tests.txt Mon Feb 14 07:09:44 2011 @@ -118,3 +118,12 @@ # CHECK: setend le 0x00 0x00 0x01 0xf1 + +# CHECK: cpsie aif +0xc0 0x01 0x08 0xf1 + +# CHECK: cps #15 +0x0f 0x00 0x02 0xf1 + +# CHECK: cpsie if, #10 +0xca 0x00 0x0a 0xf1 Modified: llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt (original) +++ llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt Mon Feb 14 07:09:44 2011 @@ -103,3 +103,15 @@ # IT block end # CHECK: rsbs r1, r2, #0 0x51 0x42 + +# CHECK: cpsid.w f +0xaf 0xf3 0x20 0x86 + +# CHECK: cps #15 +0xaf 0xf3 0x0f 0x81 + +# CHECK: cpsie.w if, #10 +0xaf 0xf3 0x6a 0x85 + +# CHECK: cpsie aif +0x67 0xb6 Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=125489&r1=125488&r2=125489&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/EDEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/EDEmitter.cpp Mon Feb 14 07:09:44 2011 @@ -576,6 +576,8 @@ IMM("nohash_imm"); IMM("p_imm"); IMM("c_imm"); + IMM("imod_op"); + IMM("iflags_op"); IMM("cpinst_operand"); IMM("setend_op"); IMM("cps_opt"); From baldrick at free.fr Mon Feb 14 07:47:47 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 14 Feb 2011 14:47:47 +0100 Subject: [llvm-commits] [llvm] r125319 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/JumpThreading/degenerate-phi.ll In-Reply-To: <7E8EAEF2-1835-4E85-B065-A9D6B2C67812@apple.com> References: <20110210235410.768AF2A6C12C@llvm.org> <4D54E80F.2090806@free.fr> <4D54F28C.7030901@mxc.ca> <4D54F322.8020602@free.fr> <7E8EAEF2-1835-4E85-B065-A9D6B2C67812@apple.com> Message-ID: <4D593283.60209@free.fr> Hi, >>>>> I think it would be better to have jump-threading zap >>>>> any zero operand phis when it makes them, rather than changing all analyses to >>>>> support them. >>>> >>>> It doesn't create them, it calls BasicBlock::removePredecessor. >>> >>> clearly it must clean them up somewhere (since phi nodes with no operands are >>> invalid), so can't it just clean them up earlier? >> >> It looks to me like the problem is that removePredecessor() respects >> the 'DontDeleteUselessPHIs' parameter even when the only predecessor >> is removed, and that JumpThreading always passes 'true' for that (even >> though AFAICT it doesn't have a good reason to). >> >> The best fix is probably to ignore that parameter if it's removing the >> last predecessor; IMHO in this case it should just replace all PHIs >> with undefs and then kill them, regardless of that parameter. > > I agree, that does seem like the right fix. it seems dangerous to erase phi's when explicitly told not to - it creates the danger of the caller using freed memory and so on. Instead, how about having removePredecessor always do a RAUW of degenerate phis with undef, but not actually erase them if DontDeleteUselessPHIs was passed. Ciao, Duncan. From kirk.beitz at nokia.com Mon Feb 14 10:14:44 2011 From: kirk.beitz at nokia.com (kirk.beitz at nokia.com) Date: Mon, 14 Feb 2011 16:14:44 +0000 Subject: [llvm-commits] PATCH : change clang Attrs.td to avoid conflict w/MinGW basetyps.h Message-ID: <26E7CB4B-3736-41FC-B0E6-6D4A45F4AA49@nokia.com> Trying again because i didn't see a response to this previously (11 days ago), and i don't have permissions in the svn repository to commit this, yet. Attached, please find a patch to tools/clang/include/clang/Basic/Attrs.td It is used to generate tools/clang/includes/clang/AST/Attrs.inc, which gets #included by Attr.h (which in turn is getting #included several nested levels deep in our effort to build lldb under MinGW ). Without this change, one of the classes to be generated defined "Args=Interface". This causes the generated class to contain a private member named "interface". Under MinGW, when code #includes Attr.h and "basetyps.h" from MinGW before it, a conflict results, because MinGW's basetypes.h will (under most circumstances) pull in windows headers which have the following macro definition: #define interface struct The patch shows that 'Interface' is simply changed to 'InterFace' (with the F capitalized) so that the private member variable that gets generated becomes "interFace". This mimics style elsewhere in Attrs.td (e.g. "Args=>FormatIdx" causes a private member formatIdx to be generated). The capitalization difference leads to the resolution of the conflict with MinGW's basetypes.h . Thanks in advance for any review/comments/feedback. Index: include/clang/Basic/Attr.td =================================================================== --- include/clang/Basic/Attr.td (revision 123723) +++ include/clang/Basic/Attr.td (working copy) @@ -258,7 +258,7 @@ def IBOutletCollection : Attr { let Spellings = ["iboutletcollection"]; - let Args = [TypeArgument<"Interface">]; + let Args = [TypeArgument<"InterFace">]; } def Malloc : Attr { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/5515da90/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: Attr.td.patch Type: application/octet-stream Size: 415 bytes Desc: Attr.td.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/5515da90/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/5515da90/attachment.htm From rafael.espindola at gmail.com Mon Feb 14 10:51:08 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 14 Feb 2011 16:51:08 -0000 Subject: [llvm-commits] [llvm] r125490 - in /llvm/trunk: include/llvm/MC/MCSectionELF.h lib/CodeGen/ELFWriter.cpp lib/MC/MCSectionELF.cpp Message-ID: <20110214165108.577D42A6C12C@llvm.org> Author: rafael Date: Mon Feb 14 10:51:08 2011 New Revision: 125490 URL: http://llvm.org/viewvc/llvm-project?rev=125490&view=rev Log: Move broken HasCommonSymbols to ELFWriter.cpp. Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/MC/MCSectionELF.cpp Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=125490&r1=125489&r2=125490&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSectionELF.h (original) +++ llvm/trunk/include/llvm/MC/MCSectionELF.h Mon Feb 14 10:51:08 2011 @@ -55,11 +55,6 @@ /// should be printed before the section name bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; - /// HasCommonSymbols - True if this section holds common symbols, this is - /// indicated on the ELF object file by a symbol with SHN_COMMON section - /// header index. - bool HasCommonSymbols() const; - StringRef getSectionName() const { return SectionName; } unsigned getType() const { return Type; } unsigned getFlags() const { return Flags; } Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=125490&r1=125489&r2=125490&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Mon Feb 14 10:51:08 2011 @@ -328,6 +328,18 @@ } } +/// HasCommonSymbols - True if this section holds common symbols, this is +/// indicated on the ELF object file by a symbol with SHN_COMMON section +/// header index. +static bool HasCommonSymbols(const MCSectionELF &S) { + // FIXME: this is wrong, a common symbol can be in .data for example. + if (StringRef(S.getSectionName()).startswith(".gnu.linkonce.")) + return true; + + return false; +} + + // EmitGlobal - Choose the right section for global and emit it void ELFWriter::EmitGlobal(const GlobalValue *GV) { @@ -364,7 +376,7 @@ unsigned Size = TD->getTypeAllocSize(GVar->getInitializer()->getType()); GblSym->Size = Size; - if (S->HasCommonSymbols()) { // Symbol must go to a common section + if (HasCommonSymbols(*S)) { // Symbol must go to a common section GblSym->SectionIdx = ELF::SHN_COMMON; // A new linkonce section is created for each global in the Modified: llvm/trunk/lib/MC/MCSectionELF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=125490&r1=125489&r2=125490&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCSectionELF.cpp (original) +++ llvm/trunk/lib/MC/MCSectionELF.cpp Mon Feb 14 10:51:08 2011 @@ -115,17 +115,6 @@ return getType() == ELF::SHT_NOBITS; } -// HasCommonSymbols - True if this section holds common symbols, this is -// indicated on the ELF object file by a symbol with SHN_COMMON section -// header index. -bool MCSectionELF::HasCommonSymbols() const { - - if (StringRef(SectionName).startswith(".gnu.linkonce.")) - return true; - - return false; -} - unsigned MCSectionELF::DetermineEntrySize(SectionKind Kind) { if (Kind.isMergeable1ByteCString()) return 1; if (Kind.isMergeable2ByteCString()) return 2; From kremenek at apple.com Mon Feb 14 11:06:09 2011 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 14 Feb 2011 09:06:09 -0800 Subject: [llvm-commits] PATCH : change clang Attrs.td to avoid conflict w/MinGW basetyps.h In-Reply-To: <26E7CB4B-3736-41FC-B0E6-6D4A45F4AA49@nokia.com> References: <26E7CB4B-3736-41FC-B0E6-6D4A45F4AA49@nokia.com> Message-ID: <725955C2-DE27-4032-B2EC-DD7A4898AC32@apple.com> Hi Kirk, You're emailing the wrong mailing list. This patch should go to cfe-commits. Ted On Feb 14, 2011, at 8:14 AM, kirk.beitz at nokia.com wrote: > Trying again because i didn't see a response to this previously (11 days ago), and i don't have permissions in the svn repository to commit this, yet. > > Attached, please find a patch to tools/clang/include/clang/Basic/Attrs.td > > It is used to generate tools/clang/includes/clang/AST/Attrs.inc, which gets #included by Attr.h (which in turn is getting #included several nested levels deep in our effort to build lldb under MinGW ). > > Without this change, one of the classes to be generated defined "Args=Interface". > > This causes the generated class to contain a private member named "interface". > > Under MinGW, when code #includes Attr.h and "basetyps.h" from MinGW before it, a conflict results, because MinGW's basetypes.h will (under most circumstances) pull in windows headers which have the following macro definition: > > #define interface struct > > The patch shows that 'Interface' is simply changed to 'InterFace' (with the F capitalized) so that the private member variable that gets generated becomes "interFace". > > This mimics style elsewhere in Attrs.td (e.g. "Args=>FormatIdx" causes a private member formatIdx to be generated). > > The capitalization difference leads to the resolution of the conflict with MinGW's basetypes.h . > > Thanks in advance for any review/comments/feedback. > > > Index: include/clang/Basic/Attr.td > =================================================================== > --- include/clang/Basic/Attr.td > (revision 123723) > +++ include/clang/Basic/Attr.td > (working copy) > @@ -258,7 +258,7 @@ > > def IBOutletCollection : Attr { > let Spellings = ["iboutletcollection"]; > - let Args = [TypeArgument<"Interface">]; > + let Args = [TypeArgument<"InterFace">]; > } > > def Malloc : Attr { > > > > > > ++ kirk beitz : nokia : austin + san diego : kirk.beitz at nokia.com ++ > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/5e834bea/attachment.html From akyrtzi at gmail.com Mon Feb 14 11:58:52 2011 From: akyrtzi at gmail.com (Argyrios Kyrtzidis) Date: Mon, 14 Feb 2011 17:58:52 -0000 Subject: [llvm-commits] [llvm] r125493 - in /llvm/trunk/utils/TableGen: CMakeLists.txt ClangSACheckersEmitter.cpp ClangSACheckersEmitter.h TableGen.cpp Message-ID: <20110214175852.89F422A6C12C@llvm.org> Author: akirtzidis Date: Mon Feb 14 11:58:52 2011 New Revision: 125493 URL: http://llvm.org/viewvc/llvm-project?rev=125493&view=rev Log: Add the ClangSACheckersEmitter tablegen backend which will be used for the clang static analyzer. Added: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp llvm/trunk/utils/TableGen/ClangSACheckersEmitter.h Modified: llvm/trunk/utils/TableGen/CMakeLists.txt llvm/trunk/utils/TableGen/TableGen.cpp Modified: llvm/trunk/utils/TableGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CMakeLists.txt?rev=125493&r1=125492&r2=125493&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CMakeLists.txt (original) +++ llvm/trunk/utils/TableGen/CMakeLists.txt Mon Feb 14 11:58:52 2011 @@ -12,6 +12,7 @@ ClangASTNodesEmitter.cpp ClangAttrEmitter.cpp ClangDiagnosticsEmitter.cpp + ClangSACheckersEmitter.cpp CodeEmitterGen.cpp CodeGenDAGPatterns.cpp CodeGenInstruction.cpp Added: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp?rev=125493&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp (added) +++ llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Mon Feb 14 11:58:52 2011 @@ -0,0 +1,194 @@ +//=- ClangSACheckersEmitter.cpp - Generate Clang SA checkers tables -*- C++ -*- +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This tablegen backend emits Clang Static Analyzer checkers tables. +// +//===----------------------------------------------------------------------===// + +#include "ClangSACheckersEmitter.h" +#include "Record.h" +#include "llvm/ADT/DenseSet.h" +#include +#include +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Static Analyzer Checkers Tables generation +//===----------------------------------------------------------------------===// + +/// \brief True if it is specified hidden or a parent package is specified +/// as hidden, otherwise false. +static bool isHidden(const Record &R) { + if (R.getValueAsBit("Hidden")) + return true; + // Not declared as hidden, check the parent package if it is hidden. + if (DefInit *DI = dynamic_cast(R.getValueInit("ParentPackage"))) + return isHidden(*DI->getDef()); + + return false; +} + +static std::string getPackageFullName(Record *R); + +static std::string getParentPackageFullName(Record *R) { + std::string name; + if (DefInit *DI = dynamic_cast(R->getValueInit("ParentPackage"))) + name = getPackageFullName(DI->getDef()); + return name; +} + +static std::string getPackageFullName(Record *R) { + std::string name = getParentPackageFullName(R); + if (!name.empty()) name += "."; + return name + R->getValueAsString("PackageName"); +} + +static std::string getCheckerFullName(Record *R) { + std::string name = getParentPackageFullName(R); + if (!name.empty()) name += "."; + return name + R->getValueAsString("CheckerName"); +} + +namespace { +struct GroupInfo { + std::vector Checkers; + llvm::DenseSet SubGroups; + unsigned Index; +}; +} + +void ClangSACheckersEmitter::run(raw_ostream &OS) { + std::vector checkers = Records.getAllDerivedDefinitions("Checker"); + llvm::DenseMap checkerRecIndexMap; + for (unsigned i = 0, e = checkers.size(); i != e; ++i) + checkerRecIndexMap[checkers[i]] = i; + + OS << "\n#ifdef GET_CHECKERS\n"; + for (unsigned i = 0, e = checkers.size(); i != e; ++i) { + const Record &R = *checkers[i]; + + OS << "CHECKER(" << "\""; + OS.write_escaped(R.getValueAsString("CheckerName")) << "\", "; + OS << R.getValueAsString("ClassName") << ", "; + OS << R.getValueAsString("DescFile") << ", "; + OS << "\""; + OS.write_escaped(R.getValueAsString("HelpText")) << "\", "; + // Hidden bit + if (isHidden(R)) + OS << "true"; + else + OS << "false"; + OS << ")\n"; + } + OS << "#endif // GET_CHECKERS\n\n"; + + // Invert the mapping of checkers to package/group into a one to many + // mapping of packages/groups to checkers. + std::map groupInfoByName; + llvm::DenseMap recordGroupMap; + + std::vector packages = Records.getAllDerivedDefinitions("Package"); + for (unsigned i = 0, e = packages.size(); i != e; ++i) { + Record *R = packages[i]; + std::string fullName = getPackageFullName(R); + if (!fullName.empty()) { + GroupInfo &info = groupInfoByName[fullName]; + recordGroupMap[R] = &info; + } + } + + std::vector + checkerGroups = Records.getAllDerivedDefinitions("CheckerGroup"); + for (unsigned i = 0, e = checkerGroups.size(); i != e; ++i) { + Record *R = checkerGroups[i]; + std::string name = R->getValueAsString("GroupName"); + if (!name.empty()) { + GroupInfo &info = groupInfoByName[name]; + recordGroupMap[R] = &info; + } + } + + for (unsigned i = 0, e = checkers.size(); i != e; ++i) { + Record *R = checkers[i]; + std::string fullName = getCheckerFullName(R); + if (!fullName.empty()) { + GroupInfo &info = groupInfoByName[fullName]; + recordGroupMap[R] = &info; + info.Checkers.push_back(R); + Record *currR = R; + // Insert the checker and its parent packages into the set of the + // corresponding parent package. + while (DefInit *DI + = dynamic_cast(currR->getValueInit("ParentPackage"))) { + Record *parentPackage = DI->getDef(); + recordGroupMap[parentPackage]->SubGroups.insert(currR); + currR = parentPackage; + } + // Insert the checker into the set of its group. + if (DefInit *DI = dynamic_cast(R->getValueInit("Group"))) + recordGroupMap[DI->getDef()]->SubGroups.insert(R); + } + } + + unsigned index = 0; + for (std::map::iterator + I = groupInfoByName.begin(), E = groupInfoByName.end(); I != E; ++I) + I->second.Index = index++; + + // Walk through the packages/groups/checkers emitting an array for each + // set of checkers and an array for each set of subpackages. + + OS << "\n#ifdef GET_MEMBER_ARRAYS\n"; + unsigned maxLen = 0; + for (std::map::iterator + I = groupInfoByName.begin(), E = groupInfoByName.end(); I != E; ++I) { + maxLen = std::max(maxLen, (unsigned)I->first.size()); + + std::vector &V = I->second.Checkers; + if (!V.empty()) { + OS << "static const short CheckerArray" << I->second.Index << "[] = { "; + for (unsigned i = 0, e = V.size(); i != e; ++i) + OS << checkerRecIndexMap[V[i]] << ", "; + OS << "-1 };\n"; + } + + llvm::DenseSet &subGroups = I->second.SubGroups; + if (!subGroups.empty()) { + OS << "static const short SubPackageArray" << I->second.Index << "[] = { "; + for (llvm::DenseSet::iterator + I = subGroups.begin(), E = subGroups.end(); I != E; ++I) { + OS << recordGroupMap[*I]->Index << ", "; + } + OS << "-1 };\n"; + } + } + OS << "#endif // GET_MEMBER_ARRAYS\n\n"; + + OS << "\n#ifdef GET_CHECKNAME_TABLE\n"; + for (std::map::iterator + I = groupInfoByName.begin(), E = groupInfoByName.end(); I != E; ++I) { + // Group option string. + OS << " { \""; + OS.write_escaped(I->first) << "\"," + << std::string(maxLen-I->first.size()+1, ' '); + + if (I->second.Checkers.empty()) + OS << "0, "; + else + OS << "CheckerArray" << I->second.Index << ", "; + + // Subgroups. + if (I->second.SubGroups.empty()) + OS << 0; + else + OS << "SubPackageArray" << I->second.Index; + OS << " },\n"; + } + OS << "#endif // GET_CHECKNAME_TABLE\n\n"; +} Added: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangSACheckersEmitter.h?rev=125493&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/ClangSACheckersEmitter.h (added) +++ llvm/trunk/utils/TableGen/ClangSACheckersEmitter.h Mon Feb 14 11:58:52 2011 @@ -0,0 +1,31 @@ +//===- ClangSACheckersEmitter.h - Generate Clang SA checkers tables -*- C++ -*- +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This tablegen backend emits Clang Static Analyzer checkers tables. +// +//===----------------------------------------------------------------------===// + +#ifndef CLANGSACHECKERS_EMITTER_H +#define CLANGSACHECKERS_EMITTER_H + +#include "TableGenBackend.h" + +namespace llvm { + +class ClangSACheckersEmitter : public TableGenBackend { + RecordKeeper &Records; +public: + explicit ClangSACheckersEmitter(RecordKeeper &R) : Records(R) {} + + void run(raw_ostream &OS); +}; + +} // End llvm namespace + +#endif Modified: llvm/trunk/utils/TableGen/TableGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=125493&r1=125492&r2=125493&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TableGen.cpp (original) +++ llvm/trunk/utils/TableGen/TableGen.cpp Mon Feb 14 11:58:52 2011 @@ -21,6 +21,7 @@ #include "ClangASTNodesEmitter.h" #include "ClangAttrEmitter.h" #include "ClangDiagnosticsEmitter.h" +#include "ClangSACheckersEmitter.h" #include "CodeEmitterGen.h" #include "DAGISelEmitter.h" #include "DisassemblerEmitter.h" @@ -66,6 +67,7 @@ GenClangDiagGroups, GenClangDeclNodes, GenClangStmtNodes, + GenClangSACheckers, GenDAGISel, GenFastISel, GenOptParserDefs, GenOptParserImpl, @@ -141,6 +143,8 @@ "Generate Clang AST declaration nodes"), clEnumValN(GenClangStmtNodes, "gen-clang-stmt-nodes", "Generate Clang AST statement nodes"), + clEnumValN(GenClangSACheckers, "gen-clang-sa-checkers", + "Generate Clang Static Analyzer checkers"), clEnumValN(GenLLVMCConf, "gen-llvmc", "Generate LLVMC configuration library"), clEnumValN(GenEDInfo, "gen-enhanced-disassembly-info", @@ -298,6 +302,9 @@ case GenClangStmtNodes: ClangASTNodesEmitter(Records, "Stmt", "").run(Out.os()); break; + case GenClangSACheckers: + ClangSACheckersEmitter(Records).run(Out.os()); + break; case GenDisassembler: DisassemblerEmitter(Records).run(Out.os()); break; From criswell at uiuc.edu Mon Feb 14 11:59:50 2011 From: criswell at uiuc.edu (John Criswell) Date: Mon, 14 Feb 2011 17:59:50 -0000 Subject: [llvm-commits] [poolalloc] r125496 - in /poolalloc/trunk: CMakeLists.txt lib/AssistDS/CMakeLists.txt lib/DSA/CMakeLists.txt lib/PoolAllocate/CMakeLists.txt Message-ID: <20110214175950.D94E42A6C12C@llvm.org> Author: criswell Date: Mon Feb 14 11:59:50 2011 New Revision: 125496 URL: http://llvm.org/viewvc/llvm-project?rev=125496&view=rev Log: Updating CMakefile files to work for me (globbing isn't working for some reason). Modified: poolalloc/trunk/CMakeLists.txt poolalloc/trunk/lib/AssistDS/CMakeLists.txt poolalloc/trunk/lib/DSA/CMakeLists.txt poolalloc/trunk/lib/PoolAllocate/CMakeLists.txt Modified: poolalloc/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/CMakeLists.txt?rev=125496&r1=125495&r2=125496&view=diff ============================================================================== --- poolalloc/trunk/CMakeLists.txt (original) +++ poolalloc/trunk/CMakeLists.txt Mon Feb 14 11:59:50 2011 @@ -1,6 +1,6 @@ -include_directories(include) -configure_file(include/poolalloc/Config/config.h.cmake - include/poolalloc/Config/config.h) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/poolalloc/Config/config.h.cmake + ${CMAKE_CURRENT_SOURCE_DIR}/include/poolalloc/Config/config.h) add_subdirectory(lib) add_subdirectory(runtime) add_subdirectory(tools) Modified: poolalloc/trunk/lib/AssistDS/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/CMakeLists.txt?rev=125496&r1=125495&r2=125496&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/CMakeLists.txt (original) +++ poolalloc/trunk/lib/AssistDS/CMakeLists.txt Mon Feb 14 11:59:50 2011 @@ -1,2 +1,6 @@ -file(GLOB sources *.cpp) -add_llvm_library( AssistDS ${sources} ) +add_llvm_library(AssistDS + Devirt.cpp + FuncSpec.cpp + IndCloner.cpp + SVADevirt.cpp +) Modified: poolalloc/trunk/lib/DSA/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CMakeLists.txt?rev=125496&r1=125495&r2=125496&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/CMakeLists.txt (original) +++ poolalloc/trunk/lib/DSA/CMakeLists.txt Mon Feb 14 11:59:50 2011 @@ -1,2 +1,25 @@ -file(GLOB sources "*.cpp") -add_llvm_library( LLVMDataStructure ${sources} ) +add_llvm_library(LLVMDataStructure + AddressTakenAnalysis.cpp + Basic.cpp + BottomUpClosure.cpp + CallTargets.cpp + CompleteBottomUp.cpp + DSCallGraph.cpp + DSGraph.cpp + DSTest.cpp + DataStructure.cpp + DataStructureAA.cpp + DataStructureOpt.cpp + DataStructureStats.cpp + EntryPointAnalysis.cpp + EquivClassGraphs.cpp + GraphChecker.cpp + Local.cpp + Printer.cpp + SanityCheck.cpp + StdLibPass.cpp + Steensgaard.cpp + SteensgaardAA.cpp + TopDownClosure.cpp + TypeSafety.cpp + ) Modified: poolalloc/trunk/lib/PoolAllocate/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/CMakeLists.txt?rev=125496&r1=125495&r2=125496&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/CMakeLists.txt (original) +++ poolalloc/trunk/lib/PoolAllocate/CMakeLists.txt Mon Feb 14 11:59:50 2011 @@ -1,3 +1,13 @@ -file(GLOB sources *.cpp) -add_llvm_library(poolalloc ${sources}) -target_link_libraries(poolalloc LLVMDataStructure) \ No newline at end of file +add_llvm_library(poolalloc + AccessTrace.cpp + AllNodesHeuristic.cpp + Heuristic.cpp + PAMultipleGlobalPool.cpp + PASimple.cpp + PointerCompress.cpp + PoolAllocate.cpp + PoolOptimize.cpp + RunTimeAssociate.cpp + TransformFunctionBody.cpp + ) +target_link_libraries(poolalloc LLVMDataStructure) From sabre at nondot.org Mon Feb 14 12:15:46 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 14 Feb 2011 18:15:46 -0000 Subject: [llvm-commits] [llvm] r125504 - in /llvm/trunk: include/llvm/ADT/ArrayRef.h include/llvm/Constants.h lib/Analysis/ConstantFolding.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp lib/Transforms/Scalar/ScalarReplAggregates.cpp lib/VMCore/AutoUpgrade.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp lib/VMCore/Core.cpp Message-ID: <20110214181546.C4D162A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 12:15:46 2011 New Revision: 125504 URL: http://llvm.org/viewvc/llvm-project?rev=125504&view=rev Log: revert my ConstantVector patch, it seems to have made the llvm-gcc builders unhappy. Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h llvm/trunk/include/llvm/Constants.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/trunk/lib/VMCore/AutoUpgrade.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Feb 14 12:15:46 2011 @@ -17,8 +17,8 @@ class APInt; /// ArrayRef - Represent a constant reference to an array (0 or more elements - /// consecutively in memory), i.e. a start pointer and a length. It allows - /// various APIs to take consecutive elements easily and conveniently. + /// consequtively in memory), i.e. a start pointer and a length. It allows + /// various APIs to take consequtive elements easily and conveniently. /// /// This class does not own the underlying data, it is expected to be used in /// situations where the data resides in some other buffer, whose lifetime Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Mon Feb 14 12:15:46 2011 @@ -25,7 +25,7 @@ #include "llvm/OperandTraits.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/APFloat.h" -#include "llvm/ADT/ArrayRef.h" +#include namespace llvm { @@ -39,6 +39,8 @@ struct ConstantCreator; template struct ConvertConstantType; +template +class SmallVector; //===----------------------------------------------------------------------===// /// This is the shared class of boolean and integer constants. This class @@ -471,9 +473,9 @@ ConstantVector(const VectorType *T, const std::vector &Val); public: // ConstantVector accessors - static Constant *get(ArrayRef V); - // FIXME: Eliminate this constructor form. static Constant *get(const VectorType *T, const std::vector &V); + static Constant *get(const std::vector &V); + static Constant *get(Constant *const *Vals, unsigned NumVals); /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Feb 14 12:15:46 2011 @@ -54,7 +54,7 @@ // vector so the code below can handle it uniformly. if (isa(C) || isa(C)) { Constant *Ops = C; // don't take the address of C! - return FoldBitCast(ConstantVector::get(Ops), DestTy, TD); + return FoldBitCast(ConstantVector::get(&Ops, 1), DestTy, TD); } // If this is a bitcast from constant vector -> vector, fold it. @@ -167,7 +167,7 @@ } } - return ConstantVector::get(Result); + return ConstantVector::get(Result.data(), Result.size()); } Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Feb 14 12:15:46 2011 @@ -2079,7 +2079,7 @@ "vector element #" + Twine(i) + " is not of type '" + Elts[0]->getType()->getDescription()); - ID.ConstantVal = ConstantVector::get(Elts); + ID.ConstantVal = ConstantVector::get(Elts.data(), Elts.size()); ID.Kind = ValID::t_Constant; return false; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Feb 14 12:15:46 2011 @@ -298,7 +298,7 @@ NewC = ConstantStruct::get(Context, &NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); } else if (isa(UserC)) { - NewC = ConstantVector::get(NewOps); + NewC = ConstantVector::get(&NewOps[0], NewOps.size()); } else { assert(isa(UserC) && "Must be a ConstantExpr."); NewC = cast(UserC)->getWithOperands(&NewOps[0], Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 14 12:15:46 2011 @@ -2387,14 +2387,30 @@ void SelectionDAGBuilder::visitFSub(const User &I) { // -0.0 - X --> fneg const Type *Ty = I.getType(); - if (isa(I.getOperand(0)) && - I.getOperand(0) == ConstantFP::getZeroValueForNegation(Ty)) { - SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); - return; + if (Ty->isVectorTy()) { + if (ConstantVector *CV = dyn_cast(I.getOperand(0))) { + const VectorType *DestTy = cast(I.getType()); + const Type *ElTy = DestTy->getElementType(); + unsigned VL = DestTy->getNumElements(); + std::vector NZ(VL, ConstantFP::getNegativeZero(ElTy)); + Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); + if (CV == CNZ) { + SDValue Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2)); + return; + } + } } + if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) + if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { + SDValue Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2)); + return; + } + visitBinary(I, ISD::FSUB); } Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Feb 14 12:15:46 2011 @@ -2257,7 +2257,8 @@ if (Init->getType()->isArrayTy()) return ConstantArray::get(cast(InitTy), Elts); - return ConstantVector::get(Elts); + else + return ConstantVector::get(&Elts[0], Elts.size()); } } Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Mon Feb 14 12:15:46 2011 @@ -1037,8 +1037,11 @@ if (Pred == ICmpInst::ICMP_SLT && CmpLHS->getType() == DestTy) { const Type *EltTy = VTy->getElementType(); - // splat the shift constant to a constant vector. - Constant *VSh = ConstantInt::get(VTy, EltTy->getScalarSizeInBits()-1); + // splat the shift constant to a cosntant vector + Constant *Sh = ConstantInt::get(EltTy, EltTy->getScalarSizeInBits()-1); + std::vector Elts(VTy->getNumElements(), Sh); + Constant *VSh = ConstantVector::get(Elts); + Value *In = Builder->CreateAShr(CmpLHS, VSh,CmpLHS->getName()+".lobit"); return ReplaceInstUsesWith(CI, In); } @@ -1387,7 +1390,8 @@ ConstantInt::get(Int32Ty, SrcElts)); } - return new ShuffleVectorInst(InVal, V2, ConstantVector::get(ShuffleMask)); + Constant *Mask = ConstantVector::get(ShuffleMask.data(), ShuffleMask.size()); + return new ShuffleVectorInst(InVal, V2, Mask); } static bool isMultipleOfTypeSize(unsigned Value, const Type *Ty) { Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Feb 14 12:15:46 2011 @@ -1916,7 +1916,7 @@ if (EltTy != ValTy) { unsigned NumElts = cast(ValTy)->getNumElements(); SmallVector Elts(NumElts, StoreVal); - StoreVal = ConstantVector::get(Elts); + StoreVal = ConstantVector::get(&Elts[0], NumElts); } } new StoreInst(StoreVal, EltPtr, MI); Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Mon Feb 14 12:15:46 2011 @@ -859,7 +859,7 @@ for (unsigned i = 0; i != 8; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value *SV = ConstantVector::get(Indices); + Value *SV = ConstantVector::get(Indices.begin(), Indices.size()); Rep = Builder.CreateShuffleVector(Op2, Op1, SV, "palignr"); Rep = Builder.CreateBitCast(Rep, F->getReturnType()); } @@ -915,7 +915,7 @@ for (unsigned i = 0; i != 16; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value *SV = ConstantVector::get(Indices); + Value *SV = ConstantVector::get(Indices.begin(), Indices.size()); Rep = Builder.CreateShuffleVector(Op2, Op1, SV, "palignr"); Rep = Builder.CreateBitCast(Rep, F->getReturnType()); } Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Feb 14 12:15:46 2011 @@ -150,7 +150,7 @@ // This allows for other simplifications (although some of them // can only be handled by Analysis/ConstantFolding.cpp). if (isa(V) || isa(V)) - return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy); + return ConstantExpr::getBitCast(ConstantVector::get(&V, 1), DestPTy); } // Finally, implement bitcast folding now. The code below doesn't handle @@ -873,7 +873,7 @@ Result.push_back(InElt); } - return ConstantVector::get(Result); + return ConstantVector::get(&Result[0], Result.size()); } Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg, @@ -1947,11 +1947,11 @@ // If we can constant fold the comparison of each element, constant fold // the whole vector comparison. SmallVector ResElts; - // Compare the elements, producing an i1 result or constant expr. - for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) + for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) { + // Compare the elements, producing an i1 result or constant expr. ResElts.push_back(ConstantExpr::getCompare(pred, C1Elts[i], C2Elts[i])); - - return ConstantVector::get(ResElts); + } + return ConstantVector::get(&ResElts[0], ResElts.size()); } if (C1->getType()->isFloatingPointTy()) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Feb 14 12:15:46 2011 @@ -94,7 +94,7 @@ return ConstantInt::get(Ty->getContext(), APInt::getAllOnesValue(ITy->getBitWidth())); - SmallVector Elts; + std::vector Elts; const VectorType *VTy = cast(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); assert(Elts[0] && "Not a vector integer type!"); @@ -302,8 +302,8 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) - return ConstantVector::get(SmallVector(VTy->getNumElements(), C)); + return ConstantVector::get( + std::vector(VTy->getNumElements(), C)); return C; } @@ -329,7 +329,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - SmallVector(VTy->getNumElements(), C)); + std::vector(VTy->getNumElements(), C)); return C; } @@ -372,7 +372,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - SmallVector(VTy->getNumElements(), C)); + std::vector(VTy->getNumElements(), C)); return C; } @@ -387,7 +387,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - SmallVector(VTy->getNumElements(), C)); + std::vector(VTy->getNumElements(), C)); return C; } @@ -404,9 +404,9 @@ Constant *ConstantFP::getZeroValueForNegation(const Type* Ty) { if (const VectorType *PTy = dyn_cast(Ty)) if (PTy->getElementType()->isFloatingPointTy()) { - SmallVector zeros(PTy->getNumElements(), + std::vector zeros(PTy->getNumElements(), getNegativeZero(PTy->getElementType())); - return ConstantVector::get(zeros); + return ConstantVector::get(PTy, zeros); } if (Ty->isFloatingPointTy()) @@ -601,12 +601,13 @@ } // ConstantVector accessors. -Constant *ConstantVector::get(const VectorType *T, - const std::vector &V) { +Constant *ConstantVector::get(const VectorType* T, + const std::vector& V) { assert(!V.empty() && "Vectors can't be empty"); - LLVMContextImpl *pImpl = T->getContext().pImpl; + LLVMContext &Context = T->getContext(); + LLVMContextImpl *pImpl = Context.pImpl; - // If this is an all-undef or all-zero vector, return a + // If this is an all-undef or alll-zero vector, return a // ConstantAggregateZero or UndefValue. Constant *C = V[0]; bool isZero = C->isNullValue(); @@ -628,10 +629,14 @@ return pImpl->VectorConstants.getOrCreate(T, V); } -Constant *ConstantVector::get(ArrayRef V) { +Constant *ConstantVector::get(const std::vector& V) { + assert(!V.empty() && "Cannot infer type if V is empty"); + return get(VectorType::get(V.front()->getType(),V.size()), V); +} + +Constant *ConstantVector::get(Constant *const* Vals, unsigned NumVals) { // FIXME: make this the primary ctor method. - assert(!V.empty() && "Vectors cannot be empty"); - return get(VectorType::get(V.front()->getType(), V.size()), V.vec()); + return get(std::vector(Vals, Vals+NumVals)); } // Utility function for determining if a ConstantExpr is a CastOp or not. This Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=125504&r1=125503&r2=125504&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Mon Feb 14 12:15:46 2011 @@ -629,8 +629,8 @@ Packed); } LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) { - return wrap(ConstantVector::get(ArrayRef( - unwrap(ScalarConstantVals, Size), Size))); + return wrap(ConstantVector::get( + unwrap(ScalarConstantVals, Size), Size)); } /*--.. Constant expressions ................................................--*/ @@ -647,62 +647,74 @@ } LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNeg(unwrap(ConstantVal))); + return wrap(ConstantExpr::getNeg( + unwrap(ConstantVal))); } LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNSWNeg(unwrap(ConstantVal))); + return wrap(ConstantExpr::getNSWNeg( + unwrap(ConstantVal))); } LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNUWNeg(unwrap(ConstantVal))); + return wrap(ConstantExpr::getNUWNeg( + unwrap(ConstantVal))); } LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getFNeg(unwrap(ConstantVal))); + return wrap(ConstantExpr::getFNeg( + unwrap(ConstantVal))); } LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNot(unwrap(ConstantVal))); + return wrap(ConstantExpr::getNot( + unwrap(ConstantVal))); } LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAdd(unwrap(LHSConstant), + return wrap(ConstantExpr::getAdd( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWAdd(unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWAdd( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWAdd(unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWAdd( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFAdd(unwrap(LHSConstant), + return wrap(ConstantExpr::getFAdd( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSub(unwrap(LHSConstant), + return wrap(ConstantExpr::getSub( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWSub(unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWSub( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWSub(unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWSub( + unwrap(LHSConstant), unwrap(RHSConstant))); } @@ -712,75 +724,89 @@ } LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getMul(unwrap(LHSConstant), + return wrap(ConstantExpr::getMul( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWMul(unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWMul( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWMul(unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWMul( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFMul(unwrap(LHSConstant), + return wrap(ConstantExpr::getFMul( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getUDiv(unwrap(LHSConstant), + return wrap(ConstantExpr::getUDiv( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSDiv(unwrap(LHSConstant), + return wrap(ConstantExpr::getSDiv( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getExactSDiv(unwrap(LHSConstant), + return wrap(ConstantExpr::getExactSDiv( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFDiv(unwrap(LHSConstant), + return wrap(ConstantExpr::getFDiv( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getURem(unwrap(LHSConstant), + return wrap(ConstantExpr::getURem( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSRem(unwrap(LHSConstant), + return wrap(ConstantExpr::getSRem( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFRem(unwrap(LHSConstant), + return wrap(ConstantExpr::getFRem( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAnd(unwrap(LHSConstant), + return wrap(ConstantExpr::getAnd( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getOr(unwrap(LHSConstant), + return wrap(ConstantExpr::getOr( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getXor(unwrap(LHSConstant), + return wrap(ConstantExpr::getXor( + unwrap(LHSConstant), unwrap(RHSConstant))); } @@ -799,23 +825,27 @@ } LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getShl(unwrap(LHSConstant), - unwrap(RHSConstant))); + return wrap(ConstantExpr::getShl( + unwrap(LHSConstant), + unwrap(RHSConstant))); } LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getLShr(unwrap(LHSConstant), + return wrap(ConstantExpr::getLShr( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAShr(unwrap(LHSConstant), + return wrap(ConstantExpr::getAShr( + unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices) { - return wrap(ConstantExpr::getGetElementPtr(unwrap(ConstantVal), + return wrap(ConstantExpr::getGetElementPtr( + unwrap(ConstantVal), unwrap(ConstantIndices, NumIndices), NumIndices)); @@ -830,32 +860,38 @@ } LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getTrunc(unwrap(ConstantVal), + return wrap(ConstantExpr::getTrunc( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExt(unwrap(ConstantVal), + return wrap(ConstantExpr::getSExt( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExt(unwrap(ConstantVal), + return wrap(ConstantExpr::getZExt( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPTrunc(unwrap(ConstantVal), + return wrap(ConstantExpr::getFPTrunc( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPExtend(unwrap(ConstantVal), + return wrap(ConstantExpr::getFPExtend( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getUIToFP(unwrap(ConstantVal), + return wrap(ConstantExpr::getUIToFP( + unwrap(ConstantVal), unwrap(ToType))); } @@ -870,78 +906,92 @@ } LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPToSI(unwrap(ConstantVal), + return wrap(ConstantExpr::getFPToSI( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getPtrToInt(unwrap(ConstantVal), + return wrap(ConstantExpr::getPtrToInt( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getIntToPtr(unwrap(ConstantVal), + return wrap(ConstantExpr::getIntToPtr( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getBitCast(unwrap(ConstantVal), + return wrap(ConstantExpr::getBitCast( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExtOrBitCast(unwrap(ConstantVal), + return wrap(ConstantExpr::getZExtOrBitCast( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExtOrBitCast(unwrap(ConstantVal), + return wrap(ConstantExpr::getSExtOrBitCast( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getTruncOrBitCast(unwrap(ConstantVal), + return wrap(ConstantExpr::getTruncOrBitCast( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getPointerCast(unwrap(ConstantVal), + return wrap(ConstantExpr::getPointerCast( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned) { - return wrap(ConstantExpr::getIntegerCast(unwrap(ConstantVal), - unwrap(ToType), isSigned)); + return wrap(ConstantExpr::getIntegerCast( + unwrap(ConstantVal), + unwrap(ToType), + isSigned)); } LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPCast(unwrap(ConstantVal), + return wrap(ConstantExpr::getFPCast( + unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, LLVMValueRef ConstantIfTrue, LLVMValueRef ConstantIfFalse) { - return wrap(ConstantExpr::getSelect(unwrap(ConstantCondition), + return wrap(ConstantExpr::getSelect( + unwrap(ConstantCondition), unwrap(ConstantIfTrue), unwrap(ConstantIfFalse))); } LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getExtractElement(unwrap(VectorConstant), + return wrap(ConstantExpr::getExtractElement( + unwrap(VectorConstant), unwrap(IndexConstant))); } LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getInsertElement(unwrap(VectorConstant), + return wrap(ConstantExpr::getInsertElement( + unwrap(VectorConstant), unwrap(ElementValueConstant), unwrap(IndexConstant))); } @@ -949,21 +999,24 @@ LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant) { - return wrap(ConstantExpr::getShuffleVector(unwrap(VectorAConstant), + return wrap(ConstantExpr::getShuffleVector( + unwrap(VectorAConstant), unwrap(VectorBConstant), unwrap(MaskConstant))); } LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList, unsigned NumIdx) { - return wrap(ConstantExpr::getExtractValue(unwrap(AggConstant), + return wrap(ConstantExpr::getExtractValue( + unwrap(AggConstant), IdxList, NumIdx)); } LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef ElementValueConstant, unsigned *IdxList, unsigned NumIdx) { - return wrap(ConstantExpr::getInsertValue(unwrap(AggConstant), + return wrap(ConstantExpr::getInsertValue( + unwrap(AggConstant), unwrap(ElementValueConstant), IdxList, NumIdx)); } From hkultala at iki.fi Mon Feb 14 13:11:08 2011 From: hkultala at iki.fi (Heikki Kultala) Date: Mon, 14 Feb 2011 21:11:08 +0200 Subject: [llvm-commits] patch: fix broken code generation with r125471 and newer when preferred alignment of some data type is is bigger than stack alignment Message-ID: <8E2B3382-17E2-4E2B-9507-D18D96BC5893@iki.fi> A non-text attachment was scrubbed... Name: stackalign.patch Type: application/octet-stream Size: 943 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/a7e965fa/attachment.obj -------------- next part -------------- From ofv at wanadoo.es Mon Feb 14 14:13:58 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Mon, 14 Feb 2011 20:13:58 -0000 Subject: [llvm-commits] [llvm] r125513 - /llvm/trunk/CMakeLists.txt Message-ID: <20110214201358.4C9522A6C12C@llvm.org> Author: ofv Date: Mon Feb 14 14:13:58 2011 New Revision: 125513 URL: http://llvm.org/viewvc/llvm-project?rev=125513&view=rev Log: Add current binary and source directories to the header search list for all compiler invocations. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=125513&r1=125512&r2=125513&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Mon Feb 14 14:13:58 2011 @@ -169,6 +169,8 @@ option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR}) if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) From daniel at zuster.org Mon Feb 14 14:14:25 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 14 Feb 2011 20:14:25 -0000 Subject: [llvm-commits] [test-suite] r125515 - in /test-suite/trunk: Makefile.config.in autoconf/configure.ac Message-ID: <20110214201425.5DA532A6C12C@llvm.org> Author: ddunbar Date: Mon Feb 14 14:14:25 2011 New Revision: 125515 URL: http://llvm.org/viewvc/llvm-project?rev=125515&view=rev Log: test-suite: Check target configure information so that we can initialize TARGET_OS and friends appropriately when running --without-llvm. - This is totally bogus, naturally, but matches existing bogus behavior. Modified: test-suite/trunk/Makefile.config.in test-suite/trunk/autoconf/configure.ac Modified: test-suite/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.config.in?rev=125515&r1=125514&r2=125515&view=diff ============================================================================== --- test-suite/trunk/Makefile.config.in (original) +++ test-suite/trunk/Makefile.config.in Mon Feb 14 14:14:25 2011 @@ -56,6 +56,11 @@ SED := sed TCLSH := tclsh +# Configure parameters. +TARGET_OS := @TARGET_OS@ +ARCH := @ARCH@ +ENDIAN := @ENDIAN@ + endif # Ignore the LIBS set by $(LLVM_OBJ_ROOT)/Makefile.config Modified: test-suite/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/autoconf/configure.ac?rev=125515&r1=125514&r2=125515&view=diff ============================================================================== --- test-suite/trunk/autoconf/configure.ac (original) +++ test-suite/trunk/autoconf/configure.ac Mon Feb 14 14:14:25 2011 @@ -48,6 +48,101 @@ AC_CONFIG_MAKEFILE(SingleSource/Makefile.singlesrc) AC_CONFIG_MAKEFILE(tools/Makefile) +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 2: Architecture, target, and host checks +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl Check the target for which we're compiling and the host that will do the +dnl compilations. This will tell us which LLVM compiler will be used for +dnl compiling SSA into object code. This needs to be done early because +dnl following tests depend on it. +AC_CANONICAL_TARGET + +AC_CACHE_CHECK([type of operating system we're going to target], + [llvm_cv_target_os_type], +[case $target in + *-*-aix*) + llvm_cv_target_os_type="AIX" ;; + *-*-irix*) + llvm_cv_target_os_type="IRIX" ;; + *-*-cygwin*) + llvm_cv_target_os_type="Cygwin" ;; + *-*-darwin*) + llvm_cv_target_os_type="Darwin" ;; + *-*-minix*) + llvm_cv_target_os_type="Minix" ;; + *-*-freebsd*) + llvm_cv_target_os_type="FreeBSD" ;; + *-*-openbsd*) + llvm_cv_target_os_type="OpenBSD" ;; + *-*-netbsd*) + llvm_cv_target_os_type="NetBSD" ;; + *-*-dragonfly*) + llvm_cv_target_os_type="DragonFly" ;; + *-*-hpux*) + llvm_cv_target_os_type="HP-UX" ;; + *-*-interix*) + llvm_cv_target_os_type="Interix" ;; + *-*-linux*) + llvm_cv_target_os_type="Linux" ;; + *-*-solaris*) + llvm_cv_target_os_type="SunOS" ;; + *-*-auroraux*) + llvm_cv_target_os_type="AuroraUX" ;; + *-*-win32*) + llvm_cv_target_os_type="Win32" ;; + *-*-mingw*) + llvm_cv_target_os_type="MingW" ;; + *-*-haiku*) + llvm_cv_target_os_type="Haiku" ;; + *-unknown-eabi*) + llvm_cv_target_os_type="Freestanding" ;; + *) + llvm_cv_target_os_type="Unknown" ;; +esac]) + +dnl Set the "TARGET_OS" Makefile variable based on the target type. +AC_SUBST(TARGET_OS,$llvm_cv_target_os_type) + +dnl Determine what our target architecture is and configure accordingly. +dnl This will allow Makefiles to make a distinction between the hardware and +dnl the OS. +AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch], +[case $target in + i?86-*) llvm_cv_target_arch="x86" ;; + amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;; + sparc*-*) llvm_cv_target_arch="Sparc" ;; + powerpc*-*) llvm_cv_target_arch="PowerPC" ;; + alpha*-*) llvm_cv_target_arch="Alpha" ;; + arm*-*) llvm_cv_target_arch="ARM" ;; + mips-*) llvm_cv_target_arch="Mips" ;; + xcore-*) llvm_cv_target_arch="XCore" ;; + msp430-*) llvm_cv_target_arch="MSP430" ;; + s390x-*) llvm_cv_target_arch="SystemZ" ;; + bfin-*) llvm_cv_target_arch="Blackfin" ;; + mblaze-*) llvm_cv_target_arch="MBlaze" ;; + ptx-*) llvm_cv_target_arch="PTX" ;; + *) llvm_cv_target_arch="Unknown" ;; +esac]) +if test "$llvm_cv_target_arch" = "Unknown" ; then + AC_MSG_WARN([Configuring LLVM for an unknown target archicture]) +fi + +# Determine the LLVM native architecture for the target +case "$llvm_cv_target_arch" in + x86) LLVM_NATIVE_ARCH="X86" ;; + x86_64) LLVM_NATIVE_ARCH="X86" ;; + *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;; +esac + +dnl Define a substitution, ARCH, for the target architecture +AC_SUBST(ARCH,$llvm_cv_target_arch) + +dnl Check for the endianness of the target +AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) + dnl ************************************************************************** dnl * Get command line options dnl ************************************************************************** From daniel at zuster.org Mon Feb 14 14:14:27 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 14 Feb 2011 20:14:27 -0000 Subject: [llvm-commits] [test-suite] r125516 - /test-suite/trunk/configure Message-ID: <20110214201428.060792A6C12D@llvm.org> Author: ddunbar Date: Mon Feb 14 14:14:27 2011 New Revision: 125516 URL: http://llvm.org/viewvc/llvm-project?rev=125516&view=rev Log: Regenerate. Modified: test-suite/trunk/configure Modified: test-suite/trunk/configure URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/configure?rev=125516&r1=125515&r2=125516&view=diff ============================================================================== --- test-suite/trunk/configure (original) +++ test-suite/trunk/configure Mon Feb 14 14:14:27 2011 @@ -791,6 +791,31 @@ build_alias host_alias target_alias +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +target +target_cpu +target_vendor +target_os +TARGET_OS +ARCH +ENDIAN +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP LLVM_SRC LLVM_OBJ LLVM_EXTERNALS @@ -819,26 +844,8 @@ DISABLE_LLC_DIFFS CXX CXXFLAGS -LDFLAGS -CPPFLAGS ac_ct_CXX -EXEEXT -OBJEXT -CC -CFLAGS -ac_ct_CC -CPP ifGNUmake -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -GREP -EGREP LN_S ECHO AR @@ -869,14 +876,14 @@ ac_precious_vars='build_alias host_alias target_alias -CXX -CXXFLAGS -LDFLAGS -CPPFLAGS -CCC CC CFLAGS +LDFLAGS +CPPFLAGS CPP +CXX +CXXFLAGS +CCC CXXCPP F77 FFLAGS' @@ -1442,6 +1449,7 @@ System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi @@ -1487,15 +1495,15 @@ Specify that the nag-fortran includes are in DIR Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags @@ -2083,625 +2091,948 @@ +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } -# Check whether --with-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval=$with_llvmsrc; LLVM_SRC=$withval - +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - LLVM_SRC=`cd ${srcdir}/../..; pwd` + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - -# Check whether --with-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval=$with_llvmobj; LLVM_OBJ=$withval - +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - LLVM_OBJ=`cd ../..; pwd` - -fi - - - -# Check whether --with-externals was given. -if test "${with_externals+set}" = set; then - withval=$with_externals; LLVM_EXTERNALS=$withval - + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build else - LLVM_EXTERNALS=$LLVM_SRC/projects/test-suite-externals - + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -{ echo "$as_me:$LINENO: checking for spec95 benchmark sources" >&5 -echo $ECHO_N "checking for spec95 benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/spec95/benchspec" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/spec95/benchspec/" ; then - SPEC95_ROOT=${LLVM_EXTERNALS}/spec95/benchspec - - USE_SPEC95=USE_SPEC95=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/spec95/benchspec" - else - checkresult="no" - fi - else - SPEC95_ROOT=${LLVM_EXTERNALS}/spec95/benchspec - - USE_SPEC95=USE_SPEC95=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/spec95/benchspec" - fi +{ echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6; } +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - checkresult="no" + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} + { (exit 1); exit 1; }; } fi -if test "$checkresult" = "no" ; then - - checkresult="no, not found in ${LLVM_EXTERNALS}/spec95/benchspec" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - +{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +{ echo "$as_me:$LINENO: checking type of operating system we're going to target" >&5 +echo $ECHO_N "checking type of operating system we're going to target... $ECHO_C" >&6; } +if test "${llvm_cv_target_os_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $target in + *-*-aix*) + llvm_cv_target_os_type="AIX" ;; + *-*-irix*) + llvm_cv_target_os_type="IRIX" ;; + *-*-cygwin*) + llvm_cv_target_os_type="Cygwin" ;; + *-*-darwin*) + llvm_cv_target_os_type="Darwin" ;; + *-*-minix*) + llvm_cv_target_os_type="Minix" ;; + *-*-freebsd*) + llvm_cv_target_os_type="FreeBSD" ;; + *-*-openbsd*) + llvm_cv_target_os_type="OpenBSD" ;; + *-*-netbsd*) + llvm_cv_target_os_type="NetBSD" ;; + *-*-dragonfly*) + llvm_cv_target_os_type="DragonFly" ;; + *-*-hpux*) + llvm_cv_target_os_type="HP-UX" ;; + *-*-interix*) + llvm_cv_target_os_type="Interix" ;; + *-*-linux*) + llvm_cv_target_os_type="Linux" ;; + *-*-solaris*) + llvm_cv_target_os_type="SunOS" ;; + *-*-auroraux*) + llvm_cv_target_os_type="AuroraUX" ;; + *-*-win32*) + llvm_cv_target_os_type="Win32" ;; + *-*-mingw*) + llvm_cv_target_os_type="MingW" ;; + *-*-haiku*) + llvm_cv_target_os_type="Haiku" ;; + *-unknown-eabi*) + llvm_cv_target_os_type="Freestanding" ;; + *) + llvm_cv_target_os_type="Unknown" ;; +esac +fi +{ echo "$as_me:$LINENO: result: $llvm_cv_target_os_type" >&5 +echo "${ECHO_T}$llvm_cv_target_os_type" >&6; } +TARGET_OS=$llvm_cv_target_os_type -{ echo "$as_me:$LINENO: checking for spec2000 benchmark sources" >&5 -echo $ECHO_N "checking for spec2000 benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/speccpu2000/benchspec" ; then - if test -n "CINT2000" ; then - if test -e "${LLVM_EXTERNALS}/speccpu2000/benchspec/CINT2000" ; then - SPEC2000_ROOT=${LLVM_EXTERNALS}/speccpu2000/benchspec - USE_SPEC2000=USE_SPEC2000=1 +{ echo "$as_me:$LINENO: checking target architecture" >&5 +echo $ECHO_N "checking target architecture... $ECHO_C" >&6; } +if test "${llvm_cv_target_arch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $target in + i?86-*) llvm_cv_target_arch="x86" ;; + amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;; + sparc*-*) llvm_cv_target_arch="Sparc" ;; + powerpc*-*) llvm_cv_target_arch="PowerPC" ;; + alpha*-*) llvm_cv_target_arch="Alpha" ;; + arm*-*) llvm_cv_target_arch="ARM" ;; + mips-*) llvm_cv_target_arch="Mips" ;; + xcore-*) llvm_cv_target_arch="XCore" ;; + msp430-*) llvm_cv_target_arch="MSP430" ;; + s390x-*) llvm_cv_target_arch="SystemZ" ;; + bfin-*) llvm_cv_target_arch="Blackfin" ;; + mblaze-*) llvm_cv_target_arch="MBlaze" ;; + ptx-*) llvm_cv_target_arch="PTX" ;; + *) llvm_cv_target_arch="Unknown" ;; +esac +fi +{ echo "$as_me:$LINENO: result: $llvm_cv_target_arch" >&5 +echo "${ECHO_T}$llvm_cv_target_arch" >&6; } +if test "$llvm_cv_target_arch" = "Unknown" ; then + { echo "$as_me:$LINENO: WARNING: Configuring LLVM for an unknown target archicture" >&5 +echo "$as_me: WARNING: Configuring LLVM for an unknown target archicture" >&2;} +fi + +# Determine the LLVM native architecture for the target +case "$llvm_cv_target_arch" in + x86) LLVM_NATIVE_ARCH="X86" ;; + x86_64) LLVM_NATIVE_ARCH="X86" ;; + *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;; +esac - checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2000/benchspec" - else - checkresult="no" - fi - else - SPEC2000_ROOT=${LLVM_EXTERNALS}/speccpu2000/benchspec +ARCH=$llvm_cv_target_arch - USE_SPEC2000=USE_SPEC2000=1 - checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2000/benchspec" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - checkresult="no" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -if test "$checkresult" = "no" ; then - checkresult="no, not found in ${LLVM_EXTERNALS}/speccpu2000/benchspec" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - - - - -{ echo "$as_me:$LINENO: checking for spec2006 benchmark sources" >&5 -echo $ECHO_N "checking for spec2006 benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/speccpu2006/benchspec" ; then - if test -n "CPU2006" ; then - if test -e "${LLVM_EXTERNALS}/speccpu2006/benchspec/CPU2006" ; then - SPEC2006_ROOT=${LLVM_EXTERNALS}/speccpu2006/benchspec +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS - USE_SPEC2006=USE_SPEC2006=1 +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi - checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2006/benchspec" - else - checkresult="no" - fi + if test "x$ac_ct_CC" = x; then + CC="" else - SPEC2006_ROOT=${LLVM_EXTERNALS}/speccpu2006/benchspec - - USE_SPEC2006=USE_SPEC2006=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2006/benchspec" + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC fi else - checkresult="no" + CC="$ac_cv_prog_CC" fi -if test "$checkresult" = "no" ; then +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS - checkresult="no, not found in ${LLVM_EXTERNALS}/speccpu2006/benchspec" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - - - - -{ echo "$as_me:$LINENO: checking for povray benchmark sources" >&5 -echo $ECHO_N "checking for povray benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/povray31" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/povray31/" ; then - POVRAY_ROOT=${LLVM_EXTERNALS}/povray31 - - USE_POVRAY=USE_POVRAY=1 +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi - checkresult="yes, found in ${LLVM_EXTERNALS}/povray31" - else - checkresult="no" - fi - else - POVRAY_ROOT=${LLVM_EXTERNALS}/povray31 - USE_POVRAY=USE_POVRAY=1 + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS - checkresult="yes, found in ${LLVM_EXTERNALS}/povray31" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - checkresult="no" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -if test "$checkresult" = "no" ; then - checkresult="no, not found in ${LLVM_EXTERNALS}/povray31" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi -{ echo "$as_me:$LINENO: checking for namd benchmark sources" >&5 -echo $ECHO_N "checking for namd benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/spec_namd" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/spec_namd/" ; then - NAMD_ROOT=${LLVM_EXTERNALS}/spec_namd + test -n "$ac_ct_CC" && break +done - USE_NAMD=USE_NAMD=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/spec_namd" - else - checkresult="no" - fi + if test "x$ac_ct_CC" = x; then + CC="" else - NAMD_ROOT=${LLVM_EXTERNALS}/spec_namd - - USE_NAMD=USE_NAMD=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/spec_namd" + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC fi -else - checkresult="no" fi -if test "$checkresult" = "no" ; then - - checkresult="no, not found in ${LLVM_EXTERNALS}/spec_namd" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -{ echo "$as_me:$LINENO: checking for sweep3d benchmark sources" >&5 -echo $ECHO_N "checking for sweep3d benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/sweep3d" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/sweep3d/" ; then - SWEEP3D_ROOT=${LLVM_EXTERNALS}/sweep3d +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - USE_SWEEP3D=USE_SWEEP3D=1 +int +main () +{ - checkresult="yes, found in ${LLVM_EXTERNALS}/sweep3d" - else - checkresult="no" - fi - else - SWEEP3D_ROOT=${LLVM_EXTERNALS}/sweep3d + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles - USE_SWEEP3D=USE_SWEEP3D=1 +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= - checkresult="yes, found in ${LLVM_EXTERNALS}/sweep3d" - fi else - checkresult="no" -fi -if test "$checkresult" = "no" ; then - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - checkresult="no, not found in ${LLVM_EXTERNALS}/sweep3d" +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - - - - -{ echo "$as_me:$LINENO: checking for fpgrowth benchmark sources" >&5 -echo $ECHO_N "checking for fpgrowth benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/fpgrowth" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/fpgrowth/" ; then - FPGROWTH_ROOT=${LLVM_EXTERNALS}/fpgrowth - USE_FPGROWTH=USE_FPGROWTH=1 +ac_exeext=$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } - checkresult="yes, found in ${LLVM_EXTERNALS}/fpgrowth" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes else - checkresult="no" + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi - else - FPGROWTH_ROOT=${LLVM_EXTERNALS}/fpgrowth - - USE_FPGROWTH=USE_FPGROWTH=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/fpgrowth" fi -else - checkresult="no" -fi -if test "$checkresult" = "no" ; then - - - checkresult="no, not found in ${LLVM_EXTERNALS}/fpgrowth" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - - +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } -{ echo "$as_me:$LINENO: checking for alp benchmark sources" >&5 -echo $ECHO_N "checking for alp benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/alp" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/alp/" ; then - ALP_ROOT=${LLVM_EXTERNALS}/alp - - USE_ALP=USE_ALP=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/alp" - else - checkresult="no" - fi - else - ALP_ROOT=${LLVM_EXTERNALS}/alp - - USE_ALP=USE_ALP=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/alp" - fi +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done else - checkresult="no" -fi -if test "$checkresult" = "no" ; then - - - checkresult="no, not found in ${LLVM_EXTERNALS}/alp" + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - - - - -{ echo "$as_me:$LINENO: checking for nurbs benchmark sources" >&5 -echo $ECHO_N "checking for nurbs benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/nurbs" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/nurbs/" ; then - NURBS_ROOT=${LLVM_EXTERNALS}/nurbs - USE_NURBS=USE_NURBS=1 +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } - checkresult="yes, found in ${LLVM_EXTERNALS}/nurbs" - else - checkresult="no" - fi - else - NURBS_ROOT=${LLVM_EXTERNALS}/nurbs +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - USE_NURBS=USE_NURBS=1 +int +main () +{ - checkresult="yes, found in ${LLVM_EXTERNALS}/nurbs" - fi + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done else - checkresult="no" -fi -if test "$checkresult" = "no" ; then - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - checkresult="no, not found in ${LLVM_EXTERNALS}/nurbs" +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - - - -{ echo "$as_me:$LINENO: checking for hmmer benchmark sources" >&5 -echo $ECHO_N "checking for hmmer benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/hmmer" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/hmmer/" ; then - HMMER_ROOT=${LLVM_EXTERNALS}/hmmer - - USE_HMMER=USE_HMMER=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/hmmer" - else - checkresult="no" - fi - else - HMMER_ROOT=${LLVM_EXTERNALS}/hmmer +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - USE_HMMER=USE_HMMER=1 +int +main () +{ +#ifndef __GNUC__ + choke me +#endif - checkresult="yes, found in ${LLVM_EXTERNALS}/hmmer" - fi + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - checkresult="no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no fi -if test "$checkresult" = "no" ; then +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu - checkresult="no, not found in ${LLVM_EXTERNALS}/hmmer" fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ - - - - - -{ echo "$as_me:$LINENO: checking for skidmarks10 benchmark sources" >&5 -echo $ECHO_N "checking for skidmarks10 benchmark sources... $ECHO_C" >&6; } -if test -d "${LLVM_EXTERNALS}/skidmarks10" ; then - if test -n "" ; then - if test -e "${LLVM_EXTERNALS}/skidmarks10/" ; then - SKIDMARKS10_ROOT=${LLVM_EXTERNALS}/skidmarks10 - - USE_SKIDMARKS10=USE_SKIDMARKS10=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/skidmarks10" - else - checkresult="no" - fi - else - SKIDMARKS10_ROOT=${LLVM_EXTERNALS}/skidmarks10 - - USE_SKIDMARKS10=USE_SKIDMARKS10=1 - - checkresult="yes, found in ${LLVM_EXTERNALS}/skidmarks10" - fi -else - checkresult="no" -fi -if test "$checkresult" = "no" ; then - - - checkresult="no, not found in ${LLVM_EXTERNALS}/skidmarks10" -fi -{ echo "$as_me:$LINENO: result: $checkresult" >&5 -echo "${ECHO_T}$checkresult" >&6; } - - - - - -# Check whether --enable-llc_diffs was given. -if test "${enable_llc_diffs+set}" = set; then - enableval=$enable_llc_diffs; -else - enableval=yes -fi - -if test ${enableval} = "no" -then - DISABLE_LLC_DIFFS=DISABLE_LLC_DIFFS:=1 - -else - DISABLE_LLC_DIFFS= - -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf at gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf at gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2716,98 +3047,21 @@ return 0; } _ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 -echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 -echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -2816,136 +3070,25 @@ (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done + (exit $ac_status); }; }; then + : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2955,9 +3098,6 @@ int main () { -#ifndef __GNUC__ - choke me -#endif ; return 0; @@ -2977,7 +3117,7 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -2997,103 +3137,109 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_compiler_gnu=yes + ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_compiler_gnu=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -int -main () +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; { - - ; - return 0; + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; } -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - CXXFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; int main () { - +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF -rm -f conftest.$ac_objext +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; @@ -3107,7 +3253,7 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -3127,255 +3273,467 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + # Passes both tests. +ac_preproc_ok=: +break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi +rm -f conftest.err conftest.$ac_ext -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag + done + ac_cv_prog_CPP=$CPP + fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi + CPP=$ac_cv_prog_CPP else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in gcc - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done done + done IFS=$as_save_IFS + fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + ac_cv_path_GREP=$GREP fi - test -n "$CC" && break - done fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in gcc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done done - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf at gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf at gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi +done +IFS=$as_save_IFS -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } +fi -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } +else + ac_cv_path_EGREP=$EGREP +fi -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -3384,13 +3742,14 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include +#include +#include int main () { -#ifndef __GNUC__ - choke me -#endif ; return 0; @@ -3430,127 +3789,105 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_compiler_gnu=yes + ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_compiler_gnu=no + ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include -int -main () -{ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* - ; - return 0; -} +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest* - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { - - ; + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -3562,25 +3899,57 @@ (exit $ac_status); }; }; then : else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +$ac_includes_default -int -main () -{ - - ; - return 0; -} +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -3616,109 +3985,56 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then +done + + +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC + # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include #include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +#include -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; int main () { -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + ; return 0; } _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext +rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; @@ -3752,1227 +4068,856 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian #endif - Syntax error + + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_try") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break + ac_cv_c_bigendian=no fi - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no else - ac_cpp_err= + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown fi -else - ac_cpp_err=yes fi -if test -z "$ac_cpp_err"; then - : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext +fi - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) + ENDIAN=big + ;; + no) + ENDIAN=little + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac -{ echo "$as_me:$LINENO: checking for GNU make" >&5 -echo $ECHO_N "checking for GNU make... $ECHO_C" >&6; } -if test "${llvm_cv_gnu_make_command+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + +# Check whether --with-llvmsrc was given. +if test "${with_llvmsrc+set}" = set; then + withval=$with_llvmsrc; LLVM_SRC=$withval + else - llvm_cv_gnu_make_command='' - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) - then - llvm_cv_gnu_make_command=$a ; - break; - fi - done + LLVM_SRC=`cd ${srcdir}/../..; pwd` + fi -{ echo "$as_me:$LINENO: result: $llvm_cv_gnu_make_command" >&5 -echo "${ECHO_T}$llvm_cv_gnu_make_command" >&6; } - if test "x$llvm_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - { echo "$as_me:$LINENO: result: \"Not found\"" >&5 -echo "${ECHO_T}\"Not found\"" >&6; }; - fi -if test -z "$llvm_cv_gnu_make_command" ; then - { { echo "$as_me:$LINENO: error: GNU Make required but not found" >&5 -echo "$as_me: error: GNU Make required but not found" >&2;} - { (exit 1); exit 1; }; } + +# Check whether --with-llvmobj was given. +if test "${with_llvmobj+set}" = set; then + withval=$with_llvmobj; LLVM_OBJ=$withval + +else + LLVM_OBJ=`cd ../..; pwd` + fi -# Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac + + +# Check whether --with-externals was given. +if test "${with_externals+set}" = set; then + withval=$with_externals; LLVM_EXTERNALS=$withval + else - enable_shared=yes + LLVM_EXTERNALS=$LLVM_SRC/projects/test-suite-externals + fi -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac + + + + +{ echo "$as_me:$LINENO: checking for spec95 benchmark sources" >&5 +echo $ECHO_N "checking for spec95 benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/spec95/benchspec" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/spec95/benchspec/" ; then + SPEC95_ROOT=${LLVM_EXTERNALS}/spec95/benchspec + + USE_SPEC95=USE_SPEC95=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/spec95/benchspec" + else + checkresult="no" + fi + else + SPEC95_ROOT=${LLVM_EXTERNALS}/spec95/benchspec + + USE_SPEC95=USE_SPEC95=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/spec95/benchspec" + fi else - enable_static=yes + checkresult="no" fi +if test "$checkresult" = "no" ; then -# Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes + checkresult="no, not found in ${LLVM_EXTERNALS}/spec95/benchspec" fi +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build + + +{ echo "$as_me:$LINENO: checking for spec2000 benchmark sources" >&5 +echo $ECHO_N "checking for spec2000 benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/speccpu2000/benchspec" ; then + if test -n "CINT2000" ; then + if test -e "${LLVM_EXTERNALS}/speccpu2000/benchspec/CINT2000" ; then + SPEC2000_ROOT=${LLVM_EXTERNALS}/speccpu2000/benchspec + + USE_SPEC2000=USE_SPEC2000=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2000/benchspec" + else + checkresult="no" + fi + else + SPEC2000_ROOT=${LLVM_EXTERNALS}/speccpu2000/benchspec + + USE_SPEC2000=USE_SPEC2000=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2000/benchspec" + fi else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } + checkresult="no" fi +if test "$checkresult" = "no" ; then + + checkresult="no, not found in ${LLVM_EXTERNALS}/speccpu2000/benchspec" fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -fi -SED=$lt_cv_path_SED -{ echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6; } -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_GREP_found && break 3 - done -done -done -IFS=$as_save_IFS +{ echo "$as_me:$LINENO: checking for spec2006 benchmark sources" >&5 +echo $ECHO_N "checking for spec2006 benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/speccpu2006/benchspec" ; then + if test -n "CPU2006" ; then + if test -e "${LLVM_EXTERNALS}/speccpu2006/benchspec/CPU2006" ; then + SPEC2006_ROOT=${LLVM_EXTERNALS}/speccpu2006/benchspec + USE_SPEC2006=USE_SPEC2006=1 -fi + checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2006/benchspec" + else + checkresult="no" + fi + else + SPEC2006_ROOT=${LLVM_EXTERNALS}/speccpu2006/benchspec -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi + USE_SPEC2006=USE_SPEC2006=1 + checkresult="yes, found in ${LLVM_EXTERNALS}/speccpu2006/benchspec" + fi else - ac_cv_path_GREP=$GREP + checkresult="no" fi +if test "$checkresult" = "no" ; then + checkresult="no, not found in ${LLVM_EXTERNALS}/speccpu2006/benchspec" fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_EGREP_found && break 3 - done -done -done -IFS=$as_save_IFS + +{ echo "$as_me:$LINENO: checking for povray benchmark sources" >&5 +echo $ECHO_N "checking for povray benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/povray31" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/povray31/" ; then + POVRAY_ROOT=${LLVM_EXTERNALS}/povray31 + + USE_POVRAY=USE_POVRAY=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/povray31" + else + checkresult="no" + fi + else + POVRAY_ROOT=${LLVM_EXTERNALS}/povray31 + + USE_POVRAY=USE_POVRAY=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/povray31" + fi +else + checkresult="no" fi +if test "$checkresult" = "no" ; then -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + + checkresult="no, not found in ${LLVM_EXTERNALS}/povray31" fi +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } + + + + + + + + +{ echo "$as_me:$LINENO: checking for namd benchmark sources" >&5 +echo $ECHO_N "checking for namd benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/spec_namd" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/spec_namd/" ; then + NAMD_ROOT=${LLVM_EXTERNALS}/spec_namd + + USE_NAMD=USE_NAMD=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/spec_namd" + else + checkresult="no" + fi + else + NAMD_ROOT=${LLVM_EXTERNALS}/spec_namd + + USE_NAMD=USE_NAMD=1 + checkresult="yes, found in ${LLVM_EXTERNALS}/spec_namd" + fi else - ac_cv_path_EGREP=$EGREP + checkresult="no" fi +if test "$checkresult" = "no" ; then - fi + checkresult="no, not found in ${LLVM_EXTERNALS}/spec_namd" fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes + + + + + +{ echo "$as_me:$LINENO: checking for sweep3d benchmark sources" >&5 +echo $ECHO_N "checking for sweep3d benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/sweep3d" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/sweep3d/" ; then + SWEEP3D_ROOT=${LLVM_EXTERNALS}/sweep3d + + USE_SWEEP3D=USE_SWEEP3D=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/sweep3d" + else + checkresult="no" + fi + else + SWEEP3D_ROOT=${LLVM_EXTERNALS}/sweep3d + + USE_SWEEP3D=USE_SWEEP3D=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/sweep3d" + fi else - with_gnu_ld=no + checkresult="no" fi +if test "$checkresult" = "no" ; then -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } -else - { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } + + checkresult="no, not found in ${LLVM_EXTERNALS}/sweep3d" fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$checkresult" >&6; } + + + + + + + + +{ echo "$as_me:$LINENO: checking for fpgrowth benchmark sources" >&5 +echo $ECHO_N "checking for fpgrowth benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/fpgrowth" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/fpgrowth/" ; then + FPGROWTH_ROOT=${LLVM_EXTERNALS}/fpgrowth + + USE_FPGROWTH=USE_FPGROWTH=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/fpgrowth" + else + checkresult="no" fi - done - IFS="$lt_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi + else + FPGROWTH_ROOT=${LLVM_EXTERNALS}/fpgrowth -LD="$lt_cv_path_LD" -if test -n "$LD"; then - { echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + USE_FPGROWTH=USE_FPGROWTH=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/fpgrowth" + fi else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld +if test "$checkresult" = "no" ; then -{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 -echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_reload_flag='-r' + checkresult="no, not found in ${LLVM_EXTERNALS}/fpgrowth" fi -{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 -echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r $compiler_flags -o $output$reload_objs' +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } + + + + + + + + +{ echo "$as_me:$LINENO: checking for alp benchmark sources" >&5 +echo $ECHO_N "checking for alp benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/alp" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/alp/" ; then + ALP_ROOT=${LLVM_EXTERNALS}/alp + + USE_ALP=USE_ALP=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/alp" else - reload_cmds='$LD$reload_flag -o $output$reload_objs' + checkresult="no" fi - ;; -esac + else + ALP_ROOT=${LLVM_EXTERNALS}/alp -{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 -echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" + USE_ALP=USE_ALP=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/alp" fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi +else + checkresult="no" fi -{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6; } -NM="$lt_cv_path_NM" +if test "$checkresult" = "no" ; then -{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else - { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6; } + + checkresult="no, not found in ${LLVM_EXTERNALS}/alp" fi +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 -echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; -beos*) - lt_cv_deplibs_check_method=pass_all - ;; -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; -freebsd* | kfreebsd*-gnu | dragonfly*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac +{ echo "$as_me:$LINENO: checking for nurbs benchmark sources" >&5 +echo $ECHO_N "checking for nurbs benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/nurbs" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/nurbs/" ; then + NURBS_ROOT=${LLVM_EXTERNALS}/nurbs + + USE_NURBS=USE_NURBS=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/nurbs" + else + checkresult="no" + fi else - lt_cv_deplibs_check_method=pass_all + NURBS_ROOT=${LLVM_EXTERNALS}/nurbs + + USE_NURBS=USE_NURBS=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/nurbs" fi - ;; +else + checkresult="no" +fi +if test "$checkresult" = "no" ; then -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; + checkresult="no, not found in ${LLVM_EXTERNALS}/nurbs" +fi +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -interix3*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + +{ echo "$as_me:$LINENO: checking for hmmer benchmark sources" >&5 +echo $ECHO_N "checking for hmmer benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/hmmer" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/hmmer/" ; then + HMMER_ROOT=${LLVM_EXTERNALS}/hmmer + + USE_HMMER=USE_HMMER=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/hmmer" + else + checkresult="no" + fi else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + HMMER_ROOT=${LLVM_EXTERNALS}/hmmer + + USE_HMMER=USE_HMMER=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/hmmer" fi - ;; +else + checkresult="no" +fi +if test "$checkresult" = "no" ; then -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; + checkresult="no, not found in ${LLVM_EXTERNALS}/hmmer" +fi +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac + + + + + +{ echo "$as_me:$LINENO: checking for skidmarks10 benchmark sources" >&5 +echo $ECHO_N "checking for skidmarks10 benchmark sources... $ECHO_C" >&6; } +if test -d "${LLVM_EXTERNALS}/skidmarks10" ; then + if test -n "" ; then + if test -e "${LLVM_EXTERNALS}/skidmarks10/" ; then + SKIDMARKS10_ROOT=${LLVM_EXTERNALS}/skidmarks10 + + USE_SKIDMARKS10=USE_SKIDMARKS10=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/skidmarks10" + else + checkresult="no" + fi + else + SKIDMARKS10_ROOT=${LLVM_EXTERNALS}/skidmarks10 + + USE_SKIDMARKS10=USE_SKIDMARKS10=1 + + checkresult="yes, found in ${LLVM_EXTERNALS}/skidmarks10" + fi +else + checkresult="no" +fi +if test "$checkresult" = "no" ; then + + + checkresult="no, not found in ${LLVM_EXTERNALS}/skidmarks10" fi -{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 -echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown +{ echo "$as_me:$LINENO: result: $checkresult" >&5 +echo "${ECHO_T}$checkresult" >&6; } -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} +# Check whether --enable-llc_diffs was given. +if test "${enable_llc_diffs+set}" = set; then + enableval=$enable_llc_diffs; +else + enableval=yes +fi -# Allow CC to be a program name with arguments. -compiler=$CC +if test ${enableval} = "no" +then + DISABLE_LLC_DIFFS=DISABLE_LLC_DIFFS:=1 +else + DISABLE_LLC_DIFFS= -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval=$enable_libtool_lock; fi -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 4879 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - rm -rf conftest* - ;; +done +done +IFS=$as_save_IFS -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 -echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then +{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4982,26 +4927,29 @@ int main () { +#ifndef __GNUC__ + choke me +#endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -5011,7 +4959,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -5021,72 +4969,38 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - lt_cv_cc_needs_belf=yes + ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - lt_cv_cc_needs_belf=no + ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 -echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) LD="${LD-ld} -64" ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - - -esac - -need_locks="$enable_libtool_lock" - - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -#include -#include int main () @@ -5110,7 +5024,7 @@ cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -5130,105 +5044,108 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_header_stdc=yes + ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +int +main () +{ + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; + + ; return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -5238,68 +5155,1572 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - : + ac_cv_prog_cxx_g=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_header_stdc=no + fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in gcc + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in gcc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +{ echo "$as_me:$LINENO: checking for GNU make" >&5 +echo $ECHO_N "checking for GNU make... $ECHO_C" >&6; } +if test "${llvm_cv_gnu_make_command+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + llvm_cv_gnu_make_command='' + for a in "$MAKE" make gmake gnumake ; do + if test -z "$a" ; then continue ; fi ; + if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) + then + llvm_cv_gnu_make_command=$a ; + break; + fi + done +fi +{ echo "$as_me:$LINENO: result: $llvm_cv_gnu_make_command" >&5 +echo "${ECHO_T}$llvm_cv_gnu_make_command" >&6; } + if test "x$llvm_cv_gnu_make_command" != "x" ; then + ifGNUmake='' ; + else + ifGNUmake='#' ; + { echo "$as_me:$LINENO: result: \"Not found\"" >&5 +echo "${ECHO_T}\"Not found\"" >&6; }; + fi + + +if test -z "$llvm_cv_gnu_make_command" ; then + { { echo "$as_me:$LINENO: error: GNU Make required but not found" >&5 +echo "$as_me: error: GNU Make required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + +# Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + +{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + +fi + +SED=$lt_cv_path_SED +{ echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6; } + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + +{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r $compiler_flags -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6; } +NM="$lt_cv_path_NM" + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | kfreebsd*-gnu | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix3*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown -fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} +# Allow CC to be a program name with arguments. +compiler=$CC +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 6605 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +int +main () +{ + + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -5316,7 +6737,7 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -s conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -5326,27 +6747,54 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" + lt_cv_cc_needs_belf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_Header=no" + lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu fi +{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -done + +esac + +need_locks="$enable_libtool_lock" @@ -7041,11 +8489,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7044: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8492: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7048: \$? = $ac_status" >&5 + echo "$as_me:8496: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7309,11 +8757,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7312: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8760: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7316: \$? = $ac_status" >&5 + echo "$as_me:8764: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7413,11 +8861,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7416: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8864: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7420: \$? = $ac_status" >&5 + echo "$as_me:8868: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9865,7 +11313,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13784: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12340: \$? = $ac_status" >&5 + echo "$as_me:13788: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12437,11 +13885,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12440: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13888: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12444: \$? = $ac_status" >&5 + echo "$as_me:13892: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14007,11 +15455,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14010: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15458: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14014: \$? = $ac_status" >&5 + echo "$as_me:15462: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14111,11 +15559,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14114: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15562: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14118: \$? = $ac_status" >&5 + echo "$as_me:15566: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16346,11 +17794,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16349: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17797: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16353: \$? = $ac_status" >&5 + echo "$as_me:17801: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16614,11 +18062,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16617: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18065: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16621: \$? = $ac_status" >&5 + echo "$as_me:18069: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16718,11 +18166,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16721: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18169: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16725: \$? = $ac_status" >&5 + echo "$as_me:18173: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21178,6 +22626,31 @@ build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +target!$target$ac_delim +target_cpu!$target_cpu$ac_delim +target_vendor!$target_vendor$ac_delim +target_os!$target_os$ac_delim +TARGET_OS!$TARGET_OS$ac_delim +ARCH!$ARCH$ac_delim +ENDIAN!$ENDIAN$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim LLVM_SRC!$LLVM_SRC$ac_delim LLVM_OBJ!$LLVM_OBJ$ac_delim LLVM_EXTERNALS!$LLVM_EXTERNALS$ac_delim @@ -21206,38 +22679,13 @@ DISABLE_LLC_DIFFS!$DISABLE_LLC_DIFFS$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -CPP!$CPP$ac_delim ifGNUmake!$ifGNUmake$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim LN_S!$LN_S$ac_delim ECHO!$ECHO$ac_delim AR!$AR$ac_delim RANLIB!$RANLIB$ac_delim STRIP!$STRIP$ac_delim -CXXCPP!$CXXCPP$ac_delim -F77!$F77$ac_delim -FFLAGS!$FFLAGS$ac_delim -ac_ct_F77!$ac_ct_F77$ac_delim -LIBTOOL!$LIBTOOL$ac_delim -USE_F2C!$USE_F2C$ac_delim -F2C!$F2C$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -21279,6 +22727,13 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +CXXCPP!$CXXCPP$ac_delim +F77!$F77$ac_delim +FFLAGS!$FFLAGS$ac_delim +ac_ct_F77!$ac_ct_F77$ac_delim +LIBTOOL!$LIBTOOL$ac_delim +USE_F2C!$USE_F2C$ac_delim +F2C!$F2C$ac_delim F2C_BIN!$F2C_BIN$ac_delim F2C_DIR!$F2C_DIR$ac_delim F2C_INC!$F2C_INC$ac_delim @@ -21295,7 +22750,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 14; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From nadav.rotem at intel.com Mon Feb 14 14:37:30 2011 From: nadav.rotem at intel.com (Rotem, Nadav) Date: Mon, 14 Feb 2011 22:37:30 +0200 Subject: [llvm-commits] Patch review for 9216 - Endless loop in Instcombine Message-ID: <6594DDFF12B03D4E89690887C24869940270FC96B8@hasmsx504.ger.corp.intel.com> Hi, This patch reproduces and fixes an endless loop in Instcombine. The cause of the problem is described below. Please review this patch. Cheers, Nadav Index: llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll =================================================================== --- llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll (revision 0) +++ llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll (revision 0) @@ -0,0 +1,17 @@ +; This testcase causes an infinite loop in the instruction combiner, +; because it changes a pattern and the original pattern is almost +; identical to the newly-generated pattern. +; RUN: opt < %s -instcombine -disable-output + +target triple = "x86_64-unknown-linux-gnu" + +define <4 x float> @m_387(i8* noalias nocapture %A, i8* nocapture %B, <4 x i1> %C) nounwind { +entry: + %movcsext20 = sext <4 x i1> %C to <4 x i32> + %tmp2389 = xor <4 x i32> %movcsext20, + %movcand25 = and <4 x i32> %tmp2389, + %movcor26 = or <4 x i32> %movcand25, zeroinitializer + %L2 = bitcast <4 x i32> %movcor26 to <4 x float> + %L3 = shufflevector <4 x float> zeroinitializer, <4 x float> %L2, <4 x i32> + ret <4 x float> %L3 +} Property changes on: llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll ___________________________________________________________________ Added: svn:eol-style + native Index: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp =================================================================== --- llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (revision 125511) +++ llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (working copy) @@ -1138,7 +1138,11 @@ cast(Op1)->swapOperands(); std::swap(A, B); } - if (A == Op0) // A&(A^B) -> A & ~B + // Notice that the patten (A&(~B)) is actually (A&(-1^B)), so if + // A is originally -1 (or a vector of -1 and undefs), then we enter + // an endless loop. By checking that A is non-constant we ensure that + // we will never get to the loop. + if (A == Op0 && ! dyn_cast(A) ) // A&(A^B) -> A & ~B return BinaryOperator::CreateAnd(A, Builder->CreateNot(B, "tmp")); } --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/13b90f82/attachment.html From bruno.cardoso at gmail.com Mon Feb 14 15:10:33 2011 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 14 Feb 2011 21:10:33 -0000 Subject: [llvm-commits] [llvm] r125521 - /llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Message-ID: <20110214211033.2D4202A6C12C@llvm.org> Author: bruno Date: Mon Feb 14 15:10:33 2011 New Revision: 125521 URL: http://llvm.org/viewvc/llvm-project?rev=125521&view=rev Log: A fail to match coprocessor number and register number must fail instead of assert. Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=125521&r1=125520&r2=125521&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Mon Feb 14 15:10:33 2011 @@ -771,7 +771,6 @@ break; } - llvm_unreachable("Unhandled coprocessor operand string!"); return -1; } From evan.cheng at apple.com Mon Feb 14 15:50:37 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 14 Feb 2011 21:50:37 -0000 Subject: [llvm-commits] [llvm] r125523 - /llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Message-ID: <20110214215037.A25502A6C12C@llvm.org> Author: evancheng Date: Mon Feb 14 15:50:37 2011 New Revision: 125523 URL: http://llvm.org/viewvc/llvm-project?rev=125523&view=rev Log: Fix PR8854. Track inserted copies to avoid read before write. Sorry, it's hard to reduce a sensible small test case. Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=125523&r1=125522&r2=125523&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original) +++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Mon Feb 14 15:50:37 2011 @@ -331,25 +331,37 @@ ImmDefRegs.clear(); ImmDefMIs.clear(); + MachineBasicBlock::iterator PMII = I->begin(); for (MachineBasicBlock::iterator MII = I->begin(), MIE = I->end(); MII != MIE; ) { - MachineInstr *MI = &*MII++; + MachineInstr *MI = &*MII; LocalMIs.insert(MI); if (MI->isLabel() || MI->isPHI() || MI->isImplicitDef() || MI->isKill() || MI->isInlineAsm() || MI->isDebugValue() || - MI->hasUnmodeledSideEffects()) + MI->hasUnmodeledSideEffects()) { + ++MII; continue; + } if (MI->getDesc().isCompare()) { - Changed |= OptimizeCmpInstr(MI, MBB); - } else if (isMoveImmediate(MI, ImmDefRegs, ImmDefMIs)) { + if (OptimizeCmpInstr(MI, MBB)) { + // MI is deleted. + Changed = true; + MII = llvm::next(PMII); + continue; + } + } + + if (isMoveImmediate(MI, ImmDefRegs, ImmDefMIs)) { SeenMoveImm = true; } else { Changed |= OptimizeExtInstr(MI, MBB, LocalMIs); if (SeenMoveImm) Changed |= FoldImmediate(MI, MBB, ImmDefRegs, ImmDefMIs); } + PMII = MII; + ++MII; } } From nadav.rotem at intel.com Mon Feb 14 15:56:57 2011 From: nadav.rotem at intel.com (Rotem, Nadav) Date: Mon, 14 Feb 2011 23:56:57 +0200 Subject: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll In-Reply-To: <4D5855BE.5080307@mxc.ca> References: <20110211193756.00C782A6C12C@llvm.org> <33543FF9-1ACE-4D44-8E7F-6D73B5F52D06@googlemail.com> <6594DDFF12B03D4E89690887C24869940270CCB0D6@hasmsx504.ger.corp.intel.com> <4D580EB3.2070701@free.fr> <4D5855BE.5080307@mxc.ca> Message-ID: <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> I started by looking at adding alone support for constants. I started by adding support for float/double inside the Constant function. A change to APFloat is also possible but more complex. What do you think ? Index: Constants.cpp =================================================================== --- Constants.cpp (revision 3012) +++ Constants.cpp (working copy) @@ -91,6 +91,16 @@ return ConstantInt::get(Ty->getContext(), APInt::getAllOnesValue(ITy->getBitWidth())); + unsigned t = 0xFFFFFFFF; + unsigned long long dt = 0xFFFFFFFFFFFFFFFF; + float F = reinterpret_cast(t); + if (Ty->isFloatTy()) return ConstantFP::get(Ty->getContext(), + APFloat(F)); + + double D = reinterpret_cast(dt); + if (Ty->isDoubleTy()) return ConstantFP::get(Ty->getContext(), + APFloat(D)); + std::vector Elts; const VectorType *VTy = cast(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); -----Original Message----- From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Nick Lewycky Sent: Monday, February 14, 2011 00:06 To: Duncan Sands Cc: llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll Duncan Sands wrote: > Hi Nadav, > >> Thank you for catching this. >> >> The patch below fixes the problem. If it looks good to you I will commit it. > > why not teach getAllOnesValue to handle floating point types instead? Further, it seems that if we're going to have Constant::getAllOnesValue then we should also have Constant->isAllOnesValue(). Nick _______________________________________________ llvm-commits mailing list llvm-commits at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. From bob.wilson at apple.com Mon Feb 14 16:12:50 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 14 Feb 2011 22:12:50 -0000 Subject: [llvm-commits] [llvm] r125525 - /llvm/trunk/test/CodeGen/ARM/vector-DAGCombine.ll Message-ID: <20110214221250.D39F52A6C12C@llvm.org> Author: bwilson Date: Mon Feb 14 16:12:50 2011 New Revision: 125525 URL: http://llvm.org/viewvc/llvm-project?rev=125525&view=rev Log: PR9139: Specify ARM/Darwin triple for vector-DAGCombine.ll test. The i64_buildvector test in this file relies on the alignment of i64 and f64 types being the same, which is true for Darwin but not AAPCS. Modified: llvm/trunk/test/CodeGen/ARM/vector-DAGCombine.ll Modified: llvm/trunk/test/CodeGen/ARM/vector-DAGCombine.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vector-DAGCombine.ll?rev=125525&r1=125524&r2=125525&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vector-DAGCombine.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vector-DAGCombine.ll Mon Feb 14 16:12:50 2011 @@ -1,7 +1,7 @@ -; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s +; RUN: llc < %s -mtriple=armv7-apple-darwin | FileCheck %s ; PR7158 -define arm_aapcs_vfpcc i32 @test_pr7158() nounwind { +define i32 @test_pr7158() nounwind { bb.nph55.bb.nph55.split_crit_edge: br label %bb3 From fvbommel at gmail.com Mon Feb 14 16:25:28 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Mon, 14 Feb 2011 23:25:28 +0100 Subject: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll In-Reply-To: <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> References: <20110211193756.00C782A6C12C@llvm.org> <33543FF9-1ACE-4D44-8E7F-6D73B5F52D06@googlemail.com> <6594DDFF12B03D4E89690887C24869940270CCB0D6@hasmsx504.ger.corp.intel.com> <4D580EB3.2070701@free.fr> <4D5855BE.5080307@mxc.ca> <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> Message-ID: On Mon, Feb 14, 2011 at 10:56 PM, Rotem, Nadav wrote: > I started by looking at adding alone support for constants. I started by adding support for float/double inside the Constant function. A change to APFloat is also possible but more complex. What do you think ? No need to go messing around with floats and doubles and reinterpret_casts (or changing APFloat). APFloat has a constructor that takes an APInt and initializes the floating-point value with those bits (just be careful with 'fp128' vs 'ppc_fp128' values, that's what the second parameter is for). From rafael.espindola at gmail.com Mon Feb 14 16:23:49 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 14 Feb 2011 22:23:49 -0000 Subject: [llvm-commits] [llvm] r125526 - in /llvm/trunk: lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/MC/MCSectionELF.cpp test/CodeGen/X86/global-sections.ll test/CodeGen/X86/pic_jumptable.ll tools/gold/gold-plugin.cpp Message-ID: <20110214222349.E69EB2A6C12C@llvm.org> Author: rafael Date: Mon Feb 14 16:23:49 2011 New Revision: 125526 URL: http://llvm.org/viewvc/llvm-project?rev=125526&view=rev Log: Switch llvm to using comdats. For now always use groups with a single section. Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/trunk/lib/MC/MCSectionELF.cpp llvm/trunk/test/CodeGen/X86/global-sections.ll llvm/trunk/test/CodeGen/X86/pic_jumptable.ll llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=125526&r1=125525&r2=125526&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Feb 14 16:23:49 2011 @@ -266,22 +266,6 @@ getELFSectionFlags(Kind), Kind); } -static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) { - if (Kind.isText()) return ".gnu.linkonce.t."; - if (Kind.isReadOnly()) return ".gnu.linkonce.r."; - - if (Kind.isThreadData()) return ".gnu.linkonce.td."; - if (Kind.isThreadBSS()) return ".gnu.linkonce.tb."; - - if (Kind.isDataNoRel()) return ".gnu.linkonce.d."; - if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local."; - if (Kind.isDataRel()) return ".gnu.linkonce.d.rel."; - if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local."; - - assert(Kind.isReadOnlyWithRel() && "Unknown section kind"); - return ".gnu.linkonce.d.rel.ro."; -} - /// getSectionPrefixForGlobal - Return the section prefix name used by options /// FunctionsSections and DataSections. static const char *getSectionPrefixForGlobal(SectionKind Kind) { @@ -317,19 +301,21 @@ if ((GV->isWeakForLinker() || EmitUniquedSection) && !Kind.isCommon() && !Kind.isBSS()) { const char *Prefix; - if (GV->isWeakForLinker()) - Prefix = getSectionPrefixForUniqueGlobal(Kind); - else { - assert(EmitUniquedSection); - Prefix = getSectionPrefixForGlobal(Kind); - } + Prefix = getSectionPrefixForGlobal(Kind); SmallString<128> Name(Prefix, Prefix+strlen(Prefix)); MCSymbol *Sym = Mang->getSymbol(GV); Name.append(Sym->getName().begin(), Sym->getName().end()); + StringRef Group = ""; + unsigned Flags = getELFSectionFlags(Kind); + if (GV->isWeakForLinker()) { + Group = Sym->getName(); + Flags |= ELF::SHF_GROUP; + } + return getContext().getELFSection(Name.str(), getELFSectionType(Name.str(), Kind), - getELFSectionFlags(Kind), Kind); + Flags, Kind, 0, Group); } if (Kind.isText()) return TextSection; Modified: llvm/trunk/lib/MC/MCSectionELF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=125526&r1=125525&r2=125526&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCSectionELF.cpp (original) +++ llvm/trunk/lib/MC/MCSectionELF.cpp Mon Feb 14 16:23:49 2011 @@ -61,6 +61,8 @@ OS << 'a'; if (Flags & ELF::SHF_EXECINSTR) OS << 'x'; + if (Flags & ELF::SHF_GROUP) + OS << 'G'; if (Flags & ELF::SHF_WRITE) OS << 'w'; if (Flags & ELF::SHF_MERGE) @@ -104,6 +106,8 @@ OS << "," << EntrySize; } + if (Flags & ELF::SHF_GROUP) + OS << "," << Group->getName() << ",comdat"; OS << '\n'; } Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=125526&r1=125525&r2=125526&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/global-sections.ll (original) +++ llvm/trunk/test/CodeGen/X86/global-sections.ll Mon Feb 14 16:23:49 2011 @@ -66,7 +66,7 @@ @"foo bar" = linkonce global i32 42 ; LINUX: .type foo_20_bar, at object -; LINUX:.section .gnu.linkonce.d.foo_20_bar,"aw", at progbits +; LINUX: .section .data.foo_20_bar,"aGw", at progbits,foo_20_bar,comdat ; LINUX: .weak foo_20_bar ; LINUX: foo_20_bar: @@ -79,7 +79,7 @@ @G6 = weak_odr unnamed_addr constant [1 x i8] c"\01" ; LINUX: .type G6, at object -; LINUX: .section .gnu.linkonce.r.G6,"a", at progbits +; LINUX: .section .rodata.G6,"aG", at progbits,G6,comdat ; LINUX: .weak G6 ; LINUX: G6: ; LINUX: .byte 1 Modified: llvm/trunk/test/CodeGen/X86/pic_jumptable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pic_jumptable.ll?rev=125526&r1=125525&r2=125526&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/pic_jumptable.ll (original) +++ llvm/trunk/test/CodeGen/X86/pic_jumptable.ll Mon Feb 14 16:23:49 2011 @@ -1,4 +1,4 @@ -; RUN: llc < %s -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false | not grep -F .text +; RUN: llc < %s -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false | grep -F .text._Z3fooILi1EEvi,"axG", at progbits,_Z3fooILi1EEvi,comdat ; RUN: llc < %s -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | FileCheck %s ; RUN: llc < %s -mtriple=x86_64-apple-darwin | not grep 'lJTI' ; rdar://6971437 Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=125526&r1=125525&r2=125526&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Mon Feb 14 16:23:49 2011 @@ -339,6 +339,7 @@ } int definition = attrs & LTO_SYMBOL_DEFINITION_MASK; + sym.comdat_key = NULL; switch (definition) { case LTO_SYMBOL_DEFINITION_REGULAR: sym.def = LDPK_DEF; @@ -350,6 +351,7 @@ sym.def = LDPK_COMMON; break; case LTO_SYMBOL_DEFINITION_WEAK: + sym.comdat_key = sym.name; sym.def = LDPK_WEAKDEF; break; case LTO_SYMBOL_DEFINITION_WEAKUNDEF: @@ -360,9 +362,7 @@ return LDPS_ERR; } - // LLVM never emits COMDAT. sym.size = 0; - sym.comdat_key = NULL; sym.resolution = LDPR_UNKNOWN; } From anton at korobeynikov.info Mon Feb 14 16:40:05 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 15 Feb 2011 01:40:05 +0300 Subject: [llvm-commits] [llvm] r125526 - in /llvm/trunk: lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/MC/MCSectionELF.cpp test/CodeGen/X86/global-sections.ll test/CodeGen/X86/pic_jumptable.ll tools/gold/gold-plugin.cpp In-Reply-To: <20110214222349.E69EB2A6C12C@llvm.org> References: <20110214222349.E69EB2A6C12C@llvm.org> Message-ID: Hi Rafael, > Switch llvm to using comdats. For now always use groups with a single > section. This definitely imposes some constraints on the version of binutils which should be used to link the stuff. Could you please clarify this? I'd prefer to have both comdat and section-name style linkonce stuff. This way we can switch between them and hook into configure-time check inside llvm-gcc to this option, for example. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From rafael.espindola at gmail.com Mon Feb 14 17:05:47 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Mon, 14 Feb 2011 18:05:47 -0500 Subject: [llvm-commits] [llvm] r125526 - in /llvm/trunk: lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/MC/MCSectionELF.cpp test/CodeGen/X86/global-sections.ll test/CodeGen/X86/pic_jumptable.ll tools/gold/gold-plugin.cpp In-Reply-To: References: <20110214222349.E69EB2A6C12C@llvm.org> Message-ID: <4D59B54B.7030505@gmail.com> On 11-02-14 05:40 PM, Anton Korobeynikov wrote: > Hi Rafael, > >> Switch llvm to using comdats. For now always use groups with a single >> section. > This definitely imposes some constraints on the version of binutils > which should be used to link the stuff. > Could you please clarify this? > > I'd prefer to have both comdat and section-name style linkonce stuff. > This way we can switch between them and hook into configure-time check > inside llvm-gcc to this option, for example. comdats have been available ever since I started working on system software. A git log in binutils shows that their are available since 1999 at least. Cheers, Rafael From dpatel at apple.com Mon Feb 14 17:03:23 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 14 Feb 2011 23:03:23 -0000 Subject: [llvm-commits] [llvm] r125529 - in /llvm/trunk: lib/Transforms/Scalar/LoopRotation.cpp test/Transforms/LoopRotate/dbgvalue.ll Message-ID: <20110214230323.8B9162A6C12D@llvm.org> Author: dpatel Date: Mon Feb 14 17:03:23 2011 New Revision: 125529 URL: http://llvm.org/viewvc/llvm-project?rev=125529&view=rev Log: Do not hoist @llvm.dbg.value. Here, @llvm.dbg.value is "referring" a value that is modified inside loop. Added: llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=125529&r1=125528&r2=125529&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Mon Feb 14 17:03:23 2011 @@ -14,6 +14,7 @@ #define DEBUG_TYPE "loop-rotate" #include "llvm/Transforms/Scalar.h" #include "llvm/Function.h" +#include "llvm/IntrinsicInst.h" #include "llvm/Analysis/CodeMetrics.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/InstructionSimplify.h" @@ -231,7 +232,7 @@ // memory (without proving that the loop doesn't write). if (L->hasLoopInvariantOperands(Inst) && !Inst->mayReadFromMemory() && !Inst->mayWriteToMemory() && - !isa(Inst)) { + !isa(Inst) && !isa(Inst)) { Inst->moveBefore(LoopEntryBranch); continue; } Added: llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll?rev=125529&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll (added) +++ llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll Mon Feb 14 17:03:23 2011 @@ -0,0 +1,59 @@ +; RUN: opt -S -loop-rotate %s | FileCheck %s + +; CHECK: entry +; CHECK-NEXT: call void @llvm.dbg.value(metadata !{i32 %x} + +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone + +define i32 @tak(i32 %x, i32 %y, i32 %z) nounwind ssp { +entry: + br label %tailrecurse + +tailrecurse: ; preds = %if.then, %entry + %x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ] + %y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ] + %z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ] + tail call void @llvm.dbg.value(metadata !{i32 %x.tr}, i64 0, metadata !6), !dbg !7 + tail call void @llvm.dbg.value(metadata !{i32 %y.tr}, i64 0, metadata !8), !dbg !9 + tail call void @llvm.dbg.value(metadata !{i32 %z.tr}, i64 0, metadata !10), !dbg !11 + %cmp = icmp slt i32 %y.tr, %x.tr, !dbg !12 + br i1 %cmp, label %if.then, label %if.end, !dbg !12 + +if.then: ; preds = %tailrecurse + %sub = sub nsw i32 %x.tr, 1, !dbg !14 + %call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !14 + %sub6 = sub nsw i32 %y.tr, 1, !dbg !14 + %call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !14 + %sub11 = sub nsw i32 %z.tr, 1, !dbg !14 + %call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !14 + br label %tailrecurse + +if.end: ; preds = %tailrecurse + br label %return, !dbg !16 + +return: ; preds = %if.end + ret i32 %z.tr, !dbg !17 +} + +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +!llvm.dbg.sp = !{!0} + +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"tak", metadata !"tak", metadata !"", metadata !1, i32 32, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32, i32, i32)* @tak} ; [ DW_TAG_subprogram ] +!1 = metadata !{i32 589865, metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame", metadata !2} ; [ DW_TAG_file_type ] +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame", metadata !"clang version 2.9 (trunk 125492)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{metadata !5} +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!6 = metadata !{i32 590081, metadata !0, metadata !"x", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!7 = metadata !{i32 32, i32 13, metadata !0, null} +!8 = metadata !{i32 590081, metadata !0, metadata !"y", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!9 = metadata !{i32 32, i32 20, metadata !0, null} +!10 = metadata !{i32 590081, metadata !0, metadata !"z", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!11 = metadata !{i32 32, i32 27, metadata !0, null} +!12 = metadata !{i32 33, i32 3, metadata !13, null} +!13 = metadata !{i32 589835, metadata !0, i32 32, i32 30, metadata !1, i32 6} ; [ DW_TAG_lexical_block ] +!14 = metadata !{i32 34, i32 5, metadata !15, null} +!15 = metadata !{i32 589835, metadata !13, i32 33, i32 14, metadata !1, i32 7} ; [ DW_TAG_lexical_block ] +!16 = metadata !{i32 36, i32 3, metadata !13, null} +!17 = metadata !{i32 37, i32 1, metadata !13, null} From dpatel at apple.com Mon Feb 14 17:10:22 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 14 Feb 2011 15:10:22 -0800 Subject: [llvm-commits] [llvm] r125529 - in /llvm/trunk: lib/Transforms/Scalar/LoopRotation.cpp test/Transforms/LoopRotate/dbgvalue.ll In-Reply-To: <20110214230323.8B9162A6C12D@llvm.org> References: <20110214230323.8B9162A6C12D@llvm.org> Message-ID: <66F50601-328E-473F-8B37-8327F77E6FB4@apple.com> FWIW, After this patch argument values for following function (from our SingleSource test suite) is preserved at -Os. int tak(int x, int y, int z) { if (y < x) { return tak(tak(x - 1, y, z), tak(y - 1, z, x), tak(z - 1, x, y)); } return z; } - Devang On Feb 14, 2011, at 3:03 PM, Devang Patel wrote: > Author: dpatel > Date: Mon Feb 14 17:03:23 2011 > New Revision: 125529 > > URL: http://llvm.org/viewvc/llvm-project?rev=125529&view=rev > Log: > Do not hoist @llvm.dbg.value. Here, @llvm.dbg.value is "referring" a value that is modified inside loop. > > Added: > llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll > Modified: > llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=125529&r1=125528&r2=125529&view=diff > ============================================================================== > --- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Mon Feb 14 17:03:23 2011 > @@ -14,6 +14,7 @@ > #define DEBUG_TYPE "loop-rotate" > #include "llvm/Transforms/Scalar.h" > #include "llvm/Function.h" > +#include "llvm/IntrinsicInst.h" > #include "llvm/Analysis/CodeMetrics.h" > #include "llvm/Analysis/LoopPass.h" > #include "llvm/Analysis/InstructionSimplify.h" > @@ -231,7 +232,7 @@ > // memory (without proving that the loop doesn't write). > if (L->hasLoopInvariantOperands(Inst) && > !Inst->mayReadFromMemory() && !Inst->mayWriteToMemory() && > - !isa(Inst)) { > + !isa(Inst) && !isa(Inst)) { > Inst->moveBefore(LoopEntryBranch); > continue; > } > > Added: llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll?rev=125529&view=auto > ============================================================================== > --- llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll (added) > +++ llvm/trunk/test/Transforms/LoopRotate/dbgvalue.ll Mon Feb 14 17:03:23 2011 > @@ -0,0 +1,59 @@ > +; RUN: opt -S -loop-rotate %s | FileCheck %s > + > +; CHECK: entry > +; CHECK-NEXT: call void @llvm.dbg.value(metadata !{i32 %x} > + > +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone > + > +define i32 @tak(i32 %x, i32 %y, i32 %z) nounwind ssp { > +entry: > + br label %tailrecurse > + > +tailrecurse: ; preds = %if.then, %entry > + %x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ] > + %y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ] > + %z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ] > + tail call void @llvm.dbg.value(metadata !{i32 %x.tr}, i64 0, metadata !6), !dbg !7 > + tail call void @llvm.dbg.value(metadata !{i32 %y.tr}, i64 0, metadata !8), !dbg !9 > + tail call void @llvm.dbg.value(metadata !{i32 %z.tr}, i64 0, metadata !10), !dbg !11 > + %cmp = icmp slt i32 %y.tr, %x.tr, !dbg !12 > + br i1 %cmp, label %if.then, label %if.end, !dbg !12 > + > +if.then: ; preds = %tailrecurse > + %sub = sub nsw i32 %x.tr, 1, !dbg !14 > + %call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !14 > + %sub6 = sub nsw i32 %y.tr, 1, !dbg !14 > + %call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !14 > + %sub11 = sub nsw i32 %z.tr, 1, !dbg !14 > + %call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !14 > + br label %tailrecurse > + > +if.end: ; preds = %tailrecurse > + br label %return, !dbg !16 > + > +return: ; preds = %if.end > + ret i32 %z.tr, !dbg !17 > +} > + > +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone > + > +!llvm.dbg.sp = !{!0} > + > +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"tak", metadata !"tak", metadata !"", metadata !1, i32 32, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 (i32, i32, i32)* @tak} ; [ DW_TAG_subprogram ] > +!1 = metadata !{i32 589865, metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame", metadata !2} ; [ DW_TAG_file_type ] > +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", metadata !"/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame", metadata !"clang version 2.9 (trunk 125492)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] > +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] > +!4 = metadata !{metadata !5} > +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] > +!6 = metadata !{i32 590081, metadata !0, metadata !"x", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] > +!7 = metadata !{i32 32, i32 13, metadata !0, null} > +!8 = metadata !{i32 590081, metadata !0, metadata !"y", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] > +!9 = metadata !{i32 32, i32 20, metadata !0, null} > +!10 = metadata !{i32 590081, metadata !0, metadata !"z", metadata !1, i32 32, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] > +!11 = metadata !{i32 32, i32 27, metadata !0, null} > +!12 = metadata !{i32 33, i32 3, metadata !13, null} > +!13 = metadata !{i32 589835, metadata !0, i32 32, i32 30, metadata !1, i32 6} ; [ DW_TAG_lexical_block ] > +!14 = metadata !{i32 34, i32 5, metadata !15, null} > +!15 = metadata !{i32 589835, metadata !13, i32 33, i32 14, metadata !1, i32 7} ; [ DW_TAG_lexical_block ] > +!16 = metadata !{i32 36, i32 3, metadata !13, null} > +!17 = metadata !{i32 37, i32 1, metadata !13, null} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From anton at korobeynikov.info Mon Feb 14 17:18:35 2011 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 15 Feb 2011 02:18:35 +0300 Subject: [llvm-commits] [llvm] r125526 - in /llvm/trunk: lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/MC/MCSectionELF.cpp test/CodeGen/X86/global-sections.ll test/CodeGen/X86/pic_jumptable.ll tools/gold/gold-plugin.cpp In-Reply-To: <4D59B54B.7030505@gmail.com> References: <20110214222349.E69EB2A6C12C@llvm.org> <4D59B54B.7030505@gmail.com> Message-ID: > comdats have been available ever since I started working on system software. > A git log in binutils shows that their are available since 1999 at least. Hrm, ok. Why gcc has a switch for them then? :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From stoklund at 2pi.dk Mon Feb 14 17:15:38 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 14 Feb 2011 23:15:38 -0000 Subject: [llvm-commits] [llvm] r125530 - in /llvm/trunk: include/llvm/CodeGen/CalcSpillWeights.h include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/CalcSpillWeights.cpp lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <20110214231538.D1B422A6C12C@llvm.org> Author: stoklund Date: Mon Feb 14 17:15:38 2011 New Revision: 125530 URL: http://llvm.org/viewvc/llvm-project?rev=125530&view=rev Log: Move more fragments of spill weight calculation into CalcSpillWeights.h Simplify the spill weight calculation a bit by bypassing getApproximateInstructionCount() and using LiveInterval::getSize() directly. This changes the computed spill weights, but only by a constant factor in each function. It should not affect how spill weights compare against each other, and so it shouldn't affect code generation. Modified: llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Modified: llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h?rev=125530&r1=125529&r2=125530&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h (original) +++ llvm/trunk/include/llvm/CodeGen/CalcSpillWeights.h Mon Feb 14 17:15:38 2011 @@ -20,6 +20,26 @@ class LiveIntervals; class MachineLoopInfo; + /// normalizeSpillWeight - The spill weight of a live interval is computed as: + /// + /// (sum(use freq) + sum(def freq)) / (K + size) + /// + /// @param UseDefFreq Expected number of executed use and def instructions + /// per function call. Derived from block frequencies. + /// @param Size Size of live interval as returnexd by getSize() + /// + static inline float normalizeSpillWeight(float UseDefFreq, unsigned Size) { + // The magic constant 200 corresponds to approx. 25 instructions since + // SlotIndexes allocate 8 slots per instruction. + // + // The constant is added to avoid depending too much on accidental SlotIndex + // gaps for small intervals. The effect is that small intervals have a spill + // weight that is mostly proportional to the number of uses, while large + // intervals get a spill weight that is closer to a use density. + // + return UseDefFreq / (Size + 200); + } + /// VirtRegAuxInfo - Calculate auxiliary information for a virtual /// register such as its spill weight and allocation hint. class VirtRegAuxInfo { Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=125530&r1=125529&r2=125530&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Feb 14 17:15:38 2011 @@ -75,14 +75,6 @@ // Calculate the spill weight to assign to a single instruction. static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth); - // After summing the spill weights of all defs and uses, the final weight - // should be normalized, dividing the weight of the interval by its size. - // This encourages spilling of intervals that are large and have few uses, - // and discourages spilling of small intervals with many uses. - void normalizeSpillWeight(LiveInterval &li) { - li.weight /= getApproximateInstructionCount(li) + 25; - } - typedef Reg2IntervalMap::iterator iterator; typedef Reg2IntervalMap::const_iterator const_iterator; const_iterator begin() const { return r2iMap_.begin(); } @@ -461,9 +453,6 @@ DenseMap &MBBVRegsMap, std::vector &NewLIs); - // Normalize the spill weight of all the intervals in NewLIs. - void normalizeSpillWeights(std::vector &NewLIs); - static LiveInterval* createInterval(unsigned Reg); void printInstrs(raw_ostream &O) const; Modified: llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp?rev=125530&r1=125529&r2=125530&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp (original) +++ llvm/trunk/lib/CodeGen/CalcSpillWeights.cpp Mon Feb 14 17:15:38 2011 @@ -174,8 +174,7 @@ totalWeight *= 0.5F; } - li.weight = totalWeight; - lis_.normalizeSpillWeight(li); + li.weight = normalizeSpillWeight(totalWeight, li.getSize()); } void VirtRegAuxInfo::CalculateRegClass(unsigned reg) { Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=125530&r1=125529&r2=125530&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Feb 14 17:15:38 2011 @@ -20,6 +20,7 @@ #include "VirtRegMap.h" #include "llvm/Value.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" @@ -1706,10 +1707,10 @@ return (isDef + isUse) * lc; } -void -LiveIntervals::normalizeSpillWeights(std::vector &NewLIs) { +static void normalizeSpillWeights(std::vector &NewLIs) { for (unsigned i = 0, e = NewLIs.size(); i != e; ++i) - normalizeSpillWeight(*NewLIs[i]); + NewLIs[i]->weight = + normalizeSpillWeight(NewLIs[i]->weight, NewLIs[i]->getSize()); } std::vector LiveIntervals:: From rafael.espindola at gmail.com Mon Feb 14 17:20:24 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Mon, 14 Feb 2011 18:20:24 -0500 Subject: [llvm-commits] [llvm] r125526 - in /llvm/trunk: lib/CodeGen/TargetLoweringObjectFileImpl.cpp lib/MC/MCSectionELF.cpp test/CodeGen/X86/global-sections.ll test/CodeGen/X86/pic_jumptable.ll tools/gold/gold-plugin.cpp In-Reply-To: References: <20110214222349.E69EB2A6C12C@llvm.org> <4D59B54B.7030505@gmail.com> Message-ID: <4D59B8B8.9020807@gmail.com> On 11-02-14 06:18 PM, Anton Korobeynikov wrote: >> comdats have been available ever since I started working on system software. >> A git log in binutils shows that their are available since 1999 at least. > Hrm, ok. Why gcc has a switch for them then? :) I can only guess that they switched soon after binutils got support for it and never removed the switch. Cheers, Rafael From bob.wilson at apple.com Mon Feb 14 17:40:38 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 14 Feb 2011 23:40:38 -0000 Subject: [llvm-commits] [llvm] r125534 - in /llvm/trunk/lib/Target/ARM: ARMFrameLowering.cpp ARMMachineFunctionInfo.h Message-ID: <20110214234038.6A8962A6C12C@llvm.org> Author: bwilson Date: Mon Feb 14 17:40:38 2011 New Revision: 125534 URL: http://llvm.org/viewvc/llvm-project?rev=125534&view=rev Log: Remove unused bitvectors that record ARM callee-saved registers. Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=125534&r1=125533&r2=125534&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Mon Feb 14 17:40:38 2011 @@ -833,7 +833,6 @@ unsigned Reg = CSRegs[i]; bool Spilled = false; if (MF.getRegInfo().isPhysRegUsed(Reg)) { - AFI->setCSRegisterIsSpilled(Reg); Spilled = true; CanEliminateFrame = false; } else { @@ -932,7 +931,6 @@ // Spill LR as well so we can fold BX_RET to the registers restore (LDM). if (!LRSpilled && CS1Spilled) { MF.getRegInfo().setPhysRegUsed(ARM::LR); - AFI->setCSRegisterIsSpilled(ARM::LR); NumGPRSpills++; UnspilledCS1GPRs.erase(std::find(UnspilledCS1GPRs.begin(), UnspilledCS1GPRs.end(), (unsigned)ARM::LR)); @@ -957,7 +955,6 @@ if (!AFI->isThumb1OnlyFunction() || isARMLowRegister(Reg) || Reg == ARM::LR) { MF.getRegInfo().setPhysRegUsed(Reg); - AFI->setCSRegisterIsSpilled(Reg); if (!RegInfo->isReservedReg(MF, Reg)) ExtraCSSpill = true; break; @@ -966,7 +963,6 @@ } else if (!UnspilledCS2GPRs.empty() && !AFI->isThumb1OnlyFunction()) { unsigned Reg = UnspilledCS2GPRs.front(); MF.getRegInfo().setPhysRegUsed(Reg); - AFI->setCSRegisterIsSpilled(Reg); if (!RegInfo->isReservedReg(MF, Reg)) ExtraCSSpill = true; } @@ -1006,7 +1002,6 @@ if (Extras.size() && NumExtras == 0) { for (unsigned i = 0, e = Extras.size(); i != e; ++i) { MF.getRegInfo().setPhysRegUsed(Extras[i]); - AFI->setCSRegisterIsSpilled(Extras[i]); } } else if (!AFI->isThumb1OnlyFunction()) { // note: Thumb1 functions spill to R12, not the stack. Reserve a slot @@ -1021,7 +1016,6 @@ if (ForceLRSpill) { MF.getRegInfo().setPhysRegUsed(ARM::LR); - AFI->setCSRegisterIsSpilled(ARM::LR); AFI->setLRIsSpilledForFarJump(true); } } Modified: llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h?rev=125534&r1=125533&r2=125534&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h Mon Feb 14 17:40:38 2011 @@ -79,10 +79,6 @@ BitVector GPRCS2Frames; BitVector DPRCSFrames; - /// SpilledCSRegs - A BitVector mask of all spilled callee-saved registers. - /// - BitVector SpilledCSRegs; - /// JumpTableUId - Unique id for jumptables. /// unsigned JumpTableUId; @@ -119,7 +115,6 @@ FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0), GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0), GPRCS1Frames(32), GPRCS2Frames(32), DPRCSFrames(32), - SpilledCSRegs(MF.getTarget().getRegisterInfo()->getNumRegs()), JumpTableUId(0), PICLabelUId(0), VarArgsFrameIndex(0), HasITBlocks(false) {} @@ -211,18 +206,6 @@ } } - void setCSRegisterIsSpilled(unsigned Reg) { - SpilledCSRegs.set(Reg); - } - - bool isCSRegisterSpilled(unsigned Reg) const { - return SpilledCSRegs[Reg]; - } - - const BitVector &getSpilledCSRegisters() const { - return SpilledCSRegs; - } - unsigned createJumpTableUId() { return JumpTableUId++; } From clattner at apple.com Mon Feb 14 17:45:49 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Feb 2011 15:45:49 -0800 Subject: [llvm-commits] Patch review for 9216 - Endless loop in Instcombine In-Reply-To: <6594DDFF12B03D4E89690887C24869940270FC96B8@hasmsx504.ger.corp.intel.com> References: <6594DDFF12B03D4E89690887C24869940270FC96B8@hasmsx504.ger.corp.intel.com> Message-ID: <646866A2-2B11-45E8-BFEE-11A0A935E770@apple.com> On Feb 14, 2011, at 12:37 PM, Rotem, Nadav wrote: > Hi, > > This patch reproduces and fixes an endless loop in Instcombine. The cause of the problem is described below. Please review this patch. Looks good, but please use "!isa(A)" instead of dyn_cast, and no extra spaces before dyn_cast and between the ))'s. Thanks Nadav! -Chris > > Cheers, > Nadav > > Index: llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll > =================================================================== > --- llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll (revision 0) > +++ llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll (revision 0) > @@ -0,0 +1,17 @@ > +; This testcase causes an infinite loop in the instruction combiner, > +; because it changes a pattern and the original pattern is almost > +; identical to the newly-generated pattern. > +; RUN: opt < %s -instcombine -disable-output > + > +target triple = "x86_64-unknown-linux-gnu" > + > +define <4 x float> @m_387(i8* noalias nocapture %A, i8* nocapture %B, <4 x i1> %C) nounwind { > +entry: > + %movcsext20 = sext <4 x i1> %C to <4 x i32> > + %tmp2389 = xor <4 x i32> %movcsext20, > + %movcand25 = and <4 x i32> %tmp2389, > + %movcor26 = or <4 x i32> %movcand25, zeroinitializer > + %L2 = bitcast <4 x i32> %movcor26 to <4 x float> > + %L3 = shufflevector <4 x float> zeroinitializer, <4 x float> %L2, <4 x i32> > + ret <4 x float> %L3 > +} > > Property changes on: llvm/test/Transforms/InstCombine/2011-02-14-InfLoop.ll > ___________________________________________________________________ > Added: svn:eol-style > + native > > Index: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp > =================================================================== > --- llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (revision 125511) > +++ llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (working copy) > @@ -1138,7 +1138,11 @@ > cast(Op1)->swapOperands(); > std::swap(A, B); > } > - if (A == Op0) // A&(A^B) -> A & ~B > + // Notice that the patten (A&(~B)) is actually (A&(-1^B)), so if > + // A is originally -1 (or a vector of -1 and undefs), then we enter > + // an endless loop. By checking that A is non-constant we ensure that > + // we will never get to the loop. > + if (A == Op0 && ! dyn_cast(A) ) // A&(A^B) -> A & ~B > return BinaryOperator::CreateAnd(A, Builder->CreateNot(B, "tmp")); > } > > --------------------------------------------------------------------- > Intel Israel (74) Limited > > This e-mail and any attachments may contain confidential material for > the sole use of the intended recipient(s). Any review or distribution > by others is strictly prohibited. If you are not the intended > recipient, please contact the sender and delete all copies._______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110214/6c8b4ef1/attachment-0001.html From sabre at nondot.org Mon Feb 14 18:06:37 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 00:06:37 -0000 Subject: [llvm-commits] [llvm] r125536 - /llvm/trunk/include/llvm/ADT/ArrayRef.h Message-ID: <20110215000637.D15142A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 18:06:37 2011 New Revision: 125536 URL: http://llvm.org/viewvc/llvm-project?rev=125536&view=rev Log: fix some typos. Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=125536&r1=125535&r2=125536&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Feb 14 18:06:37 2011 @@ -17,8 +17,8 @@ class APInt; /// ArrayRef - Represent a constant reference to an array (0 or more elements - /// consequtively in memory), i.e. a start pointer and a length. It allows - /// various APIs to take consequtive elements easily and conveniently. + /// consecutively in memory), i.e. a start pointer and a length. It allows + /// various APIs to take consecutive elements easily and conveniently. /// /// This class does not own the underlying data, it is expected to be used in /// situations where the data resides in some other buffer, whose lifetime @@ -53,7 +53,7 @@ : Data(&OneElt), Length(1) {} /// Construct an ArrayRef from a pointer and length. - /*implicit*/ ArrayRef(T *data, size_t length) + /*implicit*/ ArrayRef(const T *data, size_t length) : Data(data), Length(length) {} /// Construct an ArrayRef from a SmallVector. @@ -85,7 +85,7 @@ return Data[0]; } - /// back - Get the last character in the string. + /// back - Get the last element. const T &back() const { assert(!empty()); return Data[Length-1]; @@ -95,7 +95,7 @@ /// @name Operator Overloads /// @{ - char operator[](size_t Index) const { + const T &operator[](size_t Index) const { assert(Index < Length && "Invalid index!"); return Data[Index]; } From sabre at nondot.org Mon Feb 14 18:14:00 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 00:14:00 -0000 Subject: [llvm-commits] [llvm] r125537 - in /llvm/trunk: include/llvm/Constants.h lib/Analysis/ConstantFolding.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp lib/Transforms/Scalar/ScalarReplAggregates.cpp lib/VMCore/AutoUpgrade.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp lib/VMCore/Core.cpp Message-ID: <20110215001401.01FB82A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 18:14:00 2011 New Revision: 125537 URL: http://llvm.org/viewvc/llvm-project?rev=125537&view=rev Log: convert ConstantVector::get to use ArrayRef. Modified: llvm/trunk/include/llvm/Constants.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/trunk/lib/VMCore/AutoUpgrade.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Mon Feb 14 18:14:00 2011 @@ -25,7 +25,7 @@ #include "llvm/OperandTraits.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/APFloat.h" -#include +#include "llvm/ADT/ArrayRef.h" namespace llvm { @@ -39,8 +39,6 @@ struct ConstantCreator; template struct ConvertConstantType; -template -class SmallVector; //===----------------------------------------------------------------------===// /// This is the shared class of boolean and integer constants. This class @@ -473,9 +471,9 @@ ConstantVector(const VectorType *T, const std::vector &Val); public: // ConstantVector accessors + static Constant *get(ArrayRef V); + // FIXME: Eliminate this constructor form. static Constant *get(const VectorType *T, const std::vector &V); - static Constant *get(const std::vector &V); - static Constant *get(Constant *const *Vals, unsigned NumVals); /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Feb 14 18:14:00 2011 @@ -54,7 +54,7 @@ // vector so the code below can handle it uniformly. if (isa(C) || isa(C)) { Constant *Ops = C; // don't take the address of C! - return FoldBitCast(ConstantVector::get(&Ops, 1), DestTy, TD); + return FoldBitCast(ConstantVector::get(Ops), DestTy, TD); } // If this is a bitcast from constant vector -> vector, fold it. @@ -167,7 +167,7 @@ } } - return ConstantVector::get(Result.data(), Result.size()); + return ConstantVector::get(Result); } Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Feb 14 18:14:00 2011 @@ -2079,7 +2079,7 @@ "vector element #" + Twine(i) + " is not of type '" + Elts[0]->getType()->getDescription()); - ID.ConstantVal = ConstantVector::get(Elts.data(), Elts.size()); + ID.ConstantVal = ConstantVector::get(Elts); ID.Kind = ValID::t_Constant; return false; } Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Feb 14 18:14:00 2011 @@ -298,7 +298,7 @@ NewC = ConstantStruct::get(Context, &NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); } else if (isa(UserC)) { - NewC = ConstantVector::get(&NewOps[0], NewOps.size()); + NewC = ConstantVector::get(NewOps); } else { assert(isa(UserC) && "Must be a ConstantExpr."); NewC = cast(UserC)->getWithOperands(&NewOps[0], Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon Feb 14 18:14:00 2011 @@ -2387,30 +2387,14 @@ void SelectionDAGBuilder::visitFSub(const User &I) { // -0.0 - X --> fneg const Type *Ty = I.getType(); - if (Ty->isVectorTy()) { - if (ConstantVector *CV = dyn_cast(I.getOperand(0))) { - const VectorType *DestTy = cast(I.getType()); - const Type *ElTy = DestTy->getElementType(); - unsigned VL = DestTy->getNumElements(); - std::vector NZ(VL, ConstantFP::getNegativeZero(ElTy)); - Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); - if (CV == CNZ) { - SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); - return; - } - } + if (isa(I.getOperand(0)) && + I.getOperand(0) == ConstantFP::getZeroValueForNegation(Ty)) { + SDValue Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2)); + return; } - if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) - if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { - SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); - return; - } - visitBinary(I, ISD::FSUB); } Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Feb 14 18:14:00 2011 @@ -2257,8 +2257,7 @@ if (Init->getType()->isArrayTy()) return ConstantArray::get(cast(InitTy), Elts); - else - return ConstantVector::get(&Elts[0], Elts.size()); + return ConstantVector::get(Elts); } } Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Mon Feb 14 18:14:00 2011 @@ -1037,11 +1037,8 @@ if (Pred == ICmpInst::ICMP_SLT && CmpLHS->getType() == DestTy) { const Type *EltTy = VTy->getElementType(); - // splat the shift constant to a cosntant vector - Constant *Sh = ConstantInt::get(EltTy, EltTy->getScalarSizeInBits()-1); - std::vector Elts(VTy->getNumElements(), Sh); - Constant *VSh = ConstantVector::get(Elts); - + // splat the shift constant to a constant vector. + Constant *VSh = ConstantInt::get(VTy, EltTy->getScalarSizeInBits()-1); Value *In = Builder->CreateAShr(CmpLHS, VSh,CmpLHS->getName()+".lobit"); return ReplaceInstUsesWith(CI, In); } @@ -1390,8 +1387,7 @@ ConstantInt::get(Int32Ty, SrcElts)); } - Constant *Mask = ConstantVector::get(ShuffleMask.data(), ShuffleMask.size()); - return new ShuffleVectorInst(InVal, V2, Mask); + return new ShuffleVectorInst(InVal, V2, ConstantVector::get(ShuffleMask)); } static bool isMultipleOfTypeSize(unsigned Value, const Type *Ty) { Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Feb 14 18:14:00 2011 @@ -1916,7 +1916,7 @@ if (EltTy != ValTy) { unsigned NumElts = cast(ValTy)->getNumElements(); SmallVector Elts(NumElts, StoreVal); - StoreVal = ConstantVector::get(&Elts[0], NumElts); + StoreVal = ConstantVector::get(Elts); } } new StoreInst(StoreVal, EltPtr, MI); Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Mon Feb 14 18:14:00 2011 @@ -859,7 +859,7 @@ for (unsigned i = 0; i != 8; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value *SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value *SV = ConstantVector::get(Indices); Rep = Builder.CreateShuffleVector(Op2, Op1, SV, "palignr"); Rep = Builder.CreateBitCast(Rep, F->getReturnType()); } @@ -915,7 +915,7 @@ for (unsigned i = 0; i != 16; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value *SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value *SV = ConstantVector::get(Indices); Rep = Builder.CreateShuffleVector(Op2, Op1, SV, "palignr"); Rep = Builder.CreateBitCast(Rep, F->getReturnType()); } Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Feb 14 18:14:00 2011 @@ -150,7 +150,7 @@ // This allows for other simplifications (although some of them // can only be handled by Analysis/ConstantFolding.cpp). if (isa(V) || isa(V)) - return ConstantExpr::getBitCast(ConstantVector::get(&V, 1), DestPTy); + return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy); } // Finally, implement bitcast folding now. The code below doesn't handle @@ -873,7 +873,7 @@ Result.push_back(InElt); } - return ConstantVector::get(&Result[0], Result.size()); + return ConstantVector::get(Result); } Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg, @@ -1947,11 +1947,11 @@ // If we can constant fold the comparison of each element, constant fold // the whole vector comparison. SmallVector ResElts; - for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) { - // Compare the elements, producing an i1 result or constant expr. + // Compare the elements, producing an i1 result or constant expr. + for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) ResElts.push_back(ConstantExpr::getCompare(pred, C1Elts[i], C2Elts[i])); - } - return ConstantVector::get(&ResElts[0], ResElts.size()); + + return ConstantVector::get(ResElts); } if (C1->getType()->isFloatingPointTy()) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Feb 14 18:14:00 2011 @@ -94,7 +94,7 @@ return ConstantInt::get(Ty->getContext(), APInt::getAllOnesValue(ITy->getBitWidth())); - std::vector Elts; + SmallVector Elts; const VectorType *VTy = cast(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); assert(Elts[0] && "Not a vector integer type!"); @@ -302,8 +302,8 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) - return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + return ConstantVector::get(SmallVector(VTy->getNumElements(), C)); return C; } @@ -329,7 +329,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + SmallVector(VTy->getNumElements(), C)); return C; } @@ -372,7 +372,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + SmallVector(VTy->getNumElements(), C)); return C; } @@ -387,7 +387,7 @@ // For vectors, broadcast the value. if (const VectorType *VTy = dyn_cast(Ty)) return ConstantVector::get( - std::vector(VTy->getNumElements(), C)); + SmallVector(VTy->getNumElements(), C)); return C; } @@ -404,9 +404,9 @@ Constant *ConstantFP::getZeroValueForNegation(const Type* Ty) { if (const VectorType *PTy = dyn_cast(Ty)) if (PTy->getElementType()->isFloatingPointTy()) { - std::vector zeros(PTy->getNumElements(), + SmallVector zeros(PTy->getNumElements(), getNegativeZero(PTy->getElementType())); - return ConstantVector::get(PTy, zeros); + return ConstantVector::get(zeros); } if (Ty->isFloatingPointTy()) @@ -601,13 +601,12 @@ } // ConstantVector accessors. -Constant *ConstantVector::get(const VectorType* T, - const std::vector& V) { +Constant *ConstantVector::get(const VectorType *T, + const std::vector &V) { assert(!V.empty() && "Vectors can't be empty"); - LLVMContext &Context = T->getContext(); - LLVMContextImpl *pImpl = Context.pImpl; + LLVMContextImpl *pImpl = T->getContext().pImpl; - // If this is an all-undef or alll-zero vector, return a + // If this is an all-undef or all-zero vector, return a // ConstantAggregateZero or UndefValue. Constant *C = V[0]; bool isZero = C->isNullValue(); @@ -629,14 +628,10 @@ return pImpl->VectorConstants.getOrCreate(T, V); } -Constant *ConstantVector::get(const std::vector& V) { - assert(!V.empty() && "Cannot infer type if V is empty"); - return get(VectorType::get(V.front()->getType(),V.size()), V); -} - -Constant *ConstantVector::get(Constant *const* Vals, unsigned NumVals) { +Constant *ConstantVector::get(ArrayRef V) { // FIXME: make this the primary ctor method. - return get(std::vector(Vals, Vals+NumVals)); + assert(!V.empty() && "Vectors cannot be empty"); + return get(VectorType::get(V.front()->getType(), V.size()), V.vec()); } // Utility function for determining if a ConstantExpr is a CastOp or not. This Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=125537&r1=125536&r2=125537&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Mon Feb 14 18:14:00 2011 @@ -629,8 +629,8 @@ Packed); } LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) { - return wrap(ConstantVector::get( - unwrap(ScalarConstantVals, Size), Size)); + return wrap(ConstantVector::get(ArrayRef( + unwrap(ScalarConstantVals, Size), Size))); } /*--.. Constant expressions ................................................--*/ @@ -647,74 +647,62 @@ } LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNSWNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNSWNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNUWNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNUWNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getFNeg( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getFNeg(unwrap(ConstantVal))); } LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal) { - return wrap(ConstantExpr::getNot( - unwrap(ConstantVal))); + return wrap(ConstantExpr::getNot(unwrap(ConstantVal))); } LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFAdd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFAdd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSub( - unwrap(LHSConstant), + return wrap(ConstantExpr::getSub(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWSub( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWSub(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWSub( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWSub(unwrap(LHSConstant), unwrap(RHSConstant))); } @@ -724,89 +712,75 @@ } LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNSWMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNSWMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getNUWMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getNUWMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFMul( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFMul(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getUDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getUDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getSDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getExactSDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getExactSDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFDiv( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFDiv(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getURem( - unwrap(LHSConstant), + return wrap(ConstantExpr::getURem(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getSRem( - unwrap(LHSConstant), + return wrap(ConstantExpr::getSRem(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getFRem( - unwrap(LHSConstant), + return wrap(ConstantExpr::getFRem(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAnd( - unwrap(LHSConstant), + return wrap(ConstantExpr::getAnd(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getOr( - unwrap(LHSConstant), + return wrap(ConstantExpr::getOr(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getXor( - unwrap(LHSConstant), + return wrap(ConstantExpr::getXor(unwrap(LHSConstant), unwrap(RHSConstant))); } @@ -825,27 +799,23 @@ } LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getShl( - unwrap(LHSConstant), - unwrap(RHSConstant))); + return wrap(ConstantExpr::getShl(unwrap(LHSConstant), + unwrap(RHSConstant))); } LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getLShr( - unwrap(LHSConstant), + return wrap(ConstantExpr::getLShr(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) { - return wrap(ConstantExpr::getAShr( - unwrap(LHSConstant), + return wrap(ConstantExpr::getAShr(unwrap(LHSConstant), unwrap(RHSConstant))); } LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices) { - return wrap(ConstantExpr::getGetElementPtr( - unwrap(ConstantVal), + return wrap(ConstantExpr::getGetElementPtr(unwrap(ConstantVal), unwrap(ConstantIndices, NumIndices), NumIndices)); @@ -860,38 +830,32 @@ } LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getTrunc( - unwrap(ConstantVal), + return wrap(ConstantExpr::getTrunc(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExt( - unwrap(ConstantVal), + return wrap(ConstantExpr::getSExt(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExt( - unwrap(ConstantVal), + return wrap(ConstantExpr::getZExt(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPTrunc( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPTrunc(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPExtend( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPExtend(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getUIToFP( - unwrap(ConstantVal), + return wrap(ConstantExpr::getUIToFP(unwrap(ConstantVal), unwrap(ToType))); } @@ -906,92 +870,78 @@ } LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPToSI( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPToSI(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getPtrToInt( - unwrap(ConstantVal), + return wrap(ConstantExpr::getPtrToInt(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getIntToPtr( - unwrap(ConstantVal), + return wrap(ConstantExpr::getIntToPtr(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getZExtOrBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getZExtOrBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getSExtOrBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getSExtOrBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getTruncOrBitCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getTruncOrBitCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getPointerCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getPointerCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned) { - return wrap(ConstantExpr::getIntegerCast( - unwrap(ConstantVal), - unwrap(ToType), - isSigned)); + return wrap(ConstantExpr::getIntegerCast(unwrap(ConstantVal), + unwrap(ToType), isSigned)); } LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - return wrap(ConstantExpr::getFPCast( - unwrap(ConstantVal), + return wrap(ConstantExpr::getFPCast(unwrap(ConstantVal), unwrap(ToType))); } LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, LLVMValueRef ConstantIfTrue, LLVMValueRef ConstantIfFalse) { - return wrap(ConstantExpr::getSelect( - unwrap(ConstantCondition), + return wrap(ConstantExpr::getSelect(unwrap(ConstantCondition), unwrap(ConstantIfTrue), unwrap(ConstantIfFalse))); } LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getExtractElement( - unwrap(VectorConstant), + return wrap(ConstantExpr::getExtractElement(unwrap(VectorConstant), unwrap(IndexConstant))); } LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, LLVMValueRef ElementValueConstant, LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getInsertElement( - unwrap(VectorConstant), + return wrap(ConstantExpr::getInsertElement(unwrap(VectorConstant), unwrap(ElementValueConstant), unwrap(IndexConstant))); } @@ -999,24 +949,21 @@ LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant, LLVMValueRef VectorBConstant, LLVMValueRef MaskConstant) { - return wrap(ConstantExpr::getShuffleVector( - unwrap(VectorAConstant), + return wrap(ConstantExpr::getShuffleVector(unwrap(VectorAConstant), unwrap(VectorBConstant), unwrap(MaskConstant))); } LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList, unsigned NumIdx) { - return wrap(ConstantExpr::getExtractValue( - unwrap(AggConstant), + return wrap(ConstantExpr::getExtractValue(unwrap(AggConstant), IdxList, NumIdx)); } LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant, LLVMValueRef ElementValueConstant, unsigned *IdxList, unsigned NumIdx) { - return wrap(ConstantExpr::getInsertValue( - unwrap(AggConstant), + return wrap(ConstantExpr::getInsertValue(unwrap(AggConstant), unwrap(ElementValueConstant), IdxList, NumIdx)); } From sabre at nondot.org Mon Feb 14 18:14:14 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 00:14:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r125539 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <20110215001414.BA2552A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 18:14:14 2011 New Revision: 125539 URL: http://llvm.org/viewvc/llvm-project?rev=125539&view=rev Log: update for ConstantVector::get API change. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=125539&r1=125538&r2=125539&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Feb 14 18:14:14 2011 @@ -1019,7 +1019,7 @@ for (unsigned i = 0; i != 16; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value* SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value* SV = ConstantVector::get(Indices); Result = Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr"); return true; } From sabre at nondot.org Mon Feb 14 18:15:39 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 00:15:39 -0000 Subject: [llvm-commits] [dragonegg] r125540 - /dragonegg/trunk/x86/llvm-target.cpp Message-ID: <20110215001539.BA6B52A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 18:15:39 2011 New Revision: 125540 URL: http://llvm.org/viewvc/llvm-project?rev=125540&view=rev Log: Update to build with ConstantVector API change. Modified: dragonegg/trunk/x86/llvm-target.cpp Modified: dragonegg/trunk/x86/llvm-target.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/x86/llvm-target.cpp?rev=125540&r1=125539&r2=125540&view=diff ============================================================================== --- dragonegg/trunk/x86/llvm-target.cpp (original) +++ dragonegg/trunk/x86/llvm-target.cpp Mon Feb 14 18:15:39 2011 @@ -671,7 +671,7 @@ for (unsigned i = 0; i != 8; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value* SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value* SV = ConstantVector::get(Indices); Result = Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr"); return true; } @@ -723,7 +723,7 @@ for (unsigned i = 0; i != 16; ++i) Indices.push_back(ConstantInt::get(IntTy, shiftVal + i)); - Value* SV = ConstantVector::get(Indices.begin(), Indices.size()); + Value* SV = ConstantVector::get(Indices); Result = Builder.CreateShuffleVector(Ops[1], Ops[0], SV, "palignr"); return true; } From clattner at apple.com Mon Feb 14 18:26:41 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Feb 2011 16:26:41 -0800 Subject: [llvm-commits] [llvm] r125319 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/JumpThreading/degenerate-phi.ll In-Reply-To: <4D593283.60209@free.fr> References: <20110210235410.768AF2A6C12C@llvm.org> <4D54E80F.2090806@free.fr> <4D54F28C.7030901@mxc.ca> <4D54F322.8020602@free.fr> <7E8EAEF2-1835-4E85-B065-A9D6B2C67812@apple.com> <4D593283.60209@free.fr> Message-ID: <9DEFA69F-FF43-4140-9534-4B935F79070F@apple.com> On Feb 14, 2011, at 5:47 AM, Duncan Sands wrote: >>> It looks to me like the problem is that removePredecessor() respects >>> the 'DontDeleteUselessPHIs' parameter even when the only predecessor >>> is removed, and that JumpThreading always passes 'true' for that (even >>> though AFAICT it doesn't have a good reason to). >>> >>> The best fix is probably to ignore that parameter if it's removing the >>> last predecessor; IMHO in this case it should just replace all PHIs >>> with undefs and then kill them, regardless of that parameter. >> >> I agree, that does seem like the right fix. > > it seems dangerous to erase phi's when explicitly told not to - it creates the > danger of the caller using freed memory and so on. Instead, how about having > removePredecessor always do a RAUW of degenerate phis with undef, but not > actually erase them if DontDeleteUselessPHIs was passed. That sounds like it is just a matter of updating the comment on the method, and checking the clients to see who is doing this (fixing it as appropriate). -Chris From sabre at nondot.org Mon Feb 14 18:23:53 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 00:23:53 -0000 Subject: [llvm-commits] [llvm] r125543 - /llvm/trunk/include/llvm/ADT/ArrayRef.h Message-ID: <20110215002353.76A712A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 18:23:53 2011 New Revision: 125543 URL: http://llvm.org/viewvc/llvm-project?rev=125543&view=rev Log: fix comments Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=125543&r1=125542&r2=125543&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ArrayRef.h (original) +++ llvm/trunk/include/llvm/ADT/ArrayRef.h Mon Feb 14 18:23:53 2011 @@ -73,10 +73,10 @@ iterator begin() const { return Data; } iterator end() const { return Data + Length; } - /// empty - Check if the string is empty. + /// empty - Check if the array is empty. bool empty() const { return Length == 0; } - /// size - Get the string size. + /// size - Get the array size. size_t size() const { return Length; } /// front - Get the first element. From sabre at nondot.org Mon Feb 14 18:24:32 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 00:24:32 -0000 Subject: [llvm-commits] [llvm] r125544 - /llvm/trunk/docs/tutorial/LangImpl3.html Message-ID: <20110215002432.AA4EC2A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 18:24:32 2011 New Revision: 125544 URL: http://llvm.org/viewvc/llvm-project?rev=125544&view=rev Log: Minor fixes to tutorial, patch by Benjamin Meyer! Modified: llvm/trunk/docs/tutorial/LangImpl3.html Modified: llvm/trunk/docs/tutorial/LangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=125544&r1=125543&r2=125544&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl3.html (original) +++ llvm/trunk/docs/tutorial/LangImpl3.html Mon Feb 14 18:24:32 2011 @@ -353,8 +353,8 @@

    The Module symbol table works just like the Function symbol table when it -comes to name conflicts: if a new function is created with a name was previously -added to the symbol table, it will get implicitly renamed when added to the +comes to name conflicts: if a new function is created with a name that was previously +added to the symbol table, the new function will get implicitly renamed when added to the Module. The code above exploits this fact to determine if there was a previous definition of this function.

    From clattner at apple.com Mon Feb 14 18:28:11 2011 From: clattner at apple.com (Chris Lattner) Date: Mon, 14 Feb 2011 16:28:11 -0800 Subject: [llvm-commits] [PATCH] A small tweak to the documentation In-Reply-To: <2ECA47BD-B5A4-4721-96A5-A156910BFBB3@meyerhome.net> References: <2ECA47BD-B5A4-4721-96A5-A156910BFBB3@meyerhome.net> Message-ID: <06424EA9-D90D-4033-8611-7E8D2F996EE4@apple.com> On Feb 10, 2011, at 7:05 AM, Benjamin Meyer wrote: > I have been working my way through the tutorial and have a small patch that fixes up a sentence for review. Thanks, committed in r125544! From sabre at nondot.org Mon Feb 14 19:56:08 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 01:56:08 -0000 Subject: [llvm-commits] [llvm] r125546 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Message-ID: <20110215015608.922C12A6C12C@llvm.org> Author: lattner Date: Mon Feb 14 19:56:08 2011 New Revision: 125546 URL: http://llvm.org/viewvc/llvm-project?rev=125546&view=rev Log: tidy up a bit. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=125546&r1=125545&r2=125546&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Feb 14 19:56:08 2011 @@ -274,10 +274,11 @@ ConstantInt *CI = ConstantInt::get(AndRHS->getContext(), AndRHS->getValue() & ShlMask); - if (CI->getValue() == ShlMask) { - // Masking out bits that the shift already masks + if (CI->getValue() == ShlMask) + // Masking out bits that the shift already masks. return ReplaceInstUsesWith(TheAnd, Op); // No need for the and. - } else if (CI != AndRHS) { // Reducing bits set in and. + + if (CI != AndRHS) { // Reducing bits set in and. TheAnd.setOperand(1, CI); return &TheAnd; } @@ -294,10 +295,11 @@ ConstantInt *CI = ConstantInt::get(Op->getContext(), AndRHS->getValue() & ShrMask); - if (CI->getValue() == ShrMask) { - // Masking out bits that the shift already masks. + if (CI->getValue() == ShrMask) + // Masking out bits that the shift already masks. return ReplaceInstUsesWith(TheAnd, Op); - } else if (CI != AndRHS) { + + if (CI != AndRHS) { TheAnd.setOperand(1, CI); // Reduce bits set in and cst. return &TheAnd; } @@ -1065,7 +1067,7 @@ } break; } - + if (ConstantInt *Op0CI = dyn_cast(Op0I->getOperand(1))) if (Instruction *Res = OptAndOp(Op0I, Op0CI, AndRHS, I)) return Res; From dpatel at apple.com Mon Feb 14 20:02:30 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 15 Feb 2011 02:02:30 -0000 Subject: [llvm-commits] [llvm] r125547 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Message-ID: <20110215020230.D356A2A6C12C@llvm.org> Author: dpatel Date: Mon Feb 14 20:02:30 2011 New Revision: 125547 URL: http://llvm.org/viewvc/llvm-project?rev=125547&view=rev Log: Do not forget DebugLoc! Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=125547&r1=125546&r2=125547&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Mon Feb 14 20:02:30 2011 @@ -1588,6 +1588,7 @@ DEBUG(errs() << "IC: Old = " << *I << '\n' << " New = " << *Result << '\n'); + Result->setDebugLoc(I->getDebugLoc()); // Everything uses the new instruction now. I->replaceAllUsesWith(Result); From evan.cheng at apple.com Mon Feb 14 23:00:24 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 15 Feb 2011 05:00:24 -0000 Subject: [llvm-commits] [llvm] r125552 - /llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Message-ID: <20110215050024.3BD102A6C12C@llvm.org> Author: evancheng Date: Mon Feb 14 23:00:24 2011 New Revision: 125552 URL: http://llvm.org/viewvc/llvm-project?rev=125552&view=rev Log: Fix thinko. Cmp can be the first instruction in a MBB. Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=125552&r1=125551&r2=125552&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original) +++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Mon Feb 14 23:00:24 2011 @@ -331,7 +331,8 @@ ImmDefRegs.clear(); ImmDefMIs.clear(); - MachineBasicBlock::iterator PMII = I->begin(); + bool First = true; + MachineBasicBlock::iterator PMII; for (MachineBasicBlock::iterator MII = I->begin(), MIE = I->end(); MII != MIE; ) { MachineInstr *MI = &*MII; @@ -348,7 +349,7 @@ if (OptimizeCmpInstr(MI, MBB)) { // MI is deleted. Changed = true; - MII = llvm::next(PMII); + MII = First ? I->begin() : llvm::next(PMII); continue; } } @@ -360,6 +361,8 @@ if (SeenMoveImm) Changed |= FoldImmediate(MI, MBB, ImmDefRegs, ImmDefMIs); } + + First = false; PMII = MII; ++MII; } From sabre at nondot.org Tue Feb 15 00:04:07 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 06:04:07 -0000 Subject: [llvm-commits] [www-pubs] r125553 - in /www-pubs/trunk: 2011-02-FOSDEM-LLVMAndClang.html 2011-02-FOSDEM-LLVMAndClang.pdf pubs.js Message-ID: <20110215060407.8AF732A6C12C@llvm.org> Author: lattner Date: Tue Feb 15 00:04:07 2011 New Revision: 125553 URL: http://llvm.org/viewvc/llvm-project?rev=125553&view=rev Log: add fosdem talk Added: www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.html www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.pdf (with props) Modified: www-pubs/trunk/pubs.js Added: www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.html URL: http://llvm.org/viewvc/llvm-project/www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.html?rev=125553&view=auto ============================================================================== --- www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.html (added) +++ www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.html Tue Feb 15 00:04:07 2011 @@ -0,0 +1,41 @@ + + + + + + LLVM and Clang: Advancing Compiler Technology + + + +
    + LLVM and Clang: Advancing Compiler Technology +
    + + +

    Abstract:

    +
    +

    +This talk introduces LLVM, giving a brief sense for its library based +design. It then dives into Clang to describe the end-user benefits of LLVM +compiler technology, finally wrapping up with mentions of Clang Static Analyzer, +LLDB, libc++ and the LLVM MC projects. +

    + +
    + +

    Published:

    +
    + "LLVM and Clang: Advancing Compiler Technology", Chris Lattner,
    + FOSDEM 2011: Free and Open Source Developers' European Meeting, Brussels, Belgium, Feb 2011.
    +
    + +

    Download Presentation:

    + + + + + Added: www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.pdf URL: http://llvm.org/viewvc/llvm-project/www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.pdf?rev=125553&view=auto ============================================================================== Binary file - no diff available. Propchange: www-pubs/trunk/2011-02-FOSDEM-LLVMAndClang.pdf ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: www-pubs/trunk/pubs.js URL: http://llvm.org/viewvc/llvm-project/www-pubs/trunk/pubs.js?rev=125553&r1=125552&r2=125553&view=diff ============================================================================== --- www-pubs/trunk/pubs.js (original) +++ www-pubs/trunk/pubs.js Tue Feb 15 00:04:07 2011 @@ -1,6 +1,15 @@ // The array should be sorted reverse-chronologically, and will be displayed on // the page in the order listed. var PUBS = +[{ url: "2011-02-FOSDEM-LLVMAndClang.html", + title: "LLVM and Clang: Advancing Compiler Technology", + published: 'Keynote Talk, FOSDEM 2011: Free and Open Source Developers European Meeting', + location: "Brussels, Belgium", + author: "Chris Lattner", + month: 2, + year: 2011 + }, + [{ url: "2010-12-Preuss-PathProfiling.html", title: "Implementation of Path Profiling in the Low-Level Virtual-Machine (LLVM) Compiler Infrastructure", published: "Technical Report #10-05, University of Alberta", From sabre at nondot.org Tue Feb 15 00:04:57 2011 From: sabre at nondot.org (Chris Lattner) Date: Tue, 15 Feb 2011 06:04:57 -0000 Subject: [llvm-commits] [www-pubs] r125554 - /www-pubs/trunk/pubs.js Message-ID: <20110215060457.A094B2A6C12C@llvm.org> Author: lattner Date: Tue Feb 15 00:04:57 2011 New Revision: 125554 URL: http://llvm.org/viewvc/llvm-project?rev=125554&view=rev Log: fix broken js Modified: www-pubs/trunk/pubs.js Modified: www-pubs/trunk/pubs.js URL: http://llvm.org/viewvc/llvm-project/www-pubs/trunk/pubs.js?rev=125554&r1=125553&r2=125554&view=diff ============================================================================== --- www-pubs/trunk/pubs.js (original) +++ www-pubs/trunk/pubs.js Tue Feb 15 00:04:57 2011 @@ -3,14 +3,14 @@ var PUBS = [{ url: "2011-02-FOSDEM-LLVMAndClang.html", title: "LLVM and Clang: Advancing Compiler Technology", - published: 'Keynote Talk, FOSDEM 2011: Free and Open Source Developers European Meeting', + published: "Keynote Talk, FOSDEM 2011: Free and Open Source Developers European Meeting", location: "Brussels, Belgium", author: "Chris Lattner", month: 2, year: 2011 }, -[{ url: "2010-12-Preuss-PathProfiling.html", + { url: "2010-12-Preuss-PathProfiling.html", title: "Implementation of Path Profiling in the Low-Level Virtual-Machine (LLVM) Compiler Infrastructure", published: "Technical Report #10-05, University of Alberta", location: "Alberta, Canada", From nadav.rotem at intel.com Tue Feb 15 01:13:48 2011 From: nadav.rotem at intel.com (Nadav Rotem) Date: Tue, 15 Feb 2011 07:13:48 -0000 Subject: [llvm-commits] [llvm] r125557 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp test/Transforms/InstCombine/2011-02-14-InfLoop.ll Message-ID: <20110215071349.02B5F2A6C12C@llvm.org> Author: nadav Date: Tue Feb 15 01:13:48 2011 New Revision: 125557 URL: http://llvm.org/viewvc/llvm-project?rev=125557&view=rev Log: Fix 9216 - Endless loop in InstCombine pass. The pattern "A&(A^B) -> A & ~B" recreated itself because ~B is actually a xor -1. Added: llvm/trunk/test/Transforms/InstCombine/2011-02-14-InfLoop.ll (with props) Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=125557&r1=125556&r2=125557&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Tue Feb 15 01:13:48 2011 @@ -1140,7 +1140,11 @@ cast(Op1)->swapOperands(); std::swap(A, B); } - if (A == Op0) // A&(A^B) -> A & ~B + // Notice that the patten (A&(~B)) is actually (A&(-1^B)), so if + // A is originally -1 (or a vector of -1 and undefs), then we enter + // an endless loop. By checking that A is non-constant we ensure that + // we will never get to the loop. + if (A == Op0 && !isa(A)) // A&(A^B) -> A & ~B return BinaryOperator::CreateAnd(A, Builder->CreateNot(B, "tmp")); } Added: llvm/trunk/test/Transforms/InstCombine/2011-02-14-InfLoop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2011-02-14-InfLoop.ll?rev=125557&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2011-02-14-InfLoop.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2011-02-14-InfLoop.ll Tue Feb 15 01:13:48 2011 @@ -0,0 +1,19 @@ +; This testcase causes an infinite loop in the instruction combiner, +; because it changes a pattern and the original pattern is almost +; identical to the newly-generated pattern. +; RUN: opt < %s -instcombine -disable-output + +;PR PR9216 + +target triple = "x86_64-unknown-linux-gnu" + +define <4 x float> @m_387(i8* noalias nocapture %A, i8* nocapture %B, <4 x i1> %C) nounwind { +entry: + %movcsext20 = sext <4 x i1> %C to <4 x i32> + %tmp2389 = xor <4 x i32> %movcsext20, + %movcand25 = and <4 x i32> %tmp2389, + %movcor26 = or <4 x i32> %movcand25, zeroinitializer + %L2 = bitcast <4 x i32> %movcor26 to <4 x float> + %L3 = shufflevector <4 x float> zeroinitializer, <4 x float> %L2, <4 x i32> + ret <4 x float> %L3 +} Propchange: llvm/trunk/test/Transforms/InstCombine/2011-02-14-InfLoop.ll ------------------------------------------------------------------------------ svn:eol-style = native From akyrtzi at gmail.com Tue Feb 15 01:42:17 2011 From: akyrtzi at gmail.com (Argyrios Kyrtzidis) Date: Tue, 15 Feb 2011 07:42:17 -0000 Subject: [llvm-commits] [llvm] r125558 - /llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Message-ID: <20110215074217.257EE2A6C12C@llvm.org> Author: akirtzidis Date: Tue Feb 15 01:42:16 2011 New Revision: 125558 URL: http://llvm.org/viewvc/llvm-project?rev=125558&view=rev Log: When tablegen'ing the clang analyzer checkers: -Use the tablegen class name for the checker class name. -Mark checker packages as hidden/not hidden. Modified: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Modified: llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp?rev=125558&r1=125557&r2=125558&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Tue Feb 15 01:42:16 2011 @@ -34,32 +34,49 @@ return false; } -static std::string getPackageFullName(Record *R); +static bool isCheckerNamed(const Record *R) { + return !R->getValueAsString("CheckerName").empty(); +} + +static std::string getPackageFullName(const Record *R); -static std::string getParentPackageFullName(Record *R) { +static std::string getParentPackageFullName(const Record *R) { std::string name; if (DefInit *DI = dynamic_cast(R->getValueInit("ParentPackage"))) name = getPackageFullName(DI->getDef()); return name; } -static std::string getPackageFullName(Record *R) { +static std::string getPackageFullName(const Record *R) { std::string name = getParentPackageFullName(R); if (!name.empty()) name += "."; return name + R->getValueAsString("PackageName"); } -static std::string getCheckerFullName(Record *R) { +static std::string getCheckerFullName(const Record *R) { std::string name = getParentPackageFullName(R); - if (!name.empty()) name += "."; - return name + R->getValueAsString("CheckerName"); + if (isCheckerNamed(R)) { + if (!name.empty()) name += "."; + name += R->getValueAsString("CheckerName"); + } + return name; +} + +static std::string getStringValue(const Record &R, StringRef field) { + if (StringInit * + SI = dynamic_cast(R.getValueInit(field))) + return SI->getValue(); + return std::string(); } namespace { struct GroupInfo { std::vector Checkers; llvm::DenseSet SubGroups; + bool Hidden; unsigned Index; + + GroupInfo() : Hidden(false) { } }; } @@ -72,13 +89,16 @@ OS << "\n#ifdef GET_CHECKERS\n"; for (unsigned i = 0, e = checkers.size(); i != e; ++i) { const Record &R = *checkers[i]; - + OS << "CHECKER(" << "\""; - OS.write_escaped(R.getValueAsString("CheckerName")) << "\", "; - OS << R.getValueAsString("ClassName") << ", "; - OS << R.getValueAsString("DescFile") << ", "; + std::string name; + if (isCheckerNamed(&R)) + name = getCheckerFullName(&R); + OS.write_escaped(name) << "\", "; + OS << R.getName() << ", "; + OS << getStringValue(R, "DescFile") << ", "; OS << "\""; - OS.write_escaped(R.getValueAsString("HelpText")) << "\", "; + OS.write_escaped(getStringValue(R, "HelpText")) << "\", "; // Hidden bit if (isHidden(R)) OS << "true"; @@ -99,6 +119,7 @@ std::string fullName = getPackageFullName(R); if (!fullName.empty()) { GroupInfo &info = groupInfoByName[fullName]; + info.Hidden = isHidden(*R); recordGroupMap[R] = &info; } } @@ -116,24 +137,35 @@ for (unsigned i = 0, e = checkers.size(); i != e; ++i) { Record *R = checkers[i]; - std::string fullName = getCheckerFullName(R); - if (!fullName.empty()) { + Record *package = 0; + if (DefInit * + DI = dynamic_cast(R->getValueInit("ParentPackage"))) + package = DI->getDef(); + if (!isCheckerNamed(R) && !package) + throw "Checker '" + R->getName() + "' is neither named, nor in a package!"; + + if (isCheckerNamed(R)) { + // Create a pseudo-group to hold this checker. + std::string fullName = getCheckerFullName(R); GroupInfo &info = groupInfoByName[fullName]; recordGroupMap[R] = &info; info.Checkers.push_back(R); - Record *currR = R; - // Insert the checker and its parent packages into the set of the - // corresponding parent package. - while (DefInit *DI - = dynamic_cast(currR->getValueInit("ParentPackage"))) { - Record *parentPackage = DI->getDef(); - recordGroupMap[parentPackage]->SubGroups.insert(currR); - currR = parentPackage; - } - // Insert the checker into the set of its group. - if (DefInit *DI = dynamic_cast(R->getValueInit("Group"))) - recordGroupMap[DI->getDef()]->SubGroups.insert(R); + } else { + recordGroupMap[package]->Checkers.push_back(R); + } + + Record *currR = isCheckerNamed(R) ? R : package; + // Insert the checker and its parent packages into the subgroups set of + // the corresponding parent package. + while (DefInit *DI + = dynamic_cast(currR->getValueInit("ParentPackage"))) { + Record *parentPackage = DI->getDef(); + recordGroupMap[parentPackage]->SubGroups.insert(currR); + currR = parentPackage; } + // Insert the checker into the set of its group. + if (DefInit *DI = dynamic_cast(R->getValueInit("Group"))) + recordGroupMap[DI->getDef()]->Checkers.push_back(R); } unsigned index = 0; @@ -185,9 +217,12 @@ // Subgroups. if (I->second.SubGroups.empty()) - OS << 0; + OS << "0, "; else - OS << "SubPackageArray" << I->second.Index; + OS << "SubPackageArray" << I->second.Index << ", "; + + OS << (I->second.Hidden ? "true" : "false"); + OS << " },\n"; } OS << "#endif // GET_CHECKNAME_TABLE\n\n"; From baldrick at free.fr Tue Feb 15 03:23:02 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Feb 2011 09:23:02 -0000 Subject: [llvm-commits] [llvm] r125563 - in /llvm/trunk: docs/CommandGuide/FileCheck.pod docs/TestingGuide.html docs/WritingAnLLVMPass.html include/llvm/ADT/SmallPtrSet.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/ARM/ARMConstantIslandPass.cpp lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp lib/Transforms/Scalar/LoopIdiomRecognize.cpp lib/Transforms/Scalar/MemCpyOptimizer.cpp Message-ID: <20110215092302.71F492A6C12D@llvm.org> Author: baldrick Date: Tue Feb 15 03:23:02 2011 New Revision: 125563 URL: http://llvm.org/viewvc/llvm-project?rev=125563&view=rev Log: Spelling fix: consequtive -> consecutive. Modified: llvm/trunk/docs/CommandGuide/FileCheck.pod llvm/trunk/docs/TestingGuide.html llvm/trunk/docs/WritingAnLLVMPass.html llvm/trunk/include/llvm/ADT/SmallPtrSet.h llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Modified: llvm/trunk/docs/CommandGuide/FileCheck.pod URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/FileCheck.pod?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/docs/CommandGuide/FileCheck.pod (original) +++ llvm/trunk/docs/CommandGuide/FileCheck.pod Tue Feb 15 03:23:02 2011 @@ -133,7 +133,7 @@ =head2 The "CHECK-NEXT:" directive Sometimes you want to match lines and would like to verify that matches -happen on exactly consequtive lines with no other lines in between them. In +happen on exactly consecutive lines with no other lines in between them. In this case, you can use CHECK: and CHECK-NEXT: directives to specify this. If you specified a custom check prefix, just use "-NEXT:". For example, something like this works as you'd expect: Modified: llvm/trunk/docs/TestingGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/docs/TestingGuide.html (original) +++ llvm/trunk/docs/TestingGuide.html Tue Feb 15 03:23:02 2011 @@ -604,7 +604,7 @@

    Sometimes you want to match lines and would like to verify that matches -happen on exactly consequtive lines with no other lines in between them. In +happen on exactly consecutive lines with no other lines in between them. In this case, you can use CHECK: and CHECK-NEXT: directives to specify this. If you specified a custom check prefix, just use "<PREFIX>-NEXT:". For example, something like this works as you'd expect:

    Modified: llvm/trunk/docs/WritingAnLLVMPass.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/docs/WritingAnLLVMPass.html (original) +++ llvm/trunk/docs/WritingAnLLVMPass.html Tue Feb 15 03:23:02 2011 @@ -1474,7 +1474,7 @@
  • Pipeline the execution of passes on the program - The PassManager attempts to get better cache and memory usage behavior out of a series of passes by pipelining the passes together. This means that, given -a series of consequtive FunctionPass's, it +a series of consecutive FunctionPass's, it will execute all of the FunctionPass's on the first function, then all of the FunctionPasses on the second function, Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original) +++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Tue Feb 15 03:23:02 2011 @@ -57,7 +57,7 @@ /// it, so that the end iterator actually points to valid memory. unsigned CurArraySize; - // If small, this is # elts allocated consequtively + // If small, this is # elts allocated consecutively unsigned NumElements; unsigned NumTombstones; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Feb 15 03:23:02 2011 @@ -1012,7 +1012,7 @@ } } - // On some targets (e.g. Darwin) we want to emit two consequtive labels + // On some targets (e.g. Darwin) we want to emit two consecutive labels // before each jump table. The first label is never referenced, but tells // the assembler and linker the extents of the jump table object. The // second label is actually referenced by the code. Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Tue Feb 15 03:23:02 2011 @@ -699,7 +699,7 @@ /// machine function, it upsets all of the block numbers. Renumber the blocks /// and update the arrays that parallel this numbering. void ARMConstantIslands::UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB) { - // Renumber the MBB's to keep them consequtive. + // Renumber the MBB's to keep them consecutive. NewBB->getParent()->RenumberBlocks(NewBB); // Insert a size into BBSizes to align it properly with the (newly Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Tue Feb 15 03:23:02 2011 @@ -165,7 +165,7 @@ if (LI.isVolatile()) return 0; // Do really simple store-to-load forwarding and load CSE, to catch cases - // where there are several consequtive memory accesses to the same location, + // where there are several consecutive memory accesses to the same location, // separated by a few arithmetic operations. BasicBlock::iterator BBI = &LI; if (Value *AvailableVal = FindAvailableLoadedValue(Op, LI.getParent(), BBI,6)) Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Tue Feb 15 03:23:02 2011 @@ -273,7 +273,7 @@ return false; // If the stored value is a byte-wise value (like i32 -1), then it may be - // turned into a memset of i8 -1, assuming that all the consequtive bytes + // turned into a memset of i8 -1, assuming that all the consecutive bytes // are stored. A store of i32 0x01020304 can never be turned into a memset. if (Value *SplatValue = isBytewiseValue(StoredVal)) if (processLoopStoreOfSplatValue(StorePtr, StoreSize, SI->getAlignment(), Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=125563&r1=125562&r2=125563&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Tue Feb 15 03:23:02 2011 @@ -352,7 +352,7 @@ /// tryMergingIntoMemset - When scanning forward over instructions, we look for /// some other patterns to fold away. In particular, this looks for stores to -/// neighboring locations of memory. If it sees enough consequtive ones, it +/// neighboring locations of memory. If it sees enough consecutive ones, it /// attempts to merge them together into a memcpy/memset. Instruction *MemCpyOpt::tryMergingIntoMemset(Instruction *StartInst, Value *StartPtr, Value *ByteVal) { From geek4civic at gmail.com Tue Feb 15 03:31:59 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 15 Feb 2011 18:31:59 +0900 Subject: [llvm-commits] [PATCH][llvm][clang] Triple::{MinGW32|MinGW64} => Triple::MinGW Message-ID: Good evening. For "so-called mingw64", a few issues are there. - autoconf does not know "*-mingw64". - The project "Mingw-w64" uses *-w64-mingw32 as triplet. - in llvm and clang, some parts assume Win64 as "Triple::MinGW64". In practice, we don't need to distinguish "MinGW32" and "MinGW64" in llvm. In clang, we should not assume "x86_64-mingw" as *-w64-mingw32. There is also "i686-w64-mingw32", as a variant of mingw32. I propose 4 patches for; - Introduce generic Triple::MinGW. MinGW32 and MinGW64 will be deprecated. - Add paths for (personally) known mingw-w64. Excuse me, I split patches for 4 parts, to be consistent for llvm and clang repository. Checked on x86_64-w64-g++(20101129, 20110207) and stage2-3 x64-clang. Any feedbacks are welcome! Thank you in advance. ...Takumi [llvm] NAKAMURA Takumi (2): Introduce Triple::MinGW. Triple::MinGW32 and Triple::MinGW64 are deprecated and removed. We can use Triple::MinGW. include/llvm/ADT/Triple.h | 3 +-- lib/Support/Triple.cpp | 9 +++------ lib/Target/ARM/ARMAsmBackend.cpp | 2 +- lib/Target/ARM/ARMTargetMachine.cpp | 3 +-- lib/Target/MBlaze/MBlazeAsmBackend.cpp | 2 +- lib/Target/MBlaze/MBlazeTargetMachine.cpp | 3 +-- lib/Target/X86/X86AsmBackend.cpp | 4 ++-- lib/Target/X86/X86Subtarget.h | 4 +--- lib/Target/X86/X86TargetMachine.cpp | 6 ++---- 9 files changed, 13 insertions(+), 23 deletions(-) [clang] NAKAMURA Takumi (2): Introduce Triple::MinGW. MinGW32 and MinGW64 are deprecated. lib/Frontend/InitHeaderSearch.cpp: Add mingw-w64's include paths. lib/Basic/Targets.cpp | 4 ++-- lib/CodeGen/TargetInfo.cpp | 4 ++-- lib/Driver/Driver.cpp | 3 +-- lib/Driver/Tools.cpp | 3 +-- lib/Frontend/InitHeaderSearch.cpp | 21 ++++++++++----------- lib/Sema/TargetAttributesSema.cpp | 3 +-- 6 files changed, 17 insertions(+), 21 deletions(-) From geek4civic at gmail.com Tue Feb 15 03:32:23 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 15 Feb 2011 18:32:23 +0900 Subject: [llvm-commits] [PATCH 1/4][llvm] Introduce Triple::MinGW. Message-ID: No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32. In llvm side, i686 and 64 can be treated as similar way. --- include/llvm/ADT/Triple.h | 4 +++- lib/Support/Triple.cpp | 10 ++++------ lib/Target/ARM/ARMAsmBackend.cpp | 2 +- lib/Target/ARM/ARMTargetMachine.cpp | 3 +-- lib/Target/MBlaze/MBlazeAsmBackend.cpp | 2 +- lib/Target/MBlaze/MBlazeTargetMachine.cpp | 3 +-- lib/Target/X86/X86AsmBackend.cpp | 4 ++-- lib/Target/X86/X86Subtarget.h | 4 +--- lib/Target/X86/X86TargetMachine.cpp | 6 ++---- 9 files changed, 16 insertions(+), 22 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Introduce-Triple-MinGW.patch Type: text/x-patch Size: 6396 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110215/65bdbba0/attachment.bin From geek4civic at gmail.com Tue Feb 15 03:32:53 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 15 Feb 2011 18:32:53 +0900 Subject: [llvm-commits] [PATCH 3/4][llvm] Triple::MinGW32 and Triple::MinGW64 are deprecated and removed. We can use Triple::MinGW. Message-ID: --- include/llvm/ADT/Triple.h | 3 --- lib/Support/Triple.cpp | 1 - 2 files changed, 0 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Triple-MinGW32-and-Triple-MinGW64-are-deprecated-and.patch Type: text/x-patch Size: 844 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110215/2ad5cf1c/attachment.bin From baldrick at free.fr Tue Feb 15 03:36:36 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Feb 2011 10:36:36 +0100 Subject: [llvm-commits] [PATCH][llvm][clang] Triple::{MinGW32|MinGW64} => Triple::MinGW In-Reply-To: References: Message-ID: <4D5A4924.6090407@free.fr> Hi, > For "so-called mingw64", a few issues are there. > > - autoconf does not know "*-mingw64". > - The project "Mingw-w64" uses *-w64-mingw32 as triplet. > - in llvm and clang, some parts assume Win64 as "Triple::MinGW64". > > In practice, we don't need to distinguish "MinGW32" and "MinGW64" in llvm. > In clang, we should not assume "x86_64-mingw" as *-w64-mingw32. > There is also "i686-w64-mingw32", as a variant of mingw32. what does gcc do? Ciao, Duncan. From geek4civic at gmail.com Tue Feb 15 03:44:05 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 15 Feb 2011 18:44:05 +0900 Subject: [llvm-commits] [PATCH][llvm][clang] Triple::{MinGW32|MinGW64} => Triple::MinGW In-Reply-To: <4D5A4924.6090407@free.fr> References: <4D5A4924.6090407@free.fr> Message-ID: On Tue, Feb 15, 2011 at 6:36 PM, Duncan Sands wrote: >> For "so-called mingw64", a few issues are there. >> >> ? - autoconf does not know "*-mingw64". >> ? - The project "Mingw-w64" uses *-w64-mingw32 as triplet. >> ? - in llvm and clang, some parts assume Win64 as "Triple::MinGW64". >> >> In practice, we don't need to distinguish "MinGW32" and "MinGW64" in llvm. >> In clang, we should not assume "x86_64-mingw" as *-w64-mingw32. >> There is also "i686-w64-mingw32", as a variant of mingw32. > > what does gcc do? Traditional Mingw assumes "i686-pc-mingw32". Mingw-w64 assumes "x86_64-w64-mingw32" and "i686-w64-mingw32". See also; http://sourceforge.net/apps/trac/mingw-w64/wiki/Cross%20Win32%20and%20Win64%20compiler ...Takumi From baldrick at free.fr Tue Feb 15 03:49:08 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Feb 2011 10:49:08 +0100 Subject: [llvm-commits] [PATCH][llvm][clang] Triple::{MinGW32|MinGW64} => Triple::MinGW In-Reply-To: References: <4D5A4924.6090407@free.fr> Message-ID: <4D5A4C14.7010603@free.fr> Hi, >>> For "so-called mingw64", a few issues are there. >>> >>> - autoconf does not know "*-mingw64". >>> - The project "Mingw-w64" uses *-w64-mingw32 as triplet. >>> - in llvm and clang, some parts assume Win64 as "Triple::MinGW64". >>> >>> In practice, we don't need to distinguish "MinGW32" and "MinGW64" in llvm. >>> In clang, we should not assume "x86_64-mingw" as *-w64-mingw32. >>> There is also "i686-w64-mingw32", as a variant of mingw32. >> >> what does gcc do? > > Traditional Mingw assumes "i686-pc-mingw32". > Mingw-w64 assumes "x86_64-w64-mingw32" and "i686-w64-mingw32". > > See also; > http://sourceforge.net/apps/trac/mingw-w64/wiki/Cross%20Win32%20and%20Win64%20compiler if I understand right no project understands mingw64 except for LLVM, so you are going to remove mingw64. Also, other projects use "w64" rather than "pc" to say ... well, I'm not sure what this says, but presumably to say whatever mingw64 was trying to say; so you plan to teach LLVM about w64. Is that right? Ciao, Duncan. From baldrick at free.fr Tue Feb 15 04:01:01 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Feb 2011 11:01:01 +0100 Subject: [llvm-commits] [PATCH 1/4][llvm] Introduce Triple::MinGW. In-Reply-To: References: Message-ID: <4D5A4EDD.6030307@free.fr> Hi, > @@ -84,8 +84,10 @@ public: > FreeBSD, > Linux, > Lv2, // PS3 > - MinGW32, > + MinGW, // i*86-pc-mingw32, *-w64-mingw32 > +#define MinGW32 MinGW > MinGW64, > + // FIXME: They will be removed soon. why not remove them at once? > @@ -316,10 +316,8 @@ Triple::OSType Triple::ParseOS(StringRef OSName) { > return Linux; > else if (OSName.startswith("lv2")) > return Lv2; > - else if (OSName.startswith("mingw32")) > - return MinGW32; > - else if (OSName.startswith("mingw64")) > - return MinGW64; > + else if (OSName.startswith("mingw")) > + return MinGW; here you will accept mingw, ming32 and mingw64 while gcc only accepts mingw32. I'm not saying that this is wrong, but maybe it is unwise. Ciao, Duncan. From geek4civic at gmail.com Tue Feb 15 04:18:01 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Tue, 15 Feb 2011 19:18:01 +0900 Subject: [llvm-commits] [PATCH 1/4][llvm] Introduce Triple::MinGW. In-Reply-To: <4D5A4EDD.6030307@free.fr> References: <4D5A4EDD.6030307@free.fr> Message-ID: Duncan, On Tue, Feb 15, 2011 at 7:01 PM, Duncan Sands wrote: >> @@ -84,8 +84,10 @@ public: >> ? ? FreeBSD, >> ? ? Linux, >> ? ? Lv2, ? ? ? ?// PS3 >> - ? ?MinGW32, >> + ? ?MinGW, ? ? ?// i*86-pc-mingw32, *-w64-mingw32 >> +#define MinGW32 MinGW >> ? ? MinGW64, >> + ? ?// FIXME: They will be removed soon. > > why not remove them at once? [3/4] removes them. I think MinGW32 and MinGW64 should be kept here for now. For consistency to clang. I cannot commit to llvm and clang at the same time atomically. :( Please be patient. >> @@ -316,10 +316,8 @@ Triple::OSType Triple::ParseOS(StringRef OSName) { >> ? ? return Linux; >> ? else if (OSName.startswith("lv2")) >> ? ? return Lv2; >> - ?else if (OSName.startswith("mingw32")) >> - ? ?return MinGW32; >> - ?else if (OSName.startswith("mingw64")) >> - ? ?return MinGW64; >> + ?else if (OSName.startswith("mingw")) >> + ? ?return MinGW; > > here you will accept mingw, ming32 and mingw64 while gcc only accepts > mingw32. ?I'm not saying that this is wrong, but maybe it is unwise. I understand. In practice, llvm's config.sub recognizes "mingw32", neither "mingw" nor "mingw64". $ ./config.sub mingw32 (mingw and mingw64 are not recognized) i386-pc-mingw32 I thought it would be better to relax recognizing triplet, though, that makes sense. It would be easier simply to drop "mingw64" and make assume only "mingw32" (Triple::MinGW32), even then my mission would be achieved. Thank you, ...Takumi From baldrick at free.fr Tue Feb 15 04:35:16 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Feb 2011 11:35:16 +0100 Subject: [llvm-commits] [PATCH 1/4][llvm] Introduce Triple::MinGW. In-Reply-To: References: <4D5A4EDD.6030307@free.fr> Message-ID: <4D5A56E4.4030800@free.fr> Hi, > On Tue, Feb 15, 2011 at 7:01 PM, Duncan Sands wrote: >>> @@ -84,8 +84,10 @@ public: >>> FreeBSD, >>> Linux, >>> Lv2, // PS3 >>> - MinGW32, >>> + MinGW, // i*86-pc-mingw32, *-w64-mingw32 >>> +#define MinGW32 MinGW >>> MinGW64, >>> + // FIXME: They will be removed soon. >> >> why not remove them at once? > > [3/4] removes them. I think MinGW32 and MinGW64 should be kept here for now. > For consistency to clang. I cannot commit to llvm and clang at the > same time atomically. :( > Please be patient. OK :) >>> @@ -316,10 +316,8 @@ Triple::OSType Triple::ParseOS(StringRef OSName) { >>> return Linux; >>> else if (OSName.startswith("lv2")) >>> return Lv2; >>> - else if (OSName.startswith("mingw32")) >>> - return MinGW32; >>> - else if (OSName.startswith("mingw64")) >>> - return MinGW64; >>> + else if (OSName.startswith("mingw")) >>> + return MinGW; >> >> here you will accept mingw, ming32 and mingw64 while gcc only accepts >> mingw32. I'm not saying that this is wrong, but maybe it is unwise. > > I understand. In practice, llvm's config.sub recognizes "mingw32", > neither "mingw" nor "mingw64". > > $ ./config.sub mingw32 (mingw and mingw64 are not recognized) > i386-pc-mingw32 > > I thought it would be better to relax recognizing triplet, though, > that makes sense. The danger that I see is that because it will accept mingw64, people will think that by passing mingw64 they are telling LLVM something different to mingw32, creating confusion. That said, I think this patch is OK to apply. Ciao, Duncan. From baldrick at free.fr Tue Feb 15 04:36:07 2011 From: baldrick at free.fr (Duncan Sands) Date: Tue, 15 Feb 2011 11:36:07 +0100 Subject: [llvm-commits] [PATCH 3/4][llvm] Triple::MinGW32 and Triple::MinGW64 are deprecated and removed. We can use Triple::MinGW. In-Reply-To: References: Message-ID: <4D5A5717.3000507@free.fr> This patch looks OK to me. Ciao, Duncan. From vanboxem.ruben at gmail.com Tue Feb 15 05:02:06 2011 From: vanboxem.ruben at gmail.com (Ruben Van Boxem) Date: Tue, 15 Feb 2011 12:02:06 +0100 Subject: [llvm-commits] [PATCH 1/4][llvm] Introduce Triple::MinGW. In-Reply-To: <4D5A4EDD.6030307@free.fr> References: <4D5A4EDD.6030307@free.fr> Message-ID: Better would be mingw*, and every toolchain should be classified as mingw32, irrelevant if there's mingw.org or mingw-w64. (the 32 comes from the win32 API). mingw64 does not exist... Op 15 feb. 2011 11:01 schreef "Duncan Sands" het volgende: > Hi, > >> @@ -84,8 +84,10 @@ public: >> FreeBSD, >> Linux, >> Lv2, // PS3 >> - MinGW32, >> + MinGW, // i*86-pc-mingw32, *-w64-mingw32 >> +#define MinGW32 MinGW >> MinGW64, >> + // FIXME: They will be removed soon. > > why not remove them at once? > >> @@ -316,10 +316,8 @@ Triple::OSType Triple::ParseOS(StringRef OSName) { >> return Linux; >> else if (OSName.startswith("lv2")) >> return Lv2; >> - else if (OSName.startswith("mingw32")) >> - return MinGW32; >> - else if (OSName.startswith("mingw64")) >> - return MinGW64; >> + else if (OSName.startswith("mingw")) >> + return MinGW; > > here you will accept mingw, ming32 and mingw64 while gcc only accepts > mingw32. I'm not saying that this is wrong, but maybe it is unwise. > > Ciao, Duncan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110215/042189ab/attachment.html From dpatel at apple.com Tue Feb 15 11:24:56 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 15 Feb 2011 17:24:56 -0000 Subject: [llvm-commits] [llvm] r125567 - in /llvm/trunk/lib/Analysis: DbgInfoPrinter.cpp DebugInfo.cpp Message-ID: <20110215172456.C6DF62A6C12D@llvm.org> Author: dpatel Date: Tue Feb 15 11:24:56 2011 New Revision: 125567 URL: http://llvm.org/viewvc/llvm-project?rev=125567&view=rev Log: Print function info. Patch by Minjang Kim. Modified: llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp?rev=125567&r1=125566&r2=125567&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp (original) +++ llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp Tue Feb 15 11:24:56 2011 @@ -66,8 +66,12 @@ Out << "; "; WriteAsOperand(Out, V, false, 0); - Out << " is variable " << DisplayName - << " of type " << Type << " declared at "; + if (isa(V)) + Out << " is function " << DisplayName + << " of type " << Type << " declared at "; + else + Out << " is variable " << DisplayName + << " of type " << Type << " declared at "; if (PrintDirectory) Out << Directory << "/"; Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=125567&r1=125566&r2=125567&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Feb 15 11:24:56 2011 @@ -1592,6 +1592,23 @@ return 0; } +/// Find the debug info descriptor corresponding to this function. +static Value *findDbgSubprogramDeclare(Function *V) { + const Module *M = V->getParent(); + NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp"); + if (!NMD) + return 0; + + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { + DIDescriptor DIG(cast(NMD->getOperand(i))); + if (!DIG.isSubprogram()) + continue; + if (DISubprogram(DIG).getFunction() == V) + return DIG; + } + return 0; +} + /// Finds the llvm.dbg.declare intrinsic corresponding to this value if any. /// It looks through pointer casts too. static const DbgDeclareInst *findDbgDeclare(const Value *V) { @@ -1633,6 +1650,17 @@ LineNo = Var.getLineNumber(); Unit = Var.getCompileUnit(); TypeD = Var.getType(); + } else if (Function *F = dyn_cast(const_cast(V))){ + Value *DIF = findDbgSubprogramDeclare(F); + if (!DIF) return false; + DISubprogram Var(cast(DIF)); + + StringRef D = Var.getDisplayName(); + if (!D.empty()) + DisplayName = D; + LineNo = Var.getLineNumber(); + Unit = Var.getCompileUnit(); + TypeD = Var.getType(); } else { const DbgDeclareInst *DDI = findDbgDeclare(V); if (!DDI) return false; From dpatel at apple.com Tue Feb 15 11:36:11 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 15 Feb 2011 17:36:11 -0000 Subject: [llvm-commits] [llvm] r125571 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DbgInfoPrinter.cpp lib/Analysis/DebugInfo.cpp Message-ID: <20110215173611.3E44F2A6C12D@llvm.org> Author: dpatel Date: Tue Feb 15 11:36:11 2011 New Revision: 125571 URL: http://llvm.org/viewvc/llvm-project?rev=125571&view=rev Log: Move DbgInfoPrinter specific utlities inside DbgInfoPrinter.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=125571&r1=125570&r2=125571&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Tue Feb 15 11:36:11 2011 @@ -868,10 +868,6 @@ Constant *GetTagConstant(unsigned TAG); }; - bool getLocationInfo(const Value *V, std::string &DisplayName, - std::string &Type, unsigned &LineNo, std::string &File, - std::string &Dir); - /// getDISubprogram - Find subprogram that is enclosing this scope. DISubprogram getDISubprogram(const MDNode *Scope); Modified: llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp?rev=125571&r1=125570&r2=125571&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp (original) +++ llvm/trunk/lib/Analysis/DbgInfoPrinter.cpp Tue Feb 15 11:36:11 2011 @@ -20,6 +20,7 @@ #include "llvm/Function.h" #include "llvm/IntrinsicInst.h" #include "llvm/Metadata.h" +#include "llvm/Module.h" #include "llvm/Assembly/Writer.h" #include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/Passes.h" @@ -57,6 +58,117 @@ FunctionPass *llvm::createDbgInfoPrinterPass() { return new PrintDbgInfo(); } +/// Find the debug info descriptor corresponding to this global variable. +static Value *findDbgGlobalDeclare(GlobalVariable *V) { + const Module *M = V->getParent(); + NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv"); + if (!NMD) + return 0; + + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { + DIDescriptor DIG(cast(NMD->getOperand(i))); + if (!DIG.isGlobalVariable()) + continue; + if (DIGlobalVariable(DIG).getGlobal() == V) + return DIG; + } + return 0; +} + +/// Find the debug info descriptor corresponding to this function. +static Value *findDbgSubprogramDeclare(Function *V) { + const Module *M = V->getParent(); + NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp"); + if (!NMD) + return 0; + + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { + DIDescriptor DIG(cast(NMD->getOperand(i))); + if (!DIG.isSubprogram()) + continue; + if (DISubprogram(DIG).getFunction() == V) + return DIG; + } + return 0; +} + +/// Finds the llvm.dbg.declare intrinsic corresponding to this value if any. +/// It looks through pointer casts too. +static const DbgDeclareInst *findDbgDeclare(const Value *V) { + V = V->stripPointerCasts(); + + if (!isa(V) && !isa(V)) + return 0; + + const Function *F = NULL; + if (const Instruction *I = dyn_cast(V)) + F = I->getParent()->getParent(); + else if (const Argument *A = dyn_cast(V)) + F = A->getParent(); + + for (Function::const_iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI) + for (BasicBlock::const_iterator BI = (*FI).begin(), BE = (*FI).end(); + BI != BE; ++BI) + if (const DbgDeclareInst *DDI = dyn_cast(BI)) + if (DDI->getAddress() == V) + return DDI; + + return 0; +} + +static bool getLocationInfo(const Value *V, std::string &DisplayName, + std::string &Type, unsigned &LineNo, + std::string &File, std::string &Dir) { + DICompileUnit Unit; + DIType TypeD; + + if (GlobalVariable *GV = dyn_cast(const_cast(V))) { + Value *DIGV = findDbgGlobalDeclare(GV); + if (!DIGV) return false; + DIGlobalVariable Var(cast(DIGV)); + + StringRef D = Var.getDisplayName(); + if (!D.empty()) + DisplayName = D; + LineNo = Var.getLineNumber(); + Unit = Var.getCompileUnit(); + TypeD = Var.getType(); + } else if (Function *F = dyn_cast(const_cast(V))){ + Value *DIF = findDbgSubprogramDeclare(F); + if (!DIF) return false; + DISubprogram Var(cast(DIF)); + + StringRef D = Var.getDisplayName(); + if (!D.empty()) + DisplayName = D; + LineNo = Var.getLineNumber(); + Unit = Var.getCompileUnit(); + TypeD = Var.getType(); + } else { + const DbgDeclareInst *DDI = findDbgDeclare(V); + if (!DDI) return false; + DIVariable Var(cast(DDI->getVariable())); + + StringRef D = Var.getName(); + if (!D.empty()) + DisplayName = D; + LineNo = Var.getLineNumber(); + Unit = Var.getCompileUnit(); + TypeD = Var.getType(); + } + + StringRef T = TypeD.getName(); + if (!T.empty()) + Type = T; + StringRef F = Unit.getFilename(); + if (!F.empty()) + File = F; + StringRef D = Unit.getDirectory(); + if (!D.empty()) + Dir = D; + return true; +} + void PrintDbgInfo::printVariableDeclaration(const Value *V) { std::string DisplayName, File, Directory, Type; unsigned LineNo; Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=125571&r1=125570&r2=125571&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Tue Feb 15 11:36:11 2011 @@ -1575,117 +1575,6 @@ return true; } -/// Find the debug info descriptor corresponding to this global variable. -static Value *findDbgGlobalDeclare(GlobalVariable *V) { - const Module *M = V->getParent(); - NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv"); - if (!NMD) - return 0; - - for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - DIDescriptor DIG(cast(NMD->getOperand(i))); - if (!DIG.isGlobalVariable()) - continue; - if (DIGlobalVariable(DIG).getGlobal() == V) - return DIG; - } - return 0; -} - -/// Find the debug info descriptor corresponding to this function. -static Value *findDbgSubprogramDeclare(Function *V) { - const Module *M = V->getParent(); - NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp"); - if (!NMD) - return 0; - - for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - DIDescriptor DIG(cast(NMD->getOperand(i))); - if (!DIG.isSubprogram()) - continue; - if (DISubprogram(DIG).getFunction() == V) - return DIG; - } - return 0; -} - -/// Finds the llvm.dbg.declare intrinsic corresponding to this value if any. -/// It looks through pointer casts too. -static const DbgDeclareInst *findDbgDeclare(const Value *V) { - V = V->stripPointerCasts(); - - if (!isa(V) && !isa(V)) - return 0; - - const Function *F = NULL; - if (const Instruction *I = dyn_cast(V)) - F = I->getParent()->getParent(); - else if (const Argument *A = dyn_cast(V)) - F = A->getParent(); - - for (Function::const_iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI) - for (BasicBlock::const_iterator BI = (*FI).begin(), BE = (*FI).end(); - BI != BE; ++BI) - if (const DbgDeclareInst *DDI = dyn_cast(BI)) - if (DDI->getAddress() == V) - return DDI; - - return 0; -} - -bool llvm::getLocationInfo(const Value *V, std::string &DisplayName, - std::string &Type, unsigned &LineNo, - std::string &File, std::string &Dir) { - DICompileUnit Unit; - DIType TypeD; - - if (GlobalVariable *GV = dyn_cast(const_cast(V))) { - Value *DIGV = findDbgGlobalDeclare(GV); - if (!DIGV) return false; - DIGlobalVariable Var(cast(DIGV)); - - StringRef D = Var.getDisplayName(); - if (!D.empty()) - DisplayName = D; - LineNo = Var.getLineNumber(); - Unit = Var.getCompileUnit(); - TypeD = Var.getType(); - } else if (Function *F = dyn_cast(const_cast(V))){ - Value *DIF = findDbgSubprogramDeclare(F); - if (!DIF) return false; - DISubprogram Var(cast(DIF)); - - StringRef D = Var.getDisplayName(); - if (!D.empty()) - DisplayName = D; - LineNo = Var.getLineNumber(); - Unit = Var.getCompileUnit(); - TypeD = Var.getType(); - } else { - const DbgDeclareInst *DDI = findDbgDeclare(V); - if (!DDI) return false; - DIVariable Var(cast(DDI->getVariable())); - - StringRef D = Var.getName(); - if (!D.empty()) - DisplayName = D; - LineNo = Var.getLineNumber(); - Unit = Var.getCompileUnit(); - TypeD = Var.getType(); - } - - StringRef T = TypeD.getName(); - if (!T.empty()) - Type = T; - StringRef F = Unit.getFilename(); - if (!F.empty()) - File = F; - StringRef D = Unit.getDirectory(); - if (!D.empty()) - Dir = D; - return true; -} - /// getDISubprogram - Find subprogram that is enclosing this scope. DISubprogram llvm::getDISubprogram(const MDNode *Scope) { DIDescriptor D(Scope); From daniel at zuster.org Tue Feb 15 11:36:57 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Feb 2011 17:36:57 -0000 Subject: [llvm-commits] [zorg] r125572 - /zorg/trunk/lnt/docs/_templates/indexsidebar.html Message-ID: <20110215173657.CFC8B2A6C12D@llvm.org> Author: ddunbar Date: Tue Feb 15 11:36:57 2011 New Revision: 125572 URL: http://llvm.org/viewvc/llvm-project?rev=125572&view=rev Log: lnt/docs: Drop download link for now, it isn't autobuilt. Modified: zorg/trunk/lnt/docs/_templates/indexsidebar.html Modified: zorg/trunk/lnt/docs/_templates/indexsidebar.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/docs/_templates/indexsidebar.html?rev=125572&r1=125571&r2=125572&view=diff ============================================================================== --- zorg/trunk/lnt/docs/_templates/indexsidebar.html (original) +++ zorg/trunk/lnt/docs/_templates/indexsidebar.html Tue Feb 15 11:36:57 2011 @@ -1,9 +1,3 @@ -

    Download

    - -

    Install

    • Current release:
      From akyrtzi at gmail.com Tue Feb 15 11:51:19 2011 From: akyrtzi at gmail.com (Argyrios Kyrtzidis) Date: Tue, 15 Feb 2011 17:51:19 -0000 Subject: [llvm-commits] [llvm] r125574 - /llvm/trunk/lib/Support/PathV2.cpp Message-ID: <20110215175119.C28CB2A6C12C@llvm.org> Author: akirtzidis Date: Tue Feb 15 11:51:19 2011 New Revision: 125574 URL: http://llvm.org/viewvc/llvm-project?rev=125574&view=rev Log: Implement a function from PathV2 whose definition is missing. Modified: llvm/trunk/lib/Support/PathV2.cpp Modified: llvm/trunk/lib/Support/PathV2.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PathV2.cpp?rev=125574&r1=125573&r2=125574&view=diff ============================================================================== --- llvm/trunk/lib/Support/PathV2.cpp (original) +++ llvm/trunk/lib/Support/PathV2.cpp Tue Feb 15 11:51:19 2011 @@ -391,6 +391,12 @@ } } +void append(SmallVectorImpl &path, + const_iterator begin, const_iterator end) { + for (; begin != end; ++begin) + path::append(path, *begin); +} + const StringRef parent_path(StringRef path) { size_t end_pos = parent_path_end(path); if (end_pos == StringRef::npos) From viridia at gmail.com Tue Feb 15 11:55:22 2011 From: viridia at gmail.com (Talin) Date: Tue, 15 Feb 2011 09:55:22 -0800 Subject: [llvm-commits] PATCH: Additional convenience methods for ConstantStruct, ConstantArray, and ConstantVector. In-Reply-To: References: Message-ID: ping? On Thu, Feb 10, 2011 at 1:40 PM, Talin wrote: > This patch adds a new "get" method to ConstantStruct, ConstantArray and > ConstantVector. The new method accepts a pair of RandomAccessIterators, > similar to other LLVM method signatures. This allows constants to be build > using a small vector or other sequential container type more easily. > > In addition, I've also added an END_WITH_NULL variant for > ConstantStruct::get(). I only added it to ConstantStruct because I figured > that it would be an uncommon use case for arrays and vectors, whereas the > creation of small constant structs of predetermined length is fairly common. > > -- > -- Talin > -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110215/b341f350/attachment.html From dpatel at apple.com Tue Feb 15 11:56:09 2011 From: dpatel at apple.com (Devang Patel) Date: Tue, 15 Feb 2011 17:56:09 -0000 Subject: [llvm-commits] [llvm] r125577 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/CodeGen/X86/dbg-value-range.ll Message-ID: <20110215175609.866232A6C12C@llvm.org> Author: dpatel Date: Tue Feb 15 11:56:09 2011 New Revision: 125577 URL: http://llvm.org/viewvc/llvm-project?rev=125577&view=rev Log: Ignore DBG_VALUE machine instructions while constructing instruction ranges based on location info. Machine instruction range consisting of only DBG_VALUE MIs only contributes consecutive labels in assembly output, which is harmless, and empty scope entry in DebugInfo, which confuses debugger tools. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/test/CodeGen/X86/dbg-value-range.ll Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=125577&r1=125576&r2=125577&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Feb 15 11:56:09 2011 @@ -2708,6 +2708,10 @@ continue; } + // Ignore DBG_VALUE. It does not contribute any instruction in output. + if (MInsn->isDebugValue()) + continue; + if (RangeBeginMI) { // If we have alread seen a beginning of a instruction range and // current instruction scope does not match scope of first instruction Modified: llvm/trunk/test/CodeGen/X86/dbg-value-range.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-range.ll?rev=125577&r1=125576&r2=125577&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-range.ll (original) +++ llvm/trunk/test/CodeGen/X86/dbg-value-range.ll Tue Feb 15 11:56:09 2011 @@ -44,12 +44,12 @@ ; check that variable bar:b value range is appropriately trucated in debug info. Here Ltmp5 is end of ; location range. -;CHECK:Ltmp7 +;CHECK:Ltmp6 ;CHECK-NEXT: DEBUG_VALUE: bar:b <- undef ;CHECK:Ldebug_loc0: ;CHECK-NEXT: .quad Ltmp -;CHECK-NEXT: .quad Ltmp7 +;CHECK-NEXT: .quad Ltmp6 ;CHECK-NEXT: .short 1 ;CHECK-NEXT: .byte 85 ;CHECK-NEXT: .quad 0 From daniel at zuster.org Tue Feb 15 13:17:25 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 15 Feb 2011 19:17:25 -0000 Subject: [llvm-commits] [test-suite] r125586 - /test-suite/trunk/tools/fpcmp.c Message-ID: <20110215191726.091F92A6C12C@llvm.org> Author: ddunbar Date: Tue Feb 15 13:17:25 2011 New Revision: 125586 URL: http://llvm.org/viewvc/llvm-project?rev=125586&view=rev Log: test-suite/fpcmp: Finish turning FileUtilities.cpp into a C program. Modified: test-suite/trunk/tools/fpcmp.c Modified: test-suite/trunk/tools/fpcmp.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/fpcmp.c?rev=125586&r1=125585&r2=125586&view=diff ============================================================================== --- test-suite/trunk/tools/fpcmp.c (original) +++ test-suite/trunk/tools/fpcmp.c Tue Feb 15 13:17:25 2011 @@ -7,10 +7,159 @@ |* *| \*===----------------------------------------------------------------------===*/ +/* Note that this file is essentially a bastardized C version of + * FileUtilities.cpp from LLVM. */ + +#include +#include #include #include #include +const char *g_program; + +/* *** */ + +typedef int bool; +#define true ((bool) 1) +#define false ((bool) 0) + +static bool isSignedChar(char C) { + return (C == '+' || C == '-'); +} + +static bool isExponentChar(char C) { + switch (C) { + case 'D': // Strange exponential notation. + case 'd': // Strange exponential notation. + case 'e': + case 'E': return true; + default: return false; + } +} + +static bool isNumberChar(char C) { + switch (C) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case '.': return true; + default: return isSignedChar(C) || isExponentChar(C); + } +} + +static const char *BackupNumber(const char *Pos, const char *FirstChar) { + // If we didn't stop in the middle of a number, don't backup. + if (!isNumberChar(*Pos)) return Pos; + + // Otherwise, return to the start of the number. + bool HasPeriod = false; + while (Pos > FirstChar && isNumberChar(Pos[-1])) { + // Backup over at most one period. + if (Pos[-1] == '.') { + if (HasPeriod) + break; + HasPeriod = true; + } + + --Pos; + if (Pos > FirstChar && isSignedChar(Pos[0]) && !isExponentChar(Pos[-1])) + break; + } + return Pos; +} + +/// EndOfNumber - Return the first character that is not part of the specified +/// number. This assumes that the buffer is null terminated, so it won't fall +/// off the end. +static const char *EndOfNumber(const char *Pos) { + while (isNumberChar(*Pos)) + ++Pos; + return Pos; +} + +/// CompareNumbers - compare two numbers, returning true if they are different. +static bool CompareNumbers(const char **F1PP, const char **F2PP, + const char *F1End, const char *F2End, + double AbsTolerance, double RelTolerance) { + const char *F1P = *F1PP; + const char *F2P = *F2PP; + const char *F1NumEnd, *F2NumEnd; + double V1 = 0.0, V2 = 0.0; + + // If one of the positions is at a space and the other isn't, chomp up 'til + // the end of the space. + while (isspace(*F1P) && F1P != F1End) + ++F1P; + while (isspace(*F2P) && F2P != F2End) + ++F2P; + + // If we stop on numbers, compare their difference. + if (!isNumberChar(*F1P) || !isNumberChar(*F2P)) { + // The diff failed. + F1NumEnd = F1P; + F2NumEnd = F2P; + } else { + // Note that some ugliness is built into this to permit support for numbers + // that use "D" or "d" as their exponential marker, e.g. "1.234D45". This + // occurs in 200.sixtrack in spec2k. + V1 = strtod(F1P, (char**)(&F1NumEnd)); + V2 = strtod(F2P, (char**)(&F2NumEnd)); + + if (*F1NumEnd == 'D' || *F1NumEnd == 'd') { + // Copy string into tmp buffer to replace the 'D' with an 'e'. + char StrTmp[200]; + memcpy(StrTmp, F1P, EndOfNumber(F1NumEnd)+1 - F1P); + // Strange exponential notation! + StrTmp[(unsigned)(F1NumEnd-F1P)] = 'e'; + + V1 = strtod(&StrTmp[0], (char**)(&F1NumEnd)); + F1NumEnd = F1P + (F1NumEnd-&StrTmp[0]); + } + + if (*F2NumEnd == 'D' || *F2NumEnd == 'd') { + // Copy string into tmp buffer to replace the 'D' with an 'e'. + char StrTmp[200]; + memcpy(StrTmp, F2P, EndOfNumber(F2NumEnd)+1 - F2P); + // Strange exponential notation! + StrTmp[(unsigned)(F2NumEnd-F2P)] = 'e'; + + V2 = strtod(&StrTmp[0], (char**)(&F2NumEnd)); + F2NumEnd = F2P + (F2NumEnd-&StrTmp[0]); + } + } + + if (F1NumEnd == F1P || F2NumEnd == F2P) { + fprintf(stderr, ("%s: FP Comparison failed, not a numeric difference " + "between '%c' and '%c'\n"), g_program, F1P[0], F2P[0]); + return true; + } + + // Check to see if these are inside the absolute tolerance + if (AbsTolerance < fabs(V1-V2)) { + // Nope, check the relative tolerance... + double Diff; + if (V2) + Diff = fabs(V1/V2 - 1.0); + else if (V1) + Diff = fabs(V2/V1 - 1.0); + else + Diff = 0; // Both zero. + if (Diff > RelTolerance) { + fprintf(stderr, ("%s: Compared: %e and %e\n" + "abs. diff = %e rel.diff = %e\n" + "Out of tolerance: rel/abs: %e/%e\n"), + g_program, V1, V2, fabs(V1-V2), Diff, RelTolerance, AbsTolerance); + return true; + } + } + + // Otherwise, advance our read pointers to the end of the numbers. + *F1PP = F1NumEnd; *F2PP = F2NumEnd; + return false; +} + +/* *** */ + char *load_file(const char *path, long *size_out) { FILE *fp; long size; @@ -19,18 +168,18 @@ /* Open the file... */ fp = fopen(path, "rb"); if (!fp) { - fprintf(stderr, "error: unable to open '%s'\n", path); + fprintf(stderr, "%s: error: unable to open '%s'\n", g_program, path); exit(2); } /* Determine the file size. */ if (fseek(fp, 0, SEEK_END) == -1) { - fprintf(stderr, "error: unable to seek '%s'\n", path); + fprintf(stderr, "%s: error: unable to seek '%s'\n", g_program, path); exit(2); } size = ftell(fp); if (fseek(fp, 0, SEEK_SET) == -1) { - fprintf(stderr, "error: unable to seek '%s'\n", path); + fprintf(stderr, "%s: error: unable to seek '%s'\n", g_program, path); exit(2); } @@ -41,15 +190,18 @@ } /* Allocate a buffer for the data. */ - data = malloc(size); + data = malloc(size + 1); if (!data) { - fprintf(stderr, "error: unable to allocate buffer for '%s'\n", path); + fprintf(stderr, "%s: error: unable to allocate buffer for '%s'\n", + g_program, path); exit(2); } /* Read in the file contents. */ + data[size] = 0; if (fread(data, size, 1, fp) != 1) { - fprintf(stderr, "error: unable to read data for '%s'\n", path); + fprintf(stderr, "%s: error: unable to read data for '%s'\n", + g_program, path); exit(2); } @@ -63,27 +215,79 @@ double absolute_tolerance, double relative_tolerance) { /* First, load the file buffers completely into memory. */ - long size_a, size_b; - char *data_a = load_file(path_a, &size_a); - char *data_b = load_file(path_b, &size_b); + long A_size, B_size; + char *data_a = load_file(path_a, &A_size); + char *data_b = load_file(path_b, &B_size); /* Fast path equivalent buffers. */ - if (size_a == size_b && memcmp(data_a, data_b, size_a) == 0) + if (A_size == B_size && memcmp(data_a, data_b, A_size) == 0) return 0; /* Otherwise, if our tolerances are 0 then we are done. */ - if (relative_tolerance == 0.0 && absolute_tolerance == 0.0) + if (relative_tolerance == 0.0 && absolute_tolerance == 0.0) { + fprintf(stderr, "%s: files differ without tolerance allowance\n", + g_program); return 1; + } + + /* *** */ + + // Okay, now that we opened the files, scan them for the first difference. + const char *File1Start = data_a; + const char *File2Start = data_b; + const char *File1End = data_a + A_size; + const char *File2End = data_b + B_size; + const char *F1P = File1Start; + const char *F2P = File2Start; + + while (1) { + // Scan for the end of file or next difference. + while (F1P < File1End && F2P < File2End && *F1P == *F2P) + ++F1P, ++F2P; + + if (F1P >= File1End || F2P >= File2End) break; + + // Okay, we must have found a difference. Backup to the start of the + // current number each stream is at so that we can compare from the + // beginning. + F1P = BackupNumber(F1P, File1Start); + F2P = BackupNumber(F2P, File2Start); + + // Now that we are at the start of the numbers, compare them, exiting if + // they don't match. + if (CompareNumbers(&F1P, &F2P, File1End, File2End, + absolute_tolerance, relative_tolerance)) + return 1; + } + + // Okay, we reached the end of file. If both files are at the end, we + // succeeded. + bool F1AtEnd = F1P >= File1End; + bool F2AtEnd = F2P >= File2End; + if (!F1AtEnd || !F2AtEnd) { + // Else, we might have run off the end due to a number: backup and retry. + if (F1AtEnd && isNumberChar(F1P[-1])) --F1P; + if (F2AtEnd && isNumberChar(F2P[-1])) --F2P; + F1P = BackupNumber(F1P, File1Start); + F2P = BackupNumber(F2P, File2Start); + + // Now that we are at the start of the numbers, compare them, exiting if + // they don't match. + if (CompareNumbers(&F1P, &F2P, File1End, File2End, + absolute_tolerance, relative_tolerance)) + return 1; + + // If we found the end, we succeeded. + if (F1P < File1End || F2P < File2End) + return 1; + } - /* FIXME: Implement support for relative tolerances. */ - fprintf(stderr, "FIXME: this version of fcmp doesn't " - "support relative tolerances yet.\n"); - return 2; + return 0; } -void usage(const char *program) { +void usage() { fprintf(stderr, "usage: %s [-a VALUE] [-r VALUE] \n\n", - program); + g_program); fprintf(stderr, "Compare two files using absolute and relative tolerances\n"); fprintf(stderr, "when comparing differences between two character\n"); fprintf(stderr, "which could be real numbers\n"); @@ -95,6 +299,7 @@ double absolute_tolerance = 0.0; int i; + g_program = argv[0]; for (i = 1; i != argc; ++i) { const char *arg = argv[i]; if (arg[0] != '-') @@ -102,7 +307,7 @@ if (strlen(arg) != 2) { fprintf(stderr, "error: invalid argument '%s'\n\n", arg); - usage(argv[0]); + usage(); } switch (arg[1]) { @@ -110,14 +315,14 @@ case 'r': if (i + 1 == argc) { fprintf(stderr, "error: missing argument to '%s'\n\n", arg); - usage(argv[0]); + usage(); } else { char *endp = 0; double value = strtod(argv[++i], &endp); if (endp == 0 || *endp != '\0') { fprintf(stderr, "error: invalid argument to '%s': '%s'\n\n", arg, argv[i]); - usage(argv[0]); + usage(); } if (arg[1] == 'a') absolute_tolerance = value; @@ -128,13 +333,13 @@ default: fprintf(stderr, "error: invalid argument '%s'\n\n", arg); - usage(argv[0]); + usage(); } } if (i + 2 != argc) { fprintf(stderr, "error: invalid number of arguments\n\n"); - usage(argv[0]); + usage(); } return diff_files_with_tolerance(argv[i], argv[i + 1], From stoklund at 2pi.dk Tue Feb 15 13:51:58 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 15 Feb 2011 19:51:58 -0000 Subject: [llvm-commits] [llvm] r125591 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <20110215195158.8ED2C2A6C12C@llvm.org> Author: stoklund Date: Tue Feb 15 13:51:58 2011 New Revision: 125591 URL: http://llvm.org/viewvc/llvm-project?rev=125591&view=rev Log: Teach ARMLoadStoreOptimizer to remove kill flags from merged instructions as well. This is necessary to avoid a crash in certain tangled situations where a kill flag is first correctly moved to a merged instruction, and then needs to be moved again: STR %R0, a... STR %R0, b... First becomes: STR %R0, b... STM a, %R0, ... and then: STM a, %R0, ... STM b, %R0, ... We can now remove the kill flag from the merged STM when needed. 8960050. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=125591&r1=125590&r2=125591&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Tue Feb 15 13:51:58 2011 @@ -379,22 +379,14 @@ // First calculate which of the registers should be killed by the merged // instruction. const unsigned insertPos = memOps[insertAfter].Position; - - SmallSet UnavailRegs; SmallSet KilledRegs; DenseMap Killer; - for (unsigned i = 0; i < memOpsBegin; ++i) { - if (memOps[i].Position < insertPos && memOps[i].isKill) { - unsigned Reg = memOps[i].Reg; - if (memOps[i].Merged) - UnavailRegs.insert(Reg); - else { - KilledRegs.insert(Reg); - Killer[Reg] = i; - } + for (unsigned i = 0, e = memOps.size(); i != e; ++i) { + if (i == memOpsBegin) { + i = memOpsEnd; + if (i == e) + break; } - } - for (unsigned i = memOpsEnd, e = memOps.size(); i != e; ++i) { if (memOps[i].Position < insertPos && memOps[i].isKill) { unsigned Reg = memOps[i].Reg; KilledRegs.insert(Reg); @@ -405,12 +397,7 @@ SmallVector, 8> Regs; for (unsigned i = memOpsBegin; i < memOpsEnd; ++i) { unsigned Reg = memOps[i].Reg; - if (UnavailRegs.count(Reg)) - // Register is killed before and it's not easy / possible to update the - // kill marker on already merged instructions. Abort. - return; - - // If we are inserting the merged operation after an unmerged operation that + // If we are inserting the merged operation after an operation that // uses the same register, make sure to transfer any kill flag. bool isKill = memOps[i].isKill || KilledRegs.count(Reg); Regs.push_back(std::make_pair(Reg, isKill)); @@ -426,17 +413,24 @@ // Merge succeeded, update records. Merges.push_back(prior(Loc)); for (unsigned i = memOpsBegin; i < memOpsEnd; ++i) { - // Remove kill flags from any unmerged memops that come before insertPos. + // Remove kill flags from any memops that come before insertPos. if (Regs[i-memOpsBegin].second) { unsigned Reg = Regs[i-memOpsBegin].first; if (KilledRegs.count(Reg)) { unsigned j = Killer[Reg]; - memOps[j].MBBI->getOperand(0).setIsKill(false); + int Idx = memOps[j].MBBI->findRegisterUseOperandIdx(Reg, true); + assert(Idx >= 0 && "Cannot find killing operand"); + memOps[j].MBBI->getOperand(Idx).setIsKill(false); memOps[j].isKill = false; } + memOps[i].isKill = true; } MBB.erase(memOps[i].MBBI); + // Update this memop to refer to the merged instruction. + // We may need to move kill flags again. memOps[i].Merged = true; + memOps[i].MBBI = Merges.back(); + memOps[i].Position = insertPos; } } From rdivacky at freebsd.org Tue Feb 15 14:43:39 2011 From: rdivacky at freebsd.org (Roman Divacky) Date: Tue, 15 Feb 2011 20:43:39 -0000 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s Message-ID: <20110215204339.453842A6C12C@llvm.org> Author: rdivacky Date: Tue Feb 15 14:43:39 2011 New Revision: 125595 URL: http://llvm.org/viewvc/llvm-project?rev=125595&view=rev Log: Add support for parsing [expr]. This is submitted by Joerg Sonnenberger and fixes his PR8685. Added: llvm/trunk/test/MC/AsmParser/paren.s Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp llvm/trunk/test/MC/AsmParser/exprs.s Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=125595&r1=125594&r2=125595&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Feb 15 14:43:39 2011 @@ -173,6 +173,7 @@ bool ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc); bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res, SMLoc &EndLoc); bool ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc); + bool ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc); /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) /// and set \arg Res to the identifier contents. @@ -492,6 +493,20 @@ return false; } +/// ParseBracketExpr - Parse a bracket expression and return it. +/// NOTE: This assumes the leading '[' has already been consumed. +/// +/// bracketexpr ::= expr] +/// +bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) { + if (ParseExpression(Res)) return true; + if (Lexer.isNot(AsmToken::RBrac)) + return TokError("expected ']' in brackets expression"); + EndLoc = Lexer.getLoc(); + Lex(); + return false; +} + /// ParsePrimaryExpr - Parse a primary expression and return it. /// primaryexpr ::= (parenexpr /// primaryexpr ::= symbol @@ -587,6 +602,9 @@ case AsmToken::LParen: Lex(); // Eat the '('. return ParseParenExpr(Res, EndLoc); + case AsmToken::LBrac: + Lex(); // Eat the '['. + return ParseBracketExpr(Res, EndLoc); case AsmToken::Minus: Lex(); // Eat the operator. if (ParsePrimaryExpr(Res, EndLoc)) Modified: llvm/trunk/test/MC/AsmParser/exprs.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=125595&r1=125594&r2=125595&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/exprs.s (original) +++ llvm/trunk/test/MC/AsmParser/exprs.s Tue Feb 15 14:43:39 2011 @@ -35,6 +35,8 @@ check_expr 1 << 1, 2 check_expr 2 >> 1, 1 check_expr (~0 >> 1), -1 + check_expr [~0 >> 1], -1 + check_expr 4 * [4 + (3 + [2 * 2] + 1)], 48 check_expr 3 - 2, 1 check_expr 1 ^ 3, 2 check_expr 1 && 2, 1 Added: llvm/trunk/test/MC/AsmParser/paren.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/paren.s?rev=125595&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/paren.s (added) +++ llvm/trunk/test/MC/AsmParser/paren.s Tue Feb 15 14:43:39 2011 @@ -0,0 +1,8 @@ +// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t1 > %t2 +// RUN: FileCheck < %t1 %s + +// CHECK: error: expected ']' in brackets expression +.size x, [.-x) + +// CHECK: error: expected ')' in parentheses expression +.size y, (.-y] From joerg at britannica.bec.de Tue Feb 15 16:16:22 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Tue, 15 Feb 2011 23:16:22 +0100 Subject: [llvm-commits] [PATCH] [MC] .pushsection / .popsection support In-Reply-To: <20110209202852.GA10573@britannica.bec.de> References: <20110209202852.GA10573@britannica.bec.de> Message-ID: <20110215221622.GA12602@britannica.bec.de> Hi all, attached is a revised patch: - CurSection / PrevSection are private to MCStreamer. They are updated by PopSection and SwitchSection. Code that tried to access CurSection directly now uses the normal getCurrentSection() accessor function. - CurSectionStack / PrevSectionStack are maintained by PushSection and PopSection. Renamed to fit the existing scheme. - SwitchSection has been split into the maintainance part of CurSection / PrevSection and the target specific behavior when the effective section changes. - The LoggingStreamer doesn't see the individual SwitchSection calls nor does it see PushSection / PopSection. I don't believe the diagnostics justifies making SwitchSection, PushSection and PopSection virtual. For consideration: - Move the "Cannot emit before setting section" assertion into getCurSection(). Assumption here is that InitSections is supposed to provide a default value and nothing should call getCurSection() that early. The assembler printer should only print the default section, if there is some actual content (left as separate issue). - Removing CurSection / PrevSection adds a lot of complications for no gain. There is no constructor of MCStreamer to set up the initial element, so all functions would have to deal with the section stack being empty. Push would would have to insert an element just after the top, etc., so it doesn't even simplify anything. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: pushpop.diff Type: text/x-diff Size: 21106 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110215/d5e4c2e8/attachment.bin From nicholas at mxc.ca Tue Feb 15 17:13:23 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 15 Feb 2011 23:13:23 -0000 Subject: [llvm-commits] [llvm] r125613 - in /llvm/trunk: include/llvm/Support/PatternMatch.h test/Transforms/InstCombine/vector-casts.ll Message-ID: <20110215231323.8A1A12A6C12C@llvm.org> Author: nicholas Date: Tue Feb 15 17:13:23 2011 New Revision: 125613 URL: http://llvm.org/viewvc/llvm-project?rev=125613&view=rev Log: Teach PatternMatch that splat vectors could be floating point as well as integer. Fixes PR9228! Modified: llvm/trunk/include/llvm/Support/PatternMatch.h llvm/trunk/test/Transforms/InstCombine/vector-casts.ll Modified: llvm/trunk/include/llvm/Support/PatternMatch.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=125613&r1=125612&r2=125613&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/PatternMatch.h (original) +++ llvm/trunk/include/llvm/Support/PatternMatch.h Tue Feb 15 17:13:23 2011 @@ -81,7 +81,8 @@ return true; } if (ConstantVector *CV = dyn_cast(V)) - if (ConstantInt *CI = cast_or_null(CV->getSplatValue())) { + if (ConstantInt *CI = + dyn_cast_or_null(CV->getSplatValue())) { Res = &CI->getValue(); return true; } @@ -126,7 +127,7 @@ if (const ConstantInt *CI = dyn_cast(V)) return this->isValue(CI->getValue()); if (const ConstantVector *CV = dyn_cast(V)) - if (ConstantInt *CI = cast_or_null(CV->getSplatValue())) + if (ConstantInt *CI = dyn_cast_or_null(CV->getSplatValue())) return this->isValue(CI->getValue()); return false; } @@ -146,7 +147,7 @@ return true; } if (const ConstantVector *CV = dyn_cast(V)) - if (ConstantInt *CI = cast_or_null(CV->getSplatValue())) + if (ConstantInt *CI = dyn_cast_or_null(CV->getSplatValue())) if (this->isValue(CI->getValue())) { Res = &CI->getValue(); return true; Modified: llvm/trunk/test/Transforms/InstCombine/vector-casts.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vector-casts.ll?rev=125613&r1=125612&r2=125613&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/vector-casts.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/vector-casts.ll Tue Feb 15 17:13:23 2011 @@ -121,3 +121,31 @@ %b = sitofp <2 x i64> %a to <2 x double> ret <2 x double> %b } + +; PR9228 +; This was a crasher, so no CHECK statements. +define <4 x float> @f(i32 %a) nounwind alwaysinline { +; CHECK: @f +entry: + %dim = insertelement <4 x i32> undef, i32 %a, i32 0 + %dim30 = insertelement <4 x i32> %dim, i32 %a, i32 1 + %dim31 = insertelement <4 x i32> %dim30, i32 %a, i32 2 + %dim32 = insertelement <4 x i32> %dim31, i32 %a, i32 3 + + %offset_ptr = getelementptr <4 x float>* null, i32 1 + %offset_int = ptrtoint <4 x float>* %offset_ptr to i64 + %sizeof32 = trunc i64 %offset_int to i32 + + %smearinsert33 = insertelement <4 x i32> undef, i32 %sizeof32, i32 0 + %smearinsert34 = insertelement <4 x i32> %smearinsert33, i32 %sizeof32, i32 1 + %smearinsert35 = insertelement <4 x i32> %smearinsert34, i32 %sizeof32, i32 2 + %smearinsert36 = insertelement <4 x i32> %smearinsert35, i32 %sizeof32, i32 3 + + %delta_scale = mul <4 x i32> %dim32, %smearinsert36 + %offset_delta = add <4 x i32> zeroinitializer, %delta_scale + + %offset_varying_delta = add <4 x i32> %offset_delta, undef + + ret <4 x float> undef +} + From joerg at britannica.bec.de Tue Feb 15 18:21:39 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 16 Feb 2011 01:21:39 +0100 Subject: [llvm-commits] [PATCH] [MC] .pushsection / .popsection support In-Reply-To: <20110215221622.GA12602@britannica.bec.de> References: <20110209202852.GA10573@britannica.bec.de> <20110215221622.GA12602@britannica.bec.de> Message-ID: <20110216002139.GA23009@britannica.bec.de> On Tue, Feb 15, 2011 at 11:16:22PM +0100, Joerg Sonnenberger wrote: > - Removing CurSection / PrevSection adds a lot of complications for no > gain. There is no constructor of MCStreamer to set up the initial > element, so all functions would have to deal with the section stack > being empty. Push would would have to insert an element just after the > top, etc., so it doesn't even simplify anything. Scratch the part about the constructor. Attached is the alternative version removing CurSection / PrevSection. I still believe this is less clean than the other patch, but be my guest for either patch. Joerg -------------- next part -------------- A non-text attachment was scrubbed... Name: pushpop2.diff Type: text/x-diff Size: 22074 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110216/edc68046/attachment.bin From evan.cheng at apple.com Tue Feb 15 18:35:02 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 16 Feb 2011 00:35:02 -0000 Subject: [llvm-commits] [llvm] r125624 - in /llvm/trunk/lib/Target/ARM: ARMInstrFormats.td ARMInstrVFP.td Message-ID: <20110216003503.09FF42A6C12C@llvm.org> Author: evancheng Date: Tue Feb 15 18:35:02 2011 New Revision: 125624 URL: http://llvm.org/viewvc/llvm-project?rev=125624&view=rev Log: Some single precision VFP instructions may be executed on NEON pipeline, but not double precision ones. Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=125624&r1=125623&r2=125624&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Tue Feb 15 18:35:02 2011 @@ -1200,7 +1200,7 @@ let Inst{11-9} = 0b101; let Inst{8} = 1; // Double precision - // 64-bit loads & stores operate on both NEON and VFP pipelines. + // Loads & stores operate on both NEON and VFP pipelines. let D = VFPNeonDomain; } @@ -1225,6 +1225,9 @@ let Inst{21-20} = opcod2; let Inst{11-9} = 0b101; let Inst{8} = 0; // Single precision + + // Loads & stores operate on both NEON and VFP pipelines. + let D = VFPNeonDomain; } // VFP Load / store multiple pseudo instructions. @@ -1257,9 +1260,6 @@ let Inst{27-25} = 0b110; let Inst{11-9} = 0b101; let Inst{8} = 1; // Double precision - - // 64-bit loads & stores operate on both NEON and VFP pipelines. - let D = VFPNeonDomain; } class AXSI4; + [(set SPR:$Sd, (load addrmode5:$addr))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} } // End of 'let canFoldAsLoad = 1, isReMaterializable = 1 in' @@ -68,7 +72,11 @@ def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$Sd, addrmode5:$addr), IIC_fpStore32, "vstr", ".32\t$Sd, $addr", - [(store SPR:$Sd, addrmode5:$addr)]>; + [(store SPR:$Sd, addrmode5:$addr)]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} //===----------------------------------------------------------------------===// // Load / store multiple Instructions. @@ -118,6 +126,10 @@ let Inst{24-23} = 0b01; // Increment After let Inst{21} = 0; // No writeback let Inst{20} = L_bit; + + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines. + let D = VFPNeonDomain; } def SIA_UPD : AXSI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, spr_reglist:$regs, variable_ops), @@ -126,6 +138,10 @@ let Inst{24-23} = 0b01; // Increment After let Inst{21} = 1; // Writeback let Inst{20} = L_bit; + + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines. + let D = VFPNeonDomain; } def SDB : AXSI4<(outs), (ins GPR:$Rn, pred:$p, spr_reglist:$regs, variable_ops), @@ -134,6 +150,10 @@ let Inst{24-23} = 0b10; // Decrement Before let Inst{21} = 0; // No writeback let Inst{20} = L_bit; + + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines. + let D = VFPNeonDomain; } def SDB_UPD : AXSI4<(outs GPR:$wb), (ins GPR:$Rn, pred:$p, spr_reglist:$regs, variable_ops), @@ -142,6 +162,10 @@ let Inst{24-23} = 0b10; // Decrement Before let Inst{21} = 1; // Writeback let Inst{20} = L_bit; + + // Some single precision VFP instructions may be executed on both NEON and + // VFP pipelines. + let D = VFPNeonDomain; } } @@ -172,7 +196,11 @@ def VADDS : ASbIn<0b11100, 0b11, 0, 0, (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpALU32, "vadd", ".f32\t$Sd, $Sn, $Sm", - [(set SPR:$Sd, (fadd SPR:$Sn, SPR:$Sm))]>; + [(set SPR:$Sd, (fadd SPR:$Sn, SPR:$Sm))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VSUBD : ADbI<0b11100, 0b11, 1, 0, (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm), @@ -182,7 +210,11 @@ def VSUBS : ASbIn<0b11100, 0b11, 1, 0, (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpALU32, "vsub", ".f32\t$Sd, $Sn, $Sm", - [(set SPR:$Sd, (fsub SPR:$Sn, SPR:$Sm))]>; + [(set SPR:$Sd, (fsub SPR:$Sn, SPR:$Sm))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VDIVD : ADbI<0b11101, 0b00, 0, 0, (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm), @@ -202,7 +234,11 @@ def VMULS : ASbIn<0b11100, 0b10, 0, 0, (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpMUL32, "vmul", ".f32\t$Sd, $Sn, $Sm", - [(set SPR:$Sd, (fmul SPR:$Sn, SPR:$Sm))]>; + [(set SPR:$Sd, (fmul SPR:$Sn, SPR:$Sm))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VNMULD : ADbI<0b11100, 0b10, 1, 0, (outs DPR:$Dd), (ins DPR:$Dn, DPR:$Dm), @@ -212,7 +248,11 @@ def VNMULS : ASbI<0b11100, 0b10, 1, 0, (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpMUL32, "vnmul", ".f32\t$Sd, $Sn, $Sm", - [(set SPR:$Sd, (fneg (fmul SPR:$Sn, SPR:$Sm)))]>; + [(set SPR:$Sd, (fneg (fmul SPR:$Sn, SPR:$Sm)))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} // Match reassociated forms only if not sign dependent rounding. def : Pat<(fmul (fneg DPR:$a), (f64 DPR:$b)), @@ -230,7 +270,11 @@ def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins SPR:$Sd, SPR:$Sm), IIC_fpCMP32, "vcmpe", ".f32\t$Sd, $Sm", - [(arm_cmpfp SPR:$Sd, SPR:$Sm)]>; + [(arm_cmpfp SPR:$Sd, SPR:$Sm)]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} // FIXME: Verify encoding after integrated assembler is working. def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0, @@ -241,8 +285,12 @@ def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins SPR:$Sd, SPR:$Sm), IIC_fpCMP32, "vcmp", ".f32\t$Sd, $Sm", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } +} // Defs = [FPSCR] //===----------------------------------------------------------------------===// // FP Unary Operations. @@ -256,7 +304,11 @@ def VABSS : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0, (outs SPR:$Sd), (ins SPR:$Sm), IIC_fpUNA32, "vabs", ".f32\t$Sd, $Sm", - [(set SPR:$Sd, (fabs SPR:$Sm))]>; + [(set SPR:$Sd, (fabs SPR:$Sm))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} let Defs = [FPSCR] in { def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0, @@ -273,6 +325,10 @@ [(arm_cmpfp0 SPR:$Sd)]> { let Inst{3-0} = 0b0000; let Inst{5} = 0; + + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } // FIXME: Verify encoding after integrated assembler is working. @@ -290,8 +346,12 @@ [/* For disassembly only; pattern left blank */]> { let Inst{3-0} = 0b0000; let Inst{5} = 0; + + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } -} +} // Defs = [FPSCR] def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0, (outs DPR:$Dd), (ins SPR:$Sm), @@ -362,7 +422,11 @@ def VNEGS : ASuIn<0b11101, 0b11, 0b0001, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sm), IIC_fpUNA32, "vneg", ".f32\t$Sd, $Sm", - [(set SPR:$Sd, (fneg SPR:$Sm))]>; + [(set SPR:$Sd, (fneg SPR:$Sm))]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs DPR:$Dd), (ins DPR:$Dm), @@ -533,6 +597,10 @@ IIC_fpCVTIS, "vcvt", ".f32.s32\t$Sd, $Sm", [(set SPR:$Sd, (arm_sitof SPR:$Sm))]> { let Inst{7} = 1; // s32 + + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } def VUITOD : AVConv1IDs_Encode<0b11101, 0b11, 0b1000, 0b1011, @@ -547,6 +615,10 @@ IIC_fpCVTIS, "vcvt", ".f32.u32\t$Sd, $Sm", [(set SPR:$Sd, (arm_uitof SPR:$Sm))]> { let Inst{7} = 0; // u32 + + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } // FP -> Int: @@ -598,6 +670,10 @@ IIC_fpCVTSI, "vcvt", ".s32.f32\t$Sd, $Sm", [(set SPR:$Sd, (arm_ftosi SPR:$Sm))]> { let Inst{7} = 1; // Z bit + + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } def VTOUIZD : AVConv1IsD_Encode<0b11101, 0b11, 0b1100, 0b1011, @@ -612,6 +688,10 @@ IIC_fpCVTSI, "vcvt", ".u32.f32\t$Sd, $Sm", [(set SPR:$Sd, (arm_ftoui SPR:$Sm))]> { let Inst{7} = 1; // Z bit + + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; } // And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR. @@ -662,22 +742,38 @@ def VTOSHS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 0, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VTOUHS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 0, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VTOSLS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VTOULS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VTOSHD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 0, (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), @@ -704,22 +800,38 @@ def VSHTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 0, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VUHTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 0, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VSLTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VULTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 1, (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", - [/* For disassembly only; pattern left blank */]>; + [/* For disassembly only; pattern left blank */]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def VSHTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 0, (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), @@ -761,7 +873,11 @@ [(set SPR:$Sd, (fadd_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, - Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]>; + Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def : Pat<(fadd_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))), (VMLAD DPR:$dstin, DPR:$a, DPR:$b)>, @@ -784,7 +900,11 @@ [(set SPR:$Sd, (fadd_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)), SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, - Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]>; + Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def : Pat<(fsub_mlx DPR:$dstin, (fmul_su DPR:$a, (f64 DPR:$b))), (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>, @@ -807,7 +927,11 @@ [(set SPR:$Sd, (fsub_mlx (fneg (fmul_su SPR:$Sn, SPR:$Sm)), SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, - Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]>; + Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def : Pat<(fsub_mlx (fneg (fmul_su DPR:$a, (f64 DPR:$b))), DPR:$dstin), (VNMLAD DPR:$dstin, DPR:$a, DPR:$b)>, @@ -829,7 +953,11 @@ IIC_fpMAC32, "vnmls", ".f32\t$Sd, $Sn, $Sm", [(set SPR:$Sd, (fsub_mlx (fmul_su SPR:$Sn, SPR:$Sm), SPR:$Sdin))]>, RegConstraint<"$Sdin = $Sd">, - Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]>; + Requires<[HasVFP2,DontUseNEONForFP,UseFPVMLx]> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} def : Pat<(fsub_mlx (fmul_su DPR:$a, (f64 DPR:$b)), DPR:$dstin), (VNMLSD DPR:$dstin, DPR:$a, DPR:$b)>, @@ -866,7 +994,11 @@ (outs SPR:$Sd), (ins SPR:$Sn, SPR:$Sm), IIC_fpUNA32, "vneg", ".f32\t$Sd, $Sm", [/*(set SPR:$Sd, (ARMcneg SPR:$Sn, SPR:$Sm, imm:$cc))*/]>, - RegConstraint<"$Sn = $Sd">; + RegConstraint<"$Sn = $Sd"> { + // Some single precision VFP instructions may be executed on both NEON and VFP + // pipelines. + let D = VFPNeonDomain; +} } // neverHasSideEffects //===----------------------------------------------------------------------===// From evan.cheng at apple.com Tue Feb 15 18:37:02 2011 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 16 Feb 2011 00:37:02 -0000 Subject: [llvm-commits] [llvm] r125625 - /llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Message-ID: <20110216003702.A21BF2A6C12C@llvm.org> Author: evancheng Date: Tue Feb 15 18:37:02 2011 New Revision: 125625 URL: http://llvm.org/viewvc/llvm-project?rev=125625&view=rev Log: Remove a duplicated check. Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp?rev=125625&r1=125624&r2=125625&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegRewriter.cpp Tue Feb 15 18:37:02 2011 @@ -1633,7 +1633,7 @@ /// effect and all of its defs are dead. static bool isSafeToDelete(MachineInstr &MI) { const TargetInstrDesc &TID = MI.getDesc(); - if (TID.mayLoad() || TID.mayStore() || TID.isCall() || TID.isTerminator() || + if (TID.mayLoad() || TID.mayStore() || TID.isTerminator() || TID.isCall() || TID.isBarrier() || TID.isReturn() || MI.isLabel() || MI.isDebugValue() || MI.hasUnmodeledSideEffects()) From Brice.Lin at gmail.com Tue Feb 15 18:33:04 2011 From: Brice.Lin at gmail.com (Brice Lin) Date: Wed, 16 Feb 2011 00:33:04 -0000 Subject: [llvm-commits] [poolalloc] r125622 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Message-ID: <20110216003304.A036D2A6C12C@llvm.org> Author: bglin2 Date: Tue Feb 15 18:33:04 2011 New Revision: 125622 URL: http://llvm.org/viewvc/llvm-project?rev=125622&view=rev Log: Added new visit function to fill in null pool arguments for transformed CStdLib calls using Automatic Pool Allocation. Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=125622&r1=125621&r2=125622&view=diff ============================================================================== --- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Tue Feb 15 18:33:04 2011 @@ -71,6 +71,7 @@ void visitMemAlignCall(CallSite CS); void visitStrdupCall(CallSite CS); void visitRuntimeCheck(CallSite CS); + void visitCStdLibCheck(CallSite CS, const unsigned argc); void visitFreeCall(CallSite &CS); void visitCallSite(CallSite &CS); void visitCallInst(CallInst &CI) { @@ -740,6 +741,49 @@ } } +/** + * Visit the call site and replace null pool arguments with the correct ones + * + * @param argc Number of pool arguments to insert + */ +void FuncTransform::visitCStdLibCheck(CallSite CS, const unsigned argc) { + // Check for the correct number of pool arguments + assert ((CS.arg_size() > argc) && "Incorrect number of pool arguments!"); + + const Type *Int8Ty = Type::getInt8Ty(CS.getInstruction()->getContext()); + const Type *VoidPtrTy = PointerType::getUnqual(Int8Ty); + + if (argc == 1) { + // Get the pool handle for the pointer argument + Value *PH = getPoolHandle(CS.getArgument(1)->stripPointerCasts()); + + // Insert the pool handle + if (PH) { + PH = castTo(PH, VoidPtrTy, PH->getName(), CS.getInstruction()); + CS.setArgument(0, PH); + AddPoolUse(*(CS.getInstruction()), PH, PoolUses); + } + } else if (argc == 2) { + // Get the pool handles for the pointer arguments + Value *dstPH = getPoolHandle(CS.getArgument(2)->stripPointerCasts()); + Value *srcPH = getPoolHandle(CS.getArgument(3)->stripPointerCasts()); + + // Insert the destination pool handle + if (dstPH) { + dstPH = castTo(dstPH, VoidPtrTy, dstPH->getName(), CS.getInstruction()); + CS.setArgument(0, dstPH); + AddPoolUse(*(CS.getInstruction()), dstPH, PoolUses); + } + + // Insert the source pool handle + if (srcPH) { + srcPH = castTo(srcPH, VoidPtrTy, srcPH->getName(), CS.getInstruction()); + CS.setArgument(1, srcPH); + AddPoolUse(*(CS.getInstruction()), srcPH, PoolUses); + } + } +} + // // Method: visitCallSite() // @@ -826,6 +870,8 @@ (CF->getName() == "sc.pool_unregister") || (CF->getName() == "sc.get_actual_val")) { visitRuntimeCheck (CS); + } else if (CF->getName() == "pool_strcpy") { + visitCStdLibCheck(CS, 2); } else if (CF->getName() == "pthread_create") { thread_creation_point = true; From rafael.espindola at gmail.com Tue Feb 15 19:08:29 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 16 Feb 2011 01:08:29 -0000 Subject: [llvm-commits] [llvm] r125629 - in /llvm/trunk: include/llvm/MC/MCObjectStreamer.h include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp lib/MC/MCELFStreamer.cpp lib/MC/MCLoggingStreamer.cpp lib/MC/MCMachOStreamer.cpp lib/MC/MCNullStreamer.cpp lib/MC/MCObjectStreamer.cpp lib/MC/MCParser/ELFAsmParser.cpp lib/MC/MCPureStreamer.cpp lib/MC/MCStreamer.cpp lib/Target/PTX/PTXMCAsmStreamer.cpp test/MC/AsmParser/section.s Message-ID: <20110216010829.8A93D2A6C12C@llvm.org> Author: rafael Date: Tue Feb 15 19:08:29 2011 New Revision: 125629 URL: http://llvm.org/viewvc/llvm-project?rev=125629&view=rev Log: Add support for pushsection and popsection. Patch by Joerg Sonnenberger. Added: llvm/trunk/test/MC/AsmParser/section.s Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h llvm/trunk/include/llvm/MC/MCStreamer.h llvm/trunk/lib/MC/MCAsmStreamer.cpp llvm/trunk/lib/MC/MCELFStreamer.cpp llvm/trunk/lib/MC/MCLoggingStreamer.cpp llvm/trunk/lib/MC/MCMachOStreamer.cpp llvm/trunk/lib/MC/MCNullStreamer.cpp llvm/trunk/lib/MC/MCObjectStreamer.cpp llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp llvm/trunk/lib/MC/MCPureStreamer.cpp llvm/trunk/lib/MC/MCStreamer.cpp llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Tue Feb 15 19:08:29 2011 @@ -64,7 +64,7 @@ virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0); virtual void EmitSLEB128Value(const MCExpr *Value, unsigned AddrSpace = 0); virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol); - virtual void SwitchSection(const MCSection *Section); + virtual void ChangeSection(const MCSection *Section); virtual void EmitInstruction(const MCInst &Inst); virtual void EmitInstToFragment(const MCInst &Inst); virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value); Modified: llvm/trunk/include/llvm/MC/MCStreamer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h (original) +++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Feb 15 19:08:29 2011 @@ -14,6 +14,7 @@ #ifndef LLVM_MC_MCSTREAMER_H #define LLVM_MC_MCSTREAMER_H +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/DataTypes.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCDwarf.h" @@ -56,17 +57,17 @@ MCDwarfFrameInfo *getCurrentFrameInfo(); void EnsureValidFrame(); + /// CurSectionStack - This is stack of CurSection values saved by + /// PushSection. + SmallVector CurSectionStack; + + /// PrevSectionStack - This is stack of PrevSection values saved by + /// PushSection. + SmallVector PrevSectionStack; + protected: MCStreamer(MCContext &Ctx); - /// CurSection - This is the current section code is being emitted to, it is - /// kept up to date by SwitchSection. - const MCSection *CurSection; - - /// PrevSection - This is the previous section code is being emitted to, it - /// is kept up to date by SwitchSection. - const MCSection *PrevSection; - public: virtual ~MCStreamer(); @@ -115,17 +116,63 @@ /// getCurrentSection - Return the current section that the streamer is /// emitting code to. - const MCSection *getCurrentSection() const { return CurSection; } + const MCSection *getCurrentSection() const { + if (!CurSectionStack.empty()) + return CurSectionStack.back(); + return NULL; + } /// getPreviousSection - Return the previous section that the streamer is /// emitting code to. - const MCSection *getPreviousSection() const { return PrevSection; } + const MCSection *getPreviousSection() const { + if (!PrevSectionStack.empty()) + return PrevSectionStack.back(); + return NULL; + } + + /// ChangeSection - Update streamer for a new active section. + /// + /// This is called by PopSection and SwitchSection, if the current + /// section changes. + virtual void ChangeSection(const MCSection *) = 0; + + /// pushSection - Save the current and previous section on the + /// section stack. + void PushSection() { + PrevSectionStack.push_back(getPreviousSection()); + CurSectionStack.push_back(getCurrentSection()); + } + + /// popSection - Restore the current and previous section from + /// the section stack. Calls ChangeSection as needed. + /// + /// Returns false if the stack was empty. + bool PopSection() { + if (PrevSectionStack.size() <= 1) + return false; + assert(CurSectionStack.size() > 1); + PrevSectionStack.pop_back(); + const MCSection *oldSection = CurSectionStack.pop_back_val(); + const MCSection *curSection = CurSectionStack.back(); + + if (oldSection != curSection) + ChangeSection(curSection); + return true; + } /// SwitchSection - Set the current section where code is being emitted to /// @p Section. This is required to update CurSection. /// /// This corresponds to assembler directives like .section, .text, etc. - virtual void SwitchSection(const MCSection *Section) = 0; + void SwitchSection(const MCSection *Section) { + assert(Section && "Cannot switch to a null section!"); + const MCSection *curSection = CurSectionStack.back(); + PrevSectionStack.back() = curSection; + if (Section != curSection) { + CurSectionStack.back() = Section; + ChangeSection(Section); + } + } /// InitSections - Create the default sections and set the initial one. virtual void InitSections() = 0; Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -107,7 +107,7 @@ /// @name MCStreamer Interface /// @{ - virtual void SwitchSection(const MCSection *Section); + virtual void ChangeSection(const MCSection *Section); virtual void InitSections() { // FIXME, this is MachO specific, but the testsuite @@ -254,23 +254,19 @@ return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8)); } -void MCAsmStreamer::SwitchSection(const MCSection *Section) { +void MCAsmStreamer::ChangeSection(const MCSection *Section) { assert(Section && "Cannot switch to a null section!"); - if (Section != CurSection) { - PrevSection = CurSection; - CurSection = Section; - Section->PrintSwitchToSection(MAI, OS); - } + Section->PrintSwitchToSection(MAI, OS); } void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) { assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); - assert(CurSection && "Cannot emit before setting section!"); + assert(getCurrentSection() && "Cannot emit before setting section!"); OS << *Symbol << MAI.getLabelSuffix(); EmitEOL(); - Symbol->setSection(*CurSection); + Symbol->setSection(*getCurrentSection()); } void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { @@ -486,7 +482,7 @@ void MCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) { - assert(CurSection && "Cannot emit contents before setting section!"); + assert(getCurrentSection() && "Cannot emit contents before setting section!"); if (Data.empty()) return; if (Data.size() == 1) { @@ -517,7 +513,7 @@ void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, bool isPCRel, unsigned AddrSpace) { - assert(CurSection && "Cannot emit contents before setting section!"); + assert(getCurrentSection() && "Cannot emit contents before setting section!"); assert(!isPCRel && "Cannot emit pc relative relocations!"); const char *Directive = 0; switch (Size) { @@ -864,7 +860,7 @@ } void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { - assert(CurSection && "Cannot emit contents before setting section!"); + assert(getCurrentSection() && "Cannot emit contents before setting section!"); if (!UseLoc) MCLineEntry::Make(this, getCurrentSection()); Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCELFStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCELFStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -80,12 +80,12 @@ /// @{ virtual void InitSections(); + virtual void ChangeSection(const MCSection *Section); virtual void EmitLabel(MCSymbol *Symbol); virtual void EmitAssemblerFlag(MCAssemblerFlag Flag); virtual void EmitThumbFunc(MCSymbol *Func); virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol); - virtual void SwitchSection(const MCSection *Section); virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute); virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { assert(0 && "ELF doesn't support this directive"); @@ -222,11 +222,11 @@ Symbol->setVariableValue(AddValueSymbols(Value)); } -void MCELFStreamer::SwitchSection(const MCSection *Section) { +void MCELFStreamer::ChangeSection(const MCSection *Section) { const MCSymbol *Grp = static_cast(Section)->getGroup(); if (Grp) getAssembler().getOrCreateSymbolData(*Grp); - this->MCObjectStreamer::SwitchSection(Section); + this->MCObjectStreamer::ChangeSection(Section); } void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) { @@ -411,7 +411,7 @@ // entry in the module's symbol table (the first being the null symbol). void MCELFStreamer::EmitFileDirective(StringRef Filename) { MCSymbol *Symbol = getAssembler().getContext().GetOrCreateSymbol(Filename); - Symbol->setSection(*CurSection); + Symbol->setSection(*getCurrentSection()); Symbol->setAbsolute(); MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); Modified: llvm/trunk/lib/MC/MCLoggingStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCLoggingStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCLoggingStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCLoggingStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -48,10 +48,9 @@ return Child->AddBlankLine(); } - virtual void SwitchSection(const MCSection *Section) { - CurSection = Section; - LogCall("SwitchSection"); - return Child->SwitchSection(Section); + virtual void ChangeSection(const MCSection *Section) { + LogCall("ChangeSection"); + return Child->ChangeSection(Section); } virtual void InitSections() { Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -105,7 +105,7 @@ assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); // isSymbolLinkerVisible uses the section. - Symbol->setSection(*CurSection); + Symbol->setSection(*getCurrentSection()); // We have to create a new fragment if this is an atom defining symbol, // fragments cannot span atoms. if (getAssembler().isSymbolLinkerVisible(*Symbol)) Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -28,15 +28,13 @@ virtual void InitSections() { } - virtual void SwitchSection(const MCSection *Section) { - PrevSection = CurSection; - CurSection = Section; + virtual void ChangeSection(const MCSection *Section) { } virtual void EmitLabel(MCSymbol *Symbol) { assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); - assert(CurSection && "Cannot emit before setting section!"); - Symbol->setSection(*CurSection); + assert(getCurrentSection() && "Cannot emit before setting section!"); + Symbol->setSection(*getCurrentSection()); } virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {} Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -101,9 +101,9 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) { assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); - assert(CurSection && "Cannot emit before setting section!"); + assert(getCurrentSection() && "Cannot emit before setting section!"); - Symbol->setSection(*CurSection); + Symbol->setSection(*getCurrentSection()); MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); @@ -142,14 +142,9 @@ report_fatal_error("This file format doesn't support weak aliases."); } -void MCObjectStreamer::SwitchSection(const MCSection *Section) { +void MCObjectStreamer::ChangeSection(const MCSection *Section) { assert(Section && "Cannot switch to a null section!"); - // If already in this section, then this is a noop. - if (Section == CurSection) return; - - PrevSection = CurSection; - CurSection = Section; CurSectionData = &getAssembler().getOrCreateSectionData(*Section); } Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Tue Feb 15 19:08:29 2011 @@ -49,6 +49,8 @@ AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveDataRelRoLocal>(".data.rel.ro.local"); AddDirectiveHandler<&ELFAsmParser::ParseSectionDirectiveEhFrame>(".eh_frame"); AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSection>(".section"); + AddDirectiveHandler<&ELFAsmParser::ParseDirectivePushSection>(".pushsection"); + AddDirectiveHandler<&ELFAsmParser::ParseDirectivePopSection>(".popsection"); AddDirectiveHandler<&ELFAsmParser::ParseDirectiveSize>(".size"); AddDirectiveHandler<&ELFAsmParser::ParseDirectivePrevious>(".previous"); AddDirectiveHandler<&ELFAsmParser::ParseDirectiveType>(".type"); @@ -115,6 +117,8 @@ ELF::SHF_WRITE, SectionKind::getDataRel()); } + bool ParseDirectivePushSection(StringRef, SMLoc); + bool ParseDirectivePopSection(StringRef, SMLoc); bool ParseDirectiveSection(StringRef, SMLoc); bool ParseDirectiveSize(StringRef, SMLoc); bool ParseDirectivePrevious(StringRef, SMLoc); @@ -253,6 +257,23 @@ return flags; } +bool ELFAsmParser::ParseDirectivePushSection(StringRef s, SMLoc loc) { + getStreamer().PushSection(); + + if (ParseDirectiveSection(s, loc)) { + getStreamer().PopSection(); + return true; + } + + return false; +} + +bool ELFAsmParser::ParseDirectivePopSection(StringRef, SMLoc) { + if (!getStreamer().PopSection()) + return TokError(".popsection without corresponding .pushsection"); + return false; +} + // FIXME: This is a work in progress. bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) { StringRef SectionName; @@ -364,8 +385,9 @@ bool ELFAsmParser::ParseDirectivePrevious(StringRef DirName, SMLoc) { const MCSection *PreviousSection = getStreamer().getPreviousSection(); - if (PreviousSection != NULL) - getStreamer().SwitchSection(PreviousSection); + if (PreviousSection == NULL) + return TokError(".previous without corresponding .section"); + getStreamer().SwitchSection(PreviousSection); return false; } @@ -427,7 +449,6 @@ Lex(); - const MCSection *OldSection = getStreamer().getCurrentSection(); const MCSection *Comment = getContext().getELFSection(".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | @@ -437,13 +458,14 @@ static bool First = true; + getStreamer().PushSection(); getStreamer().SwitchSection(Comment); if (First) getStreamer().EmitIntValue(0, 1); First = false; getStreamer().EmitBytes(Data, 0); getStreamer().EmitIntValue(0, 1); - getStreamer().SwitchSection(OldSection); + getStreamer().PopSection(); return false; } Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -113,9 +113,9 @@ void MCPureStreamer::EmitLabel(MCSymbol *Symbol) { assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); - assert(CurSection && "Cannot emit before setting section!"); + assert(getCurrentSection() && "Cannot emit before setting section!"); - Symbol->setSection(*CurSection); + Symbol->setSection(*getCurrentSection()); MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); Modified: llvm/trunk/lib/MC/MCStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCStreamer.cpp (original) +++ llvm/trunk/lib/MC/MCStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -19,8 +19,9 @@ #include using namespace llvm; -MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx), CurSection(0), - PrevSection(0) { +MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx) { + PrevSectionStack.push_back(NULL); + CurSectionStack.push_back(NULL); } MCStreamer::~MCStreamer() { Modified: llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp?rev=125629&r1=125628&r2=125629&view=diff ============================================================================== --- llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp (original) +++ llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Tue Feb 15 19:08:29 2011 @@ -100,8 +100,7 @@ /// @name MCStreamer Interface /// @{ - virtual void SwitchSection(const MCSection *Section); - + virtual void ChangeSection(const MCSection *Section); virtual void InitSections() {} virtual void EmitLabel(MCSymbol *Symbol); @@ -227,22 +226,18 @@ return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8)); } -void PTXMCAsmStreamer::SwitchSection(const MCSection *Section) { +void PTXMCAsmStreamer::ChangeSection(const MCSection *Section) { assert(Section && "Cannot switch to a null section!"); - if (Section != CurSection) { - PrevSection = CurSection; - CurSection = Section; - } } void PTXMCAsmStreamer::EmitLabel(MCSymbol *Symbol) { assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); assert(!Symbol->isVariable() && "Cannot emit a variable symbol!"); - assert(CurSection && "Cannot emit before setting section!"); + assert(getCurrentSection() && "Cannot emit before setting section!"); OS << *Symbol << MAI.getLabelSuffix(); EmitEOL(); - Symbol->setSection(*CurSection); + Symbol->setSection(*getCurrentSection()); } void PTXMCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {} @@ -332,7 +327,7 @@ } void PTXMCAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) { - assert(CurSection && "Cannot emit contents before setting section!"); + assert(getCurrentSection() && "Cannot emit contents before setting section!"); if (Data.empty()) return; if (Data.size() == 1) { @@ -358,7 +353,7 @@ void PTXMCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, bool isPCRel, unsigned AddrSpace) { - assert(CurSection && "Cannot emit contents before setting section!"); + assert(getCurrentSection() && "Cannot emit contents before setting section!"); assert(!isPCRel && "Cannot emit pc relative relocations!"); const char *Directive = 0; switch (Size) { @@ -502,7 +497,7 @@ void PTXMCAsmStreamer::AddEncodingComment(const MCInst &Inst) {} void PTXMCAsmStreamer::EmitInstruction(const MCInst &Inst) { - assert(CurSection && "Cannot emit contents before setting section!"); + assert(getCurrentSection() && "Cannot emit contents before setting section!"); // Show the encoding in a comment if we have a code emitter. if (Emitter) Added: llvm/trunk/test/MC/AsmParser/section.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/section.s?rev=125629&view=auto ============================================================================== --- llvm/trunk/test/MC/AsmParser/section.s (added) +++ llvm/trunk/test/MC/AsmParser/section.s Tue Feb 15 19:08:29 2011 @@ -0,0 +1,107 @@ +# RUN: llvm-mc -triple i386-pc-linux-gnu -filetype=obj -o %t %s +# RUN: elf-dump --dump-section-data < %t | FileCheck %s +.section test1 +.byte 1 +.section test2 +.byte 2 +.previous +.byte 1 +.section test2 +.byte 2 +.previous +.byte 1 +.section test1 +.byte 1 +.previous +.byte 1 +.section test2 +.byte 2 +.pushsection test3 +.byte 3 +.pushsection test4 +.byte 4 +.pushsection test5 +.byte 5 +.popsection +.byte 4 +.popsection +.byte 3 +.popsection +.byte 2 +.pushsection test3 +.byte 3 +.pushsection test4 +.byte 4 +.previous +.byte 3 +.popsection +.byte 3 +.previous +.byte 2 +.section test1 +.byte 1 +.popsection +.byte 2 +.previous +.byte 1 +.previous +# CHECK: (('sh_name', 0x00000012) # 'test1' +# CHECK-NEXT: ('sh_type', 0x00000001) +# CHECK-NEXT: ('sh_flags', 0x00000000) +# CHECK-NEXT: ('sh_addr', 0x00000000) +# CHECK-NEXT: ('sh_offset', 0x00000034) +# CHECK-NEXT: ('sh_size', 0x00000007) +# CHECK-NEXT: ('sh_link', 0x00000000) +# CHECK-NEXT: ('sh_info', 0x00000000) +# CHECK-NEXT: ('sh_addralign', 0x00000001) +# CHECK-NEXT: ('sh_entsize', 0x00000000) +# CHECK-NEXT: ('_section_data', '01010101 010101') +# CHECK-NEXT: ), +# CHECK: (('sh_name', 0x00000018) # 'test2' +# CHECK-NEXT: ('sh_type', 0x00000001) +# CHECK-NEXT: ('sh_flags', 0x00000000) +# CHECK-NEXT: ('sh_addr', 0x00000000) +# CHECK-NEXT: ('sh_offset', 0x0000003b) +# CHECK-NEXT: ('sh_size', 0x00000006) +# CHECK-NEXT: ('sh_link', 0x00000000) +# CHECK-NEXT: ('sh_info', 0x00000000) +# CHECK-NEXT: ('sh_addralign', 0x00000001) +# CHECK-NEXT: ('sh_entsize', 0x00000000) +# CHECK-NEXT: ('_section_data', '02020202 0202') +# CHECK-NEXT: ), +# CHECK: (('sh_name', 0x0000001e) # 'test3' +# CHECK-NEXT: ('sh_type', 0x00000001) +# CHECK-NEXT: ('sh_flags', 0x00000000) +# CHECK-NEXT: ('sh_addr', 0x00000000) +# CHECK-NEXT: ('sh_offset', 0x00000041) +# CHECK-NEXT: ('sh_size', 0x00000005) +# CHECK-NEXT: ('sh_link', 0x00000000) +# CHECK-NEXT: ('sh_info', 0x00000000) +# CHECK-NEXT: ('sh_addralign', 0x00000001) +# CHECK-NEXT: ('sh_entsize', 0x00000000) +# CHECK-NEXT: ('_section_data', '03030303 03') +# CHECK-NEXT: ), +# CHECK: (('sh_name', 0x00000024) # 'test4' +# CHECK-NEXT: ('sh_type', 0x00000001) +# CHECK-NEXT: ('sh_flags', 0x00000000) +# CHECK-NEXT: ('sh_addr', 0x00000000) +# CHECK-NEXT: ('sh_offset', 0x00000046) +# CHECK-NEXT: ('sh_size', 0x00000003) +# CHECK-NEXT: ('sh_link', 0x00000000) +# CHECK-NEXT: ('sh_info', 0x00000000) +# CHECK-NEXT: ('sh_addralign', 0x00000001) +# CHECK-NEXT: ('sh_entsize', 0x00000000) +# CHECK-NEXT: ('_section_data', '040404') +# CHECK-NEXT: ), +# CHECK: (('sh_name', 0x0000002a) # 'test5' +# CHECK-NEXT: ('sh_type', 0x00000001) +# CHECK-NEXT: ('sh_flags', 0x00000000) +# CHECK-NEXT: ('sh_addr', 0x00000000) +# CHECK-NEXT: ('sh_offset', 0x00000049) +# CHECK-NEXT: ('sh_size', 0x00000001) +# CHECK-NEXT: ('sh_link', 0x00000000) +# CHECK-NEXT: ('sh_info', 0x00000000) +# CHECK-NEXT: ('sh_addralign', 0x00000001) +# CHECK-NEXT: ('sh_entsize', 0x00000000) +# CHECK-NEXT: ('_section_data', '05') +# CHECK-NEXT: ), From echristo at apple.com Tue Feb 15 19:08:31 2011 From: echristo at apple.com (Eric Christopher) Date: Wed, 16 Feb 2011 01:08:31 -0000 Subject: [llvm-commits] [llvm] r125630 - /llvm/trunk/test/CodeGen/X86/legalize-sub-zero.ll Message-ID: <20110216010831.2D86F2A6C12D@llvm.org> Author: echristo Date: Tue Feb 15 19:08:31 2011 New Revision: 125630 URL: http://llvm.org/viewvc/llvm-project?rev=125630&view=rev Log: Add testcase for PR9190. Added: llvm/trunk/test/CodeGen/X86/legalize-sub-zero.ll Added: llvm/trunk/test/CodeGen/X86/legalize-sub-zero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/legalize-sub-zero.ll?rev=125630&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/legalize-sub-zero.ll (added) +++ llvm/trunk/test/CodeGen/X86/legalize-sub-zero.ll Tue Feb 15 19:08:31 2011 @@ -0,0 +1,35 @@ +; RUN: llc < %s -mtriple=i686-pc-win32 + +;target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +;target triple = "i686-pc-win32" + +define void @test() nounwind { + %1 = fdiv <3 x double> zeroinitializer, undef + %2 = fdiv <2 x double> zeroinitializer, undef + %3 = shufflevector <2 x double> %2, <2 x double> undef, <3 x i32> + %4 = insertelement <3 x double> %3, double undef, i32 2 + %5 = bitcast <3 x double> %1 to <3 x i64> + %6 = bitcast <3 x double> %4 to <3 x i64> + %7 = sub <3 x i64> %5, %6 + %8 = shufflevector <3 x i64> %7, <3 x i64> undef, <2 x i32> + %9 = xor <2 x i64> %8, zeroinitializer + %10 = add nsw <2 x i64> %9, zeroinitializer + %11 = shufflevector <2 x i64> %10, <2 x i64> undef, <3 x i32> + %12 = insertelement <3 x i64> %11, i64 0, i32 2 + %13 = shufflevector <3 x i64> %12, <3 x i64> undef, <4 x i32> + %14 = shufflevector <4 x i64> %13, <4 x i64> undef, <2 x i32> + %15 = bitcast <2 x i64> %14 to <4 x i32> + %16 = shufflevector <4 x i32> %15, <4 x i32> undef, <4 x i32> + %17 = bitcast <4 x i32> %16 to <2 x i64> + %18 = shufflevector <2 x i64> %17, <2 x i64> undef, <2 x i32> + %19 = bitcast <2 x i64> %18 to <4 x i32> + %20 = shufflevector <4 x i32> %19, <4 x i32> undef, <3 x i32> + %21 = or <3 x i32> %20, zeroinitializer + store <3 x i32> %21, <3 x i32> addrspace(1)* undef, align 16 + ret void +} From echristo at apple.com Tue Feb 15 19:10:03 2011 From: echristo at apple.com (Eric Christopher) Date: Wed, 16 Feb 2011 01:10:03 -0000 Subject: [llvm-commits] [llvm] r125631 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/legalize-sub-zero-2.ll Message-ID: <20110216011003.EFB5B2A6C12C@llvm.org> Author: echristo Date: Tue Feb 15 19:10:03 2011 New Revision: 125631 URL: http://llvm.org/viewvc/llvm-project?rev=125631&view=rev Log: The change for PR9190 wasn't quite right. We need to avoid making the transformation if we can't legally create a build vector of the correct type. Check that we can make the transformation first, and add a TODO to refactor this code with similar cases. Fixes: PR9223 and rdar://9000350 Added: llvm/trunk/test/CodeGen/X86/legalize-sub-zero-2.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=125631&r1=125630&r2=125631&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Feb 15 19:10:03 2011 @@ -1532,8 +1532,18 @@ } // fold (sub x, x) -> 0 - if (N0 == N1) - return DAG.getConstant(0, N->getValueType(0), LegalTypes); + // FIXME: Refactor this and xor and other similar operations together. + if (N0 == N1) { + if (!VT.isVector()) { + return DAG.getConstant(0, VT); + } else if (!LegalOperations || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)){ + // Produce a vector of zeros. + SDValue El = DAG.getConstant(0, VT.getVectorElementType()); + std::vector Ops(VT.getVectorNumElements(), El); + return DAG.getNode(ISD::BUILD_VECTOR, N->getDebugLoc(), VT, + &Ops[0], Ops.size()); + } + } // fold (sub c1, c2) -> c1-c2 if (N0C && N1C) return DAG.FoldConstantArithmetic(ISD::SUB, VT, N0C, N1C); Added: llvm/trunk/test/CodeGen/X86/legalize-sub-zero-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/legalize-sub-zero-2.ll?rev=125631&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/legalize-sub-zero-2.ll (added) +++ llvm/trunk/test/CodeGen/X86/legalize-sub-zero-2.ll Tue Feb 15 19:10:03 2011 @@ -0,0 +1,41 @@ +; RUN: llc < %s -mtriple=i386-apple-darwin + +define fastcc void @foo(i32 %type) nounwind optsize { +entry: + switch i32 %type, label %bb26 [ + i32 33634, label %bb11 + i32 5121, label %bb27 + ] + +bb11: ; preds = %entry + br label %bb27 + +bb26: ; preds = %entry + unreachable + +bb27: ; preds = %bb11, %entry + %srcpb.0 = phi i32 [ 1, %bb11 ], [ 0, %entry ] + br i1 undef, label %bb348, label %bb30.lr.ph + +bb30.lr.ph: ; preds = %bb27 + %.sum743 = shl i32 %srcpb.0, 1 + %0 = mul i32 %srcpb.0, -2 + %.sum745 = add i32 %.sum743, %0 + br i1 undef, label %bb70, label %bb71 + +bb70: ; preds = %bb30.lr.ph + unreachable + +bb71: ; preds = %bb30.lr.ph + br i1 undef, label %bb92, label %bb80 + +bb80: ; preds = %bb71 + unreachable + +bb92: ; preds = %bb71 + %1 = getelementptr inbounds i8* undef, i32 %.sum745 + unreachable + +bb348: ; preds = %bb27 + ret void +} From echristo at apple.com Tue Feb 15 19:15:03 2011 From: echristo at apple.com (Eric Christopher) Date: Tue, 15 Feb 2011 17:15:03 -0800 Subject: [llvm-commits] [llvm] r125631 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/legalize-sub-zero-2.ll In-Reply-To: <20110216011003.EFB5B2A6C12C@llvm.org> References: <20110216011003.EFB5B2A6C12C@llvm.org> Message-ID: On Feb 15, 2011, at 5:10 PM, Eric Christopher wrote: > + // FIXME: Refactor this and xor and other similar operations together. And, just to say it, I plan on doing this in short order. -eric From grosbach at apple.com Tue Feb 15 20:02:10 2011 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 15 Feb 2011 18:02:10 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110215204339.453842A6C12C@llvm.org> References: <20110215204339.453842A6C12C@llvm.org> Message-ID: Shouldn't something like this, at minimum, be predicated on a target enabling it? I doubt this is something all assembly variants want. For example, on x86 does Intel vs ATT syntax change whether this is supported? What about other targets? Do they want this enabled at all? Square brackets often have special meaning (memory references being the most common) and this could very easily complicate that. -Jim On Feb 15, 2011, at 12:43 PM, Roman Divacky wrote: > Author: rdivacky > Date: Tue Feb 15 14:43:39 2011 > New Revision: 125595 > > URL: http://llvm.org/viewvc/llvm-project?rev=125595&view=rev > Log: > Add support for parsing [expr]. > > This is submitted by Joerg Sonnenberger and fixes his PR8685. > > > Added: > llvm/trunk/test/MC/AsmParser/paren.s > Modified: > llvm/trunk/lib/MC/MCParser/AsmParser.cpp > llvm/trunk/test/MC/AsmParser/exprs.s > > Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=125595&r1=125594&r2=125595&view=diff > ============================================================================== > --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original) > +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Feb 15 14:43:39 2011 > @@ -173,6 +173,7 @@ > bool ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc); > bool ParseBinOpRHS(unsigned Precedence, const MCExpr *&Res, SMLoc &EndLoc); > bool ParseParenExpr(const MCExpr *&Res, SMLoc &EndLoc); > + bool ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc); > > /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) > /// and set \arg Res to the identifier contents. > @@ -492,6 +493,20 @@ > return false; > } > > +/// ParseBracketExpr - Parse a bracket expression and return it. > +/// NOTE: This assumes the leading '[' has already been consumed. > +/// > +/// bracketexpr ::= expr] > +/// > +bool AsmParser::ParseBracketExpr(const MCExpr *&Res, SMLoc &EndLoc) { > + if (ParseExpression(Res)) return true; > + if (Lexer.isNot(AsmToken::RBrac)) > + return TokError("expected ']' in brackets expression"); > + EndLoc = Lexer.getLoc(); > + Lex(); > + return false; > +} > + > /// ParsePrimaryExpr - Parse a primary expression and return it. > /// primaryexpr ::= (parenexpr > /// primaryexpr ::= symbol > @@ -587,6 +602,9 @@ > case AsmToken::LParen: > Lex(); // Eat the '('. > return ParseParenExpr(Res, EndLoc); > + case AsmToken::LBrac: > + Lex(); // Eat the '['. > + return ParseBracketExpr(Res, EndLoc); > case AsmToken::Minus: > Lex(); // Eat the operator. > if (ParsePrimaryExpr(Res, EndLoc)) > > Modified: llvm/trunk/test/MC/AsmParser/exprs.s > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=125595&r1=125594&r2=125595&view=diff > ============================================================================== > --- llvm/trunk/test/MC/AsmParser/exprs.s (original) > +++ llvm/trunk/test/MC/AsmParser/exprs.s Tue Feb 15 14:43:39 2011 > @@ -35,6 +35,8 @@ > check_expr 1 << 1, 2 > check_expr 2 >> 1, 1 > check_expr (~0 >> 1), -1 > + check_expr [~0 >> 1], -1 > + check_expr 4 * [4 + (3 + [2 * 2] + 1)], 48 > check_expr 3 - 2, 1 > check_expr 1 ^ 3, 2 > check_expr 1 && 2, 1 > > Added: llvm/trunk/test/MC/AsmParser/paren.s > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/paren.s?rev=125595&view=auto > ============================================================================== > --- llvm/trunk/test/MC/AsmParser/paren.s (added) > +++ llvm/trunk/test/MC/AsmParser/paren.s Tue Feb 15 14:43:39 2011 > @@ -0,0 +1,8 @@ > +// RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t1 > %t2 > +// RUN: FileCheck < %t1 %s > + > +// CHECK: error: expected ']' in brackets expression > +.size x, [.-x) > + > +// CHECK: error: expected ')' in parentheses expression > +.size y, (.-y] > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From joerg at britannica.bec.de Tue Feb 15 20:25:06 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 16 Feb 2011 03:25:06 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: References: <20110215204339.453842A6C12C@llvm.org> Message-ID: <20110216022506.GA22148@britannica.bec.de> On Tue, Feb 15, 2011 at 06:02:10PM -0800, Jim Grosbach wrote: > Shouldn't something like this, at minimum, be predicated on a target > enabling it? I doubt this is something all assembly variants want. ParseBracketExpr can be made virtual if necessary, but the current status quo breaks completely legal code on i386. > For example, on x86 does Intel vs ATT syntax change whether this is > supported? What about other targets? Do they want this enabled at all? > Square brackets often have special meaning (memory references being > the most common) and this could very easily complicate that. AT&T syntax doesn't care about [], I think. Intel syntax is messy as best, but if it could only need a virtual override. Joerg From rafael.espindola at gmail.com Tue Feb 15 21:25:55 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 16 Feb 2011 03:25:55 -0000 Subject: [llvm-commits] [llvm] r125648 - in /llvm/trunk: include/llvm/MC/MCObjectWriter.h lib/MC/ELFObjectWriter.cpp lib/MC/MCAssembler.cpp lib/MC/MCObjectWriter.cpp lib/MC/WinCOFFObjectWriter.cpp test/MC/ELF/relax.s Message-ID: <20110216032555.F2CC42A6C12C@llvm.org> Author: rafael Date: Tue Feb 15 21:25:55 2011 New Revision: 125648 URL: http://llvm.org/viewvc/llvm-project?rev=125648&view=rev Log: Gas is very inconsistent about when a relaxation/relocation is needed. Do the right thing and stop trying to copy it. Fixes PR8944. Modified: llvm/trunk/include/llvm/MC/MCObjectWriter.h llvm/trunk/lib/MC/ELFObjectWriter.cpp llvm/trunk/lib/MC/MCAssembler.cpp llvm/trunk/lib/MC/MCObjectWriter.cpp llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp llvm/trunk/test/MC/ELF/relax.s Modified: llvm/trunk/include/llvm/MC/MCObjectWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectWriter.h?rev=125648&r1=125647&r2=125648&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCObjectWriter.h (original) +++ llvm/trunk/include/llvm/MC/MCObjectWriter.h Tue Feb 15 21:25:55 2011 @@ -96,7 +96,7 @@ const MCSymbolData &DataA, const MCFragment &FB, bool InSet, - bool IsPCRel) const = 0; + bool IsPCRel) const; /// Write the object file. Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=125648&r1=125647&r2=125648&view=diff ============================================================================== --- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Feb 15 21:25:55 2011 @@ -359,13 +359,6 @@ MCDataFragment *F, const MCSectionData *SD); - virtual bool - IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, - const MCSymbolData &DataA, - const MCFragment &FB, - bool InSet, - bool IsPCRel) const; - virtual void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout); virtual void WriteSection(MCAssembler &Asm, const SectionIndexMapTy &SectionIndexMap, @@ -1181,24 +1174,6 @@ } } -bool -ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, - const MCSymbolData &DataA, - const MCFragment &FB, - bool InSet, - bool IsPCRel) const { - // FIXME: This is in here just to match gnu as output. If the two ends - // are in the same section, there is nothing that the linker can do to - // break it. - if (DataA.isExternal()) - return false; - - const MCSection &SecA = DataA.getSymbol().AliasedSymbol().getSection(); - const MCSection &SecB = FB.getParent()->getSection(); - // On ELF A - B is absolute if A and B are in the same section. - return &SecA == &SecB; -} - void ELFObjectWriter::CreateIndexedSections(MCAssembler &Asm, MCAsmLayout &Layout, GroupMapTy &GroupMap, Modified: llvm/trunk/lib/MC/MCAssembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=125648&r1=125647&r2=125648&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCAssembler.cpp (original) +++ llvm/trunk/lib/MC/MCAssembler.cpp Tue Feb 15 21:25:55 2011 @@ -229,8 +229,10 @@ } else if (!Target.getSymA()) { IsResolved = false; } else { - const MCSymbol &SA = Target.getSymA()->getSymbol(); - if (SA.AliasedSymbol().isUndefined()) { + const MCSymbolRefExpr *A = Target.getSymA(); + const MCSymbol &SA = A->getSymbol(); + if (A->getKind() != MCSymbolRefExpr::VK_None || + SA.AliasedSymbol().isUndefined()) { IsResolved = false; } else { const MCSymbolData &DataA = getSymbolData(SA); Modified: llvm/trunk/lib/MC/MCObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectWriter.cpp?rev=125648&r1=125647&r2=125648&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/MCObjectWriter.cpp Tue Feb 15 21:25:55 2011 @@ -66,3 +66,15 @@ InSet, false); } + +bool +MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, + const MCSymbolData &DataA, + const MCFragment &FB, + bool InSet, + bool IsPCRel) const { + const MCSection &SecA = DataA.getSymbol().AliasedSymbol().getSection(); + const MCSection &SecB = FB.getParent()->getSection(); + // On ELF and COFF A - B is absolute if A and B are in the same section. + return &SecA == &SecB; +} Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=125648&r1=125647&r2=125648&view=diff ============================================================================== --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original) +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Feb 15 21:25:55 2011 @@ -179,13 +179,6 @@ MCValue Target, uint64_t &FixedValue); - virtual bool - IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, - const MCSymbolData &DataA, - const MCFragment &FB, - bool InSet, - bool IsPCRel) const; - void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout); }; } @@ -719,19 +712,6 @@ coff_section->Relocations.push_back(Reloc); } -bool -WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl( - const MCAssembler &Asm, - const MCSymbolData &DataA, - const MCFragment &FB, - bool InSet, - bool IsPCRel) const { - const MCSection &SecA = DataA.getSymbol().AliasedSymbol().getSection(); - const MCSection &SecB = FB.getParent()->getSection(); - // On COFF A - B is absolute if A and B are in the same section. - return &SecA == &SecB; -} - void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) { // Assign symbol and section indexes and offsets. Modified: llvm/trunk/test/MC/ELF/relax.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relax.s?rev=125648&r1=125647&r2=125648&view=diff ============================================================================== --- llvm/trunk/test/MC/ELF/relax.s (original) +++ llvm/trunk/test/MC/ELF/relax.s Tue Feb 15 21:25:55 2011 @@ -1,10 +1,6 @@ // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s -// Test that we do a relaxation for foo but not for bar or zed. Relaxing foo is -// probably not necessary, but matches what gnu as does. - -// Also test that the relaxation done for foo uses the symbol, not section and -// offset. +// Test that we do not relax these. bar: .globl foo @@ -20,22 +16,12 @@ // CHECK-NEXT: ('sh_flags', 0x00000006) // CHECK-NEXT: ('sh_addr', 0x00000000) // CHECK-NEXT: ('sh_offset', 0x00000040) -// CHECK-NEXT: ('sh_size', 0x00000009) +// CHECK-NEXT: ('sh_size', 0x00000006) // CHECK-NEXT: ('sh_link', 0x00000000) // CHECK-NEXT: ('sh_info', 0x00000000) // CHECK-NEXT: ('sh_addralign', 0x00000004) // CHECK-NEXT: ('sh_entsize', 0x00000000) -// CHECK-NEXT: ('_section_data', 'ebfee900 000000eb f7') +// CHECK-NEXT: ('_section_data', 'ebfeebfc ebfa') // CHECK: # Symbol 0x00000006 // CHECK-NEXT: (('st_name', 0x00000005) # 'foo' - -// CHECK: .rela.text -// CHECK: ('_relocations', [ -// CHECK-NEXT: Relocation 0x00000000 -// CHECK-NEXT: (('r_offset', 0x00000003) -// CHECK-NEXT: ('r_sym', 0x00000006) -// CHECK-NEXT: ('r_type', 0x00000002) -// CHECK-NEXT: ('r_addend', 0xfffffffc) -// CHECK-NEXT: ), -// CHECK-NEXT: ]) From geek4civic at gmail.com Tue Feb 15 21:57:59 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Wed, 16 Feb 2011 12:57:59 +0900 Subject: [llvm-commits] [PATCH][llvm][clang] Use Triple::MinGW32 instead of Triple::MinGW64 Message-ID: Hello. I have reworked Triple patches. - Use Triple::MinGW32. (I got rid of Triple::MinGW) - *-mingw64 is no longer recognized. Use *-mingw32. Please take a look into them, thank you. * clang-0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt * llvm-0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt Reworked. * clang-0002-lib-Frontend-InitHeaderSearch.cpp-Add-mingw-w64-.patch.txt Almost same as last one. ...Takumi -------------- next part -------------- From ae588cf518e2ffe66fac97d58ca2477e6de3e234 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 16 Feb 2011 10:47:25 +0900 Subject: [PATCH 1/2] Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 instead. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.7.1.GIT" This is a multi-part message in MIME format. --------------1.7.1.GIT Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32. --- lib/Basic/Targets.cpp | 2 +- lib/CodeGen/TargetInfo.cpp | 2 +- lib/Driver/Driver.cpp | 1 - lib/Driver/Tools.cpp | 3 +-- lib/Frontend/InitHeaderSearch.cpp | 9 --------- lib/Sema/TargetAttributesSema.cpp | 3 +-- 6 files changed, 4 insertions(+), 16 deletions(-) --------------1.7.1.GIT Content-Type: text/x-patch; name="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt" diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 2af28d6..35817a2 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -2691,7 +2691,7 @@ static TargetInfo *AllocateTarget(const std::string &T) { return new FreeBSDTargetInfo(T); case llvm::Triple::Solaris: return new SolarisTargetInfo(T); - case llvm::Triple::MinGW64: + case llvm::Triple::MinGW32: return new MinGWX86_64TargetInfo(T); case llvm::Triple::Win32: // This is what Triple.h supports now. if (Triple.getEnvironment() == llvm::Triple::MachO) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index c12e540..e27292c 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -2829,7 +2829,7 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { case llvm::Triple::x86_64: switch (Triple.getOS()) { case llvm::Triple::Win32: - case llvm::Triple::MinGW64: + case llvm::Triple::MinGW32: case llvm::Triple::Cygwin: return *(TheTargetCodeGenInfo = new WinX86_64TargetCodeGenInfo(Types)); default: diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index a4f6c3f..5a5986b 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1349,7 +1349,6 @@ const HostInfo *Driver::GetHostInfo(const char *TripleStr) const { case llvm::Triple::Win32: return createWindowsHostInfo(*this, Triple); case llvm::Triple::MinGW32: - case llvm::Triple::MinGW64: return createMinGWHostInfo(*this, Triple); default: return createUnknownHostInfo(*this, Triple); diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index c8a3ef7..176384a 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1448,8 +1448,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (KernelOrKext || !Args.hasFlag(options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, getToolChain().getTriple().getOS() != llvm::Triple::Cygwin && - getToolChain().getTriple().getOS() != llvm::Triple::MinGW32 && - getToolChain().getTriple().getOS() != llvm::Triple::MinGW64)) + getToolChain().getTriple().getOS() != llvm::Triple::MinGW32)) CmdArgs.push_back("-fno-use-cxa-atexit"); // -fms-extensions=0 is default. diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp index 50b89aa..39f30e5 100644 --- a/lib/Frontend/InitHeaderSearch.cpp +++ b/lib/Frontend/InitHeaderSearch.cpp @@ -529,7 +529,6 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, case llvm::Triple::Cygwin: AddPath("/usr/include/w32api", System, true, false, false); break; - case llvm::Triple::MinGW64: case llvm::Triple::MinGW32: AddPath("c:/mingw/include", System, true, false, false); break; @@ -566,14 +565,6 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { // FIXME: Do we support g++-3.4.4? AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4"); break; - case llvm::Triple::MinGW64: - // Try gcc 4.5.0 - AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.5.0"); - // Try gcc 4.4.0 - AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.4.0"); - // Try gcc 4.3.0 - AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.3.0"); - // Fall through. case llvm::Triple::MinGW32: // Try gcc 4.5.0 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0"); diff --git a/lib/Sema/TargetAttributesSema.cpp b/lib/Sema/TargetAttributesSema.cpp index bb61802..6d7f2e6 100644 --- a/lib/Sema/TargetAttributesSema.cpp +++ b/lib/Sema/TargetAttributesSema.cpp @@ -238,8 +238,7 @@ namespace { const AttributeList &Attr, Sema &S) const { const llvm::Triple &Triple(S.Context.Target.getTriple()); if (Triple.getOS() == llvm::Triple::Win32 || - Triple.getOS() == llvm::Triple::MinGW32 || - Triple.getOS() == llvm::Triple::MinGW64) { + Triple.getOS() == llvm::Triple::MinGW32) { switch (Attr.getKind()) { case AttributeList::AT_dllimport: HandleDLLImportAttr(D, Attr, S); return true; --------------1.7.1.GIT-- -------------- next part -------------- From 7b89bb61e24b3f2e51aa6d0be94938de8a5700d5 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 16 Feb 2011 10:41:06 +0900 Subject: [PATCH] Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 generally. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.7.1.GIT" This is a multi-part message in MIME format. --------------1.7.1.GIT Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32. In llvm side, i686 and x64 can be treated as similar way. --- include/llvm/ADT/Triple.h | 3 +-- lib/Support/Triple.cpp | 3 --- lib/Target/ARM/ARMTargetMachine.cpp | 1 - lib/Target/MBlaze/MBlazeTargetMachine.cpp | 1 - lib/Target/X86/X86AsmBackend.cpp | 2 +- lib/Target/X86/X86Subtarget.h | 4 +--- lib/Target/X86/X86TargetMachine.cpp | 2 -- test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll | 2 +- test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll | 2 +- 9 files changed, 5 insertions(+), 15 deletions(-) --------------1.7.1.GIT Content-Type: text/x-patch; name="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-Triple-MinGW64-is-deprecated-and-removed.-We-can.patch.txt" diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 9e2eb86..e6dcc23 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -84,8 +84,7 @@ public: FreeBSD, Linux, Lv2, // PS3 - MinGW32, - MinGW64, + MinGW32, // i*86-pc-mingw32, *-w64-mingw32 NetBSD, OpenBSD, Psp, diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index d4a7dec..36edf6e 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -101,7 +101,6 @@ const char *Triple::getOSTypeName(OSType Kind) { case Linux: return "linux"; case Lv2: return "lv2"; case MinGW32: return "mingw32"; - case MinGW64: return "mingw64"; case NetBSD: return "netbsd"; case OpenBSD: return "openbsd"; case Psp: return "psp"; @@ -318,8 +317,6 @@ Triple::OSType Triple::ParseOS(StringRef OSName) { return Lv2; else if (OSName.startswith("mingw32")) return MinGW32; - else if (OSName.startswith("mingw64")) - return MinGW64; else if (OSName.startswith("netbsd")) return NetBSD; else if (OSName.startswith("openbsd")) diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 60df718..0ee773b 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -45,7 +45,6 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, case Triple::Darwin: return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll); case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: llvm_unreachable("ARM does not support Windows COFF format"); diff --git a/lib/Target/MBlaze/MBlazeTargetMachine.cpp b/lib/Target/MBlaze/MBlazeTargetMachine.cpp index f83f70b..cd949e1 100644 --- a/lib/Target/MBlaze/MBlazeTargetMachine.cpp +++ b/lib/Target/MBlaze/MBlazeTargetMachine.cpp @@ -41,7 +41,6 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, llvm_unreachable("MBlaze does not support Darwin MACH-O format"); return NULL; case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: llvm_unreachable("MBlaze does not support Windows COFF format"); diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp index 3c426be..da5f5b1 100644 --- a/lib/Target/X86/X86AsmBackend.cpp +++ b/lib/Target/X86/X86AsmBackend.cpp @@ -428,7 +428,7 @@ TargetAsmBackend *llvm::createX86_64AsmBackend(const Target &T, switch (Triple(TT).getOS()) { case Triple::Darwin: return new DarwinX86_64AsmBackend(T); - case Triple::MinGW64: + case Triple::MinGW32: case Triple::Cygwin: case Triple::Win32: if (Triple(TT).getEnvironment() == Triple::MachO) diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 48ceb21..2bd60da 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -175,9 +175,7 @@ public: bool isTargetLinux() const { return TargetTriple.getOS() == Triple::Linux; } bool isTargetWindows() const { return TargetTriple.getOS() == Triple::Win32; } - bool isTargetMingw() const { - return TargetTriple.getOS() == Triple::MinGW32 || - TargetTriple.getOS() == Triple::MinGW64; } + bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32; } bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; } bool isTargetCygMing() const { return isTargetMingw() || isTargetCygwin(); diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index f216279..b2a9a5c 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -30,7 +30,6 @@ static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) { case Triple::Darwin: return new X86MCAsmInfoDarwin(TheTriple); case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: if (TheTriple.getEnvironment() == Triple::MachO) @@ -53,7 +52,6 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, case Triple::Darwin: return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: if (TheTriple.getEnvironment() == Triple::MachO) diff --git a/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll b/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll index 9d06a9e..98b1e0e 100644 --- a/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll +++ b/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-mingw32 < %s | FileCheck %s ; CHECK-NOT: -{{[1-9][0-9]*}}(%rsp) define x86_fp80 @a(i64 %x) nounwind readnone { diff --git a/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll b/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll index 6e8d9a9..12bd285 100644 --- a/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll +++ b/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-mingw32 < %s | FileCheck %s ; CHECK: subq $40, %rsp ; CHECK: movaps %xmm8, (%rsp) ; CHECK: movaps %xmm7, 16(%rsp) --------------1.7.1.GIT-- -------------- next part -------------- From 641db868ffb08e4a49ea8207405e385dcd2d42df Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 16 Feb 2011 11:01:30 +0900 Subject: [PATCH 2/2] lib/Frontend/InitHeaderSearch.cpp: Add mingw-w64's include paths. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.7.1.GIT" This is a multi-part message in MIME format. --------------1.7.1.GIT Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- lib/Frontend/InitHeaderSearch.cpp | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) --------------1.7.1.GIT Content-Type: text/x-patch; name="0002-lib-Frontend-InitHeaderSearch.cpp-Add-mingw-w64-.patch.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0002-lib-Frontend-InitHeaderSearch.cpp-Add-mingw-w64-.patch.txt" diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp index 39f30e5..cc9bb0c 100644 --- a/lib/Frontend/InitHeaderSearch.cpp +++ b/lib/Frontend/InitHeaderSearch.cpp @@ -566,6 +566,14 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4"); break; case llvm::Triple::MinGW32: + // mingw-w64-20110207 + AddPath("c:/MinGW/include/c++/4.5.3", System, true, false, false); + AddPath("c:/MinGW/include/c++/4.5.3/x86_64-w64-mingw32", System, true, false, false); + AddPath("c:/MinGW/include/c++/4.5.3/backward", System, true, false, false); + // mingw-w64-20101129 + AddPath("c:/MinGW/include/c++/4.5.2", System, true, false, false); + AddPath("c:/MinGW/include/c++/4.5.2/x86_64-w64-mingw32", System, true, false, false); + AddPath("c:/MinGW/include/c++/4.5.2/backward", System, true, false, false); // Try gcc 4.5.0 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0"); // Try gcc 4.4.0 --------------1.7.1.GIT-- From geek4civic at gmail.com Tue Feb 15 22:12:49 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Wed, 16 Feb 2011 13:12:49 +0900 Subject: [llvm-commits] [PATCH][llvm][clang] Triple::{MinGW32|MinGW64} => Triple::MinGW In-Reply-To: <4D5A4C14.7010603@free.fr> References: <4D5A4924.6090407@free.fr> <4D5A4C14.7010603@free.fr> Message-ID: Duncan, Thank you to give me comments! On Tue, Feb 15, 2011 at 6:49 PM, Duncan Sands wrote: > if I understand right no project understands mingw64 except for LLVM, so you > are > going to remove mingw64. ?Also, other projects use "w64" rather than "pc" to > say > ... well, I'm not sure what this says, but presumably to say whatever > mingw64 > was trying to say; so you plan to teach LLVM about w64. ?Is that right? For now, I don't think recognition of -w64- would be needed to clang and llvm. I would propose to tweak -w64- to llvm::Triple if I needed one. ...Takumi From echristo at apple.com Tue Feb 15 22:50:12 2011 From: echristo at apple.com (Eric Christopher) Date: Wed, 16 Feb 2011 04:50:12 -0000 Subject: [llvm-commits] [llvm] r125651 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <20110216045012.945012A6C12C@llvm.org> Author: echristo Date: Tue Feb 15 22:50:12 2011 New Revision: 125651 URL: http://llvm.org/viewvc/llvm-project?rev=125651&view=rev Log: Refactor zero folding slightly. Clean up todo. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=125651&r1=125650&r2=125651&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Feb 15 22:50:12 2011 @@ -1518,6 +1518,22 @@ return SDValue(); } +// Since it may not be valid to emit a fold to zero for vector initializers +// check if we can before folding. +static SDValue tryFoldToZero(DebugLoc DL, const TargetLowering &TLI, EVT VT, + SelectionDAG &DAG, bool LegalOperations) { + if (!VT.isVector()) { + return DAG.getConstant(0, VT); + } else if (!LegalOperations || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)) { + // Produce a vector of zeros. + SDValue El = DAG.getConstant(0, VT.getVectorElementType()); + std::vector Ops(VT.getVectorNumElements(), El); + return DAG.getNode(ISD::BUILD_VECTOR, DL, VT, + &Ops[0], Ops.size()); + } + return SDValue(); +} + SDValue DAGCombiner::visitSUB(SDNode *N) { SDValue N0 = N->getOperand(0); SDValue N1 = N->getOperand(1); @@ -1533,17 +1549,8 @@ // fold (sub x, x) -> 0 // FIXME: Refactor this and xor and other similar operations together. - if (N0 == N1) { - if (!VT.isVector()) { - return DAG.getConstant(0, VT); - } else if (!LegalOperations || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)){ - // Produce a vector of zeros. - SDValue El = DAG.getConstant(0, VT.getVectorElementType()); - std::vector Ops(VT.getVectorNumElements(), El); - return DAG.getNode(ISD::BUILD_VECTOR, N->getDebugLoc(), VT, - &Ops[0], Ops.size()); - } - } + if (N0 == N1) + return tryFoldToZero(N->getDebugLoc(), TLI, VT, DAG, LegalOperations); // fold (sub c1, c2) -> c1-c2 if (N0C && N1C) return DAG.FoldConstantArithmetic(ISD::SUB, VT, N0C, N1C); @@ -2843,17 +2850,8 @@ N01C->getAPIntValue(), VT)); } // fold (xor x, x) -> 0 - if (N0 == N1) { - if (!VT.isVector()) { - return DAG.getConstant(0, VT); - } else if (!LegalOperations || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)){ - // Produce a vector of zeros. - SDValue El = DAG.getConstant(0, VT.getVectorElementType()); - std::vector Ops(VT.getVectorNumElements(), El); - return DAG.getNode(ISD::BUILD_VECTOR, N->getDebugLoc(), VT, - &Ops[0], Ops.size()); - } - } + if (N0 == N1) + return tryFoldToZero(N->getDebugLoc(), TLI, VT, DAG, LegalOperations); // Simplify: xor (op x...), (op y...) -> (op (xor x, y)) if (N0.getOpcode() == N1.getOpcode()) { From eli.friedman at gmail.com Wed Feb 16 01:17:44 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 16 Feb 2011 07:17:44 -0000 Subject: [llvm-commits] [llvm] r125658 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110216071744.DB3342A6C12C@llvm.org> Author: efriedma Date: Wed Feb 16 01:17:44 2011 New Revision: 125658 URL: http://llvm.org/viewvc/llvm-project?rev=125658&view=rev Log: Update README entry. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125658&r1=125657&r2=125658&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 16 01:17:44 2011 @@ -1783,13 +1783,12 @@ } Generated code: - addq %rcx, %rdx - movl $0, %eax - adcq $0, %rax - addq %r8, %rax - movq %rax, (%rdi) - movq %rdx, (%rsi) - ret + addq %rcx, %rdx + sbbq %rax, %rax + subq %rax, %r8 + movq %r8, (%rdi) + movq %rdx, (%rsi) + ret Expected code: addq %rcx, %rdx @@ -1798,12 +1797,6 @@ movq %rdx, (%rsi) ret -The generated SelectionDAG has an ADD of an ADDE, where both operands of the -ADDE are zero. Replacing one of the operands of the ADDE with the other operand -of the ADD, and replacing the ADD with the ADDE, should give the desired result. - -(That said, we are doing a lot better than gcc on this testcase. :) ) - //===---------------------------------------------------------------------===// Switch lowering generates less than ideal code for the following switch: From eli.friedman at gmail.com Wed Feb 16 01:18:19 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 16 Feb 2011 07:18:19 -0000 Subject: [llvm-commits] [llvm] r125659 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110216071819.0B7792A6C12C@llvm.org> Author: efriedma Date: Wed Feb 16 01:18:18 2011 New Revision: 125659 URL: http://llvm.org/viewvc/llvm-project?rev=125659&view=rev Log: Remove outdated README entry. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125659&r1=125658&r2=125659&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 16 01:18:18 2011 @@ -1840,23 +1840,7 @@ ret .LBB0_2: jmp foo # TAILCALL -//===---------------------------------------------------------------------===// -Given a branch where the two target blocks are identical ("ret i32 %b" in -both), simplifycfg will simplify them away. But not so for a switch statement: - -define i32 @f(i32 %a, i32 %b) nounwind readnone { -entry: - switch i32 %a, label %bb3 [ - i32 4, label %bb - i32 6, label %bb - ] -bb: ; preds = %entry, %entry - ret i32 %b - -bb3: ; preds = %entry - ret i32 %b -} //===---------------------------------------------------------------------===// We compile this: From eli.friedman at gmail.com Wed Feb 16 01:41:19 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 16 Feb 2011 07:41:19 -0000 Subject: [llvm-commits] [llvm] r125660 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110216074119.D09682A6C12C@llvm.org> Author: efriedma Date: Wed Feb 16 01:41:19 2011 New Revision: 125660 URL: http://llvm.org/viewvc/llvm-project?rev=125660&view=rev Log: Remove outdated README entry. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125660&r1=125659&r2=125660&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 16 01:41:19 2011 @@ -733,18 +733,6 @@ //===---------------------------------------------------------------------===// -We miss some instcombines for stuff like this: -void bar (void); -void foo (unsigned int a) { - /* This one is equivalent to a >= (3 << 2). */ - if ((a >> 2) >= 3) - bar (); -} - -A few other related ones are in GCC PR14753. - -//===---------------------------------------------------------------------===// - Divisibility by constant can be simplified (according to GCC PR12849) from being a mulhi to being a mul lo (cheaper). Testcase: From rafael.espindola at gmail.com Wed Feb 16 05:19:44 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 16 Feb 2011 11:19:44 -0000 Subject: [llvm-commits] [llvm] r125663 - /llvm/trunk/tools/gold/gold-plugin.cpp Message-ID: <20110216111944.5EE1D2A6C12C@llvm.org> Author: rafael Date: Wed Feb 16 05:19:44 2011 New Revision: 125663 URL: http://llvm.org/viewvc/llvm-project?rev=125663&view=rev Log: Add a debug obj-path option to make it easy to keep the .o produce by LTO. Modified: llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=125663&r1=125662&r2=125663&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Feb 16 05:19:44 2011 @@ -72,6 +72,7 @@ static bool generate_api_file = false; static generate_bc generate_bc_file = BC_NO; static std::string bc_path; + static std::string obj_path; static std::string as_path; static std::vector as_args; static std::vector pass_through; @@ -112,6 +113,8 @@ pass_through.push_back(item.str()); } else if (opt.startswith("mtriple=")) { triple = opt.substr(strlen("mtriple=")); + } else if (opt.startswith("obj-path=")) { + obj_path = opt.substr(strlen("obj-path=")); } else if (opt == "emit-llvm") { generate_bc_file = BC_ONLY; } else if (opt == "also-emit-llvm") { @@ -471,23 +474,29 @@ std::string ErrMsg; - sys::Path uniqueObjPath("/tmp/llvmgold.o"); - if (uniqueObjPath.createTemporaryFileOnDisk(true, &ErrMsg)) { - (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); - return LDPS_ERR; - } - tool_output_file objFile(uniqueObjPath.c_str(), ErrMsg, - raw_fd_ostream::F_Binary); - if (!ErrMsg.empty()) { - (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); - return LDPS_ERR; + const char *objPath; + if (!options::obj_path.empty()) { + objPath = options::obj_path.c_str(); + } else { + sys::Path uniqueObjPath("/tmp/llvmgold.o"); + if (uniqueObjPath.createTemporaryFileOnDisk(true, &ErrMsg)) { + (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); + return LDPS_ERR; + } + objPath = uniqueObjPath.c_str(); } + tool_output_file objFile(objPath, ErrMsg, + raw_fd_ostream::F_Binary); + if (!ErrMsg.empty()) { + (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); + return LDPS_ERR; + } objFile.os().write(buffer, bufsize); objFile.os().close(); if (objFile.os().has_error()) { (*message)(LDPL_ERROR, "Error writing output file '%s'", - uniqueObjPath.c_str()); + objPath); objFile.os().clear_error(); return LDPS_ERR; } @@ -495,9 +504,9 @@ lto_codegen_dispose(cg); - if ((*add_input_file)(uniqueObjPath.c_str()) != LDPS_OK) { + if ((*add_input_file)(objPath) != LDPS_OK) { (*message)(LDPL_ERROR, "Unable to add .o file to the link."); - (*message)(LDPL_ERROR, "File left behind in: %s", uniqueObjPath.c_str()); + (*message)(LDPL_ERROR, "File left behind in: %s", objPath); return LDPS_ERR; } @@ -525,7 +534,8 @@ } } - Cleanup.push_back(uniqueObjPath); + if (options::obj_path.empty()) + Cleanup.push_back(sys::Path(objPath)); return LDPS_OK; } From dmalyshev at accesssoftek.com Wed Feb 16 10:21:54 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Wed, 16 Feb 2011 08:21:54 -0800 Subject: [llvm-commits] Fix floating point numbers in tests on MinGW In-Reply-To: References: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA26@mail.accesssoftek.com> Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE17DD2905F9@mail.accesssoftek.com> Hello, A week passed and nobody else replyed yet, so it seems we are the only two who cares of this issue. :) Defining PRINTF_EXPONENT_DIGITS env is the suggested way to make MinGW ANSI/POSIX compatible. This is not only about the case we are discussing, but in general, I'd like to have explicitly defined compatibility mode for all the tests running on MinGW. I understand that it does not fix issues with scientific notation in general. It seems that you need to follow up with your patch, since you feel strong for it. This patch does not block you or affect you on any way. Could you or somebody else apply my patch, please? I have attached it to this e-mail for convenience. Thank you, Danil -------------- next part -------------- A non-text attachment was scrubbed... Name: fix-scientific-02.diff Type: application/octet-stream Size: 519 bytes Desc: fix-scientific-02.diff Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110216/c65a53df/attachment.obj From stuart at apple.com Wed Feb 16 10:23:55 2011 From: stuart at apple.com (Stuart Hastings) Date: Wed, 16 Feb 2011 16:23:55 -0000 Subject: [llvm-commits] [llvm] r125665 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/Alpha/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ lib/Target/XCore/ Message-ID: <20110216162355.8C0D32A6C12C@llvm.org> Author: stuart Date: Wed Feb 16 10:23:55 2011 New Revision: 125665 URL: http://llvm.org/viewvc/llvm-project?rev=125665&view=rev Log: Swap VT and DebugLoc operands of getExtLoad() for consistency with other getNode() methods. Radar 9002173. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Feb 16 10:23:55 2011 @@ -634,7 +634,7 @@ MachinePointerInfo PtrInfo, bool isVolatile, bool isNonTemporal, unsigned Alignment, const MDNode *TBAAInfo = 0); - SDValue getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl, + SDValue getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, bool isVolatile, bool isNonTemporal, unsigned Alignment, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 16 10:23:55 2011 @@ -674,7 +674,7 @@ : ISD::EXTLOAD) : LD->getExtensionType(); Replace = true; - return DAG.getExtLoad(ExtType, PVT, dl, + return DAG.getExtLoad(ExtType, dl, PVT, LD->getChain(), LD->getBasePtr(), LD->getPointerInfo(), MemVT, LD->isVolatile(), @@ -897,7 +897,7 @@ ? (TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT) ? ISD::ZEXTLOAD : ISD::EXTLOAD) : LD->getExtensionType(); - SDValue NewLD = DAG.getExtLoad(ExtType, PVT, dl, + SDValue NewLD = DAG.getExtLoad(ExtType, dl, PVT, LD->getChain(), LD->getBasePtr(), LD->getPointerInfo(), MemVT, LD->isVolatile(), @@ -2327,7 +2327,7 @@ BitWidth - MemVT.getScalarType().getSizeInBits())) && ((!LegalOperations && !LN0->isVolatile()) || TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT))) { - SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N0.getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N0.getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), MemVT, LN0->isVolatile(), LN0->isNonTemporal(), @@ -2349,7 +2349,7 @@ BitWidth - MemVT.getScalarType().getSizeInBits())) && ((!LegalOperations && !LN0->isVolatile()) || TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT))) { - SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N0.getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N0.getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), MemVT, @@ -2383,7 +2383,7 @@ EVT LoadResultTy = HasAnyExt ? LN0->getValueType(0) : VT; SDValue NewLoad = - DAG.getExtLoad(ISD::ZEXTLOAD, LoadResultTy, LN0->getDebugLoc(), + DAG.getExtLoad(ISD::ZEXTLOAD, LN0->getDebugLoc(), LoadResultTy, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), ExtVT, LN0->isVolatile(), LN0->isNonTemporal(), @@ -2419,7 +2419,7 @@ EVT LoadResultTy = HasAnyExt ? LN0->getValueType(0) : VT; SDValue Load = - DAG.getExtLoad(ISD::ZEXTLOAD, LoadResultTy, LN0->getDebugLoc(), + DAG.getExtLoad(ISD::ZEXTLOAD, LN0->getDebugLoc(), LoadResultTy, LN0->getChain(), NewPtr, LN0->getPointerInfo(), ExtVT, LN0->isVolatile(), LN0->isNonTemporal(), @@ -3694,7 +3694,7 @@ DoXform = ExtendUsesToFormExtLoad(N, N0, ISD::SIGN_EXTEND, SetCCs, TLI); if (DoXform) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), N0.getValueType(), @@ -3737,7 +3737,7 @@ EVT MemVT = LN0->getMemoryVT(); if ((!LegalOperations && !LN0->isVolatile()) || TLI.isLoadExtLegal(ISD::SEXTLOAD, MemVT)) { - SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), MemVT, @@ -3896,7 +3896,7 @@ DoXform = ExtendUsesToFormExtLoad(N, N0, ISD::ZERO_EXTEND, SetCCs, TLI); if (DoXform) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), N0.getValueType(), @@ -3939,7 +3939,7 @@ EVT MemVT = LN0->getMemoryVT(); if ((!LegalOperations && !LN0->isVolatile()) || TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT)) { - SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), MemVT, @@ -4103,7 +4103,7 @@ DoXform = ExtendUsesToFormExtLoad(N, N0, ISD::ANY_EXTEND, SetCCs, TLI); if (DoXform) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), N0.getValueType(), @@ -4146,9 +4146,8 @@ N0.hasOneUse()) { LoadSDNode *LN0 = cast(N0); EVT MemVT = LN0->getMemoryVT(); - SDValue ExtLoad = DAG.getExtLoad(LN0->getExtensionType(), VT, - N->getDebugLoc(), - LN0->getChain(), LN0->getBasePtr(), + SDValue ExtLoad = DAG.getExtLoad(LN0->getExtensionType(), N->getDebugLoc(), + VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), MemVT, LN0->isVolatile(), LN0->isNonTemporal(), LN0->getAlignment()); @@ -4350,7 +4349,7 @@ LN0->getPointerInfo().getWithOffset(PtrOff), LN0->isVolatile(), LN0->isNonTemporal(), NewAlign); else - Load = DAG.getExtLoad(ExtType, VT, N0.getDebugLoc(), LN0->getChain(),NewPtr, + Load = DAG.getExtLoad(ExtType, N0.getDebugLoc(), VT, LN0->getChain(),NewPtr, LN0->getPointerInfo().getWithOffset(PtrOff), ExtVT, LN0->isVolatile(), LN0->isNonTemporal(), NewAlign); @@ -4444,7 +4443,7 @@ ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::SEXTLOAD, EVT))) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), EVT, @@ -4461,7 +4460,7 @@ ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::SEXTLOAD, EVT))) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), EVT, @@ -5233,7 +5232,7 @@ ((!LegalOperations && !cast(N0)->isVolatile()) || TLI.isLoadExtLegal(ISD::EXTLOAD, N0.getValueType()))) { LoadSDNode *LN0 = cast(N0); - SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, VT, N->getDebugLoc(), + SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, N->getDebugLoc(), VT, LN0->getChain(), LN0->getBasePtr(), LN0->getPointerInfo(), N0.getValueType(), @@ -5821,8 +5820,8 @@ if (OptLevel != CodeGenOpt::None && LD->isUnindexed()) { if (unsigned Align = DAG.InferPtrAlignment(Ptr)) { if (Align > LD->getAlignment()) - return DAG.getExtLoad(LD->getExtensionType(), LD->getValueType(0), - N->getDebugLoc(), + return DAG.getExtLoad(LD->getExtensionType(), N->getDebugLoc(), + LD->getValueType(0), Chain, Ptr, LD->getPointerInfo(), LD->getMemoryVT(), LD->isVolatile(), LD->isNonTemporal(), Align); @@ -5844,8 +5843,8 @@ LD->isVolatile(), LD->isNonTemporal(), LD->getAlignment()); } else { - ReplLoad = DAG.getExtLoad(LD->getExtensionType(), LD->getValueType(0), - LD->getDebugLoc(), + ReplLoad = DAG.getExtLoad(LD->getExtensionType(), LD->getDebugLoc(), + LD->getValueType(0), BetterChain, Ptr, LD->getPointerInfo(), LD->getMemoryVT(), LD->isVolatile(), @@ -6970,8 +6969,8 @@ } else { Load = DAG.getExtLoad(LLD->getExtensionType() == ISD::EXTLOAD ? RLD->getExtensionType() : LLD->getExtensionType(), - TheSelect->getValueType(0), TheSelect->getDebugLoc(), + TheSelect->getValueType(0), // FIXME: Discards pointer info. LLD->getChain(), Addr, MachinePointerInfo(), LLD->getMemoryVT(), LLD->isVolatile(), Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 16 10:23:55 2011 @@ -394,7 +394,7 @@ SDValue CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy()); unsigned Alignment = cast(CPIdx)->getAlignment(); if (Extend) - return DAG.getExtLoad(ISD::EXTLOAD, OrigVT, dl, + return DAG.getExtLoad(ISD::EXTLOAD, dl, OrigVT, DAG.getEntryNode(), CPIdx, MachinePointerInfo::getConstantPool(), VT, false, false, Alignment); @@ -471,7 +471,7 @@ 8 * (StoredBytes - Offset)); // Load from the stack slot. - SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, RegVT, dl, Store, StackPtr, + SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Store, StackPtr, MachinePointerInfo(), MemVT, false, false, 0); @@ -575,7 +575,7 @@ // The last copy may be partial. Do an extending load. EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), 8 * (LoadedBytes - Offset)); - SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, RegVT, dl, Chain, Ptr, + SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Chain, Ptr, LD->getPointerInfo().getWithOffset(Offset), MemVT, LD->isVolatile(), LD->isNonTemporal(), @@ -592,7 +592,7 @@ Stores.size()); // Finally, perform the original load only redirected to the stack slot. - Load = DAG.getExtLoad(LD->getExtensionType(), VT, dl, TF, StackBase, + Load = DAG.getExtLoad(LD->getExtensionType(), dl, VT, TF, StackBase, MachinePointerInfo(), LoadedVT, false, false, 0); // Callers expect a MERGE_VALUES node. @@ -620,22 +620,22 @@ // Load the value in two parts SDValue Lo, Hi; if (TLI.isLittleEndian()) { - Lo = DAG.getExtLoad(ISD::ZEXTLOAD, VT, dl, Chain, Ptr, LD->getPointerInfo(), + Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr, LD->getPointerInfo(), NewLoadedVT, LD->isVolatile(), LD->isNonTemporal(), Alignment); Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, DAG.getConstant(IncrementSize, TLI.getPointerTy())); - Hi = DAG.getExtLoad(HiExtType, VT, dl, Chain, Ptr, + Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr, LD->getPointerInfo().getWithOffset(IncrementSize), NewLoadedVT, LD->isVolatile(), LD->isNonTemporal(), MinAlign(Alignment,IncrementSize)); } else { - Hi = DAG.getExtLoad(HiExtType, VT, dl, Chain, Ptr, LD->getPointerInfo(), + Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr, LD->getPointerInfo(), NewLoadedVT, LD->isVolatile(), LD->isNonTemporal(), Alignment); Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, DAG.getConstant(IncrementSize, TLI.getPointerTy())); - Lo = DAG.getExtLoad(ISD::ZEXTLOAD, VT, dl, Chain, Ptr, + Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr, LD->getPointerInfo().getWithOffset(IncrementSize), NewLoadedVT, LD->isVolatile(), LD->isNonTemporal(), MinAlign(Alignment,IncrementSize)); @@ -1204,7 +1204,7 @@ ISD::LoadExtType NewExtType = ExtType == ISD::ZEXTLOAD ? ISD::ZEXTLOAD : ISD::EXTLOAD; - Result = DAG.getExtLoad(NewExtType, Node->getValueType(0), dl, + Result = DAG.getExtLoad(NewExtType, dl, Node->getValueType(0), Tmp1, Tmp2, LD->getPointerInfo(), NVT, isVolatile, isNonTemporal, Alignment); @@ -1240,7 +1240,7 @@ if (TLI.isLittleEndian()) { // EXTLOAD:i24 -> ZEXTLOAD:i16 | (shl EXTLOAD at +2:i8, 16) // Load the bottom RoundWidth bits. - Lo = DAG.getExtLoad(ISD::ZEXTLOAD, Node->getValueType(0), dl, + Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, Node->getValueType(0), Tmp1, Tmp2, LD->getPointerInfo(), RoundVT, isVolatile, isNonTemporal, Alignment); @@ -1249,7 +1249,7 @@ IncrementSize = RoundWidth / 8; Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2, DAG.getIntPtrConstant(IncrementSize)); - Hi = DAG.getExtLoad(ExtType, Node->getValueType(0), dl, Tmp1, Tmp2, + Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Tmp1, Tmp2, LD->getPointerInfo().getWithOffset(IncrementSize), ExtraVT, isVolatile, isNonTemporal, MinAlign(Alignment, IncrementSize)); @@ -1269,7 +1269,7 @@ // Big endian - avoid unaligned loads. // EXTLOAD:i24 -> (shl EXTLOAD:i16, 8) | ZEXTLOAD at +2:i8 // Load the top RoundWidth bits. - Hi = DAG.getExtLoad(ExtType, Node->getValueType(0), dl, Tmp1, Tmp2, + Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Tmp1, Tmp2, LD->getPointerInfo(), RoundVT, isVolatile, isNonTemporal, Alignment); @@ -1278,7 +1278,7 @@ Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2, DAG.getIntPtrConstant(IncrementSize)); Lo = DAG.getExtLoad(ISD::ZEXTLOAD, - Node->getValueType(0), dl, Tmp1, Tmp2, + dl, Node->getValueType(0), Tmp1, Tmp2, LD->getPointerInfo().getWithOffset(IncrementSize), ExtraVT, isVolatile, isNonTemporal, MinAlign(Alignment, IncrementSize)); @@ -1365,7 +1365,7 @@ "EXTLOAD should always be supported!"); // Turn the unsupported load into an EXTLOAD followed by an explicit // zero/sign extend inreg. - Result = DAG.getExtLoad(ISD::EXTLOAD, Node->getValueType(0), dl, + Result = DAG.getExtLoad(ISD::EXTLOAD, dl, Node->getValueType(0), Tmp1, Tmp2, LD->getPointerInfo(), SrcVT, LD->isVolatile(), LD->isNonTemporal(), LD->getAlignment()); @@ -1580,7 +1580,7 @@ if (Op.getValueType().isVector()) return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr,MachinePointerInfo(), false, false, 0); - return DAG.getExtLoad(ISD::EXTLOAD, Op.getValueType(), dl, Ch, StackPtr, + return DAG.getExtLoad(ISD::EXTLOAD, dl, Op.getValueType(), Ch, StackPtr, MachinePointerInfo(), Vec.getValueType().getVectorElementType(), false, false, 0); @@ -1861,7 +1861,7 @@ false, false, DestAlign); assert(SlotSize < DestSize && "Unknown extension!"); - return DAG.getExtLoad(ISD::EXTLOAD, DestVT, dl, Store, FIPtr, + return DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT, Store, FIPtr, PtrInfo, SlotVT, false, false, DestAlign); } @@ -2288,7 +2288,7 @@ false, false, Alignment); else { FudgeInReg = - LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, DestVT, dl, + LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT, DAG.getEntryNode(), CPIdx, MachinePointerInfo::getConstantPool(), MVT::f32, false, false, Alignment)); @@ -3318,7 +3318,7 @@ SDValue Addr = DAG.getNode(ISD::ADD, dl, PTy, Index, Table); EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), EntrySize * 8); - SDValue LD = DAG.getExtLoad(ISD::SEXTLOAD, PTy, dl, Chain, Addr, + SDValue LD = DAG.getExtLoad(ISD::SEXTLOAD, dl, PTy, Chain, Addr, MachinePointerInfo::getJumpTable(), MemVT, false, false, 0); Addr = LD; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Feb 16 10:23:55 2011 @@ -1110,7 +1110,7 @@ assert(NVT.isByteSized() && "Expanded type not byte sized!"); assert(LD->getMemoryVT().bitsLE(NVT) && "Float type not round?"); - Hi = DAG.getExtLoad(LD->getExtensionType(), NVT, dl, Chain, Ptr, + Hi = DAG.getExtLoad(LD->getExtensionType(), dl, NVT, Chain, Ptr, LD->getPointerInfo(), LD->getMemoryVT(), LD->isVolatile(), LD->isNonTemporal(), LD->getAlignment()); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Feb 16 10:23:55 2011 @@ -370,7 +370,7 @@ ISD::LoadExtType ExtType = ISD::isNON_EXTLoad(N) ? ISD::EXTLOAD : N->getExtensionType(); DebugLoc dl = N->getDebugLoc(); - SDValue Res = DAG.getExtLoad(ExtType, NVT, dl, N->getChain(), N->getBasePtr(), + SDValue Res = DAG.getExtLoad(ExtType, dl, NVT, N->getChain(), N->getBasePtr(), N->getPointerInfo(), N->getMemoryVT(), N->isVolatile(), N->isNonTemporal(), N->getAlignment()); @@ -1682,7 +1682,7 @@ if (N->getMemoryVT().bitsLE(NVT)) { EVT MemVT = N->getMemoryVT(); - Lo = DAG.getExtLoad(ExtType, NVT, dl, Ch, Ptr, N->getPointerInfo(), + Lo = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(), MemVT, isVolatile, isNonTemporal, Alignment); // Remember the chain. @@ -1715,7 +1715,7 @@ unsigned IncrementSize = NVT.getSizeInBits()/8; Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, DAG.getIntPtrConstant(IncrementSize)); - Hi = DAG.getExtLoad(ExtType, NVT, dl, Ch, Ptr, + Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo().getWithOffset(IncrementSize), NEVT, isVolatile, isNonTemporal, MinAlign(Alignment, IncrementSize)); @@ -1733,7 +1733,7 @@ unsigned ExcessBits = (EBytes - IncrementSize)*8; // Load both the high bits and maybe some of the low bits. - Hi = DAG.getExtLoad(ExtType, NVT, dl, Ch, Ptr, N->getPointerInfo(), + Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(), EVT::getIntegerVT(*DAG.getContext(), MemVT.getSizeInBits() - ExcessBits), isVolatile, isNonTemporal, Alignment); @@ -1742,7 +1742,7 @@ Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, DAG.getIntPtrConstant(IncrementSize)); // Load the rest of the low bits. - Lo = DAG.getExtLoad(ISD::ZEXTLOAD, NVT, dl, Ch, Ptr, + Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, NVT, Ch, Ptr, N->getPointerInfo().getWithOffset(IncrementSize), EVT::getIntegerVT(*DAG.getContext(), ExcessBits), isVolatile, isNonTemporal, @@ -2632,7 +2632,7 @@ // Load the value out, extending it from f32 to the destination float type. // FIXME: Avoid the extend by constructing the right constant pool? - SDValue Fudge = DAG.getExtLoad(ISD::EXTLOAD, DstVT, dl, DAG.getEntryNode(), + SDValue Fudge = DAG.getExtLoad(ISD::EXTLOAD, dl, DstVT, DAG.getEntryNode(), FudgePtr, MachinePointerInfo::getConstantPool(), MVT::f32, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Wed Feb 16 10:23:55 2011 @@ -1103,7 +1103,7 @@ // Load back the required element. StackPtr = GetVectorElementPointer(StackPtr, EltVT, Idx); - return DAG.getExtLoad(ISD::EXTLOAD, N->getValueType(0), dl, Store, StackPtr, + return DAG.getExtLoad(ISD::EXTLOAD, dl, N->getValueType(0), Store, StackPtr, MachinePointerInfo(), EltVT, false, false, 0); } @@ -2387,7 +2387,7 @@ unsigned WidenNumElts = WidenVT.getVectorNumElements(); SmallVector Ops(WidenNumElts); unsigned Increment = LdEltVT.getSizeInBits() / 8; - Ops[0] = DAG.getExtLoad(ExtType, EltVT, dl, Chain, BasePtr, + Ops[0] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, BasePtr, LD->getPointerInfo(), LdEltVT, isVolatile, isNonTemporal, Align); LdChain.push_back(Ops[0].getValue(1)); @@ -2395,7 +2395,7 @@ for (i=1; i < NumElts; ++i, Offset += Increment) { SDValue NewBasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(), BasePtr, DAG.getIntPtrConstant(Offset)); - Ops[i] = DAG.getExtLoad(ExtType, EltVT, dl, Chain, NewBasePtr, + Ops[i] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, NewBasePtr, LD->getPointerInfo().getWithOffset(Offset), LdEltVT, isVolatile, isNonTemporal, Align); LdChain.push_back(Ops[i].getValue(1)); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Feb 16 10:23:55 2011 @@ -3462,7 +3462,7 @@ // FIXME does the case above also need this? EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT); assert(NVT.bitsGE(VT)); - Value = DAG.getExtLoad(ISD::EXTLOAD, NVT, dl, Chain, + Value = DAG.getExtLoad(ISD::EXTLOAD, dl, NVT, Chain, getMemBasePlusOffset(Src, SrcOff, DAG), SrcPtrInfo.getWithOffset(SrcOff), VT, isVol, false, MinAlign(SrcAlign, SrcOff)); @@ -4113,7 +4113,7 @@ PtrInfo, VT, isVolatile, isNonTemporal, Alignment, TBAAInfo); } -SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, EVT VT, DebugLoc dl, +SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, EVT MemVT, bool isVolatile, bool isNonTemporal, Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Wed Feb 16 10:23:55 2011 @@ -542,7 +542,7 @@ false, false, 0); SDValue Tmp = DAG.getNode(ISD::ADD, dl, MVT::i64, VAListP, DAG.getConstant(8, MVT::i64)); - SDValue Offset = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, dl, Base.getValue(1), + SDValue Offset = DAG.getExtLoad(ISD::SEXTLOAD, dl, MVT::i64, Base.getValue(1), Tmp, MachinePointerInfo(), MVT::i32, false, false, 0); DataPtr = DAG.getNode(ISD::ADD, dl, MVT::i64, Base, Offset); @@ -709,7 +709,7 @@ SDValue Result; if (Op.getValueType() == MVT::i32) - Result = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, dl, Chain, DataPtr, + Result = DAG.getExtLoad(ISD::SEXTLOAD, dl, MVT::i64, Chain, DataPtr, MachinePointerInfo(), MVT::i32, false, false, 0); else Result = DAG.getLoad(Op.getValueType(), dl, Chain, DataPtr, @@ -732,7 +732,7 @@ false, false, 0); SDValue NP = DAG.getNode(ISD::ADD, dl, MVT::i64, SrcP, DAG.getConstant(8, MVT::i64)); - Val = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, dl, Result, + Val = DAG.getExtLoad(ISD::SEXTLOAD, dl, MVT::i64, Result, NP, MachinePointerInfo(), MVT::i32, false, false, 0); SDValue NPD = DAG.getNode(ISD::ADD, dl, MVT::i64, DestP, DAG.getConstant(8, MVT::i64)); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Feb 16 10:23:55 2011 @@ -3050,7 +3050,7 @@ // Everything else is passed left-justified. EVT VT = (Size==1) ? MVT::i8 : MVT::i16; if (GPR_idx != NumGPRs) { - SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, PtrVT, dl, Chain, Arg, + SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, PtrVT, Chain, Arg, MachinePointerInfo(), VT, false, false, 0); MemOpChains.push_back(Load.getValue(1)); Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Wed Feb 16 10:23:55 2011 @@ -274,7 +274,7 @@ unsigned Offset = 4-std::max(1U, VA.getValVT().getSizeInBits()/8); FIPtr = DAG.getNode(ISD::ADD, dl, MVT::i32, FIPtr, DAG.getConstant(Offset, MVT::i32)); - Load = DAG.getExtLoad(LoadOp, MVT::i32, dl, Chain, FIPtr, + Load = DAG.getExtLoad(LoadOp, dl, MVT::i32, Chain, FIPtr, MachinePointerInfo(), VA.getValVT(), false, false,0); Load = DAG.getNode(ISD::TRUNCATE, dl, VA.getValVT(), Load); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Feb 16 10:23:55 2011 @@ -506,7 +506,7 @@ N->getOperand(0), MemTmp, MachinePointerInfo(), MemVT, false, false, 0); - SDValue Result = CurDAG->getExtLoad(ISD::EXTLOAD, DstVT, dl, Store, MemTmp, + SDValue Result = CurDAG->getExtLoad(ISD::EXTLOAD, dl, DstVT, Store, MemTmp, MachinePointerInfo(), MemVT, false, false, 0); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 16 10:23:55 2011 @@ -6889,7 +6889,7 @@ // Load the value out, extending it from f32 to f80. // FIXME: Avoid the extend by constructing the right constant pool? - SDValue Fudge = DAG.getExtLoad(ISD::EXTLOAD, MVT::f80, dl, DAG.getEntryNode(), + SDValue Fudge = DAG.getExtLoad(ISD::EXTLOAD, dl, MVT::f80, DAG.getEntryNode(), FudgePtr, MachinePointerInfo::getConstantPool(), MVT::f32, false, false, 4); // Extend everything to 80 bits to force it to be done on x87. Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=125665&r1=125664&r2=125665&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Wed Feb 16 10:23:55 2011 @@ -455,12 +455,12 @@ } if (LD->getAlignment() == 2) { - SDValue Low = DAG.getExtLoad(ISD::ZEXTLOAD, MVT::i32, DL, Chain, + SDValue Low = DAG.getExtLoad(ISD::ZEXTLOAD, DL, MVT::i32, Chain, BasePtr, LD->getPointerInfo(), MVT::i16, LD->isVolatile(), LD->isNonTemporal(), 2); SDValue HighAddr = DAG.getNode(ISD::ADD, DL, MVT::i32, BasePtr, DAG.getConstant(2, MVT::i32)); - SDValue High = DAG.getExtLoad(ISD::EXTLOAD, MVT::i32, DL, Chain, + SDValue High = DAG.getExtLoad(ISD::EXTLOAD, DL, MVT::i32, Chain, HighAddr, LD->getPointerInfo().getWithOffset(2), MVT::i16, LD->isVolatile(), From baldrick at free.fr Wed Feb 16 11:09:42 2011 From: baldrick at free.fr (Duncan Sands) Date: Wed, 16 Feb 2011 17:09:42 -0000 Subject: [llvm-commits] [dragonegg] r125666 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <20110216170943.019E52A6C12C@llvm.org> Author: baldrick Date: Wed Feb 16 11:09:42 2011 New Revision: 125666 URL: http://llvm.org/viewvc/llvm-project?rev=125666&view=rev Log: Recent GCC has does an (undocumented) optimization by which it generates "same body aliases" rather than multiple copies of the same function. If the aliasee has "extern inline" semantics then GCC discards it along with all of its aliases after running the inliner. We were creating a function with AvailableExternally linkage for the "extern inline" function and weak aliases for the same body aliases. At LLVM codegen time the aliasee would be discarded, leading to unresolved external references for the aliases. Solve this by arranging for all uses of the aliases to be replaced with the corresponding use of the aliasee, so when the aliasee is discarded in effect so are all the aliases. This fixes the OpenCV version 2.0 build, reported broken by sabaliauskas g. (gs5g08) on the mailing list. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=125666&r1=125665&r2=125666&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Wed Feb 16 11:09:42 2011 @@ -1859,7 +1859,25 @@ if (errorcount || sorrycount) return; // Do not process broken code. - emit_alias(alias->decl, alias->thunk.alias); + // If the target is not "extern inline" then output an ordinary alias. + tree target = alias->thunk.alias; + if (!DECL_EXTERNAL(target)) { + emit_alias(alias->decl, target); + return; + } + + // Same body aliases have the property that if the body of the aliasee is not + // output then neither are the aliases. To arrange this for "extern inline" + // functions, which have AvailableExternally linkage in LLVM, make all users + // of the alias directly use the aliasee instead. + GlobalValue *Alias = cast(DECL_LLVM(alias->decl)); + GlobalValue *Aliasee = cast(DEFINITION_LLVM(target)); + Alias->replaceAllUsesWith(ConstantExpr::getBitCast(Aliasee,Alias->getType())); + changeLLVMConstant(Alias, Aliasee); + Alias->eraseFromParent(); + + // Mark the alias as written so gcc doesn't waste time outputting it. + TREE_ASM_WRITTEN(alias->decl) = 1; } /// emit_file_scope_asm - Emit the specified string as a file-scope inline From grosbach at apple.com Wed Feb 16 11:47:22 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 16 Feb 2011 09:47:22 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110216022506.GA22148@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> Message-ID: <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> On Feb 15, 2011, at 6:25 PM, Joerg Sonnenberger wrote: > On Tue, Feb 15, 2011 at 06:02:10PM -0800, Jim Grosbach wrote: >> Shouldn't something like this, at minimum, be predicated on a target >> enabling it? I doubt this is something all assembly variants want. > > ParseBracketExpr can be made virtual if necessary, but the current > status quo breaks completely legal code on i386. > >> For example, on x86 does Intel vs ATT syntax change whether this is >> supported? What about other targets? Do they want this enabled at all? >> Square brackets often have special meaning (memory references being >> the most common) and this could very easily complicate that. > > AT&T syntax doesn't care about [], I think. Intel syntax is messy as best, > but if it could only need a virtual override. What about other targets? ARM, MIPS, etc.. shouldn't accept bracket-as-parens expressions unless that's part of their documented syntax. I don't know for sure how this fits into the overall asmparser scheme of things (Daniel would be the right person to answer that). I'm just noting that we want to make sure to keep things like this isolated to those targets that want the behavior. For example, the following is not legal ARM assembly and should give a syntax error on the '[' token. add r0, r1, #[_foo - _bar] With these changes, that's not happening anymore. -Jim From joerg at britannica.bec.de Wed Feb 16 12:12:40 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Wed, 16 Feb 2011 19:12:40 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> Message-ID: <20110216181240.GB23037@britannica.bec.de> On Wed, Feb 16, 2011 at 09:47:22AM -0800, Jim Grosbach wrote: > > AT&T syntax doesn't care about [], I think. Intel syntax is messy as best, > > but if it could only need a virtual override. > > What about other targets? ARM, MIPS, etc.. shouldn't accept > bracket-as-parens expressions unless that's part of their documented syntax. Do we really want to repeat the mistakes of GNU as? Having a slightly different assembler syntax on every platforms just sucks. So unless there is a very good reason, I would strongly discourage having such diversity. Joerg From grosbach at apple.com Wed Feb 16 12:17:53 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 16 Feb 2011 10:17:53 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <20110216181240.GB23037@britannica.bec.de> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> Message-ID: On Feb 16, 2011, at 10:12 AM, Joerg Sonnenberger wrote: > On Wed, Feb 16, 2011 at 09:47:22AM -0800, Jim Grosbach wrote: >>> AT&T syntax doesn't care about [], I think. Intel syntax is messy as best, >>> but if it could only need a virtual override. >> >> What about other targets? ARM, MIPS, etc.. shouldn't accept >> bracket-as-parens expressions unless that's part of their documented syntax. > > Do we really want to repeat the mistakes of GNU as? Having a slightly > different assembler syntax on every platforms just sucks. So unless > there is a very good reason, I would strongly discourage having such > diversity. That's not a choice that's up to us. We're not deciding what the syntax is. We're supporting existing (hopefully documented) syntax. -Jim From rafael.espindola at gmail.com Wed Feb 16 12:28:23 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Wed, 16 Feb 2011 13:28:23 -0500 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> Message-ID: <4D5C1747.9030404@gmail.com> > That's not a choice that's up to us. We're not deciding what the syntax is. We're supporting existing (hopefully documented) syntax. So we need to support what gas does, but we can support a superset of it when we find some advantaged in doing so. Is there a case where handling [] changes the meaning of a valid asm file or we now just accept more code then gas does? > -Jim Cheers, Rafael From sabre at nondot.org Wed Feb 16 13:16:34 2011 From: sabre at nondot.org (Chris Lattner) Date: Wed, 16 Feb 2011 19:16:34 -0000 Subject: [llvm-commits] [llvm] r125681 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110216191634.861282A6C12C@llvm.org> Author: lattner Date: Wed Feb 16 13:16:34 2011 New Revision: 125681 URL: http://llvm.org/viewvc/llvm-project?rev=125681&view=rev Log: Add a few missed xforms from GCC PR14753 Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125681&r1=125680&r2=125681&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 16 13:16:34 2011 @@ -2218,3 +2218,32 @@ avoids partial register stalls in some important cases. //===---------------------------------------------------------------------===// + +Some missed instcombine xforms (from GCC PR14753): + +void bar (void); + +void mask_gt (unsigned int a) { +/* This is equivalent to a > 15. */ +if ((a & ~7) > 8) +bar(); +} + +void neg_eq_cst(unsigned int a) { +if (-a == 123) +bar(); +} + +void minus_cst(unsigned int a) { +if (20 - a == 5) +bar(); +} + +void rotate_cst (unsigned a) { +a = (a << 10) | (a >> 22); +if (a == 123) +bar (); +} + +//===---------------------------------------------------------------------===// + From benny.kra at googlemail.com Wed Feb 16 13:30:00 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Wed, 16 Feb 2011 20:30:00 +0100 Subject: [llvm-commits] [llvm] r125681 - /llvm/trunk/lib/Target/README.txt In-Reply-To: <20110216191634.861282A6C12C@llvm.org> References: <20110216191634.861282A6C12C@llvm.org> Message-ID: <54177972-2C7C-46B8-BC17-117DD2B8F75A@googlemail.com> On 16.02.2011, at 20:16, Chris Lattner wrote: > Author: lattner > Date: Wed Feb 16 13:16:34 2011 > New Revision: 125681 > > URL: http://llvm.org/viewvc/llvm-project?rev=125681&view=rev > Log: > Add a few missed xforms from GCC PR14753 > > Modified: > llvm/trunk/lib/Target/README.txt > > Modified: llvm/trunk/lib/Target/README.txt > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125681&r1=125680&r2=125681&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/README.txt (original) > +++ llvm/trunk/lib/Target/README.txt Wed Feb 16 13:16:34 2011 > @@ -2218,3 +2218,32 @@ > avoids partial register stalls in some important cases. > > //===---------------------------------------------------------------------===// > + > +Some missed instcombine xforms (from GCC PR14753): > + > +void bar (void); > + > +void mask_gt (unsigned int a) { > +/* This is equivalent to a > 15. */ > +if ((a & ~7) > 8) > +bar(); > +} > + > +void neg_eq_cst(unsigned int a) { > +if (-a == 123) > +bar(); > +} > + > +void minus_cst(unsigned int a) { > +if (20 - a == 5) > +bar(); > +} > + > +void rotate_cst (unsigned a) { > +a = (a << 10) | (a >> 22); > +if (a == 123) > +bar (); > +} > + > +//===---------------------------------------------------------------------===// > + Some of those are in the other PR14753 section in README.txt already ? From nadav.rotem at intel.com Wed Feb 16 14:26:56 2011 From: nadav.rotem at intel.com (Rotem, Nadav) Date: Wed, 16 Feb 2011 22:26:56 +0200 Subject: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll In-Reply-To: References: <20110211193756.00C782A6C12C@llvm.org> <33543FF9-1ACE-4D44-8E7F-6D73B5F52D06@googlemail.com> <6594DDFF12B03D4E89690887C24869940270CCB0D6@hasmsx504.ger.corp.intel.com> <4D580EB3.2070701@free.fr> <4D5855BE.5080307@mxc.ca> <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> Message-ID: <6594DDFF12B03D4E89690887C2486994027105D780@hasmsx504.ger.corp.intel.com> Hi Frits, Nick and Duncan, I attached a revised patch which supports getAllOnesValue on FP values. I added minor changes to APFloat as well as new tests. Thanks, Nadav -----Original Message----- From: Frits van Bommel [mailto:fvbommel at gmail.com] Sent: Tuesday, February 15, 2011 00:25 To: Rotem, Nadav Cc: Nick Lewycky; Duncan Sands; llvm-commits at cs.uiuc.edu Subject: Re: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll On Mon, Feb 14, 2011 at 10:56 PM, Rotem, Nadav wrote: > I started by looking at adding alone support for constants. I started by adding support for float/double inside the Constant function. A change to APFloat is also possible but more complex. What do you think ? No need to go messing around with floats and doubles and reinterpret_casts (or changing APFloat). APFloat has a constructor that takes an APInt and initializes the floating-point value with those bits (just be careful with 'fp128' vs 'ppc_fp128' values, that's what the second parameter is for). --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -------------- next part -------------- A non-text attachment was scrubbed... Name: fp.diff Type: application/octet-stream Size: 4493 bytes Desc: fp.diff Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110216/e7616222/attachment.obj From grosbach at apple.com Wed Feb 16 15:55:20 2011 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 16 Feb 2011 13:55:20 -0800 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4D5C1747.9030404@gmail.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> Message-ID: <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> On Feb 16, 2011, at 10:28 AM, Rafael Avila de Espindola wrote: >> That's not a choice that's up to us. We're not deciding what the syntax is. We're supporting existing (hopefully documented) syntax. > > So we need to support what gas does, but we can support a superset of it > when we find some advantaged in doing so. Close, but not quite. We have to support the documented syntax for the target. In many cases that's de-facto the documented gas behavior. Even then, gas has a lot of undocumented extensions, however. We can and should decide whether to support those on a case by case basis. Just like deciding what to do with GCC's language extensions in clang. > Is there a case where handling [] changes the meaning of a valid asm > file or we now just accept more code then gas does? Brackets have well-defined meaning in lots of asm dialects (memory references, etc). Overloading that to mean something else in expressions is dubious at best. For example, ldr r0, [r5] Is that an expression referring to a symbol named r5, or is it an indirect memory reference via register 5? -Jim From aggarwa4 at illinois.edu Wed Feb 16 17:19:40 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Wed, 16 Feb 2011 23:19:40 -0000 Subject: [llvm-commits] [poolalloc] r125692 - in /poolalloc/trunk/lib/AssistDS: MergeGEP.cpp VarArgsFunc.cpp Message-ID: <20110216231940.991182A6C12C@llvm.org> Author: aggarwa4 Date: Wed Feb 16 17:19:40 2011 New Revision: 125692 URL: http://llvm.org/viewvc/llvm-project?rev=125692&view=rev Log: Helper functions for DSA. MergeGEP helps merge GEPs. This is similiar to some level of instruction combining. VarargsFunc, helps convert calls of type call (bitcast F(void) to (...)*)() to direct calls to F, without the bitcast. Added: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Added: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=125692&view=auto ============================================================================== --- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (added) +++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Wed Feb 16 17:19:40 2011 @@ -0,0 +1,125 @@ +//===-- MergeGEP.cpp - Merge GEPs for indexing in arrays ------------ ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "mergegep" + +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Instructions.h" +#include "llvm/Constants.h" +#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Debug.h" +#include + +using namespace llvm; + + +namespace { + class MergeGEP : public ModulePass { + public: + static char ID; + MergeGEP() : ModulePass(&ID) {} + bool runOnModule(Module& M) { + bool changed = false; + bool found; + do { + found = false; + for (Module::iterator F = M.begin(); F != M.end(); ++F){ + for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { + for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { + if(!(isa(I))) + continue; + GetElementPtrInst *GEP = cast(I); + if(!isa(GEP->getType()->getElementType())) + continue; + for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP); + I != E; ++I) { + if (isa(*I)) { + gep_type_iterator II = I; + if(++II == E){ + std::vector worklist; + for (Value::use_iterator UI = GEP->use_begin(), + UE = GEP->use_end(); UI != UE; ++UI){ + if(!isa(UI)) + break; + GetElementPtrInst *GEPUse = cast(UI); + worklist.push_back(GEPUse); + } + while(!worklist.empty()){ + GetElementPtrInst *GEPUse = worklist.back(); + worklist.pop_back(); + SmallVector Indices; + Indices.append(GEP->op_begin()+1, GEP->op_end()); + Indices.append(GEPUse->idx_begin()+1, GEPUse->idx_end()); + GetElementPtrInst *GEPNew = GetElementPtrInst::Create(GEP->getOperand(0), + Indices.begin(), + Indices.end(), + GEPUse->getName()+ "mod", + GEPUse); + GEPUse->replaceAllUsesWith(GEPNew); + GEPUse->eraseFromParent(); + found = true; + changed = true; + } + } + } + } + } + } + std::vector worklist; + for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { + for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { + if(!(isa(I))) + continue; + GetElementPtrInst *GEP = cast(I); + if (Constant *C = dyn_cast(GEP->getOperand(0))) { + if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::GetElementPtr) { + worklist.push_back(GEP); + } + } + } + } + } + while(!worklist.empty()) { + GetElementPtrInst *GEP = worklist.back(); + worklist.pop_back(); + Constant *C = cast(GEP->getOperand(0)); + ConstantExpr *CE = cast(C); + SmallVector Indices; + Indices.append(CE->op_begin()+1, CE->op_end()); + Indices.append(GEP->idx_begin()+1, GEP->idx_end()); + GetElementPtrInst *GEPNew = GetElementPtrInst::Create(CE->getOperand(0), + Indices.begin(), + Indices.end(), + GEP->getName()+ "mod", + GEP); + //GEP->dump(); + //GEPNew->dump(); + GEP->replaceAllUsesWith(GEPNew); + GEP->eraseFromParent(); + changed = true; + found = true; + } + } + }while(found); + return changed; + } + }; +} + +char MergeGEP::ID = 0; +static RegisterPass +X("mergegep", "Merge GEPs for arrays in structs"); Added: poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp?rev=125692&view=auto ============================================================================== --- poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp (added) +++ poolalloc/trunk/lib/AssistDS/VarArgsFunc.cpp Wed Feb 16 17:19:40 2011 @@ -0,0 +1,93 @@ +//===-- VarArgsFunc.cpp - Simplify calls to bitcasted const funcs --------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "varargfunc" + +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/Debug.h" + +#include +#include +#include + +using namespace llvm; + +STATISTIC(numSimplified, "Number of Calls Simplified"); + +namespace { + class VarArgsFunc : public ModulePass { + public: + static char ID; + VarArgsFunc() : ModulePass(&ID) {} + bool runOnModule(Module& M) { + bool changed = false; + std::vector worklist; + for (Module::iterator I = M.begin(); I != M.end(); ++I) { + if (!I->isDeclaration() && !I->mayBeOverridden()) { + //Call Sites + for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); + ui != ue; ++ui) { + if (Constant *C = dyn_cast(ui)) { + if (ConstantExpr *CE = dyn_cast(C)) { + if (CE->getOpcode() == Instruction::BitCast) { + if(CE->getOperand(0) == I) { + if(const FunctionType *FTy = dyn_cast((cast(CE->getType()))->getElementType())) { + if(FTy->isVarArg()) { + for(Value::use_iterator uii = CE->use_begin(), uee = CE->use_end(); + uii != uee; ++uii) { + if (CallInst* CI = dyn_cast(uii)) { + if(CI->getCalledValue() == CE) { + worklist.push_back(CI); + } + } + } + } + } + } + } + } + } + } + } + } + while(!worklist.empty()) { + CallInst *CI = worklist.back(); + worklist.pop_back(); + Function *F = cast(CI->getCalledValue()->stripPointerCasts()); + if(F->arg_size() != (CI->getNumOperands()-1)) + continue; + if(F->getReturnType() != CI->getType()) + continue; + int arg_count = 1; + bool change = true; + for (Function::arg_iterator ii = F->arg_begin(), ee = F->arg_end();ii != ee; ++ii,arg_count++) { + if(ii->getType() != CI->getOperand(arg_count)->getType()) { + change = false; + break; + } + } + + if(change) { + CI->setCalledFunction(F); + changed = true; + numSimplified++; + } + } + return changed; + } + }; +} + +char VarArgsFunc::ID = 0; +static RegisterPass +X("varargsfunc", "Specialize for ill-defined non-varargs functions"); From rafael.espindola at gmail.com Wed Feb 16 17:25:04 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Wed, 16 Feb 2011 18:25:04 -0500 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> Message-ID: <4D5C5CD0.1080703@gmail.com> > Brackets have well-defined meaning in lots of asm dialects (memory references, etc). Overloading that to mean something else in expressions is dubious at best. > > For example, > ldr r0, [r5] > > Is that an expression referring to a symbol named r5, or is it an indirect memory reference via register 5? Yes, that is bad. So, the two questions are * Should be support [] at all * If yes, everywhere? I so far have seem [] being used only one file and updated that one file :-) I think Joerg mentioned it being common on old BSD code, so we might have to support it. You have a valid argument as for why it is better to not support it is some arches, so maybe we need to make this conditional. Joerg, how common are assembly files with [] in them? If common, can you code a patch making [] conditional on x86(-64) ELF? > -Jim Cheers, Rafael From joerg at britannica.bec.de Wed Feb 16 18:08:29 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Thu, 17 Feb 2011 01:08:29 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4D5C5CD0.1080703@gmail.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> <4D5C5CD0.1080703@gmail.com> Message-ID: <20110217000829.GC23813@britannica.bec.de> On Wed, Feb 16, 2011 at 06:25:04PM -0500, Rafael Avila de Espindola wrote: > I so far have seem [] being used only one file and updated that one file > :-) I think Joerg mentioned it being common on old BSD code, so we might > have to support it. [] is used in the default PIC prologue created by various compilers. > Joerg, how common are assembly files with [] in them? If common, can you > code a patch making [] conditional on x86(-64) ELF? Why not just make the function virtual and let platforms that can't accept the default behavior overwrite it? I actually think that quite a few platforms GNU as support don't distinguish between [] and () as the patch implements. Joerg From joerg at britannica.bec.de Wed Feb 16 18:09:59 2011 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Thu, 17 Feb 2011 01:09:59 +0100 Subject: [llvm-commits] [llvm] r125595 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp test/MC/AsmParser/exprs.s test/MC/AsmParser/paren.s In-Reply-To: <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> References: <20110215204339.453842A6C12C@llvm.org> <20110216022506.GA22148@britannica.bec.de> <3075B8C8-F8FA-4C99-99AE-6BA896521B42@apple.com> <20110216181240.GB23037@britannica.bec.de> <4D5C1747.9030404@gmail.com> <4682C3BA-FE60-4A76-9EBA-58CFA343CFFA@apple.com> Message-ID: <20110217000959.GD23813@britannica.bec.de> On Wed, Feb 16, 2011 at 01:55:20PM -0800, Jim Grosbach wrote: > Brackets have well-defined meaning in lots of asm dialects (memory references, etc). Overloading that to mean something else in expressions is dubious at best. > > For example, > ldr r0, [r5] > > Is that an expression referring to a symbol named r5, or is it an indirect memory reference via register 5? How is ldr r0, (r5) interpreted in this context? AT&T syntax for x86 and quite a few other platforms consider those to be equivalent. Joerg From eli.friedman at gmail.com Wed Feb 16 18:25:14 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 16 Feb 2011 16:25:14 -0800 Subject: [llvm-commits] [PATCH] Patch (WIP) to custom-lower 64-bit relational comparisons on x86-32 Message-ID: Example of what the attached patch does (x86-32): C code: int foo(); int bar(long long x, long long y) { if (x < y) foo(); } Current generated code: subl $12, %esp movl 16(%esp), %eax movl 20(%esp), %ecx cmpl 24(%esp), %eax setae %al cmpl 28(%esp), %ecx setge %cl je .LBB0_2 movb %cl, %al .LBB0_2: testb %al, %al jne .LBB0_4 calll foo .LBB0_4: addl $12, %esp ret New generated code: subl $12, %esp movl 16(%esp), %eax movl 20(%esp), %ecx subl 24(%esp), %eax sbbl 28(%esp), %ecx jge .LBB0_2 calll foo .LBB0_2: addl $12, %esp ret I initially wrote this patch a couple years ago, but the backend choked on it before some recent changes. The reason this works is that on x86, comparisons are fundamentally just subtraction. So to do a wide comparison, all that is necessary is to split the subtraction, and use the flag results of the top half. A bit of trickiness is required because the ZF flag isn't set in a useful way, but that's straightforward to solve: don't lower equality comparisons with this method and commute other comparisons that look at the ZF flag. I'm mainly looking for feedback as to whether this seems like generally a good idea... I haven't seen any compiler use this particular implementation of relational comparisons. -Eli -------------- next part -------------- Index: X86/X86ISelLowering.cpp =================================================================== --- X86/X86ISelLowering.cpp (revision 125651) +++ X86/X86ISelLowering.cpp (working copy) @@ -446,6 +446,7 @@ setOperationAction(ISD::SETCC , MVT::i8 , Custom); setOperationAction(ISD::SETCC , MVT::i16 , Custom); setOperationAction(ISD::SETCC , MVT::i32 , Custom); + setOperationAction(ISD::SETCC , MVT::i64 , Custom); setOperationAction(ISD::SETCC , MVT::f32 , Custom); setOperationAction(ISD::SETCC , MVT::f64 , Custom); setOperationAction(ISD::SETCC , MVT::f80 , Custom); @@ -7402,6 +7403,38 @@ if (X86CC == X86::COND_INVALID) return SDValue(); + if (!Subtarget->is64Bit() && Op0.getValueType() == MVT::i64) { + if (X86CC == X86::COND_E || X86CC == X86::COND_NE) + return SDValue(); + if (X86CC == X86::COND_A) { + X86CC = X86::COND_B; + std::swap(Op0, Op1); + } else if (X86CC == X86::COND_BE) { + X86CC = X86::COND_AE; + std::swap(Op0, Op1); + } else if (X86CC == X86::COND_G) { + X86CC = X86::COND_L; + std::swap(Op0, Op1); + } else if (X86CC == X86::COND_LE) { + X86CC = X86::COND_GE; + std::swap(Op0, Op1); + } + SDValue Op0Low = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, + Op0, DAG.getIntPtrConstant(0)); + SDValue Op1Low = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, + Op1, DAG.getIntPtrConstant(0)); + SDValue Op0High = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, + Op0, DAG.getIntPtrConstant(1)); + SDValue Op1High = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, + Op1, DAG.getIntPtrConstant(1)); + SDValue res1, res2; + SDVTList VTList = DAG.getVTList(MVT::i32, MVT::i32); + res1 = SDValue(DAG.getNode(X86ISD::SUB, dl, VTList, Op0Low, Op1Low).getNode(), 1); + res2 = SDValue(DAG.getNode(X86ISD::SBB, dl, VTList, Op0High, Op1High, res1).getNode(), 1); + return DAG.getNode(X86ISD::SETCC, dl, MVT::i8, + DAG.getConstant(X86CC, MVT::i8), res2); + } + SDValue EFLAGS = EmitCmp(Op0, Op1, X86CC, DAG); return DAG.getNode(X86ISD::SETCC, dl, MVT::i8, DAG.getConstant(X86CC, MVT::i8), EFLAGS); From aggarwa4 at illinois.edu Wed Feb 16 19:03:57 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 17 Feb 2011 01:03:57 -0000 Subject: [llvm-commits] [poolalloc] r125697 - in /poolalloc/trunk/test: TEST.dsgraph.Makefile TEST.dsgraph.report Message-ID: <20110217010358.00CD72A6C12C@llvm.org> Author: aggarwa4 Date: Wed Feb 16 19:03:57 2011 New Revision: 125697 URL: http://llvm.org/viewvc/llvm-project?rev=125697&view=rev Log: Remove all type inference data from this, and move to separate makefile Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile poolalloc/trunk/test/TEST.dsgraph.report Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.Makefile?rev=125697&r1=125696&r2=125697&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.dsgraph.Makefile (original) +++ poolalloc/trunk/test/TEST.dsgraph.Makefile Wed Feb 16 19:03:57 2011 @@ -42,7 +42,6 @@ Output/%.$(TEST).report.txt: Output/%.base.bc Output/%.LOC.txt $(LOPT) @# Gather data -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 - -($(RUNOPT) -dsa-$(PASS) -dsa-stdlib-no-fold $(ANALYZE_OPTS) $<)> $@.time.2 2>&1 -($(RUNOPT) $(MEM) -dsa-$(PASS) -disable-verify $<)> $@.mem.1 2>&1 @# Emit data. @echo "---------------------------------------------------------------" > $@ @@ -69,36 +68,6 @@ @/bin/echo -n "SCCSIZE: " >> $@ - at grep 'Maximum SCC Size in Call Graph' $@.time.1 >> $@ @echo >> $@ - @/bin/echo -n "ACCESSES TYPED: " >> $@ - - at grep 'Number of loads/stores which are fully typed' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES UNTYPED: " >> $@ - - at grep 'Number of loads/stores which are untyped' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES TYPED1: " >> $@ - - at grep 'Number of loads/stores which are access a DSNode with 1 type' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES TYPED2: " >> $@ - - at grep 'Number of loads/stores which are access a DSNode with 2 type' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES TYPED3: " >> $@ - - at grep 'Number of loads/stores which are access a DSNode with 3 type' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES TYPED4: " >> $@ - - at grep 'Number of loads/stores which are access a DSNode with >3 type' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES I: " >> $@ - - at grep 'Number of loads/stores which are on incomplete nodes' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES E: " >> $@ - - at grep 'Number of loads/stores which are on external nodes' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "ACCESSES U: " >> $@ - - at grep 'Number of loads/stores which are on unknown nodes' $@.time.1 >> $@ - @echo >> $@ - @/bin/echo -n "STD_LIB_FOLD: " >> $@ - - at grep 'Number of nodes folded in std lib' $@.time.1 >> $@ - @echo >> $@ @# Emit timing data. @/bin/echo -n "TIME: " >> $@ - at grep ' Local Data Structure' $@.time.1 >> $@ Modified: poolalloc/trunk/test/TEST.dsgraph.report URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.report?rev=125697&r1=125696&r2=125697&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.dsgraph.report (original) +++ poolalloc/trunk/test/TEST.dsgraph.report Wed Feb 16 19:03:57 2011 @@ -156,21 +156,7 @@ ["GlobGr" , "GLOBALSGRAPH: *([0-9]+)"], ["MaxSCC" , "SCCSIZE: *([0-9]+)"], [], - ["TypeSafe", "ACCESSES TYPED: *([0-9]+)"], - ["NonType", "ACCESSES UNTYPED: *([0-9]+)"], - ["TS %" , sub { return TypeSafeRatio(@_); }], - [], - ["Type1", "ACCESSES TYPED1: *([0-9]+)"], - ["Type2", "ACCESSES TYPED2: *([0-9]+)"], - ["Type3", "ACCESSES TYPED3: *([0-9]+)"], - ["Type4", "ACCESSES TYPED4: *([0-9]+)"], - ["I", "ACCESSES I: *([0-9]+)"], - ["E", "ACCESSES E: *([0-9]+)"], - ["U", "ACCESSES U: *([0-9]+)"], - ["U", "ACCESSES U: *([0-9]+)"], - [], # Nodes Folded - ["StdLibFold", "STD_LIB_FOLD: *([0-9]+)"], ["IndClone", "CLONED_INDCLONE: *([0-9]+)"], ["FuncSpec", "CLONED_FUNCSPEC: *([0-9]+)"], ); From aggarwa4 at illinois.edu Wed Feb 16 19:06:36 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 17 Feb 2011 01:06:36 -0000 Subject: [llvm-commits] [poolalloc] r125698 - in /poolalloc/trunk/test: Makefile TEST.types.Makefile TEST.types.report Message-ID: <20110217010636.E497F2A6C12C@llvm.org> Author: aggarwa4 Date: Wed Feb 16 19:06:36 2011 New Revision: 125698 URL: http://llvm.org/viewvc/llvm-project?rev=125698&view=rev Log: Adding tests for type inference testing. Added: poolalloc/trunk/test/TEST.types.Makefile (with props) poolalloc/trunk/test/TEST.types.report (with props) Modified: poolalloc/trunk/test/Makefile Modified: poolalloc/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/Makefile?rev=125698&r1=125697&r2=125698&view=diff ============================================================================== --- poolalloc/trunk/test/Makefile (original) +++ poolalloc/trunk/test/Makefile Wed Feb 16 19:06:36 2011 @@ -308,6 +308,30 @@ done @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" +# Program tests for Types +progtypes:: + for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ + (cd $$dir; \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=types \ + LARGE_PROBLEM_SIZE=1 report.html) \ + done + for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ + (cd $$dir; \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -j1 TEST=types \ + report.html) \ + done + @for dir in $(LARGE_PROBLEM_SIZE_DIRS); do \ + (cd $$dir; \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=types \ + LARGE_PROBLEM_SIZE=1 report) \ + done + @for dir in $(NORMAL_PROBLEM_SIZE_DIRS); do \ + (cd $$dir; \ + PROJECT_DIR=$(PROJ_OBJ_ROOT) $(MAKE) -s -j1 TEST=types \ + report) \ + done + @printf "\a"; sleep 1; printf "\a"; sleep 1; printf "\a" + ############################################################################## # Targets for running tests and gathering statistics for arbitrary tests Added: poolalloc/trunk/test/TEST.types.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.Makefile?rev=125698&view=auto ============================================================================== --- poolalloc/trunk/test/TEST.types.Makefile (added) +++ poolalloc/trunk/test/TEST.types.Makefile Wed Feb 16 19:06:36 2011 @@ -0,0 +1,147 @@ +##===- TEST.dsgraph.Makefile -------------------------------*- Makefile -*-===## +# +# This recursively traverses the programs, computing DSGraphs for each of the +# programs in the testsuite. +# +##===----------------------------------------------------------------------===## + +RELDIR := $(subst $(PROJ_OBJ_ROOT),,$(PROJ_OBJ_DIR)) + +# We require the programs to be linked with libdummy +#include $(LEVEL)/Makefile.dummylib + +# Pathname to poolalloc object tree +PADIR := $(LLVM_OBJ_ROOT)/projects/poolalloc + +# Pathame to the DSA pass dynamic library +DSA_SO := $(PADIR)/$(CONFIGURATION)/lib/libLLVMDataStructure$(SHLIBEXT) +ASSIST_SO := $(PADIR)/$(CONFIGURATION)/lib/libAssistDS$(SHLIBEXT) + +# Command for running the opt program +RUNOPT := $(RUNTOOLSAFELY) $(LLVM_OBJ_ROOT)/projects/poolalloc/$(CONFIGURATION)/bin/watchdog $(LOPT) -load $(DSA_SO) + +# PASS - The dsgraph pass to run: ds, bu, td +PASS := td + +ANALYZE_OPTS := -stats -time-passes -disable-output -dsstats +#ANALYZE_OPTS := -stats -time-passes -dsstats +ANALYZE_OPTS += -instcount -disable-verify +MEM := -track-memory -time-passes -disable-output + +SAFE_OPTS := -internalize -scalarrepl -deadargelim -globaldce -basiccg -inline + +$(PROGRAMS_TO_TEST:%=Output/%.linked1.bc): \ +Output/%.linked1.bc: Output/%.linked.rbc $(LOPT) + -$(RUNOPT) -disable-opt $(SAFE_OPTS) -info-output-file=$(CURDIR)/$@.info -stats -time-passes $< -f -o $@ + +$(PROGRAMS_TO_TEST:%=Output/%.llvm1.bc): \ +Output/%.llvm1.bc: Output/%.linked1.bc $(LLVM_LDDPROG) + -$(RUNTOOLSAFELY) $(LLVMLD) -disable-opt $(SAFE_OPTS) -info-output-file=$(CURDIR)/$@.info -stats -time-passes $(LLVMLD_FLAGS) $< -lc $(LIBS) -o Output/$*.llvm1 + +$(PROGRAMS_TO_TEST:%=Output/%.opt.bc): \ +Output/%.opt.bc: Output/%.llvm1.bc $(LOPT) $(ASSIST_SO) + -$(RUNOPT) -load $(ASSIST_SO) -disable-opt -info-output-file=$(CURDIR)/$@.info -instnamer -internalize -varargsfunc -indclone -funcspec -ipsccp -deadargelim -mergegep -die -globaldce -stats -time-passes $< -f -o $@ + +$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ +Output/%.$(TEST).report.txt: Output/%.opt.bc Output/%.LOC.txt $(LOPT) + @# Gather data + -($(RUNOPT) -dsa-$(PASS) -enable-type-inference-opts -dsa-stdlib-no-fold $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 + -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.2 2>&1 + @# Emit data. + @echo "---------------------------------------------------------------" > $@ + @echo ">>> ========= '$(RELDIR)/$*' Program" >> $@ + @echo "---------------------------------------------------------------" >> $@ + @/bin/echo -n "LOC: " >> $@ + @cat Output/$*.LOC.txt >> $@ + @echo >> $@ + @/bin/echo -n "MEMINSTS: " >> $@ + - at grep 'Number of memory instructions' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "FOLDEDNODES: " >> $@ + - at grep 'Number of nodes completely folded' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "TOTALNODES: " >> $@ + - at grep 'Number of nodes allocated' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "MAXGRAPHSIZE: " >> $@ + - at grep 'Maximum graph size' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "GLOBALSGRAPH: " >> $@ + - at grep 'td.GlobalsGraph.dot' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "SCCSIZE: " >> $@ + - at grep 'Maximum SCC Size in Call Graph' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES TYPED_O: " >> $@ + - at grep 'Number of loads/stores which are fully typed' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES UNTYPED_O: " >> $@ + - at grep 'Number of loads/stores which are untyped' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES TYPED: " >> $@ + - at grep 'Number of loads/stores which are fully typed' $@.time.2 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES UNTYPED: " >> $@ + - at grep 'Number of loads/stores which are untyped' $@.time.2 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES TYPED1: " >> $@ + - at grep 'Number of loads/stores which are access a DSNode with 1 type' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES TYPED2: " >> $@ + - at grep 'Number of loads/stores which are access a DSNode with 2 type' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES TYPED3: " >> $@ + - at grep 'Number of loads/stores which are access a DSNode with 3 type' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES TYPED4: " >> $@ + - at grep 'Number of loads/stores which are access a DSNode with >3 type' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES I: " >> $@ + - at grep 'Number of loads/stores which are on incomplete nodes' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES E: " >> $@ + - at grep 'Number of loads/stores which are on external nodes' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "ACCESSES U: " >> $@ + - at grep 'Number of loads/stores which are on unknown nodes' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "STD_LIB_FOLD: " >> $@ + - at grep 'Number of nodes folded in std lib' $@.time.1 >> $@ + @echo >> $@ + @# Emit timing data. + @/bin/echo -n "TIME: " >> $@ + - at grep ' Local Data Structure' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "TIME: " >> $@ + - at grep ' Bottom-up Data Structure' $@.time.1 >> $@ + @echo >> $@ + @/bin/echo -n "TIME: " >> $@ + - at grep ' Top-down Data Structure' $@.time.1 >> $@ + @echo >> $@ + @# Emit AssistDS stats + @/bin/echo -n "CLONED_FUNCSPEC: " >> $@ + - at grep 'Number of Functions Cloned in FuncSpec' $<.info >> $@ + @echo >> $@ + @/bin/echo -n "CLONED_INDCLONE: " >> $@ + - at grep 'Number of Functions Cloned in IndClone' $<.info >> $@ + @echo >> $@ + @/bin/echo -n "VARARGS_CALLS: " >> $@ + - at grep 'Number of Calls Simplified' $<.info >> $@ + @echo >> $@ + @/bin/echo -n "CALLS1: " >> $@ + - at grep 'Number of calls that could not be resolved' $@.time.1 >> $@ + @echo >> $@ + + +$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \ +test.$(TEST).%: Output/%.$(TEST).report.txt + @echo "---------------------------------------------------------------" + @echo ">>> ========= '$(RELDIR)/$*' Program" + @echo "---------------------------------------------------------------" + @cat $< + +# Define REPORT_DEPENDENCIES so that the report is regenerated if analyze or +# dummylib is updated. +# +REPORT_DEPENDENCIES := $(DUMMYLIB) $(LOPT) + Propchange: poolalloc/trunk/test/TEST.types.Makefile ------------------------------------------------------------------------------ svn:executable = * Added: poolalloc/trunk/test/TEST.types.report URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.report?rev=125698&view=auto ============================================================================== --- poolalloc/trunk/test/TEST.types.report (added) +++ poolalloc/trunk/test/TEST.types.report Wed Feb 16 19:06:36 2011 @@ -0,0 +1,167 @@ +##=== TEST.dsgraph.report - Report description for dsgraph -----*- perl -*-===## +# +# This file defines a report to be generated for the dsgraph test. +# +##===----------------------------------------------------------------------===## + +$SortNumeric = 1; # Sort numerically, not textually. +$TrimAllDirectories = 1; # Trim off benchmark directories. +$SortCol = 2; # Sort by #MemInstrs +$SortReverse = 1; # Sort in descending order + + +# Helper function +sub Ratio { + my ($Cols, $Col) = @_; + if ($Cols->[$Col-2] ne "*" and + $Cols->[$Col-2] != "0") { + return $Cols->[$Col-1]/$Cols->[$Col-2]; + } else { + return "n/a"; + } +} + +sub TypeSafeRatio { + my ($Cols, $Col) = @_; + my $TS = $Cols->[$Col-2]; + my $NTS = $Cols->[$Col-1]; + $TS = 0 if ($TS eq "*"); + $NTS = 0 if ($NTS eq "*"); + + if ($TS + $NTS != 0) { + return sprintf("%4.1f%%", 100*$TS/($TS+$NTS+0.0)); + } else { + return "n/a"; + } +} + +sub FormatSize { + my $Size = shift; + if ($Size > 10*1024*1024) { + return (int $Size*10 / (1024*1024))/10 . "MB"; + } elsif ($Size > 10*1024) { + return (int $Size / 1024); + } else { + return $Size . "B"; + } +} + +sub NoStar { + return "0" if ($_[0] eq '*'); + return $_[0]; +} + +sub NoCallNodes { + $_[0] =~ m/([0-9]+)\+/; + return $1; +} + +# For latex output, limit benchmarks and rename as appropriate + at LatexRowMapOrder = ( + '-' => '-', + + '181.mcf' => '181.mcf', + '256.bzip2' => '256.bzip2', + '164.gzip' => '164.gzip', + '175.vpr' => '175.vpr', + '197.parser' => '197.parser', + '186.crafty' => '186.crafty', + '300.twolf' => '300.twolf', + '255.vortex' => '255.vortex', + '254.gap' => '254.gap', + '252.eon' => '252.eon', + '253.perlbmk' => '253.perlbmk', + '176.gcc' => '176.gcc', + '-' => '-', + '179.art' => '179.art', + '183.equake' => '183.equake', + '171.swim' => '171.swim', + '172.mgrid' => '172.mgrid', + '168.wupwise' => '168.wupwise', + '173.applu' => '173.applu', + '188.ammp' => '188.ammp', + '177.mesa' => '177.mesa', + '-' => '-', + '129.compress' => '129.compress', + '130.li' => '130.li', + '124.m88ksim' => '124.m88ksim', + '132.ijpeg' => '132.ijpeg', + '099.go' => '099.go', + '134.perl' => '134.perl', + '147.vortex' => '147.vortex', + '126.gcc' => '126.gcc', + '-' => '-', + '102.swim' => '102.swim', + '101.tomcatv' => '101.tomcatv', + '107.mgrid' => '107.mgrid', + '145.fpppp' => '145.fpppp', + '104.hydro2d' => '104.hydro2d', + '110.applu' => '110.applu', + '103.su2cor' => '103.su2cor', + '146.wave5' => '146.wave5', + '-' => '-', + 'fpgrowth' => 'fpgrowth', + 'bsim' => 'boxed-sim', + 'namd' => 'NAMD', + 'povray' => 'povray31', + ); + + at LxxatexColumns = (1, 2, 19, # LOC, #MemInstrs, MaxSCC + 15,16, # Total/Collapsed nodes + 17, 18); # Max Size, GG Size + + at LatexColumns = (2, 21, 22, 23); # Type safety numbers + + +# Specify how to format columns nicely for printing... +%LatexColumnFormat = ( +# 11 => \&FormatSize, +# 12 => \&FormatSize, + 16 => \&NoStar, + 15 => \&NoCallNodes, + 18 => \&NoCallNodes + ); + + at Graphs = (["scatter", "timeVmem.txt", 27, 7], + ["scatter", "timeVloc.txt", 1, 7]); + + +# These are the columns for the report. The first entry is the header for the +# column, the second is the regex to use to match the value. Empty list create +# seperators, and closures may be put in for custom processing. + +my $USERSYSTTIME = '([0-9.]+)[ 0-9.]+\([^)]+\)[ 0-9.]+\([^)]+\) +'; +( +# Name + ["Name:" , '\'([^\']+)\' Program'], + ["LOC:" , 'LOC: *([0-9]+)'], + ["MemInsts", '([0-9]+).*Number of memory instructions'], + [], +# Misc stuff + ["NumNodes", "TOTALNODES: *([0-9]+)"], + ["NumFold", "FOLDEDNODES: *([0-9]+)"], + [], + ["TypeSafeO", "ACCESSES TYPED_O: *([0-9]+)"], + ["NonTypeO", "ACCESSES UNTYPED_O: *([0-9]+)"], + ["TSO %" , sub { return TypeSafeRatio(@_); }], + [], + ["TypeSafe", "ACCESSES TYPED: *([0-9]+)"], + ["NonType", "ACCESSES UNTYPED: *([0-9]+)"], + ["TS %" , sub { return TypeSafeRatio(@_); }], + [], + ["Type1", "ACCESSES TYPED1: *([0-9]+)"], + ["Type2", "ACCESSES TYPED2: *([0-9]+)"], + ["Type3", "ACCESSES TYPED3: *([0-9]+)"], + ["Type4", "ACCESSES TYPED4: *([0-9]+)"], + ["I", "ACCESSES I: *([0-9]+)"], + ["E", "ACCESSES E: *([0-9]+)"], + ["U", "ACCESSES U: *([0-9]+)"], + [], +# Nodes Folded + [], + ["VAFUNC", "VARARGS_CALLS: *([0-9]+)"], + ["FUNCSPEC", "CLONED_FUNCSPEC: *([0-9]+)"], + ["INDCLONE", "CLONED_INDCLONE: *([0-9]+)"], + ["StdLibFold", "STD_LIB_FOLD: *([0-9]+)"], + ["Calls", "CALLS1: *([0-9]+)"], + ); Propchange: poolalloc/trunk/test/TEST.types.report ------------------------------------------------------------------------------ svn:executable = * From clattner at apple.com Wed Feb 16 19:19:26 2011 From: clattner at apple.com (Chris Lattner) Date: Wed, 16 Feb 2011 17:19:26 -0800 Subject: [llvm-commits] Fix floating point numbers in tests on MinGW In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE17DD2905F9@mail.accesssoftek.com> References: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA26@mail.accesssoftek.com> <6AE1604EE3EC5F4296C096518C6B77EE17DD2905F9@mail.accesssoftek.com> Message-ID: <80010C5D-B584-408E-BC06-B502B639E0E6@apple.com> On Feb 16, 2011, at 8:21 AM, Danil Malyshev wrote: > Hello, > > A week passed and nobody else replyed yet, so it seems we are the only two who cares of this issue. :) > > Defining PRINTF_EXPONENT_DIGITS env is the suggested way to make MinGW ANSI/POSIX compatible. This is not only about the case we are discussing, but in general, I'd like to have explicitly defined compatibility mode for all the tests running on MinGW. > > I understand that it does not fix issues with scientific notation in general. It seems that you need to follow up with your patch, since you feel strong for it. This patch does not block you or affect you on any way. > > Could you or somebody else apply my patch, please? > I have attached it to this e-mail for convenience. This seems fine with me. Takumi, can you apply it if it looks good to you? -Chris From sabre at nondot.org Wed Feb 16 19:29:24 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 01:29:24 -0000 Subject: [llvm-commits] [llvm] r125700 - in /llvm/trunk: lib/Transforms/Scalar/Reassociate.cpp test/Transforms/Reassociate/optional-flags.ll Message-ID: <20110217012924.836362A6C12C@llvm.org> Author: lattner Date: Wed Feb 16 19:29:24 2011 New Revision: 125700 URL: http://llvm.org/viewvc/llvm-project?rev=125700&view=rev Log: fix PR9215, preventing -reassociate from clearing nsw/nuw when it swaps the LHS/RHS of a single binop. Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp llvm/trunk/test/Transforms/Reassociate/optional-flags.ll Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=125700&r1=125699&r2=125700&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Wed Feb 16 19:29:24 2011 @@ -348,9 +348,10 @@ I->setOperand(0, Ops[i].Op); I->setOperand(1, Ops[i+1].Op); - // Conservatively clear all the optional flags, which may not hold - // after the reassociation. - I->clearSubclassOptionalData(); + // Clear all the optional flags, which may not hold after the + // reassociation if the expression involved more than just this operation. + if (Ops.size() != 2) + I->clearSubclassOptionalData(); DEBUG(dbgs() << "TO: " << *I << '\n'); MadeChange = true; Modified: llvm/trunk/test/Transforms/Reassociate/optional-flags.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/optional-flags.ll?rev=125700&r1=125699&r2=125700&view=diff ============================================================================== --- llvm/trunk/test/Transforms/Reassociate/optional-flags.ll (original) +++ llvm/trunk/test/Transforms/Reassociate/optional-flags.ll Wed Feb 16 19:29:24 2011 @@ -20,3 +20,10 @@ %z = add nsw i64 %y, %a ret i64 %z } + +; PR9215 +; CHECK: %s = add nsw i32 %y, %x +define i32 @test2(i32 %x, i32 %y) { + %s = add nsw i32 %x, %y + ret i32 %s +} From sabre at nondot.org Wed Feb 16 19:43:46 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 01:43:46 -0000 Subject: [llvm-commits] [llvm] r125702 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110217014346.51DCB2A6C12C@llvm.org> Author: lattner Date: Wed Feb 16 19:43:46 2011 New Revision: 125702 URL: http://llvm.org/viewvc/llvm-project?rev=125702&view=rev Log: add some notes on compares + binops. Remove redundant entries. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125702&r1=125701&r2=125702&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Wed Feb 16 19:43:46 2011 @@ -873,6 +873,12 @@ if ((a >> 2) > 5) bar (); } + +void neg_eq_cst(unsigned int a) { +if (-a == 123) +bar(); +} + All should simplify to a single comparison. All of these are currently not optimized with "clang -emit-llvm-bc | opt -std-compile-opts". @@ -2219,31 +2225,52 @@ //===---------------------------------------------------------------------===// -Some missed instcombine xforms (from GCC PR14753): +We should fold compares like this: -void bar (void); + %1266 = add nsw i32 %.84.i.i.i, 1 + %560 = add nsw i32 %556, 1 + %1267 = icmp slt i32 %1266, %560 + +to a single 'icmp slt' when the add's have a single use, since they are NSW. -void mask_gt (unsigned int a) { -/* This is equivalent to a > 15. */ -if ((a & ~7) > 8) -bar(); -} - -void neg_eq_cst(unsigned int a) { -if (-a == 123) -bar(); -} - -void minus_cst(unsigned int a) { -if (20 - a == 5) -bar(); -} +//===---------------------------------------------------------------------===// -void rotate_cst (unsigned a) { -a = (a << 10) | (a >> 22); -if (a == 123) -bar (); -} +We don't fold (icmp (add) (add)) unless the two adds only have a single use. +There are a lot of cases that we're refusing to fold in (e.g.) 256.bzip2, for +example: + + %indvar.next90 = add i64 %indvar89, 1 ;; Has 2 uses + %tmp96 = add i64 %tmp95, 1 ;; Has 1 use + %exitcond97 = icmp eq i64 %indvar.next90, %tmp96 + +We don't fold this because we don't want to introduce an overlapped live range +of the ivar. However if we can make this more aggressive without causing +performance issues in two ways: + +1. If *either* the LHS or RHS has a single use, we can definitely do the + transformation. In the overlapping liverange case we're trading one register + use for one fewer operation, which is a reasonable trade. Before doing this + we should verify that the llc output actually shrinks for some benchmarks. +2. If both ops have multiple uses, we can still fold it if the operations are + both sinkable to *after* the icmp (e.g. in a subsequent block) which doesn't + increase register pressure. + +There are a ton of icmp's we aren't simplifying because of the reg pressure +concern. Care is warranted here though because many of these are induction +variables and other cases that matter a lot to performance, like the above. +Here's a blob of code that you can drop into the bottom of visitICmp to see some +missed cases: + + { Value *A, *B, *C, *D; + if (match(Op0, m_Add(m_Value(A), m_Value(B))) && + match(Op1, m_Add(m_Value(C), m_Value(D))) && + (A == C || A == D || B == C || B == D)) { + errs() << "OP0 = " << *Op0 << " U=" << Op0->getNumUses() << "\n"; + errs() << "OP1 = " << *Op1 << " U=" << Op1->getNumUses() << "\n"; + errs() << "CMP = " << I << "\n\n"; + } + } //===---------------------------------------------------------------------===// + From nicholas at mxc.ca Wed Feb 16 20:19:22 2011 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 17 Feb 2011 02:19:22 -0000 Subject: [llvm-commits] [llvm] r125709 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <20110217021922.E8D4A2A6C12C@llvm.org> Author: nicholas Date: Wed Feb 16 20:19:22 2011 New Revision: 125709 URL: http://llvm.org/viewvc/llvm-project?rev=125709&view=rev Log: Fix thinko, basic blocks are SESE. The exits may have many edges though. Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=125709&r1=125708&r2=125709&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Wed Feb 16 20:19:22 2011 @@ -3856,7 +3856,7 @@ Class
      Superclass: Value

      -

      This class represents a single entry multiple exit section of the code, +

      This class represents a single entry single exit section of the code, commonly known as a basic block by the compiler community. The BasicBlock class maintains a list of Instructions, which form the body of the block. From sabre at nondot.org Wed Feb 16 20:21:03 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 02:21:03 -0000 Subject: [llvm-commits] [llvm] r125710 - /llvm/trunk/test/Transforms/InstCombine/add2.ll Message-ID: <20110217022103.C73CE2A6C12C@llvm.org> Author: lattner Date: Wed Feb 16 20:21:03 2011 New Revision: 125710 URL: http://llvm.org/viewvc/llvm-project?rev=125710&view=rev Log: filecheckize Modified: llvm/trunk/test/Transforms/InstCombine/add2.ll Modified: llvm/trunk/test/Transforms/InstCombine/add2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/add2.ll?rev=125710&r1=125709&r2=125710&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/add2.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/add2.ll Wed Feb 16 20:21:03 2011 @@ -1,4 +1,4 @@ -; RUN: opt < %s -instcombine -S | not grep add +; RUN: opt < %s -instcombine -S | FileCheck %s define i64 @test1(i64 %A, i32 %B) { %tmp12 = zext i32 %B to i64 @@ -6,19 +6,30 @@ %tmp5 = add i64 %tmp3, %A %tmp6 = and i64 %tmp5, 123 ret i64 %tmp6 +; CHECK: @test1 +; CHECK-NEXT: and i64 %A, 123 +; CHECK-NEXT: ret i64 } -define i32 @test3(i32 %A) { +define i32 @test2(i32 %A) { %B = and i32 %A, 7 %C = and i32 %A, 32 %F = add i32 %B, %C ret i32 %F +; CHECK: @test2 +; CHECK-NEXT: and i32 %A, 39 +; CHECK-NEXT: ret i32 } -define i32 @test4(i32 %A) { +define i32 @test3(i32 %A) { %B = and i32 %A, 128 %C = lshr i32 %A, 30 %F = add i32 %B, %C ret i32 %F +; CHECK: @test3 +; CHECK-NEXT: and +; CHECK-NEXT: lshr +; CHECK-NEXT: or i32 %B, %C +; CHECK-NEXT: ret i32 } From sabre at nondot.org Wed Feb 16 20:23:02 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 02:23:02 -0000 Subject: [llvm-commits] [llvm] r125711 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineAddSub.cpp test/Transforms/InstCombine/add2.ll Message-ID: <20110217022302.D26322A6C12C@llvm.org> Author: lattner Date: Wed Feb 16 20:23:02 2011 New Revision: 125711 URL: http://llvm.org/viewvc/llvm-project?rev=125711&view=rev Log: preserve NUW/NSW when transforming add x,x Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp llvm/trunk/test/Transforms/InstCombine/add2.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=125711&r1=125710&r2=125711&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Wed Feb 16 20:23:02 2011 @@ -147,8 +147,13 @@ return BinaryOperator::CreateXor(LHS, RHS); // X + X --> X << 1 - if (LHS == RHS && I.getType()->isIntegerTy()) - return BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1)); + if (LHS == RHS && I.getType()->isIntegerTy()) { + BinaryOperator *New = + BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1)); + New->setHasNoSignedWrap(I.hasNoSignedWrap()); + New->setHasNoUnsignedWrap(I.hasNoUnsignedWrap()); + return New; + } // -A + B --> B - A // -A + -B --> -(A + B) Modified: llvm/trunk/test/Transforms/InstCombine/add2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/add2.ll?rev=125711&r1=125710&r2=125711&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/add2.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/add2.ll Wed Feb 16 20:23:02 2011 @@ -33,3 +33,11 @@ ; CHECK-NEXT: ret i32 } +define i32 @test4(i32 %A) { + %B = add nuw i32 %A, %A + ret i32 %B +; CHECK: @test4 +; CHECK-NEXT: %B = shl nuw i32 %A, 1 +; CHECK-NEXT: ret i32 %B +} + From aggarwa4 at illinois.edu Wed Feb 16 21:22:08 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 17 Feb 2011 03:22:08 -0000 Subject: [llvm-commits] [poolalloc] r125719 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp Message-ID: <20110217032208.A31E92A6C12C@llvm.org> Author: aggarwa4 Date: Wed Feb 16 21:22:08 2011 New Revision: 125719 URL: http://llvm.org/viewvc/llvm-project?rev=125719&view=rev Log: Adding a few more functions. Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=125719&r1=125718&r2=125719&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Wed Feb 16 21:22:08 2011 @@ -101,6 +101,7 @@ {"gets", {NRET_NARGS, YRET_YARGS, NRET_NARGS, YRET_YNARGS, false}}, {"fgets", {NRET_NYARGS, YRET_YNARGS, NRET_NARGS, YRET_YNARGS, false}}, {"getc", {NRET_YNARGS, YRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, + {"ungetc", {NRET_YNARGS, YRET_YARGS, NRET_NARGS, NRET_NARGS, false}}, {"_IO_getc", {NRET_YNARGS, YRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, {"fgetc", {NRET_YNARGS, YRET_YNARGS, NRET_NARGS, NRET_NARGS, false}}, {"putc", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, @@ -176,6 +177,7 @@ {"unlink", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, {"perror", {NRET_YARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, + {"__errno_location", {NRET_NARGS, YRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, // SAFECode Intrinsics {"sc.lscheck", {NRET_NARGS, NRET_NARGS, NRET_NARGS, NRET_NARGS, false}}, From aggarwa4 at illinois.edu Wed Feb 16 21:24:58 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Thu, 17 Feb 2011 03:24:58 -0000 Subject: [llvm-commits] [poolalloc] r125720 - in /poolalloc/trunk/lib/DSA: DSGraph.cpp Local.cpp Message-ID: <20110217032458.373762A6C12C@llvm.org> Author: aggarwa4 Date: Wed Feb 16 21:24:58 2011 New Revision: 125720 URL: http://llvm.org/viewvc/llvm-project?rev=125720&view=rev Log: 1. Add some simple type inference optimizations. 2. Remove some code that was added to handle ugly geps. We hopefully dont need that now. 3. Assume globals dont need to marked I after local unless they are passed as args. Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp poolalloc/trunk/lib/DSA/Local.cpp Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=125720&r1=125719&r2=125720&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DSGraph.cpp (original) +++ poolalloc/trunk/lib/DSA/DSGraph.cpp Wed Feb 16 21:24:58 2011 @@ -59,6 +59,8 @@ cl::init(false)); } +extern cl::opt TypeInferenceOptimize; + // Determines if the DSGraph 'should' have a node for a given value. static bool shouldHaveNodeForValue(const Value *V) { // Peer through casts @@ -655,12 +657,14 @@ markIncomplete(*I); // Mark all global nodes as incomplete that aren't initialized and constant. - if ((Flags & DSGraph::IgnoreGlobals) == 0) + if ((Flags & DSGraph::IgnoreGlobals) == 0) for (DSScalarMap::global_iterator I = ScalarMap.global_begin(), E = ScalarMap.global_end(); I != E; ++I) - if (const GlobalVariable *GV = dyn_cast(*I)) - if (!(GV->hasInitializer() && GV->isConstant())) - markIncompleteNode(ScalarMap[GV].getNode()); + if (const GlobalVariable *GV = dyn_cast(*I)) { + if (!(GV->hasInitializer() && GV->isConstant())){ + markIncompleteNode(ScalarMap[GV].getNode()); + } + } // Mark any node with the VAStart flag as incomplete. if (Flags & DSGraph::MarkVAStart) { @@ -741,9 +745,14 @@ const Function &F = *FI->first; // Mark its arguments, return value (and vanode) as external. for (Function::const_arg_iterator I = F.arg_begin(), E = F.arg_end(); - I != E; ++I) + I != E; ++I){ + if(TypeInferenceOptimize) { + if(I->getNameStr() == "argv") + continue; + } if (isa(I->getType())) markExternalNode(getNodeForValue(I).getNode(), processedNodes); + } markExternalNode(FI->second.getNode(), processedNodes); markExternalNode(getVANodeFor(F).getNode(), processedNodes); } @@ -791,6 +800,17 @@ for (DSScalarMap::global_iterator I = ScalarMap.global_begin(), E = ScalarMap.global_end(); I != E; ++I) { if (const GlobalVariable *GV = dyn_cast(*I)) { + if(TypeInferenceOptimize) { + if(GV->getNameStr() == "stderr"){ + continue; + } + if(GV->getNameStr() == "stdout"){ + continue; + } + if(GV->getNameStr() == "stdin"){ + continue; + } + } // If the global is external... mark it as such! DSNode * N = ScalarMap[GV].getNode(); if (!(GV->hasInternalLinkage() || GV->hasPrivateLinkage()) || N->isExternalNode()) Modified: poolalloc/trunk/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=125720&r1=125719&r2=125720&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/Local.cpp (original) +++ poolalloc/trunk/lib/DSA/Local.cpp Wed Feb 16 21:24:58 2011 @@ -45,19 +45,17 @@ STATISTIC(NumIndirectCall, "Number of indirect calls added"); STATISTIC(NumAsmCall, "Number of asm calls collapsed/seen"); STATISTIC(NumIntrinsicCall, "Number of intrinsics called"); -STATISTIC(NumUglyGep, "Number of uglygeps"); -STATISTIC(NumUglyGep1, "Number of uglygeps caught"); RegisterPass X("dsa-local", "Local Data Structure Analysis"); cl::opt hasMagicSections("dsa-magic-sections", cl::desc("File with section to global mapping")); //, cl::ReallyHidden); -static cl::opt TypeInferenceOptimize("enable-type-inference-opts", - cl::desc("Enable Type Inference Optimizations added to DSA."), - cl::Hidden, - cl::init(false)); } +cl::opt TypeInferenceOptimize("enable-type-inference-opts", + cl::desc("Enable Type Inference Optimizations added to DSA."), + cl::Hidden, + cl::init(false)); namespace { //===--------------------------------------------------------------------===// @@ -208,53 +206,6 @@ void mergeFunction(Function* F) { getValueDest(F); } }; - static bool handleUglygep(GetElementPtrInst *GEPInst, int *Offset) { - int O = 0; - llvm::Value* Val = GEPInst->getOperand(1); - if(isa(Val)) { - O = (cast(Val))->getSExtValue(); - } else { - std::vector exprs; - while(!isa(Val)){ - exprs.push_back(Val); - if(BinaryOperator *BI = dyn_cast(Val)){ - if(!isa(BI->getOperand(1))){ - return false; - } - Val = BI->getOperand(0); - }else { - return false; - } - } - PHINode *phi = cast(Val); - if(phi->getNumIncomingValues() > 3){ - return false; - } - if(isa(phi->getIncomingValue(1))) - O = (cast(phi->getIncomingValue(1)))->getSExtValue(); - else if(isa(phi->getIncomingValue(0))) - O = (cast(phi->getIncomingValue(0)))->getSExtValue(); - else if(isa(phi->getIncomingValue(2))) - O = (cast(phi->getIncomingValue(2)))->getSExtValue(); - while (!exprs.empty()) { - llvm::Value* V = exprs.back(); - exprs.pop_back(); - BinaryOperator *BI = cast(V); - unsigned O1 = (cast(BI->getOperand(1)))->getSExtValue(); - switch(BI->getOpcode()){ - case llvm::BinaryOperator::Shl: O = O << O1;break; - case llvm::BinaryOperator::Or: O = O | O1;break; - case llvm::BinaryOperator::And: O = O & O1;break; - case llvm::BinaryOperator::Add: O = O + O1;break; - case llvm::BinaryOperator::Sub: O = O - O1;break; - case llvm::BinaryOperator::Mul: O = O * O1;break; - default: errs() <<"NOT HANDLED : " << BI << "\n";return false; - } - } - } - *Offset = O; - return true; - } /// Traverse the whole DSGraph, and propagate the unknown flags through all /// out edges. static void propagateUnknownFlag(DSGraph * G) { @@ -548,6 +499,8 @@ return; } + if(GEP.use_empty()) + return; // // Okay, no easy way out. Calculate the offset into the object being // indexed. @@ -555,50 +508,6 @@ int Offset = 0; - if(TypeInferenceOptimize) { - // Trying to special case constant index GEPs - if(GetElementPtrInst *GEPInst = dyn_cast(&GEP)) { - if(GEPInst->hasAllConstantIndices()){ - if(GEPInst->getType() == - llvm::Type::getInt8PtrTy(GEPInst->getParent()->getParent()->getContext())) - if(GEPInst->getNumIndices() == 1) { - Offset = (cast(GEPInst->getOperand(1)))->getSExtValue(); - if(Value.getNode()->getSize() <= Value.getOffset() + (Offset+1)) { - Value.getNode()->growSize(Value.getOffset() + Offset + 1); - } - Value.setOffset(Value.getOffset()+Offset); - DSNode *N = Value.getNode(); - if(((int)Value.getOffset() + Offset) < 0) - N->foldNodeCompletely(); - setDestTo(GEP, Value); - return; - } - } - } - } - - if(TypeInferenceOptimize) { - if(GetElementPtrInst *GEPInst = dyn_cast(&GEP)) { - std::string name = GEPInst->getName(); - if (strncmp(name.c_str(), "uglygep", 7) == 0) { - ++NumUglyGep; - assert(GEPInst->getNumOperands() == 2); - int O; - if(handleUglygep(GEPInst, &O)) { - if(Value.getNode()->getSize() <= Value.getOffset() + O+1) - Value.getNode()->growSize(Value.getOffset() + O+1); - Value.setOffset(Value.getOffset()+O); - DSNode *N = Value.getNode(); - if(((int)Value.getOffset() + O) < 0) - N->foldNodeCompletely(); - setDestTo(GEP, Value); - ++NumUglyGep1; - return; - } - } - } - } - // FIXME: I am not sure if the code below is completely correct (especially // if we start doing fancy analysis on non-constant array indices). // What if the array is indexed using a larger index than its declared @@ -631,18 +540,20 @@ if (requiredSize > Value.getNode()->getSize()) Value.getNode()->growSize(requiredSize); } - Offset += (unsigned)TD.getStructLayout(STy)->getElementOffset(FieldNo); + if(TypeInferenceOptimize) { + if(const ArrayType* AT = dyn_cast(STy->getTypeAtIndex(FieldNo))) { + Value.getNode()->mergeTypeInfo(AT, Value.getOffset() + Offset); + if((++I) == E) { + break; + } + } + } } else if(const ArrayType *ATy = dyn_cast(*I)) { // indexing into an array. Value.getNode()->setArrayMarker(); const Type *CurTy = ATy->getElementType(); - if(TypeInferenceOptimize) { - //if(const ConstantInt* CUI = dyn_cast(I.getOperand())) - //if(ATy->getNumElements() > CUI->getZExtValue()) - //CUI->dump(); - } if(!isa(CurTy) && Value.getNode()->getSize() <= 0) { @@ -847,8 +758,7 @@ // Merge the first & second arguments, and mark the memory read and // modified. DSNodeHandle RetNH = getValueDest(*CS.arg_begin()); - if(!TypeInferenceOptimize) - RetNH.mergeWith(getValueDest(*(CS.arg_begin()+1))); + RetNH.mergeWith(getValueDest(*(CS.arg_begin()+1))); if (DSNode *N = RetNH.getNode()) N->setModifiedMarker()->setReadMarker(); return true; @@ -1281,6 +1191,7 @@ // collecting them in a list, to be used as target for call sites that // cant be resolved. formGlobalFunctionList(); + GlobalsGraph->maskIncompleteMarkers(); // Calculate all of the graphs... for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) @@ -1292,11 +1203,18 @@ propagateUnknownFlag(G); callgraph.insureEntry(I); G->buildCallGraph(callgraph, GlobalFunctionList, true); + G->maskIncompleteMarkers(); + G->markIncompleteNodes(DSGraph::MarkFormalArgs + |DSGraph::IgnoreGlobals); + cloneIntoGlobals(G, DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes | + DSGraph::StripAllocaBit); DEBUG(G->AssertGraphOK()); } //GlobalsGraph->removeTriviallyDeadNodes(); - GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); + GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs + |DSGraph::IgnoreGlobals); GlobalsGraph->computeExternalFlags(DSGraph::ProcessCallSites); // Now that we've computed all of the graphs, and merged all of the info into @@ -1306,6 +1224,16 @@ formGlobalECs(); propagateUnknownFlag(GlobalsGraph); + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (!I->isDeclaration()) { + DSGraph *Graph = getOrCreateGraph(I); + Graph->maskIncompleteMarkers(); + cloneGlobalsInto(Graph, DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); + Graph->markIncompleteNodes(DSGraph::MarkFormalArgs + |DSGraph::IgnoreGlobals); + } + return false; } From grosser at fim.uni-passau.de Wed Feb 16 21:52:20 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Wed, 16 Feb 2011 22:52:20 -0500 Subject: [llvm-commits] [llvm] r125709 - /llvm/trunk/docs/ProgrammersManual.html In-Reply-To: <20110217021922.E8D4A2A6C12C@llvm.org> References: <20110217021922.E8D4A2A6C12C@llvm.org> Message-ID: <4D5C9B74.3090406@fim.uni-passau.de> On 02/16/2011 09:19 PM, Nick Lewycky wrote: > Author: nicholas > Date: Wed Feb 16 20:19:22 2011 > New Revision: 125709 > > URL: http://llvm.org/viewvc/llvm-project?rev=125709&view=rev > Log: > Fix thinko, basic blocks are SESE. The exits may have many edges though. > > Modified: > llvm/trunk/docs/ProgrammersManual.html > > Modified: llvm/trunk/docs/ProgrammersManual.html > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=125709&r1=125708&r2=125709&view=diff > ============================================================================== > --- llvm/trunk/docs/ProgrammersManual.html (original) > +++ llvm/trunk/docs/ProgrammersManual.html Wed Feb 16 20:19:22 2011 > @@ -3856,7 +3856,7 @@ > Class
      > Superclass:Value

      > > -

      This class represents a single entry multiple exit section of the code, > +

      This class represents a single entry single exit section of the code, Hi Nick, for me this sentence is a little confusing. What do you consider the entry and the exit of a basic block? As far as I understand single entry single exit regions commonly refer to subgraphs of the CFG that have only a single entry EDGE and a single exit EDGE. Following this definition a basic block can actually be a multiple entry multiple exit region. You could argue the first and the last instruction of a basic block are the single entry and the single exit. However, without explanation this is not obvious to me. What about changing the sentence to: "The BasicBlock class represents a section of code that is executed sequentially and does not contain any diverging control flow." or to rewrite more of this "The BasicBlock class represents a list of instructions that is executed sequentially without diverging control flow in between. Matching the language definition, the last element of this list of instructions is always a terminator instruction (a subclass of the TerminatorInst class). The terminator instruction is the only instruction after which the control flow may diverge." Cheers Tobi From scshunt at csclub.uwaterloo.ca Wed Feb 16 21:30:09 2011 From: scshunt at csclub.uwaterloo.ca (Sean Hunt) Date: Thu, 17 Feb 2011 03:30:09 -0000 Subject: [llvm-commits] [llvm] r125721 - /llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp Message-ID: <20110217033009.E3F9B2A6C12C@llvm.org> Author: coppro Date: Wed Feb 16 21:30:09 2011 New Revision: 125721 URL: http://llvm.org/viewvc/llvm-project?rev=125721&view=rev Log: Add serialization for Expr* arguments for attributes to clang tablegen files. Patch thanks to Zach Anderson. Modified: llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp Modified: llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=125721&r1=125720&r2=125721&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/ClangAttrEmitter.cpp Wed Feb 16 21:30:09 2011 @@ -45,6 +45,7 @@ .EndsWith("Decl *", "cast_or_null<" + std::string(type, 0, type.size()-1) + ">(GetDecl(Record[Idx++]))") .Case("QualType", "GetType(Record[Idx++])") + .Case("Expr *", "ReadSubExpr()") .Default("Record[Idx++]"); } @@ -54,6 +55,7 @@ .EndsWith("Decl *", "AddDeclRef(" + std::string(name) + ", Record);\n") .Case("QualType", "AddTypeRef(" + std::string(name) + ", Record);\n") + .Case("Expr *", "AddStmt(" + std::string(name) + ");\n") .Default("Record.push_back(" + std::string(name) + ");\n"); } From pawel.kunio at gmail.com Wed Feb 16 23:13:40 2011 From: pawel.kunio at gmail.com (pawel kunio) Date: Thu, 17 Feb 2011 07:13:40 +0200 Subject: [llvm-commits] my 2nd attempt at now-infamous PR889 Message-ID: Hello, In a meantime of preparing 2 tests for PR9067, I came with my 2nd and hopefully now more successful attempt at now-infamous PR889 devirtualize Value destructor. Please find patches for llvm and clang attached to this mail. As I can see from mingw build environment, it will need moving PseudoSourceValue.cpp from lib/CodeGen to lib/VMCore after applying patch (seems not to be required on vc build env, as order of libraries given to linker is not meaningful there). Please note that destructors have been moved into protected part of interface as well as empty destructors were implemented for all Value-derived classes to help in catching all destructions. Best regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/92313f9d/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm_Value_destr_devirtualize.patch Type: application/octet-stream Size: 118479 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/92313f9d/attachment-0002.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: clang_Value_destr_devirtualize.patch Type: application/octet-stream Size: 2709 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/92313f9d/attachment-0003.obj From geek4civic at gmail.com Wed Feb 16 23:56:42 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 17 Feb 2011 05:56:42 -0000 Subject: [llvm-commits] [llvm] r125725 - /llvm/trunk/utils/lit/lit/TestingConfig.py Message-ID: <20110217055642.25F1C2A6C12C@llvm.org> Author: chapuni Date: Wed Feb 16 23:56:41 2011 New Revision: 125725 URL: http://llvm.org/viewvc/llvm-project?rev=125725&view=rev Log: lit/TestingConfig.py: Add the environment variable PRINTF_EXPONENT_DIGITS as workaround [PR6745] for mingw's tests. Danil Malyshev suggested this. FIXME: It does not improve MSVC's issue. [Danil Malyshev] Defining PRINTF_EXPONENT_DIGITS env is the suggested way to make MinGW ANSI/POSIX compatible. This is not only about the case we are discussing, but in general, I'd like to have explicitly defined compatibility mode for all the tests running on MinGW. Modified: llvm/trunk/utils/lit/lit/TestingConfig.py Modified: llvm/trunk/utils/lit/lit/TestingConfig.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=125725&r1=125724&r2=125725&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit/TestingConfig.py (original) +++ llvm/trunk/utils/lit/lit/TestingConfig.py Wed Feb 16 23:56:41 2011 @@ -17,6 +17,7 @@ 'PATHEXT' : os.environ.get('PATHEXT',''), 'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''), 'LLVM_DISABLE_CRT_DEBUG' : '1', + 'PRINTF_EXPONENT_DIGITS' : '2', } config = TestingConfig(parent, From geek4civic at gmail.com Thu Feb 17 00:02:59 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 17 Feb 2011 15:02:59 +0900 Subject: [llvm-commits] Fix floating point numbers in tests on MinGW In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE17DD2905F9@mail.accesssoftek.com> References: <6AE1604EE3EC5F4296C096518C6B77EE1774A4AA26@mail.accesssoftek.com> <6AE1604EE3EC5F4296C096518C6B77EE17DD2905F9@mail.accesssoftek.com> Message-ID: Danil, Committed in r125725! On Thu, Feb 17, 2011 at 1:21 AM, Danil Malyshev wrote: > A week passed and nobody else replyed yet, so it seems we are the only two who cares of this issue. :) I guess few persons would watch mingw. :D In my impression, there are many users with msvc in win32sphere. > I understand that it does not fix issues with scientific notation in general. It seems that you need to follow up with your patch, since you feel strong for it. This patch does not block you or affect you on any way. Please watch on PR6745, thank you! I will revert it in my local repo, to fix the issue. ...Takumi From zwarich at apple.com Thu Feb 17 00:13:44 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 17 Feb 2011 06:13:44 -0000 Subject: [llvm-commits] [llvm] r125726 - /llvm/trunk/lib/CodeGen/PHIElimination.cpp Message-ID: <20110217061344.20B3E2A6C12C@llvm.org> Author: zwarich Date: Thu Feb 17 00:13:43 2011 New Revision: 125726 URL: http://llvm.org/viewvc/llvm-project?rev=125726&view=rev Log: Return Changed from SplitPHIEdges rather than always returning true. Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=125726&r1=125725&r2=125726&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Thu Feb 17 00:13:43 2011 @@ -423,5 +423,5 @@ } } } - return true; + return Changed; } From zwarich at apple.com Thu Feb 17 00:13:46 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 17 Feb 2011 06:13:46 -0000 Subject: [llvm-commits] [llvm] r125727 - /llvm/trunk/lib/CodeGen/PHIElimination.cpp Message-ID: <20110217061346.C89222A6C12D@llvm.org> Author: zwarich Date: Thu Feb 17 00:13:46 2011 New Revision: 125727 URL: http://llvm.org/viewvc/llvm-project?rev=125727&view=rev Log: Adjust indenting of arguments. Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=125727&r1=125726&r2=125727&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Thu Feb 17 00:13:46 2011 @@ -393,9 +393,9 @@ } bool PHIElimination::SplitPHIEdges(MachineFunction &MF, - MachineBasicBlock &MBB, - LiveVariables &LV, - MachineLoopInfo *MLI) { + MachineBasicBlock &MBB, + LiveVariables &LV, + MachineLoopInfo *MLI) { if (MBB.empty() || !MBB.front().isPHI() || MBB.isLandingPad()) return false; // Quick exit for basic blocks without PHIs. From zwarich at apple.com Thu Feb 17 00:52:07 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 17 Feb 2011 06:52:07 -0000 Subject: [llvm-commits] [llvm] r125728 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <20110217065207.B3F652A6C12C@llvm.org> Author: zwarich Date: Thu Feb 17 00:52:07 2011 New Revision: 125728 URL: http://llvm.org/viewvc/llvm-project?rev=125728&view=rev Log: Switch to SmallVector in SimpleRegisterCoalescing for a 3.5% speedup on 403.gcc. 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=125728&r1=125727&r2=125728&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Thu Feb 17 00:52:07 2011 @@ -1425,9 +1425,9 @@ std::vector &TryAgain) { DEBUG(dbgs() << MBB->getName() << ":\n"); - std::vector VirtCopies; - std::vector PhysCopies; - std::vector ImpDefCopies; + SmallVector VirtCopies; + SmallVector PhysCopies; + SmallVector ImpDefCopies; for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end(); MII != E;) { MachineInstr *Inst = MII++; From baldrick at free.fr Thu Feb 17 01:23:15 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 07:23:15 -0000 Subject: [llvm-commits] [dragonegg] r125732 - /dragonegg/trunk/gcc_revision_tested_with Message-ID: <20110217072315.8FBEB2A6C12C@llvm.org> Author: baldrick Date: Thu Feb 17 01:23:15 2011 New Revision: 125732 URL: http://llvm.org/viewvc/llvm-project?rev=125732&view=rev Log: Bump the gcc revision used by the buildbots. Modified: dragonegg/trunk/gcc_revision_tested_with Modified: dragonegg/trunk/gcc_revision_tested_with URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/gcc_revision_tested_with?rev=125732&r1=125731&r2=125732&view=diff ============================================================================== --- dragonegg/trunk/gcc_revision_tested_with (original) +++ dragonegg/trunk/gcc_revision_tested_with Thu Feb 17 01:23:15 2011 @@ -1 +1 @@ -163634 +168940 From fvbommel at gmail.com Thu Feb 17 01:29:13 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Thu, 17 Feb 2011 08:29:13 +0100 Subject: [llvm-commits] [llvm] r125711 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineAddSub.cpp test/Transforms/InstCombine/add2.ll In-Reply-To: <20110217022302.D26322A6C12C@llvm.org> References: <20110217022302.D26322A6C12C@llvm.org> Message-ID: On Thu, Feb 17, 2011 at 3:23 AM, Chris Lattner wrote: > ? // X + X --> X << 1 > - ?if (LHS == RHS && I.getType()->isIntegerTy()) > - ? ?return BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1)); > + ?if (LHS == RHS && I.getType()->isIntegerTy()) { I think the isIntegerTy() check is redundant now that fadd has its own operator. From baldrick at free.fr Thu Feb 17 01:46:37 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 07:46:37 -0000 Subject: [llvm-commits] [llvm] r125734 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/icmp.ll Message-ID: <20110217074637.C00232A6C12C@llvm.org> Author: baldrick Date: Thu Feb 17 01:46:37 2011 New Revision: 125734 URL: http://llvm.org/viewvc/llvm-project?rev=125734&view=rev Log: Transform "A + B >= A + C" into "B >= C" if the adds do not wrap. Likewise for some variations (some of these were already present so I unified the code). Spotted by my auto-simplifier as occurring a lot. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp llvm/trunk/test/Transforms/InstCombine/icmp.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=125734&r1=125733&r2=125734&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Thu Feb 17 01:46:37 2011 @@ -698,13 +698,6 @@ if (Pred == ICmpInst::ICMP_NE) return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(X->getContext())); - // If this is an instruction (as opposed to constantexpr) get NUW/NSW info. - bool isNUW = false, isNSW = false; - if (BinaryOperator *Add = dyn_cast(TheAdd)) { - isNUW = Add->hasNoUnsignedWrap(); - isNSW = Add->hasNoSignedWrap(); - } - // From this point on, we know that (X+C <= X) --> (X+C < X) because C != 0, // so the values can never be equal. Similiarly for all other "or equals" // operators. @@ -713,10 +706,6 @@ // (X+2) X >u (MAXUINT-2) --> X > 253 // (X+MAXUINT) X >u (MAXUINT-MAXUINT) --> X != 0 if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) { - // If this is an NUW add, then this is always false. - if (isNUW) - return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(X->getContext())); - Value *R = ConstantExpr::getSub(ConstantInt::getAllOnesValue(CI->getType()), CI); return new ICmpInst(ICmpInst::ICMP_UGT, X, R); @@ -725,12 +714,8 @@ // (X+1) >u X --> X X != 255 // (X+2) >u X --> X X u X --> X X X == 0 - if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE) { - // If this is an NUW add, then this is always true. - if (isNUW) - return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(X->getContext())); + if (Pred == ICmpInst::ICMP_UGT || Pred == ICmpInst::ICMP_UGE) return new ICmpInst(ICmpInst::ICMP_ULT, X, ConstantExpr::getNeg(CI)); - } unsigned BitWidth = CI->getType()->getPrimitiveSizeInBits(); ConstantInt *SMax = ConstantInt::get(X->getContext(), @@ -742,16 +727,8 @@ // (X+MINSINT) X >s (MAXSINT-MINSINT) --> X >s -1 // (X+ -2) X >s (MAXSINT- -2) --> X >s 126 // (X+ -1) X >s (MAXSINT- -1) --> X != 127 - if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE) { - // If this is an NSW add, then we have two cases: if the constant is - // positive, then this is always false, if negative, this is always true. - if (isNSW) { - bool isTrue = CI->getValue().isNegative(); - return ReplaceInstUsesWith(ICI, ConstantInt::get(ICI.getType(), isTrue)); - } - + if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE) return new ICmpInst(ICmpInst::ICMP_SGT, X, ConstantExpr::getSub(SMax, CI)); - } // (X+ 1) >s X --> X X != 127 // (X+ 2) >s X --> X X s X --> X X s X --> X X == -128 - // If this is an NSW add, then we have two cases: if the constant is - // positive, then this is always true, if negative, this is always false. - if (isNSW) { - bool isTrue = !CI->getValue().isNegative(); - return ReplaceInstUsesWith(ICI, ConstantInt::get(ICI.getType(), isTrue)); - } - assert(Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE); Constant *C = ConstantInt::get(X->getContext(), CI->getValue()-1); return new ICmpInst(ICmpInst::ICMP_SLT, X, ConstantExpr::getSub(SMax, C)); @@ -2263,60 +2233,115 @@ if (Instruction *R = visitICmpInstWithCastAndCast(I)) return R; } - - // See if it's the same type of instruction on the left and right. - if (BinaryOperator *Op0I = dyn_cast(Op0)) { - if (BinaryOperator *Op1I = dyn_cast(Op1)) { - if (Op0I->getOpcode() == Op1I->getOpcode() && Op0I->hasOneUse() && - Op1I->hasOneUse() && Op0I->getOperand(1) == Op1I->getOperand(1)) { - switch (Op0I->getOpcode()) { - default: break; - case Instruction::Add: - case Instruction::Sub: - case Instruction::Xor: - if (I.isEquality()) // a+x icmp eq/ne b+x --> a icmp b - return new ICmpInst(I.getPredicate(), Op0I->getOperand(0), - Op1I->getOperand(0)); - // icmp u/s (a ^ signbit), (b ^ signbit) --> icmp s/u a, b - if (ConstantInt *CI = dyn_cast(Op0I->getOperand(1))) { - if (CI->getValue().isSignBit()) { - ICmpInst::Predicate Pred = I.isSigned() - ? I.getUnsignedPredicate() - : I.getSignedPredicate(); - return new ICmpInst(Pred, Op0I->getOperand(0), - Op1I->getOperand(0)); - } - - if (CI->getValue().isMaxSignedValue()) { - ICmpInst::Predicate Pred = I.isSigned() - ? I.getUnsignedPredicate() - : I.getSignedPredicate(); - Pred = I.getSwappedPredicate(Pred); - return new ICmpInst(Pred, Op0I->getOperand(0), - Op1I->getOperand(0)); - } + + // Special logic for binary operators. + BinaryOperator *BO0 = dyn_cast(Op0); + BinaryOperator *BO1 = dyn_cast(Op1); + if (BO0 || BO1) { + CmpInst::Predicate Pred = I.getPredicate(); + bool NoOp0WrapProblem = false, NoOp1WrapProblem = false; + if (BO0 && isa(BO0)) + NoOp0WrapProblem = ICmpInst::isEquality(Pred) || + (CmpInst::isUnsigned(Pred) && BO0->hasNoUnsignedWrap()) || + (CmpInst::isSigned(Pred) && BO0->hasNoSignedWrap()); + if (BO1 && isa(BO1)) + NoOp1WrapProblem = ICmpInst::isEquality(Pred) || + (CmpInst::isUnsigned(Pred) && BO1->hasNoUnsignedWrap()) || + (CmpInst::isSigned(Pred) && BO1->hasNoSignedWrap()); + + // Analyze the case when either Op0 or Op1 is an add instruction. + // Op0 = A + B (or A and B are null); Op1 = C + D (or C and D are null). + Value *A = 0, *B = 0, *C = 0, *D = 0; + if (BO0 && BO0->getOpcode() == Instruction::Add) + A = BO0->getOperand(0), B = BO0->getOperand(1); + if (BO1 && BO1->getOpcode() == Instruction::Add) + C = BO1->getOperand(0), D = BO1->getOperand(1); + + // icmp (X+Y), X -> icmp Y, 0 for equalities or if there is no overflow. + if ((A == Op1 || B == Op1) && NoOp0WrapProblem) + return new ICmpInst(Pred, A == Op1 ? B : A, + Constant::getNullValue(Op1->getType())); + + // icmp X, (X+Y) -> icmp 0, Y for equalities or if there is no overflow. + if ((C == Op0 || D == Op0) && NoOp1WrapProblem) + return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()), + C == Op0 ? D : C); + + // icmp (X+Y), (X+Z) -> icmp Y,Z for equalities or if there is no overflow. + if (A && C && (A == C || A == D || B == C || B == D) && + NoOp0WrapProblem && NoOp1WrapProblem && + // Try not to increase register pressure. + BO0->hasOneUse() && BO1->hasOneUse()) { + // Determine Y and Z in the form icmp (X+Y), (X+Z). + Value *Y = (A == C || A == D) ? B : A; + Value *Z = (C == A || C == B) ? D : C; + return new ICmpInst(Pred, Y, Z); + } + + // Analyze the case when either Op0 or Op1 is a sub instruction. + // Op0 = A - B (or A and B are null); Op1 = C - D (or C and D are null). + A = 0; B = 0; C = 0; D = 0; + if (BO0 && BO0->getOpcode() == Instruction::Sub) + A = BO0->getOperand(0), B = BO0->getOperand(1); + if (BO1 && BO1->getOpcode() == Instruction::Sub) + C = BO1->getOperand(0), D = BO1->getOperand(1); + + // icmp (Y-X), (Z-X) -> icmp Y,Z for equalities or if there is no overflow. + if (B && D && B == D && NoOp0WrapProblem && NoOp1WrapProblem && + // Try not to increase register pressure. + BO0->hasOneUse() && BO1->hasOneUse()) + return new ICmpInst(Pred, A, C); + + if (BO0 && BO1 && BO0->getOpcode() == BO1->getOpcode() && + BO0->hasOneUse() && BO1->hasOneUse() && + BO0->getOperand(1) == BO1->getOperand(1)) { + switch (BO0->getOpcode()) { + default: break; + case Instruction::Add: + case Instruction::Sub: + case Instruction::Xor: + if (I.isEquality()) // a+x icmp eq/ne b+x --> a icmp b + return new ICmpInst(I.getPredicate(), BO0->getOperand(0), + BO1->getOperand(0)); + // icmp u/s (a ^ signbit), (b ^ signbit) --> icmp s/u a, b + if (ConstantInt *CI = dyn_cast(BO0->getOperand(1))) { + if (CI->getValue().isSignBit()) { + ICmpInst::Predicate Pred = I.isSigned() + ? I.getUnsignedPredicate() + : I.getSignedPredicate(); + return new ICmpInst(Pred, BO0->getOperand(0), + BO1->getOperand(0)); } - break; - case Instruction::Mul: - if (!I.isEquality()) - break; - - if (ConstantInt *CI = dyn_cast(Op0I->getOperand(1))) { - // a * Cst icmp eq/ne b * Cst --> a & Mask icmp b & Mask - // Mask = -1 >> count-trailing-zeros(Cst). - if (!CI->isZero() && !CI->isOne()) { - const APInt &AP = CI->getValue(); - ConstantInt *Mask = ConstantInt::get(I.getContext(), - APInt::getLowBitsSet(AP.getBitWidth(), - AP.getBitWidth() - - AP.countTrailingZeros())); - Value *And1 = Builder->CreateAnd(Op0I->getOperand(0), Mask); - Value *And2 = Builder->CreateAnd(Op1I->getOperand(0), Mask); - return new ICmpInst(I.getPredicate(), And1, And2); - } + + if (CI->getValue().isMaxSignedValue()) { + ICmpInst::Predicate Pred = I.isSigned() + ? I.getUnsignedPredicate() + : I.getSignedPredicate(); + Pred = I.getSwappedPredicate(Pred); + return new ICmpInst(Pred, BO0->getOperand(0), + BO1->getOperand(0)); } + } + break; + case Instruction::Mul: + if (!I.isEquality()) break; + + if (ConstantInt *CI = dyn_cast(BO0->getOperand(1))) { + // a * Cst icmp eq/ne b * Cst --> a & Mask icmp b & Mask + // Mask = -1 >> count-trailing-zeros(Cst). + if (!CI->isZero() && !CI->isOne()) { + const APInt &AP = CI->getValue(); + ConstantInt *Mask = ConstantInt::get(I.getContext(), + APInt::getLowBitsSet(AP.getBitWidth(), + AP.getBitWidth() - + AP.countTrailingZeros())); + Value *And1 = Builder->CreateAnd(BO0->getOperand(0), Mask); + Value *And2 = Builder->CreateAnd(BO1->getOperand(0), Mask); + return new ICmpInst(I.getPredicate(), And1, And2); + } } + break; } } } @@ -2400,18 +2425,6 @@ return new ICmpInst(I.getPredicate(), B, Constant::getNullValue(B->getType())); - // (A+B) == A -> B == 0 - if (match(Op0, m_Add(m_Specific(Op1), m_Value(B))) || - match(Op0, m_Add(m_Value(B), m_Specific(Op1)))) - return new ICmpInst(I.getPredicate(), B, - Constant::getNullValue(B->getType())); - - // A == (A+B) -> B == 0 - if (match(Op1, m_Add(m_Specific(Op0), m_Value(B))) || - match(Op1, m_Add(m_Value(B), m_Specific(Op0)))) - return new ICmpInst(I.getPredicate(), B, - Constant::getNullValue(B->getType())); - // (X&Z) == (Y&Z) -> (X^Y) & Z == 0 if (Op0->hasOneUse() && Op1->hasOneUse() && match(Op0, m_And(m_Value(A), m_Value(B))) && Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=125734&r1=125733&r2=125734&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Thu Feb 17 01:46:37 2011 @@ -234,3 +234,22 @@ ret i1 %cmp } +; CHECK: @test25 +; CHECK: %c = icmp sgt i32 %x, %y +; CHECK: ret i1 %c +define i1 @test25(i32 %x, i32 %y, i32 %z) { + %lhs = add nsw i32 %x, %z + %rhs = add nsw i32 %y, %z + %c = icmp sgt i32 %lhs, %rhs + ret i1 %c +} + +; CHECK: @test26 +; CHECK: %c = icmp sgt i32 %x, %y +; CHECK: ret i1 %c +define i1 @test26(i32 %x, i32 %y, i32 %z) { + %lhs = sub nsw i32 %x, %z + %rhs = sub nsw i32 %y, %z + %c = icmp sgt i32 %lhs, %rhs + ret i1 %c +} From geek4civic at gmail.com Thu Feb 17 02:04:50 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 17 Feb 2011 17:04:50 +0900 Subject: [llvm-commits] [Review Request][PR9234] 59 patches of test/CodeGen/X86 for Windows hosts Message-ID: Hello, guys! At first, excuse me to post bored patches. Please be patient. (IIRC, this is take 3) http://llvm.org/bugs/show_bug.cgi?id=9234 On Windows hosts, llc -march=x86_64 is inferred as -mtriple=x86_64-{mingw32|win32}, and many tests would fail due to difference of Win64 ABI. It would be easier to add explicit -mtriple=x86_64-{darwin|linux} to hide failures. Some guys have advised me not to hide such failures, and I have been working on. All patches make tests FileCheck-ized. Each patch can be categorized; - Add explicit -mtriple=x86_64-linux. They would be nonsense to apply to Win64. (eg. redzone) - Add both -mtriple=x86_64-linux and x86_64-win32 - Relax expressions to match args registers. eg. %{{rdi|rcx}} - Add a pattern for Win64. I think they would be better. - Add *as-is* pattern for Win64. I gave them up to tweak. I am happy if someone improves them. Individual patches can be browsed at github. https://github.com/chapuni/LLVM/compare/master...w32tests/20110217#files_bucket I guess it would be hard (and bored, me too!), though, please take a look into them, thank you! ...Takumi test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll | 7 ++- test/CodeGen/X86/2007-07-18-Vector-Extract.ll | 6 ++- test/CodeGen/X86/add.ll | 13 +++-- test/CodeGen/X86/apm.ll | 11 ++++- test/CodeGen/X86/avoid-lea-scale2.ll | 5 ++- test/CodeGen/X86/break-sse-dep.ll | 15 +++--- test/CodeGen/X86/byval.ll | 5 ++- test/CodeGen/X86/byval2.ll | 39 +++++++++++++- test/CodeGen/X86/byval3.ll | 42 ++++++++++++++- test/CodeGen/X86/byval4.ll | 42 ++++++++++++++- test/CodeGen/X86/byval5.ll | 42 ++++++++++++++- test/CodeGen/X86/coalescer-commute2.ll | 21 +++++++- test/CodeGen/X86/codegen-prepare-extload.ll | 5 +- test/CodeGen/X86/constant-pool-remat-0.ll | 35 +++++++++++-- test/CodeGen/X86/constant-pool-sharing.ll | 7 ++- test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll | 12 +++- test/CodeGen/X86/ctpop-combine.ll | 4 +- test/CodeGen/X86/fast-isel-cmp-branch.ll | 7 ++- test/CodeGen/X86/fast-isel-gep.ll | 17 +++--- test/CodeGen/X86/fold-mul-lohi.ll | 5 +- test/CodeGen/X86/gather-addresses.ll | 23 ++++---- test/CodeGen/X86/h-register-store.ll | 32 +++++++++-- test/CodeGen/X86/h-registers-0.ll | 24 ++++++++- test/CodeGen/X86/i128-ret.ll | 6 ++- test/CodeGen/X86/i64-mem-copy.ll | 8 ++- test/CodeGen/X86/lea-3.ll | 15 +++-- test/CodeGen/X86/lea.ll | 9 ++-- test/CodeGen/X86/lsr-overflow.ll | 5 +- test/CodeGen/X86/lsr-reuse-trunc.ll | 9 ++-- test/CodeGen/X86/masked-iv-safe.ll | 43 ++++++++++++--- test/CodeGen/X86/memcmp.ll | 21 ++++---- test/CodeGen/X86/mmx-copy-gprs.ll | 10 +++- test/CodeGen/X86/movgs.ll | 7 ++- test/CodeGen/X86/optimize-max-3.ll | 11 ++-- test/CodeGen/X86/peep-vector-extract-concat.ll | 6 ++- test/CodeGen/X86/pmulld.ll | 12 ++++- test/CodeGen/X86/pr9127.ll | 2 +- test/CodeGen/X86/red-zone.ll | 2 +- test/CodeGen/X86/remat-mov-0.ll | 15 +++--- test/CodeGen/X86/scalar-min-max-fill-operand.ll | 34 +++++++++++- test/CodeGen/X86/sse-align-0.ll | 16 +++++- test/CodeGen/X86/sse-align-3.ll | 20 +++++++- test/CodeGen/X86/sse-align-7.ll | 8 +++- test/CodeGen/X86/sse-commute.ll | 10 +++- test/CodeGen/X86/sse_reload_fold.ll | 5 +- test/CodeGen/X86/stdarg.ll | 16 +++++- test/CodeGen/X86/stride-nine-with-base-reg.ll | 34 +++++++++++- test/CodeGen/X86/stride-reuse.ll | 33 +++++++++++- test/CodeGen/X86/tailcallbyval64.ll | 25 +++++++-- test/CodeGen/X86/test-shrink.ll | 21 ++++---- test/CodeGen/X86/use-add-flags.ll | 15 +++--- test/CodeGen/X86/v2f32.ll | 67 +++++++++++++++++++---- test/CodeGen/X86/vec_cast.ll | 3 +- test/CodeGen/X86/vec_set-8.ll | 7 ++- test/CodeGen/X86/vec_shuffle-17.ll | 7 ++- test/CodeGen/X86/vec_shuffle-37.ll | 5 +- test/CodeGen/X86/widen_load-0.ll | 8 +++- test/CodeGen/X86/x86-64-malloc.ll | 4 +- test/CodeGen/X86/xor.ll | 9 ++-- 59 files changed, 749 insertions(+), 198 deletions(-) -------------- next part -------------- diff --git a/test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll b/test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll index de226a1..3458550 100644 --- a/test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll +++ b/test/CodeGen/X86/2007-01-08-X86-64-Pointer.ll @@ -1,5 +1,8 @@ -; RUN: llc %s -o - -march=x86-64 | grep {(%rdi,%rax,8)} -; RUN: llc %s -o - -march=x86-64 | not grep {addq.*8} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK-NOT: {{addq.*8}} +; CHECK: ({{%rdi|%rcx}},%rax,8) +; CHECK-NOT: {{addq.*8}} define void @foo(double* %y) nounwind { entry: diff --git a/test/CodeGen/X86/2007-07-18-Vector-Extract.ll b/test/CodeGen/X86/2007-07-18-Vector-Extract.ll index 8625b27..6288c4a 100644 --- a/test/CodeGen/X86/2007-07-18-Vector-Extract.ll +++ b/test/CodeGen/X86/2007-07-18-Vector-Extract.ll @@ -1,5 +1,7 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse | grep {movq (%rdi), %rax} -; RUN: llc < %s -march=x86-64 -mattr=+sse | grep {movq 8(%rdi), %rax} +; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse | FileCheck %s +; CHECK: movq ([[A0:%rdi|%rcx]]), %rax +; CHECK: movq 8([[A0]]), %rax define i64 @foo_0(<2 x i64>* %val) { entry: %val12 = getelementptr <2 x i64>* %val, i32 0, i32 0 ; [#uses=1] diff --git a/test/CodeGen/X86/add.ll b/test/CodeGen/X86/add.ll index 3ec5358..62c8980 100644 --- a/test/CodeGen/X86/add.ll +++ b/test/CodeGen/X86/add.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 -; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64 ; The immediate can be encoded in a smaller way if the ; instruction is a sub instead of an add. @@ -43,7 +44,7 @@ overflow: ; X32-NEXT: jo ; X64: test4: -; X64: addl %esi, %edi +; X64: addl %e[[A1:si|dx]], %e[[A0:di|cx]] ; X64-NEXT: jo } @@ -66,7 +67,7 @@ carry: ; X32-NEXT: jb ; X64: test5: -; X64: addl %esi, %edi +; X64: addl %e[[A1]], %e[[A0]] ; X64-NEXT: jb } @@ -87,8 +88,8 @@ define i64 @test6(i64 %A, i32 %B) nounwind { ; X32-NEXT: ret ; X64: test6: -; X64: shlq $32, %rsi -; X64: leaq (%rsi,%rdi), %rax +; X64: shlq $32, %r[[A1]] +; X64: leaq (%r[[A1]],%r[[A0]]), %rax ; X64: ret } @@ -98,7 +99,7 @@ define {i32, i1} @test7(i32 %v1, i32 %v2) nounwind { } ; X64: test7: -; X64: addl %esi, %eax +; X64: addl %e[[A1]], %eax ; X64-NEXT: setb %dl ; X64-NEXT: ret diff --git a/test/CodeGen/X86/apm.ll b/test/CodeGen/X86/apm.ll index d0c64f2..b514cf6 100644 --- a/test/CodeGen/X86/apm.ll +++ b/test/CodeGen/X86/apm.ll @@ -1,10 +1,16 @@ -; RUN: llc < %s -o - -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 ; PR8573 ; CHECK: foo: ; CHECK: leaq (%rdi), %rax ; CHECK-NEXT: movl %esi, %ecx ; CHECK-NEXT: monitor +; WIN64: foo: +; WIN64: leaq (%rcx), %rax +; WIN64-NEXT: movl %edx, %ecx +; WIN64-NEXT: movl %r8d, %edx +; WIN64-NEXT: monitor define void @foo(i8* %P, i32 %E, i32 %H) nounwind { entry: tail call void @llvm.x86.sse3.monitor(i8* %P, i32 %E, i32 %H) @@ -17,6 +23,9 @@ declare void @llvm.x86.sse3.monitor(i8*, i32, i32) nounwind ; CHECK: movl %edi, %ecx ; CHECK-NEXT: movl %esi, %eax ; CHECK-NEXT: mwait +; WIN64: bar: +; WIN64: movl %edx, %eax +; WIN64-NEXT: mwait define void @bar(i32 %E, i32 %H) nounwind { entry: tail call void @llvm.x86.sse3.mwait(i32 %E, i32 %H) diff --git a/test/CodeGen/X86/avoid-lea-scale2.ll b/test/CodeGen/X86/avoid-lea-scale2.ll index 8003de2..545a3ce 100644 --- a/test/CodeGen/X86/avoid-lea-scale2.ll +++ b/test/CodeGen/X86/avoid-lea-scale2.ll @@ -1,4 +1,7 @@ -; RUN: llc < %s -march=x86-64 | grep {leal.*-2(\[%\]rdi,\[%\]rdi)} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK: leal -2(%rdi,%rdi) +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 +; WIN64: leal -2(%rcx,%rcx) define i32 @foo(i32 %x) nounwind readnone { %t0 = shl i32 %x, 1 diff --git a/test/CodeGen/X86/break-sse-dep.ll b/test/CodeGen/X86/break-sse-dep.ll index 094cbc7..2dee575 100644 --- a/test/CodeGen/X86/break-sse-dep.ll +++ b/test/CodeGen/X86/break-sse-dep.ll @@ -1,9 +1,10 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse2 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2 | FileCheck %s define double @t1(float* nocapture %x) nounwind readonly ssp { entry: ; CHECK: t1: -; CHECK: movss (%rdi), %xmm0 +; CHECK: movss ([[A0:%rdi|%rcx]]), %xmm0 ; CHECK: cvtss2sd %xmm0, %xmm0 %0 = load float* %x, align 4 @@ -14,7 +15,7 @@ entry: define float @t2(double* nocapture %x) nounwind readonly ssp optsize { entry: ; CHECK: t2: -; CHECK: cvtsd2ss (%rdi), %xmm0 +; CHECK: cvtsd2ss ([[A0]]), %xmm0 %0 = load double* %x, align 8 %1 = fptrunc double %0 to float ret float %1 @@ -23,7 +24,7 @@ entry: define float @squirtf(float* %x) nounwind { entry: ; CHECK: squirtf: -; CHECK: movss (%rdi), %xmm0 +; CHECK: movss ([[A0]]), %xmm0 ; CHECK: sqrtss %xmm0, %xmm0 %z = load float* %x %t = call float @llvm.sqrt.f32(float %z) @@ -33,7 +34,7 @@ entry: define double @squirt(double* %x) nounwind { entry: ; CHECK: squirt: -; CHECK: movsd (%rdi), %xmm0 +; CHECK: movsd ([[A0]]), %xmm0 ; CHECK: sqrtsd %xmm0, %xmm0 %z = load double* %x %t = call double @llvm.sqrt.f64(double %z) @@ -43,7 +44,7 @@ entry: define float @squirtf_size(float* %x) nounwind optsize { entry: ; CHECK: squirtf_size: -; CHECK: sqrtss (%rdi), %xmm0 +; CHECK: sqrtss ([[A0]]), %xmm0 %z = load float* %x %t = call float @llvm.sqrt.f32(float %z) ret float %t @@ -52,7 +53,7 @@ entry: define double @squirt_size(double* %x) nounwind optsize { entry: ; CHECK: squirt_size: -; CHECK: sqrtsd (%rdi), %xmm0 +; CHECK: sqrtsd ([[A0]]), %xmm0 %z = load double* %x %t = call double @llvm.sqrt.f64(double %z) ret double %t diff --git a/test/CodeGen/X86/byval.ll b/test/CodeGen/X86/byval.ll index ac0bc09..9b75537 100644 --- a/test/CodeGen/X86/byval.ll +++ b/test/CodeGen/X86/byval.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 | FileCheck -check-prefix=X86-64 %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck -check-prefix=X86-64 %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck -check-prefix=WIN64 %s ; RUN: llc < %s -march=x86 | FileCheck -check-prefix=X86 %s ; X86: movl 4(%esp), %eax @@ -6,6 +7,8 @@ ; X86-64: movq 8(%rsp), %rax +; WIN64: movq (%rcx), %rax + %struct.s = type { i64, i64, i64 } define i64 @f(%struct.s* byval %a) { diff --git a/test/CodeGen/X86/byval2.ll b/test/CodeGen/X86/byval2.ll index 71129f5..c2ac7a5 100644 --- a/test/CodeGen/X86/byval2.ll +++ b/test/CodeGen/X86/byval2.ll @@ -1,5 +1,40 @@ -; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2 -; RUN: llc < %s -march=x86 | grep rep.movsl | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64: rep +; X64-NOT: rep +; X64: movsq +; X64-NOT: movsq +; X64: rep +; X64-NOT: rep +; X64: movsq +; X64-NOT: rep +; X64-NOT: movsq + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64: {{^g:}} +; W64: subq $184, %rsp +; W64: movq %rsi, 176(%rsp) +; W64: movq %rcx, 32(%rsp) +; W64-NEXT: movq %rdx, 40(%rsp) +; W64-NEXT: movq %r8, 48(%rsp) +; W64-NEXT: leaq 32(%rsp), %rsi +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq 176(%rsp), %rsi +; W64-NEXT: addq $184, %rsp +; W64-NEXT: ret + +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 +; X32: rep +; X32-NOT: rep +; X32: movsl +; X32-NOT: movsl +; X32: rep +; X32-NOT: rep +; X32: movsl +; X32-NOT: rep +; X32-NOT: movsl %struct.s = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, diff --git a/test/CodeGen/X86/byval3.ll b/test/CodeGen/X86/byval3.ll index 504e0be..2f611ef 100644 --- a/test/CodeGen/X86/byval3.ll +++ b/test/CodeGen/X86/byval3.ll @@ -1,5 +1,43 @@ -; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2 -; RUN: llc < %s -march=x86 | grep rep.movsl | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64-NOT: rep +; X64-NOT: movsq +; X64: rep;movsq +; X64-NOT: rep +; X64-NOT: movsq +; X64: rep;movsq +; X64-NOT: rep +; X64-NOT: movsq + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64: {{^g:}} +; W64: subq $184, %rsp +; W64-NEXT: movq %rsi, 176(%rsp) +; W64-NEXT: movl %ecx, 32(%rsp) +; W64-NEXT: movl %edx, 36(%rsp) +; W64-NEXT: movl %r8d, 40(%rsp) +; W64-NEXT: movl %r9d, 44(%rsp) +; W64-NEXT: movl 224(%rsp), %eax +; W64-NEXT: movl %eax, 48(%rsp) +; W64-NEXT: movl 232(%rsp), %eax +; W64-NEXT: movl %eax, 52(%rsp) +; W64-NEXT: leaq 32(%rsp), %rsi +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq 176(%rsp), %rsi +; W64-NEXT: addq $184, %rsp +; W64-NEXT: ret + +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 +; X32-NOT: rep +; X32-NOT: movsl +; X32: rep;movsl +; X32-NOT: rep +; X32-NOT: movsl +; X32: rep;movsl +; X32-NOT: rep +; X32-NOT: movsl %struct.s = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, diff --git a/test/CodeGen/X86/byval4.ll b/test/CodeGen/X86/byval4.ll index 4db9d65..1ba23cf 100644 --- a/test/CodeGen/X86/byval4.ll +++ b/test/CodeGen/X86/byval4.ll @@ -1,5 +1,43 @@ -; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2 -; RUN: llc < %s -march=x86 | grep rep.movsl | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64-NOT: rep +; X64-NOT: movsq +; X64: rep;movsq +; X64-NOT: rep +; X64-NOT: movsq +; X64: rep;movsq +; X64-NOT: rep +; X64-NOT: movsq + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64: {{^g:}} +; W64: subq $184, %rsp +; W64-NEXT: movq %rsi, 176(%rsp) +; W64-NEXT: movw %cx, 32(%rsp) +; W64-NEXT: movw %dx, 34(%rsp) +; W64-NEXT: movw %r8w, 36(%rsp) +; W64-NEXT: movw %r9w, 38(%rsp) +; W64-NEXT: movw 224(%rsp), %ax +; W64-NEXT: movw %ax, 40(%rsp) +; W64-NEXT: movw 232(%rsp), %ax +; W64-NEXT: movw %ax, 42(%rsp) +; W64-NEXT: leaq 32(%rsp), %rsi +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq 176(%rsp), %rsi +; W64-NEXT: addq $184, %rsp +; W64-NEXT: ret + +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 +; X32-NOT: rep +; X32-NOT: movsl +; X32: rep;movsl +; X32-NOT: rep +; X32-NOT: movsl +; X32: rep;movsl +; X32-NOT: rep +; X32-NOT: movsl %struct.s = type { i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, diff --git a/test/CodeGen/X86/byval5.ll b/test/CodeGen/X86/byval5.ll index 69c115b..32c9cc7 100644 --- a/test/CodeGen/X86/byval5.ll +++ b/test/CodeGen/X86/byval5.ll @@ -1,5 +1,43 @@ -; RUN: llc < %s -march=x86-64 | grep rep.movsq | count 2 -; RUN: llc < %s -march=x86 | grep rep.movsl | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64-NOT: rep +; X64-NOT: movsq +; X64: rep;movsq +; X64-NOT: rep +; X64-NOT: movsq +; X64: rep;movsq +; X64-NOT: rep +; X64-NOT: movsq + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64: {{^g:}} +; W64: subq $184, %rsp +; W64: movq %rsi, 176(%rsp) +; W64-NEXT: movb %cl, 40(%rsp) +; W64-NEXT: movb %dl, 41(%rsp) +; W64-NEXT: movb %r8b, 42(%rsp) +; W64-NEXT: movb %r9b, 43(%rsp) +; W64-NEXT: movb 224(%rsp), %al +; W64-NEXT: movb %al, 44(%rsp) +; W64-NEXT: movb 232(%rsp), %al +; W64-NEXT: movb %al, 45(%rsp) +; W64-NEXT: leaq 40(%rsp), %rsi +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq %rsi, %rcx +; W64-NEXT: callq f +; W64-NEXT: movq 176(%rsp), %rsi +; W64-NEXT: addq $184, %rsp +; W64-NEXT: ret + +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 +; X32-NOT: rep +; X32-NOT: movsl +; X32: rep;movsl +; X32-NOT: rep +; X32-NOT: movsl +; X32: rep;movsl +; X32-NOT: rep +; X32-NOT: movsl %struct.s = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, diff --git a/test/CodeGen/X86/coalescer-commute2.ll b/test/CodeGen/X86/coalescer-commute2.ll index 5d10bba..9ff7143 100644 --- a/test/CodeGen/X86/coalescer-commute2.ll +++ b/test/CodeGen/X86/coalescer-commute2.ll @@ -1,5 +1,22 @@ -; RUN: llc < %s -march=x86-64 | grep paddw | count 2 -; RUN: llc < %s -march=x86-64 | not grep mov +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: mov +; CHECK: paddw +; CHECK-NOT: mov +; CHECK: paddw +; CHECK-NOT: paddw +; CHECK-NOT: mov + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 +; WIN64: {{^test1:}} +; WIN64: movdqa (%rcx), %xmm0 +; WIN64-NEXT: paddw (%rdx), %xmm0 +; WIN64: {{^test2:}} +; WIN64: movdqa (%rdx), %xmm0 +; WIN64-NEXT: paddw (%rcx), %xmm0 +; WIN64: {{^test3:}} +; WIN64: movdqa (%rcx), %xmm1 +; WIN64-NEXT: pshufd $27, %xmm1, %xmm0 +; WIN64-NEXT: addps %xmm1, %xmm0 ; The 2-addr pass should ensure that identical code is produced for these functions ; no extra copy should be generated. diff --git a/test/CodeGen/X86/codegen-prepare-extload.ll b/test/CodeGen/X86/codegen-prepare-extload.ll index 9f57d53..14df815 100644 --- a/test/CodeGen/X86/codegen-prepare-extload.ll +++ b/test/CodeGen/X86/codegen-prepare-extload.ll @@ -1,10 +1,11 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win64 | FileCheck %s ; rdar://7304838 ; CodeGenPrepare should move the zext into the block with the load ; so that SelectionDAG can select it with the load. -; CHECK: movzbl (%rdi), %eax +; CHECK: movzbl ({{%rdi|%rcx}}), %eax define void @foo(i8* %p, i32* %q) { entry: diff --git a/test/CodeGen/X86/constant-pool-remat-0.ll b/test/CodeGen/X86/constant-pool-remat-0.ll index 2a44463..e181237 100644 --- a/test/CodeGen/X86/constant-pool-remat-0.ll +++ b/test/CodeGen/X86/constant-pool-remat-0.ll @@ -1,7 +1,34 @@ -; RUN: llc < %s -march=x86-64 | grep LCPI | count 3 -; RUN: llc < %s -march=x86-64 -o /dev/null -stats -info-output-file - | grep asm-printer | grep 6 -; RUN: llc < %s -march=x86 -mattr=+sse2 | grep LCPI | count 3 -; RUN: llc < %s -march=x86 -mattr=+sse2 -o /dev/null -stats -info-output-file - | grep asm-printer | grep 12 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64: LCPI +; X64: LCPI +; X64: LCPI +; X64-NOT: LCPI + +; RUN: llc < %s -mtriple=x86_64-linux -o /dev/null -stats -info-output-file - | FileCheck %s -check-prefix=X64stat +; X64stat: 6 asm-printer + +; It seems rematerialization would not be needed on win64. +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64: .LCPI0_0: +; W64: array: +; W64: subq $56, %rsp +; W64-NEXT: movaps %xmm6, 32(%rsp) +; W64-NEXT: movss .LCPI0_0(%rip), %xmm6 +; W64-NEXT: mulss %xmm6, %xmm0 +; W64-NEXT: callq qux +; W64-NEXT: mulss %xmm6, %xmm0 +; W64-NEXT: movaps 32(%rsp), %xmm6 +; W64-NEXT: addq $56, %rsp +; W64-NEXT: ret + +; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=X32 +; X32: LCPI +; X32: LCPI +; X32: LCPI +; X32-NOT: LCPI + +; RUN: llc < %s -march=x86 -mattr=+sse2 -o /dev/null -stats -info-output-file - | FileCheck %s -check-prefix=X32stat +; X32stat: 12 asm-printer declare float @qux(float %y) diff --git a/test/CodeGen/X86/constant-pool-sharing.ll b/test/CodeGen/X86/constant-pool-sharing.ll index 33de576..f979945 100644 --- a/test/CodeGen/X86/constant-pool-sharing.ll +++ b/test/CodeGen/X86/constant-pool-sharing.ll @@ -1,11 +1,12 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; llc should share constant pool entries between this integer vector ; and this floating-point vector since they have the same encoding. ; CHECK: LCPI0_0(%rip), %xmm0 -; CHECK: movaps %xmm0, (%rdi) -; CHECK: movaps %xmm0, (%rsi) +; CHECK: movaps %xmm0, ({{%rdi|%rcx}}) +; CHECK: movaps %xmm0, ({{%rsi|%rdx}}) define void @foo(<4 x i32>* %p, <4 x float>* %q, i1 %t) nounwind { entry: diff --git a/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll b/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll index 17cb2b3..7739909 100644 --- a/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll +++ b/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll @@ -1,6 +1,12 @@ -; RUN: llc < %s -march=x86-64 -o %t -stats -info-output-file - | \ -; RUN: grep {asm-printer} | grep {Number of machine instrs printed} | grep 9 -; RUN: grep {leal 1(\%rsi),} %t +; RUN: llc < %s -mtriple=x86_64-linux -o /dev/null -stats |& FileCheck %s -check-prefix=X64stat +; X64stat: 9 asm-printer +; RUN: llc < %s -mtriple=x86_64-win32 -o /dev/null -stats |& FileCheck %s -check-prefix=W64stat +; W64stat: 9 asm-printer + +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64: leal 1(%rsi), +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64: leal 1(%rdx), define fastcc zeroext i8 @fullGtU(i32 %i1, i32 %i2, i8* %ptr) nounwind optsize { entry: diff --git a/test/CodeGen/X86/ctpop-combine.ll b/test/CodeGen/X86/ctpop-combine.ll index c957d38..6406cc7 100644 --- a/test/CodeGen/X86/ctpop-combine.ll +++ b/test/CodeGen/X86/ctpop-combine.ll @@ -9,7 +9,7 @@ define i32 @test1(i64 %x) nounwind readnone { %conv = zext i1 %cmp to i32 ret i32 %conv ; CHECK: test1: -; CHECK: leaq -1(%rdi) +; CHECK: leaq -1([[A0:%rdi|%rcx]]) ; CHECK-NEXT: testq ; CHECK-NEXT: setne ; CHECK: ret @@ -22,7 +22,7 @@ define i32 @test2(i64 %x) nounwind readnone { %conv = zext i1 %cmp to i32 ret i32 %conv ; CHECK: test2: -; CHECK: leaq -1(%rdi) +; CHECK: leaq -1([[A0]]) ; CHECK-NEXT: testq ; CHECK-NEXT: sete ; CHECK: ret diff --git a/test/CodeGen/X86/fast-isel-cmp-branch.ll b/test/CodeGen/X86/fast-isel-cmp-branch.ll index 4ab1bc6..12312e8 100644 --- a/test/CodeGen/X86/fast-isel-cmp-branch.ll +++ b/test/CodeGen/X86/fast-isel-cmp-branch.ll @@ -1,13 +1,14 @@ -; RUN: llc -O0 -march=x86-64 -asm-verbose=false < %s | FileCheck %s +; RUN: llc -O0 -mtriple=x86_64-linux -asm-verbose=false < %s | FileCheck %s +; RUN: llc -O0 -mtriple=x86_64-win32 -asm-verbose=false < %s | FileCheck %s ; rdar://8337108 ; Fast-isel shouldn't try to look through the compare because it's in a ; different basic block, so its operands aren't necessarily exported ; for cross-block usage. -; CHECK: movb %al, 7(%rsp) +; CHECK: movb %al, [[OFS:[0-9]*]](%rsp) ; CHECK: callq {{_?}}bar -; CHECK: movb 7(%rsp), %al +; CHECK: movb [[OFS]](%rsp), %al declare void @bar() diff --git a/test/CodeGen/X86/fast-isel-gep.ll b/test/CodeGen/X86/fast-isel-gep.ll index 622a1ff..fbe0243 100644 --- a/test/CodeGen/X86/fast-isel-gep.ll +++ b/test/CodeGen/X86/fast-isel-gep.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -O0 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux -O0 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 -O0 | FileCheck %s --check-prefix=X64 ; RUN: llc < %s -march=x86 -O0 | FileCheck %s --check-prefix=X32 ; GEP indices are interpreted as signed integers, so they @@ -13,8 +14,8 @@ define i32 @test1(i32 %t3, i32* %t1) nounwind { ; X32: ret ; X64: test1: -; X64: movslq %edi, %rax -; X64: movl (%rsi,%rax,4), %eax +; X64: movslq %e[[A0:di|cx]], %rax +; X64: movl (%r[[A1:si|dx]],%rax,4), %eax ; X64: ret } @@ -27,7 +28,7 @@ define i32 @test2(i64 %t3, i32* %t1) nounwind { ; X32: ret ; X64: test2: -; X64: movl (%rsi,%rdi,4), %eax +; X64: movl (%r[[A1]],%r[[A0]],4), %eax ; X64: ret } @@ -47,7 +48,7 @@ entry: ; X32: ret ; X64: test3: -; X64: movb -2(%rdi), %al +; X64: movb -2(%r[[A0]]), %al ; X64: ret } @@ -80,9 +81,9 @@ define i64 @test5(i8* %A, i32 %I, i64 %B) nounwind { %v11 = add i64 %B, %v10 ret i64 %v11 ; X64: test5: -; X64: movslq %esi, %rax -; X64-NEXT: movq (%rdi,%rax), %rax -; X64-NEXT: addq %rdx, %rax +; X64: movslq %e[[A1]], %rax +; X64-NEXT: movq (%r[[A0]],%rax), %rax +; X64-NEXT: addq %{{rdx|r8}}, %rax ; X64-NEXT: ret } diff --git a/test/CodeGen/X86/fold-mul-lohi.ll b/test/CodeGen/X86/fold-mul-lohi.ll index 0351eca..5614c80 100644 --- a/test/CodeGen/X86/fold-mul-lohi.ll +++ b/test/CodeGen/X86/fold-mul-lohi.ll @@ -1,5 +1,6 @@ -; RUN: llc < %s -march=x86 | not grep lea -; RUN: llc < %s -march=x86-64 | not grep lea +; RUN: llc < %s -march=x86 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: lea @B = external global [1000 x i8], align 32 @A = external global [1000 x i8], align 32 diff --git a/test/CodeGen/X86/gather-addresses.ll b/test/CodeGen/X86/gather-addresses.ll index 134ee28..4a6927f 100644 --- a/test/CodeGen/X86/gather-addresses.ll +++ b/test/CodeGen/X86/gather-addresses.ll @@ -1,20 +1,21 @@ -; RUN: llc -march=x86-64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-win32 < %s | FileCheck %s ; rdar://7398554 ; When doing vector gather-scatter index calculation with 32-bit indices, ; bounce the vector off of cache rather than shuffling each individual ; element out of the index vector. -; CHECK: andps (%rdx), %xmm0 -; CHECK: movaps %xmm0, -24(%rsp) -; CHECK: movslq -24(%rsp), %rax -; CHECK: movsd (%rdi,%rax,8), %xmm0 -; CHECK: movslq -20(%rsp), %rax -; CHECK: movhpd (%rdi,%rax,8), %xmm0 -; CHECK: movslq -16(%rsp), %rax -; CHECK: movsd (%rdi,%rax,8), %xmm1 -; CHECK: movslq -12(%rsp), %rax -; CHECK: movhpd (%rdi,%rax,8), %xmm1 +; CHECK: andps ([[H:%rdx|%r8]]), %xmm0 +; CHECK: movaps %xmm0, {{(-24)?}}(%rsp) +; CHECK: movslq {{(-24)?}}(%rsp), %rax +; CHECK: movsd ([[P:%rdi|%rcx]],%rax,8), %xmm0 +; CHECK: movslq {{-20|4}}(%rsp), %rax +; CHECK: movhpd ([[P]],%rax,8), %xmm0 +; CHECK: movslq {{-16|8}}(%rsp), %rax +; CHECK: movsd ([[P]],%rax,8), %xmm1 +; CHECK: movslq {{-12|12}}(%rsp), %rax +; CHECK: movhpd ([[P]],%rax,8), %xmm1 define <4 x double> @foo(double* %p, <4 x i32>* %i, <4 x i32>* %h) nounwind { %a = load <4 x i32>* %i diff --git a/test/CodeGen/X86/h-register-store.ll b/test/CodeGen/X86/h-register-store.ll index d30e6b3..0adb2b1 100644 --- a/test/CodeGen/X86/h-register-store.ll +++ b/test/CodeGen/X86/h-register-store.ll @@ -1,9 +1,29 @@ -; RUN: llc < %s -march=x86-64 > %t -; RUN: grep mov %t | count 6 -; RUN: grep {movb %ah, (%rsi)} %t | count 3 -; RUN: llc < %s -march=x86 > %t -; RUN: grep mov %t | count 3 -; RUN: grep {movb %ah, (%e} %t | count 3 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; X64: mov +; X64-NEXT: movb %ah, (%rsi) +; X64: mov +; X64-NEXT: movb %ah, (%rsi) +; X64: mov +; X64-NEXT: movb %ah, (%rsi) +; X64-NOT: mov + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=W64 +; W64-NOT: mov +; W64: movb %ch, (%rdx) +; W64-NOT: mov +; W64: movb %ch, (%rdx) +; W64-NOT: mov +; W64: movb %ch, (%rdx) +; W64-NOT: mov + +; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X32 +; X32-NOT: mov +; X32: movb %ah, (%e +; X32-NOT: mov +; X32: movb %ah, (%e +; X32-NOT: mov +; X32: movb %ah, (%e +; X32-NOT: mov ; Use h-register extract and store. diff --git a/test/CodeGen/X86/h-registers-0.ll b/test/CodeGen/X86/h-registers-0.ll index e84bb9a..4354d26 100644 --- a/test/CodeGen/X86/h-registers-0.ll +++ b/test/CodeGen/X86/h-registers-0.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X86-64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X86-64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 ; RUN: llc < %s -march=x86 | FileCheck %s -check-prefix=X86-32 ; Use h registers. On x86-64, codegen doesn't support general allocation @@ -9,6 +10,10 @@ define void @bar64(i64 inreg %x, i8* inreg %p) nounwind { ; X86-64: shrq $8, %rdi ; X86-64: incb %dil +; WIN64: bar64: +; WIN64: shrq $8, %rcx +; WIN64: incb %cl + ; X86-32: bar64: ; X86-32: incb %ah %t0 = lshr i64 %x, 8 @@ -23,6 +28,10 @@ define void @bar32(i32 inreg %x, i8* inreg %p) nounwind { ; X86-64: shrl $8, %edi ; X86-64: incb %dil +; WIN64: bar32: +; WIN64: shrl $8, %ecx +; WIN64: incb %cl + ; X86-32: bar32: ; X86-32: incb %ah %t0 = lshr i32 %x, 8 @@ -37,6 +46,10 @@ define void @bar16(i16 inreg %x, i8* inreg %p) nounwind { ; X86-64: shrl $8, %edi ; X86-64: incb %dil +; WIN64: bar16: +; WIN64: shrl $8, %ecx +; WIN64: incb %cl + ; X86-32: bar16: ; X86-32: incb %ah %t0 = lshr i16 %x, 8 @@ -51,6 +64,9 @@ define i64 @qux64(i64 inreg %x) nounwind { ; X86-64: movq %rdi, %rax ; X86-64: movzbl %ah, %eax +; WIN64: qux64: +; WIN64: movzbl %ch, %eax + ; X86-32: qux64: ; X86-32: movzbl %ah, %eax %t0 = lshr i64 %x, 8 @@ -63,6 +79,9 @@ define i32 @qux32(i32 inreg %x) nounwind { ; X86-64: movl %edi, %eax ; X86-64: movzbl %ah, %eax +; WIN64: qux32: +; WIN64: movzbl %ch, %eax + ; X86-32: qux32: ; X86-32: movzbl %ah, %eax %t0 = lshr i32 %x, 8 @@ -75,6 +94,9 @@ define i16 @qux16(i16 inreg %x) nounwind { ; X86-64: movl %edi, %eax ; X86-64: movzbl %ah, %eax +; WIN64: qux16: +; WIN64: movzbl %ch, %eax + ; X86-32: qux16: ; X86-32: movzbl %ah, %eax %t0 = lshr i16 %x, 8 diff --git a/test/CodeGen/X86/i128-ret.ll b/test/CodeGen/X86/i128-ret.ll index 277f428..264f07c 100644 --- a/test/CodeGen/X86/i128-ret.ll +++ b/test/CodeGen/X86/i128-ret.ll @@ -1,5 +1,7 @@ -; RUN: llc < %s -march=x86-64 | grep {movq 8(%rdi), %rdx} -; RUN: llc < %s -march=x86-64 | grep {movq (%rdi), %rax} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK: movq ([[A0:%rdi|%rcx]]), %rax +; CHECK: movq 8([[A0]]), %rdx define i128 @test(i128 *%P) { %A = load i128* %P diff --git a/test/CodeGen/X86/i64-mem-copy.ll b/test/CodeGen/X86/i64-mem-copy.ll index 847e209..dce12ae 100644 --- a/test/CodeGen/X86/i64-mem-copy.ll +++ b/test/CodeGen/X86/i64-mem-copy.ll @@ -1,5 +1,9 @@ -; RUN: llc < %s -march=x86-64 | grep {movq.*(%rsi), %rax} -; RUN: llc < %s -march=x86 -mattr=+sse2 | grep {movsd.*(%eax),} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64 +; X64: movq ({{%rsi|%rdx}}), %r + +; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=X32 +; X32: movsd (%eax), %xmm ; Uses movsd to load / store i64 values if sse2 is available. diff --git a/test/CodeGen/X86/lea-3.ll b/test/CodeGen/X86/lea-3.ll index 44413d6..040c5c2 100644 --- a/test/CodeGen/X86/lea-3.ll +++ b/test/CodeGen/X86/lea-3.ll @@ -1,16 +1,19 @@ -; RUN: llc < %s -march=x86-64 | grep {leal (%rdi,%rdi,2), %eax} -define i32 @test(i32 %a) { - %tmp2 = mul i32 %a, 3 ; [#uses=1] - ret i32 %tmp2 -} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -; RUN: llc < %s -march=x86-64 | grep {leaq (,%rdi,4), %rax} +; CHECK: leaq (,[[A0:%rdi|%rcx]],4), %rax define i64 @test2(i64 %a) { %tmp2 = shl i64 %a, 2 %tmp3 = or i64 %tmp2, %a ret i64 %tmp3 } +; CHECK: leal ([[A0]],[[A0]],2), %eax +define i32 @test(i32 %a) { + %tmp2 = mul i32 %a, 3 ; [#uses=1] + ret i32 %tmp2 +} + ;; TODO! LEA instead of shift + copy. define i64 @test3(i64 %a) { %tmp2 = shl i64 %a, 3 diff --git a/test/CodeGen/X86/lea.ll b/test/CodeGen/X86/lea.ll index 22a9644..5421355 100644 --- a/test/CodeGen/X86/lea.ll +++ b/test/CodeGen/X86/lea.ll @@ -1,11 +1,12 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s define i32 @test1(i32 %x) nounwind { %tmp1 = shl i32 %x, 3 %tmp2 = add i32 %tmp1, 7 ret i32 %tmp2 ; CHECK: test1: -; CHECK: leal 7(,%rdi,8), %eax +; CHECK: leal 7(,[[A0:%rdi|%rcx]],8), %eax } @@ -27,8 +28,8 @@ bb.nph: bb2: ret i32 %x_offs ; CHECK: test2: -; CHECK: leal -5(%rdi), %eax +; CHECK: leal -5([[A0]]), %eax ; CHECK: andl $-4, %eax ; CHECK: negl %eax -; CHECK: leal -4(%rdi,%rax), %eax +; CHECK: leal -4([[A0]],%rax), %eax } diff --git a/test/CodeGen/X86/lsr-overflow.ll b/test/CodeGen/X86/lsr-overflow.ll index 0b0214c..5bc4f7e 100644 --- a/test/CodeGen/X86/lsr-overflow.ll +++ b/test/CodeGen/X86/lsr-overflow.ll @@ -1,10 +1,11 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; The comparison uses the pre-inc value, which could lead LSR to ; try to compute -INT64_MIN. ; CHECK: movabsq $-9223372036854775808, %rax -; CHECK: cmpq %rax, %rbx +; CHECK: cmpq %rax, ; CHECK: sete %al declare i64 @bar() diff --git a/test/CodeGen/X86/lsr-reuse-trunc.ll b/test/CodeGen/X86/lsr-reuse-trunc.ll index d1d7144..29f03d6 100644 --- a/test/CodeGen/X86/lsr-reuse-trunc.ll +++ b/test/CodeGen/X86/lsr-reuse-trunc.ll @@ -1,12 +1,13 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; Full strength reduction wouldn't reduce register pressure, so LSR should ; stick with indexing here. -; CHECK: movaps (%rsi,%rax,4), %xmm3 -; CHECK: movaps %xmm3, (%rdi,%rax,4) +; CHECK: movaps (%{{rsi|rdx}},%rax,4), %xmm3 +; CHECK: movaps %xmm3, (%{{rdi|rcx}},%rax,4) ; CHECK: addq $4, %rax -; CHECK: cmpl %eax, (%rdx) +; CHECK: cmpl %eax, (%{{rdx|r8}}) ; CHECK-NEXT: jg define void @vvfloorf(float* nocapture %y, float* nocapture %x, i32* nocapture %n) nounwind { diff --git a/test/CodeGen/X86/masked-iv-safe.ll b/test/CodeGen/X86/masked-iv-safe.ll index 0b4d73a..5f968b5 100644 --- a/test/CodeGen/X86/masked-iv-safe.ll +++ b/test/CodeGen/X86/masked-iv-safe.ll @@ -1,12 +1,37 @@ -; RUN: llc < %s -march=x86-64 > %t -; RUN: not grep and %t -; RUN: not grep movz %t -; RUN: not grep sar %t -; RUN: not grep shl %t -; RUN: grep add %t | count 2 -; RUN: grep inc %t | count 4 -; RUN: grep dec %t | count 2 -; RUN: grep lea %t | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: inc +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: dec +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: inc +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: dec +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: inc +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: addq $255, %r +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: addq $16777215, %r +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: lea +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: inc +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} +; CHECK: lea +; CHECK-NOT: {{(inc|dec|lea)}} +; CHECK-NOT: {{(and|movz|sar|shl)}} ; Optimize away zext-inreg and sext-inreg on the loop induction ; variable using trip-count information. diff --git a/test/CodeGen/X86/memcmp.ll b/test/CodeGen/X86/memcmp.ll index 36be1f3..f4bc1bb 100644 --- a/test/CodeGen/X86/memcmp.ll +++ b/test/CodeGen/X86/memcmp.ll @@ -1,4 +1,5 @@ -; RUN: llc %s -o - -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; This tests codegen time inlining/optimization of memcmp ; rdar://6480398 @@ -20,8 +21,8 @@ bb: ; preds = %entry return: ; preds = %entry ret void ; CHECK: memcmp2: -; CHECK: movw (%rdi), %ax -; CHECK: cmpw (%rsi), %ax +; CHECK: movw ([[A0:%rdi|%rcx]]), %ax +; CHECK: cmpw ([[A1:%rsi|%rdx]]), %ax } define void @memcmp2a(i8* %X, i32* nocapture %P) nounwind { @@ -37,7 +38,7 @@ bb: ; preds = %entry return: ; preds = %entry ret void ; CHECK: memcmp2a: -; CHECK: cmpw $28527, (%rdi) +; CHECK: cmpw $28527, ([[A0]]) } @@ -54,8 +55,8 @@ bb: ; preds = %entry return: ; preds = %entry ret void ; CHECK: memcmp4: -; CHECK: movl (%rdi), %eax -; CHECK: cmpl (%rsi), %eax +; CHECK: movl ([[A0]]), %eax +; CHECK: cmpl ([[A1]]), %eax } define void @memcmp4a(i8* %X, i32* nocapture %P) nounwind { @@ -71,7 +72,7 @@ bb: ; preds = %entry return: ; preds = %entry ret void ; CHECK: memcmp4a: -; CHECK: cmpl $1869573999, (%rdi) +; CHECK: cmpl $1869573999, ([[A0]]) } define void @memcmp8(i8* %X, i8* %Y, i32* nocapture %P) nounwind { @@ -87,8 +88,8 @@ bb: ; preds = %entry return: ; preds = %entry ret void ; CHECK: memcmp8: -; CHECK: movq (%rdi), %rax -; CHECK: cmpq (%rsi), %rax +; CHECK: movq ([[A0]]), %rax +; CHECK: cmpq ([[A1]]), %rax } define void @memcmp8a(i8* %X, i32* nocapture %P) nounwind { @@ -105,6 +106,6 @@ return: ; preds = %entry ret void ; CHECK: memcmp8a: ; CHECK: movabsq $8029759185026510694, %rax -; CHECK: cmpq %rax, (%rdi) +; CHECK: cmpq %rax, ([[A0]]) } diff --git a/test/CodeGen/X86/mmx-copy-gprs.ll b/test/CodeGen/X86/mmx-copy-gprs.ll index 3607043..6cb21ca 100644 --- a/test/CodeGen/X86/mmx-copy-gprs.ll +++ b/test/CodeGen/X86/mmx-copy-gprs.ll @@ -1,6 +1,10 @@ -; RUN: llc < %s -march=x86-64 | grep {movq.*(%rsi), %rax} -; RUN: llc < %s -march=x86 -mattr=-sse2 | grep {movl.*4(%eax),} -; RUN: llc < %s -march=x86 -mattr=+sse2 | grep {movsd.(%eax),} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64 +; X64: movq ({{%rsi|%rdx}}), %rax +; RUN: llc < %s -march=x86 -mattr=-sse2 | FileCheck %s -check-prefix=X32 +; X32: movl 4(%eax), +; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=XMM +; XMM: movsd (%eax), ; This test should use GPRs to copy the mmx value, not MMX regs. Using mmx regs, ; increases the places that need to use emms. diff --git a/test/CodeGen/X86/movgs.ll b/test/CodeGen/X86/movgs.ll index 00190e8..97b7fe7 100644 --- a/test/CodeGen/X86/movgs.ll +++ b/test/CodeGen/X86/movgs.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86 -mattr=sse41 | FileCheck %s --check-prefix=X32 -; RUN: llc < %s -march=x86-64 -mattr=sse41 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux -mattr=sse41 | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=sse41 | FileCheck %s --check-prefix=X64 define i32 @test1() nounwind readonly { entry: @@ -30,7 +31,7 @@ entry: ; X32: calll *%gs:(%eax) ; X64: test2: -; X64: callq *%gs:(%rdi) +; X64: callq *%gs:([[A0:%rdi|%rcx]]) @@ -50,7 +51,7 @@ entry: ; X32: ret ; X64: pmovsxwd_1: -; X64: pmovsxwd %gs:(%rdi), %xmm0 +; X64: pmovsxwd %gs:([[A0]]), %xmm0 ; X64: ret } diff --git a/test/CodeGen/X86/optimize-max-3.ll b/test/CodeGen/X86/optimize-max-3.ll index f1e3c27..b90413d 100644 --- a/test/CodeGen/X86/optimize-max-3.ll +++ b/test/CodeGen/X86/optimize-max-3.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux -asm-verbose=false | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -asm-verbose=false | FileCheck %s ; LSR's OptimizeMax should eliminate the select (max). @@ -40,13 +41,13 @@ for.end: ; preds = %for.body, %entry ; CHECK: jle ; CHECK-NOT: cmov -; CHECK: xorl %edi, %edi +; CHECK: xorl {{%edi, %edi|%ecx, %ecx}} ; CHECK-NEXT: align ; CHECK-NEXT: BB1_2: ; CHECK-NEXT: callq -; CHECK-NEXT: incl %ebx -; CHECK-NEXT: cmpl %r14d, %ebx -; CHECK-NEXT: movq %rax, %rdi +; CHECK-NEXT: incl [[BX:%ebx|%esi]] +; CHECK-NEXT: cmpl [[R14:%r14d|%edi]], [[BX]] +; CHECK-NEXT: movq %rax, %r{{di|cx}} ; CHECK-NEXT: jl define void @_Z18GenerateStatusPagei(i32 %jobs_to_display) nounwind { diff --git a/test/CodeGen/X86/peep-vector-extract-concat.ll b/test/CodeGen/X86/peep-vector-extract-concat.ll index e4ab2b5..1eed317 100644 --- a/test/CodeGen/X86/peep-vector-extract-concat.ll +++ b/test/CodeGen/X86/peep-vector-extract-concat.ll @@ -1,4 +1,8 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse2,-sse41 | grep {pshufd \$3, %xmm0, %xmm0} +; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2,-sse41 | FileCheck %s +; CHECK: pshufd $3, %xmm0, %xmm0 + +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2,-sse41 | FileCheck %s -check-prefix=WIN64 +; WIN64: movss 12(%rcx), %xmm0 define float @foo(<8 x float> %a) nounwind { %c = extractelement <8 x float> %a, i32 3 diff --git a/test/CodeGen/X86/pmulld.ll b/test/CodeGen/X86/pmulld.ll index 3ef5941..fc8791a 100644 --- a/test/CodeGen/X86/pmulld.ll +++ b/test/CodeGen/X86/pmulld.ll @@ -1,8 +1,13 @@ -; RUN: llc < %s -march=x86-64 -mattr=+sse41 -asm-verbose=0 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse41 -asm-verbose=0 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse41 -asm-verbose=0 | FileCheck %s -check-prefix=WIN64 define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) nounwind { ; CHECK: test1: ; CHECK-NEXT: pmulld + +; WIN64: test1: +; WIN64: movdqa (%rcx), %xmm0 +; WIN64-NEXT: pmulld (%rdx), %xmm0 %C = mul <4 x i32> %A, %B ret <4 x i32> %C } @@ -10,6 +15,11 @@ define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) nounwind { define <4 x i32> @test1a(<4 x i32> %A, <4 x i32> *%Bp) nounwind { ; CHECK: test1a: ; CHECK-NEXT: pmulld + +; WIN64: test1a: +; WIN64: movdqa (%rcx), %xmm0 +; WIN64-NEXT: pmulld (%rdx), %xmm0 + %B = load <4 x i32>* %Bp %C = mul <4 x i32> %A, %B ret <4 x i32> %C diff --git a/test/CodeGen/X86/pr9127.ll b/test/CodeGen/X86/pr9127.ll index 45b0c6c..d61e165 100644 --- a/test/CodeGen/X86/pr9127.ll +++ b/test/CodeGen/X86/pr9127.ll @@ -9,4 +9,4 @@ entry: } ; test that the load is folded. -; CHECK: ucomisd (%rdi), %xmm0 +; CHECK: ucomisd (%{{rdi|rdx}}), %xmm0 diff --git a/test/CodeGen/X86/red-zone.ll b/test/CodeGen/X86/red-zone.ll index 1ffb4e3..d936971 100644 --- a/test/CodeGen/X86/red-zone.ll +++ b/test/CodeGen/X86/red-zone.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s ; First without noredzone. ; CHECK: f0: diff --git a/test/CodeGen/X86/remat-mov-0.ll b/test/CodeGen/X86/remat-mov-0.ll index 5fb445c..f89cd33 100644 --- a/test/CodeGen/X86/remat-mov-0.ll +++ b/test/CodeGen/X86/remat-mov-0.ll @@ -1,12 +1,13 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; CodeGen should remat the zero instead of spilling it. declare void @foo(i64 %p) ; CHECK: bar: -; CHECK: xorl %edi, %edi -; CHECK: xorl %edi, %edi +; CHECK: xorl %e[[A0:di|cx]], %e +; CHECK: xorl %e[[A0]], %e[[A0]] define void @bar() nounwind { call void @foo(i64 0) call void @foo(i64 0) @@ -14,8 +15,8 @@ define void @bar() nounwind { } ; CHECK: bat: -; CHECK: movq $-1, %rdi -; CHECK: movq $-1, %rdi +; CHECK: movq $-1, %r[[A0]] +; CHECK: movq $-1, %r[[A0]] define void @bat() nounwind { call void @foo(i64 -1) call void @foo(i64 -1) @@ -23,8 +24,8 @@ define void @bat() nounwind { } ; CHECK: bau: -; CHECK: movl $1, %edi -; CHECK: movl $1, %edi +; CHECK: movl $1, %e[[A0]] +; CHECK: movl $1, %e[[A0]] define void @bau() nounwind { call void @foo(i64 1) call void @foo(i64 1) diff --git a/test/CodeGen/X86/scalar-min-max-fill-operand.ll b/test/CodeGen/X86/scalar-min-max-fill-operand.ll index fe40758..cf0ebbf 100644 --- a/test/CodeGen/X86/scalar-min-max-fill-operand.ll +++ b/test/CodeGen/X86/scalar-min-max-fill-operand.ll @@ -1,6 +1,34 @@ -; RUN: llc < %s -march=x86-64 | grep min | count 1 -; RUN: llc < %s -march=x86-64 | grep max | count 1 -; RUN: llc < %s -march=x86-64 | grep mov | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: {{(min|max|mov)}} +; CHECK: mov +; CHECK-NOT: {{(min|max|mov)}} +; CHECK: min +; CHECK-NOT: {{(min|max|mov)}} +; CHECK: mov +; CHECK-NOT: {{(min|max|mov)}} +; CHECK: max +; CHECK-NOT: {{(min|max|mov)}} + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 +; WIN64: {{^foo:}} +; WIN64: subq $56, %rsp +; WIN64-NEXT: movaps %xmm6, 32(%rsp) +; WIN64-NEXT: movaps %xmm0, %xmm6 +; WIN64-NEXT: callq bar +; WIN64-NEXT: minss %xmm6, %xmm0 +; WIN64-NEXT: movaps 32(%rsp), %xmm6 +; WIN64-NEXT: addq $56, %rsp +; WIN64-NEXT: ret + +; WIN64: {{^hem:}} +; WIN64: subq $56, %rsp +; WIN64-NEXT: movaps %xmm6, 32(%rsp) +; WIN64-NEXT: movaps %xmm0, %xmm6 +; WIN64-NEXT: callq bar +; WIN64-NEXT: maxss %xmm6, %xmm0 +; WIN64-NEXT: movaps 32(%rsp), %xmm6 +; WIN64-NEXT: addq $56, %rsp +; WIN64-NEXT: ret declare float @bar() diff --git a/test/CodeGen/X86/sse-align-0.ll b/test/CodeGen/X86/sse-align-0.ll index b12a87d..50fdd76 100644 --- a/test/CodeGen/X86/sse-align-0.ll +++ b/test/CodeGen/X86/sse-align-0.ll @@ -1,12 +1,26 @@ -; RUN: llc < %s -march=x86-64 | not grep mov +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: mov + +; RUN: llc < %s -mtriple=x86_64-win32 -asm-verbose=false | FileCheck %s -check-prefix=WIN64 define <4 x float> @foo(<4 x float>* %p, <4 x float> %x) nounwind { %t = load <4 x float>* %p %z = fmul <4 x float> %t, %x ret <4 x float> %z } + +; WIN64: foo: +; WIN64-NEXT: movaps (%rcx), %xmm0 +; WIN64-NEXT: mulps (%rdx), %xmm0 +; WIN64-NEXT: ret + define <2 x double> @bar(<2 x double>* %p, <2 x double> %x) nounwind { %t = load <2 x double>* %p %z = fmul <2 x double> %t, %x ret <2 x double> %z } + +; WIN64: bar: +; WIN64-NEXT: movapd (%rcx), %xmm0 +; WIN64-NEXT: mulpd (%rdx), %xmm0 +; WIN64-NEXT: ret diff --git a/test/CodeGen/X86/sse-align-3.ll b/test/CodeGen/X86/sse-align-3.ll index c42f7f0..03b0a29 100644 --- a/test/CodeGen/X86/sse-align-3.ll +++ b/test/CodeGen/X86/sse-align-3.ll @@ -1,10 +1,28 @@ -; RUN: llc < %s -march=x86-64 | grep movap | count 2 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: movapd +; CHECK: movaps +; CHECK-NOT: movaps +; CHECK: movapd +; CHECK-NOT: movap + +; RUN: llc < %s -mtriple=x86_64-win32 -asm-verbose=false | FileCheck %s -check-prefix=WIN64 define void @foo(<4 x float>* %p, <4 x float> %x) nounwind { store <4 x float> %x, <4 x float>* %p ret void } + +; WIN64: foo: +; WIN64-NEXT: movaps (%rdx), %xmm0 +; WIN64-NEXT: movaps %xmm0, (%rcx) +; WIN64-NEXT: ret + define void @bar(<2 x double>* %p, <2 x double> %x) nounwind { store <2 x double> %x, <2 x double>* %p ret void } + +; WIN64: bar: +; WIN64-NEXT: movapd (%rdx), %xmm0 +; WIN64-NEXT: movapd %xmm0, (%rcx) +; WIN64-NEXT: ret diff --git a/test/CodeGen/X86/sse-align-7.ll b/test/CodeGen/X86/sse-align-7.ll index 5784481..5479ca2 100644 --- a/test/CodeGen/X86/sse-align-7.ll +++ b/test/CodeGen/X86/sse-align-7.ll @@ -1,4 +1,10 @@ -; RUN: llc < %s -march=x86-64 | grep movaps | count 1 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK: movaps +; CHECK-NOT: movaps + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 +; WIN64: movaps (%rdx), [[XMM:%xmm[0-7]+]] +; WIN64: movaps [[XMM]], (%rcx) define void @bar(<2 x i64>* %p, <2 x i64> %x) nounwind { store <2 x i64> %x, <2 x i64>* %p diff --git a/test/CodeGen/X86/sse-commute.ll b/test/CodeGen/X86/sse-commute.ll index 38ed644..1a3390a 100644 --- a/test/CodeGen/X86/sse-commute.ll +++ b/test/CodeGen/X86/sse-commute.ll @@ -1,4 +1,4 @@ -; RUN: llc -march=x86-64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s ; Commute the comparison to avoid a move. ; PR7500. @@ -17,4 +17,10 @@ entry: ret <2 x double> %tmp8 } - +; RUN: llc -mtriple=x86_64-win32 -asm-verbose=false < %s | FileCheck %s -check-prefix=WIN64 +; WIN64: a: +; WIN64-NEXT: movdqa (%rdx), %xmm0 +; WIN64-NEXT: movdqa (%rcx), %xmm1 +; WIN64-NEXT: pcmpeqd %xmm1, %xmm0 +; WIN64-NEXT: pand %xmm1, %xmm0 +; WIN64-NEXT: ret diff --git a/test/CodeGen/X86/sse_reload_fold.ll b/test/CodeGen/X86/sse_reload_fold.ll index dc3d6fe..02399c4 100644 --- a/test/CodeGen/X86/sse_reload_fold.ll +++ b/test/CodeGen/X86/sse_reload_fold.ll @@ -1,5 +1,6 @@ -; RUN: llc < %s -march=x86-64 -mattr=+64bit,+sse3 -print-failed-fuse-candidates |& \ -; RUN: grep fail | count 1 +; RUN: llc < %s -mtriple=x86_64-linux -mattr=+64bit,+sse3 -print-failed-fuse-candidates |& FileCheck %s +; CHECK: fail +; CHECK-NOT: fail declare float @test_f(float %f) declare double @test_d(double %f) diff --git a/test/CodeGen/X86/stdarg.ll b/test/CodeGen/X86/stdarg.ll index 9778fa1..29d91e8 100644 --- a/test/CodeGen/X86/stdarg.ll +++ b/test/CodeGen/X86/stdarg.ll @@ -1,4 +1,18 @@ -; RUN: llc < %s -march=x86-64 | grep {testb \[%\]al, \[%\]al} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK: testb %al, %al + +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 +; WIN64: {{^foo:}} +; WIN64: subq $56, %rsp +; WIN64-NEXT: movq %r9, 88(%rsp) +; WIN64-NEXT: movq %r8, 80(%rsp) +; WIN64-NEXT: movq %rdx, 72(%rsp) +; WIN64-NEXT: leaq 72(%rsp), %rax +; WIN64-NEXT: movq %rax, 32(%rsp) +; WIN64-NEXT: leaq 32(%rsp), %rcx +; WIN64-NEXT: callq bar +; WIN64-NEXT: addq $56, %rsp +; WIN64-NEXT: ret %struct.__va_list_tag = type { i32, i32, i8*, i8* } diff --git a/test/CodeGen/X86/stride-nine-with-base-reg.ll b/test/CodeGen/X86/stride-nine-with-base-reg.ll index f4847a3..59fa8b8 100644 --- a/test/CodeGen/X86/stride-nine-with-base-reg.ll +++ b/test/CodeGen/X86/stride-nine-with-base-reg.ll @@ -1,5 +1,6 @@ -; RUN: llc < %s -march=x86 -relocation-model=static | not grep lea -; RUN: llc < %s -march=x86-64 | not grep lea +; RUN: llc < %s -march=x86 -relocation-model=static | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: lea ; P should be sunk into the loop and folded into the address mode. There ; shouldn't be any lea instructions inside the loop. @@ -35,3 +36,32 @@ return: ret void } +; RUN: llc < %s -mtriple=x86_64-win32 -asm-verbose=false | FileCheck %s -check-prefix=WIN64 +; WIN64: foo: +; WIN64: subq $16, %rsp +; WIN64-NEXT: movq %rsi, (%rsp) +; WIN64-NEXT: movq %rdi, 8(%rsp) +; WIN64-NEXT: testl %ecx, %ecx +; WIN64-NEXT: jle .LBB0_3 +; WIN64-NEXT: xorl %eax, %eax +; WIN64-NEXT: leaq B(%rip), %rsi +; WIN64-NEXT: leaq A(%rip), %rdi +; WIN64-NEXT: leaq P(%rip), %r8 +; WIN64-NEXT: leaq Q(%rip), %r9 +; WIN64: .LBB0_2: +; WIN64-NEXT: movslq %eax, %rax +; WIN64-NEXT: movb (%rax,%rsi), %r10b +; WIN64-NEXT: addb %r10b, %r10b +; WIN64-NEXT: movb %r10b, (%rax,%rdi) +; WIN64-NEXT: movslq %edx, %rdx +; WIN64-NEXT: movb $17, (%rdx,%r8) +; WIN64-NEXT: movb $19, (%rdx,%r9) +; WIN64-NEXT: addl $9, %edx +; WIN64-NEXT: incl %eax +; WIN64-NEXT: cmpl %eax, %ecx +; WIN64-NEXT: jne .LBB0_2 +; WIN64-NEXT: LBB0_3: +; WIN64-NEXT: movq 8(%rsp), %rdi +; WIN64-NEXT: movq (%rsp), %rsi +; WIN64-NEXT: addq $16, %rsp +; WIN64-NEXT: ret diff --git a/test/CodeGen/X86/stride-reuse.ll b/test/CodeGen/X86/stride-reuse.ll index 5cbd895..55251d9 100644 --- a/test/CodeGen/X86/stride-reuse.ll +++ b/test/CodeGen/X86/stride-reuse.ll @@ -1,5 +1,6 @@ -; RUN: llc < %s -march=x86 | not grep lea -; RUN: llc < %s -march=x86-64 | not grep lea +; RUN: llc < %s -march=x86 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; CHECK-NOT: lea @B = external global [1000 x float], align 32 @A = external global [1000 x float], align 32 @@ -28,3 +29,31 @@ bb: return: ret void } + +; RUN: llc < %s -mtriple=x86_64-win32 -asm-verbose=false | FileCheck %s -check-prefix=WIN64 +; WIN64: foo: +; WIN64: subq $16, %rsp +; WIN64-NEXT: movq %rsi, (%rsp) +; WIN64-NEXT: movq %rdi, 8(%rsp) +; WIN64-NEXT: testl %ecx, %ecx +; WIN64-NEXT: jle .LBB0_3 +; WIN64-NEXT: xorl %eax, %eax +; WIN64-NEXT: movl $64, %edx +; WIN64-NEXT: leaq B(%rip), %rsi +; WIN64-NEXT: leaq A(%rip), %rdi +; WIN64-NEXT: leaq P(%rip), %r8 +; WIN64: .LBB0_2: +; WIN64-NEXT: movslq %eax, %rax +; WIN64-NEXT: movss (%rsi,%rax,4), %xmm0 +; WIN64-NEXT: addss %xmm0, %xmm0 +; WIN64-NEXT: movss %xmm0, (%rdi,%rax,4) +; WIN64-NEXT: movl %edx, (%r8,%rax,4) +; WIN64-NEXT: addl $2, %edx +; WIN64-NEXT: incl %eax +; WIN64-NEXT: cmpl %eax, %ecx +; WIN64-NEXT: jne .LBB0_2 +; WIN64-NEXT: .LBB0_3: +; WIN64-NEXT: movq 8(%rsp), %rdi +; WIN64-NEXT: movq (%rsp), %rsi +; WIN64-NEXT: addq $16, %rsp +; WIN64-NEXT: ret diff --git a/test/CodeGen/X86/tailcallbyval64.ll b/test/CodeGen/X86/tailcallbyval64.ll index 7c685b8..1b1efe7 100644 --- a/test/CodeGen/X86/tailcallbyval64.ll +++ b/test/CodeGen/X86/tailcallbyval64.ll @@ -1,15 +1,30 @@ -; RUN: llc < %s -march=x86-64 -tailcallopt | grep TAILCALL +; RUN: llc < %s -mtriple=x86_64-linux -tailcallopt | FileCheck %s + +; FIXME: Win64 does not support byval. + +; Expect the entry point. +; CHECK: tailcaller: + ; Expect 2 rep;movs because of tail call byval lowering. -; RUN: llc < %s -march=x86-64 -tailcallopt | grep rep | wc -l | grep 2 +; CHECK: rep; +; CHECK: rep; + ; A sequence of copyto/copyfrom virtual registers is used to deal with byval ; lowering appearing after moving arguments to registers. The following two ; checks verify that the register allocator changes those sequences to direct ; moves to argument register where it can (for registers that are not used in ; byval lowering - not rsi, not rdi, not rcx). ; Expect argument 4 to be moved directly to register edx. -; RUN: llc < %s -march=x86-64 -tailcallopt | grep movl | grep {7} | grep edx +; CHECK: movl $7, %edx + ; Expect argument 6 to be moved directly to register r8. -; RUN: llc < %s -march=x86-64 -tailcallopt | grep movl | grep {17} | grep r8 +; CHECK: movl $17, %r8d + +; Expect not call but jmp to @tailcallee. +; CHECK: jmp tailcallee + +; Expect the trailer. +; CHECK: .size tailcaller %struct.s = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, @@ -25,5 +40,3 @@ entry: %tmp4 = tail call fastcc i64 @tailcallee(%struct.s* %a byval, i64 %tmp3, i64 %b, i64 7, i64 13, i64 17) ret i64 %tmp4 } - - diff --git a/test/CodeGen/X86/test-shrink.ll b/test/CodeGen/X86/test-shrink.ll index 1d63693..5bc28ec 100644 --- a/test/CodeGen/X86/test-shrink.ll +++ b/test/CodeGen/X86/test-shrink.ll @@ -1,8 +1,9 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s --check-prefix=CHECK-64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-64 ; RUN: llc < %s -march=x86 | FileCheck %s --check-prefix=CHECK-32 ; CHECK-64: g64xh: -; CHECK-64: testb $8, %ah +; CHECK-64: testb $8, {{%ah|%ch}} ; CHECK-64: ret ; CHECK-32: g64xh: ; CHECK-32: testb $8, %ah @@ -19,7 +20,7 @@ no: ret void } ; CHECK-64: g64xl: -; CHECK-64: testb $8, %dil +; CHECK-64: testb $8, [[A0L:%dil|%cl]] ; CHECK-64: ret ; CHECK-32: g64xl: ; CHECK-32: testb $8, %al @@ -36,7 +37,7 @@ no: ret void } ; CHECK-64: g32xh: -; CHECK-64: testb $8, %ah +; CHECK-64: testb $8, {{%ah|%ch}} ; CHECK-64: ret ; CHECK-32: g32xh: ; CHECK-32: testb $8, %ah @@ -53,7 +54,7 @@ no: ret void } ; CHECK-64: g32xl: -; CHECK-64: testb $8, %dil +; CHECK-64: testb $8, [[A0L]] ; CHECK-64: ret ; CHECK-32: g32xl: ; CHECK-32: testb $8, %al @@ -70,7 +71,7 @@ no: ret void } ; CHECK-64: g16xh: -; CHECK-64: testb $8, %ah +; CHECK-64: testb $8, {{%ah|%ch}} ; CHECK-64: ret ; CHECK-32: g16xh: ; CHECK-32: testb $8, %ah @@ -87,7 +88,7 @@ no: ret void } ; CHECK-64: g16xl: -; CHECK-64: testb $8, %dil +; CHECK-64: testb $8, [[A0L]] ; CHECK-64: ret ; CHECK-32: g16xl: ; CHECK-32: testb $8, %al @@ -104,7 +105,7 @@ no: ret void } ; CHECK-64: g64x16: -; CHECK-64: testw $-32640, %di +; CHECK-64: testw $-32640, %[[A0W:di|cx]] ; CHECK-64: ret ; CHECK-32: g64x16: ; CHECK-32: testw $-32640, %ax @@ -121,7 +122,7 @@ no: ret void } ; CHECK-64: g32x16: -; CHECK-64: testw $-32640, %di +; CHECK-64: testw $-32640, %[[A0W]] ; CHECK-64: ret ; CHECK-32: g32x16: ; CHECK-32: testw $-32640, %ax @@ -138,7 +139,7 @@ no: ret void } ; CHECK-64: g64x32: -; CHECK-64: testl $268468352, %edi +; CHECK-64: testl $268468352, %e[[A0W]] ; CHECK-64: ret ; CHECK-32: g64x32: ; CHECK-32: testl $268468352, %eax diff --git a/test/CodeGen/X86/use-add-flags.ll b/test/CodeGen/X86/use-add-flags.ll index c2f0c23..4aed7f0 100644 --- a/test/CodeGen/X86/use-add-flags.ll +++ b/test/CodeGen/X86/use-add-flags.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -o - | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux -o - | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 -o - | FileCheck %s ; Reuse the flags value from the add instructions instead of emitting separate ; testl instructions. @@ -6,10 +7,10 @@ ; Use the flags on the add. ; CHECK: test1: -; CHECK: addl (%rdi), %esi -; CHECK-NEXT: movl %edx, %eax -; CHECK-NEXT: cmovnsl %ecx, %eax -; CHECK-NEXT: ret +; CHECK: addl {{\(%rdi\), %esi|\(%rcx\), %edx}} +; CHECK-NEXT: movl {{%edx|%r8d}}, %eax +; CHECK-NEXT: cmovnsl {{%ecx|%r9d}}, %eax +; CHECK: ret define i32 @test1(i32* %x, i32 %y, i32 %a, i32 %b) nounwind { %tmp2 = load i32* %x, align 4 ; [#uses=1] @@ -25,7 +26,7 @@ declare void @foo(i32) ; other use. A simple test is better. ; CHECK: test2: -; CHECK: testb $16, %dil +; CHECK: testb $16, {{%dil|%cl}} define void @test2(i32 %x) nounwind { %y = and i32 %x, 16 @@ -41,7 +42,7 @@ false: ; Do use the flags result of the and here, since the and has another use. ; CHECK: test3: -; CHECK: andl $16, %edi +; CHECK: andl $16, {{%edi|%ecx}} ; CHECK-NEXT: jne define void @test3(i32 %x) nounwind { diff --git a/test/CodeGen/X86/v2f32.ll b/test/CodeGen/X86/v2f32.ll index 76c3fdf..6d14099 100644 --- a/test/CodeGen/X86/v2f32.ll +++ b/test/CodeGen/X86/v2f32.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -march=x86-64 -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=W64 ; RUN: llc < %s -mcpu=yonah -march=x86 -asm-verbose=0 -o - | FileCheck %s -check-prefix=X32 ; PR7518 @@ -15,6 +16,13 @@ define void @test1(<2 x float> %Q, float *%P2) nounwind { ; X64-NEXT: movss %xmm1, (%rdi) ; X64-NEXT: ret +; W64: test1: +; W64-NEXT: movdqa (%rcx), %xmm0 +; W64-NEXT: pshufd $1, %xmm0, %xmm1 +; W64-NEXT: addss %xmm0, %xmm1 +; W64-NEXT: movss %xmm1, (%rdx) +; W64-NEXT: ret + ; X32: test1: ; X32-NEXT: pshufd $1, %xmm0, %xmm1 ; X32-NEXT: addss %xmm0, %xmm1 @@ -31,6 +39,14 @@ define <2 x float> @test2(<2 x float> %Q, <2 x float> %R, <2 x float> *%P) nounw ; X64: test2: ; X64-NEXT: addps %xmm1, %xmm0 ; X64-NEXT: ret + +; W64: test2: +; W64-NEXT: movaps (%rcx), %xmm0 +; W64-NEXT: addps (%rdx), %xmm0 +; W64-NEXT: ret + +; X32: test2: +; X32: addps %xmm1, %xmm0 } @@ -38,17 +54,35 @@ define <2 x float> @test3(<4 x float> %A) nounwind { %B = shufflevector <4 x float> %A, <4 x float> undef, <2 x i32> %C = fadd <2 x float> %B, %B ret <2 x float> %C -; CHECK: test3: -; CHECK-NEXT: addps %xmm0, %xmm0 -; CHECK-NEXT: ret +; X64: test3: +; X64-NEXT: addps %xmm0, %xmm0 +; X64-NEXT: ret + +; W64: test3: +; W64-NEXT: movaps (%rcx), %xmm0 +; W64-NEXT: addps %xmm0, %xmm0 +; W64-NEXT: ret + +; X32: test3: +; X32-NEXT: addps %xmm0, %xmm0 +; X32-NEXT: ret } define <2 x float> @test4(<2 x float> %A) nounwind { %C = fadd <2 x float> %A, %A ret <2 x float> %C -; CHECK: test4: -; CHECK-NEXT: addps %xmm0, %xmm0 -; CHECK-NEXT: ret +; X64: test4: +; X64-NEXT: addps %xmm0, %xmm0 +; X64-NEXT: ret + +; W64: test4: +; W64-NEXT: movaps (%rcx), %xmm0 +; W64-NEXT: addps %xmm0, %xmm0 +; W64-NEXT: ret + +; X32: test4: +; X32-NEXT: addps %xmm0, %xmm0 +; X32-NEXT: ret } define <4 x float> @test5(<4 x float> %A) nounwind { @@ -61,10 +95,21 @@ BB: %E = shufflevector <2 x float> %D, <2 x float> undef, <4 x i32> ret <4 x float> %E -; CHECK: _test5: -; CHECK-NEXT: addps %xmm0, %xmm0 -; CHECK-NEXT: addps %xmm0, %xmm0 -; CHECK-NEXT: ret +; X64: test5: +; X64-NEXT: addps %xmm0, %xmm0 +; X64-NEXT: addps %xmm0, %xmm0 +; X64-NEXT: ret + +; W64: test5: +; W64-NEXT: movaps (%rcx), %xmm0 +; W64-NEXT: addps %xmm0, %xmm0 +; W64-NEXT: addps %xmm0, %xmm0 +; W64-NEXT: ret + +; X32: test5: +; X32-NEXT: addps %xmm0, %xmm0 +; X32-NEXT: addps %xmm0, %xmm0 +; X32-NEXT: ret } diff --git a/test/CodeGen/X86/vec_cast.ll b/test/CodeGen/X86/vec_cast.ll index 95289c9..6263d58 100644 --- a/test/CodeGen/X86/vec_cast.ll +++ b/test/CodeGen/X86/vec_cast.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86-64 -mcpu=core2 - +; PR8311 +; XFAIL: mingw,win32 define <8 x i32> @a(<8 x i16> %a) nounwind { %c = sext <8 x i16> %a to <8 x i32> diff --git a/test/CodeGen/X86/vec_set-8.ll b/test/CodeGen/X86/vec_set-8.ll index 9697f11..66056d0 100644 --- a/test/CodeGen/X86/vec_set-8.ll +++ b/test/CodeGen/X86/vec_set-8.ll @@ -1,5 +1,8 @@ -; RUN: llc < %s -march=x86-64 | not grep movsd -; RUN: llc < %s -march=x86-64 | grep {movd.*%rdi,.*%xmm0} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK-NOT: movsd +; CHECK: movd {{%rdi|%rcx}}, %xmm0 +; CHECK-NOT: movsd define <2 x i64> @test(i64 %i) nounwind { entry: diff --git a/test/CodeGen/X86/vec_shuffle-17.ll b/test/CodeGen/X86/vec_shuffle-17.ll index 9c33abb..ebc8c5b 100644 --- a/test/CodeGen/X86/vec_shuffle-17.ll +++ b/test/CodeGen/X86/vec_shuffle-17.ll @@ -1,5 +1,8 @@ -; RUN: llc < %s -march=x86-64 | grep {movd.*%rdi, %xmm0} -; RUN: llc < %s -march=x86-64 | not grep xor +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK-NOT: xor +; CHECK: movd {{%rdi|%rcx}}, %xmm0 +; CHECK-NOT: xor ; PR2108 define <2 x i64> @doload64(i64 %x) nounwind { diff --git a/test/CodeGen/X86/vec_shuffle-37.ll b/test/CodeGen/X86/vec_shuffle-37.ll index b090930..2efdb14 100644 --- a/test/CodeGen/X86/vec_shuffle-37.ll +++ b/test/CodeGen/X86/vec_shuffle-37.ll @@ -1,9 +1,10 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s ; RUN: llc -O0 < %s -march=x86 -mcpu=core2 | FileCheck %s --check-prefix=CHECK_O0 define <4 x i32> @t00(<4 x i32>* %a0) nounwind ssp { entry: -; CHECK: movaps (%rdi), %xmm0 +; CHECK: movaps ({{%rdi|%rcx}}), %xmm0 ; CHECK-NEXT: movaps %xmm0, %xmm1 ; CHECK-NEXT: movlps (%rax), %xmm1 ; CHECK-NEXT: shufps $36, %xmm1, %xmm0 diff --git a/test/CodeGen/X86/widen_load-0.ll b/test/CodeGen/X86/widen_load-0.ll index f6c4af0..82c8252 100644 --- a/test/CodeGen/X86/widen_load-0.ll +++ b/test/CodeGen/X86/widen_load-0.ll @@ -1,4 +1,5 @@ -; RUN: llc < %s -o - -march=x86-64 | FileCheck %s +; RUN: llc < %s -o - -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -o - -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64 ; PR4891 ; Both loads should happen before either store. @@ -8,6 +9,11 @@ ; CHECK: movl %ecx, (%rdi) ; CHECK: movl %eax, (%rsi) +; WIN64: movl (%rcx), %eax +; WIN64: movl (%rdx), %esi +; WIN64: movl %esi, (%rcx) +; WIN64: movl %eax, (%rdx) + define void @short2_int_swap(<2 x i16>* nocapture %b, i32* nocapture %c) nounwind { entry: %0 = load <2 x i16>* %b, align 2 ; <<2 x i16>> [#uses=1] diff --git a/test/CodeGen/X86/x86-64-malloc.ll b/test/CodeGen/X86/x86-64-malloc.ll index b4f1fa6..4aa0ec3 100644 --- a/test/CodeGen/X86/x86-64-malloc.ll +++ b/test/CodeGen/X86/x86-64-malloc.ll @@ -1,4 +1,6 @@ -; RUN: llc < %s -march=x86-64 | grep {shll.*3, %edi} +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s +; CHECK: shll $3, {{%edi|%ecx}} ; PR3829 ; The generated code should multiply by 3 (sizeof i8*) as an i32, ; not as an i64! diff --git a/test/CodeGen/X86/xor.ll b/test/CodeGen/X86/xor.ll index 6c623cb..b90d81a 100644 --- a/test/CodeGen/X86/xor.ll +++ b/test/CodeGen/X86/xor.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=X32 -; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=X64 ; Though it is undefined, we want xor undef,undef to produce zero. define <4 x i32> @test1() nounwind { @@ -28,9 +29,9 @@ entry: ret i32 %tmp4 ; X64: test3: -; X64: notl %esi -; X64: andl %edi, %esi -; X64: movl %esi, %eax +; X64: notl [[A1:%esi|%edx]] +; X64: andl [[A0:%edi|%ecx]], [[A1]] +; X64: movl [[A1]], %eax ; X64: shrl %eax ; X64: ret From baldrick at free.fr Thu Feb 17 02:16:06 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 09:16:06 +0100 Subject: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll In-Reply-To: <6594DDFF12B03D4E89690887C2486994027105D780@hasmsx504.ger.corp.intel.com> References: <20110211193756.00C782A6C12C@llvm.org> <33543FF9-1ACE-4D44-8E7F-6D73B5F52D06@googlemail.com> <6594DDFF12B03D4E89690887C24869940270CCB0D6@hasmsx504.ger.corp.intel.com> <4D580EB3.2070701@free.fr> <4D5855BE.5080307@mxc.ca> <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> <6594DDFF12B03D4E89690887C2486994027105D780@hasmsx504.ger.corp.intel.com> Message-ID: <4D5CD946.6040800@free.fr> Hi Nadav, > I attached a revised patch which supports getAllOnesValue on FP values. I added minor changes to APFloat as well as new tests. > --- include/llvm/ADT/APFloat.h (revision 125681) > +++ include/llvm/ADT/APFloat.h (working copy) > @@ -246,6 +246,13 @@ > static APFloat getSmallestNormalized(const fltSemantics &Sem, > bool Negative = false); > > + /// getAllOnesValue - Returns a float which is bitcasted from > + /// an all one value int I don't think you should mention bitcasting here. How about: Returns a float with every bit set to one. > --- lib/VMCore/Constants.cpp (revision 125681) > +++ lib/VMCore/Constants.cpp (working copy) > @@ -93,7 +93,26 @@ > if (const IntegerType *ITy = dyn_cast(Ty)) > return ConstantInt::get(Ty->getContext(), > APInt::getAllOnesValue(ITy->getBitWidth())); > - > + > + if (Ty->isFloatingPointTy()) { > + APFloat FL(0.0f); > + switch (Ty->getTypeID()) { You can get the bitwidth using Ty->getPrimitiveSizeInBits(). Thus you only have to worry about setting the IEEE flag right. So the switch etc can be turned into something like this: APFloat FL = APFloat::getAllOnesValue(Ty->getPrimitiveSizeInBits(), Ty->isPPC_FP128Ty()); Ciao, Duncan. From baldrick at free.fr Thu Feb 17 02:16:56 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 08:16:56 -0000 Subject: [llvm-commits] [llvm] r125738 - /llvm/trunk/lib/Target/README.txt Message-ID: <20110217081656.E3C642A6C12C@llvm.org> Author: baldrick Date: Thu Feb 17 02:16:56 2011 New Revision: 125738 URL: http://llvm.org/viewvc/llvm-project?rev=125738&view=rev Log: This has been implemented. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=125738&r1=125737&r2=125738&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Thu Feb 17 02:16:56 2011 @@ -2225,16 +2225,6 @@ //===---------------------------------------------------------------------===// -We should fold compares like this: - - %1266 = add nsw i32 %.84.i.i.i, 1 - %560 = add nsw i32 %556, 1 - %1267 = icmp slt i32 %1266, %560 - -to a single 'icmp slt' when the add's have a single use, since they are NSW. - -//===---------------------------------------------------------------------===// - We don't fold (icmp (add) (add)) unless the two adds only have a single use. There are a lot of cases that we're refusing to fold in (e.g.) 256.bzip2, for example: From baldrick at free.fr Thu Feb 17 02:35:15 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 09:35:15 +0100 Subject: [llvm-commits] [PATCH][llvm][clang] Use Triple::MinGW32 instead of Triple::MinGW64 In-Reply-To: References: Message-ID: <4D5CDDC3.5040009@free.fr> Hi Takumi, > I have reworked Triple patches. > > - Use Triple::MinGW32. (I got rid of Triple::MinGW) > - *-mingw64 is no longer recognized. Use *-mingw32. > > Please take a look into them, thank you. they look fine to me, though I'm not competent to comment on the last one (clang header search paths). Ciao, Duncan. From fvbommel at gmail.com Thu Feb 17 03:41:19 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Thu, 17 Feb 2011 10:41:19 +0100 Subject: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll In-Reply-To: <4D5CD946.6040800@free.fr> References: <20110211193756.00C782A6C12C@llvm.org> <33543FF9-1ACE-4D44-8E7F-6D73B5F52D06@googlemail.com> <6594DDFF12B03D4E89690887C24869940270CCB0D6@hasmsx504.ger.corp.intel.com> <4D580EB3.2070701@free.fr> <4D5855BE.5080307@mxc.ca> <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> <6594DDFF12B03D4E89690887C2486994027105D780@hasmsx504.ger.corp.intel.com> <4D5CD946.6040800@free.fr> Message-ID: On Thu, Feb 17, 2011 at 9:16 AM, Duncan Sands wrote: >> + ?if (Ty->isFloatingPointTy()) { >> + ? ?APFloat FL(0.0f); >> + ? ?switch (Ty->getTypeID()) { > > You can get the bitwidth using Ty->getPrimitiveSizeInBits(). ?Thus you only > have to worry about setting the IEEE flag right. ?So the switch etc can be > turned into something like this: > ?APFloat FL = APFloat::getAllOnesValue(Ty->getPrimitiveSizeInBits(), > Ty->isPPC_FP128Ty()); I think you meant '!Ty->isPPC_FP128Ty()' there. Nadav's patch got this wrong too. From baldrick at free.fr Thu Feb 17 03:52:32 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 10:52:32 +0100 Subject: [llvm-commits] [llvm] r125393 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll test/Transforms/InstCombine/fold-vector-select.ll In-Reply-To: References: <20110211193756.00C782A6C12C@llvm.org> <33543FF9-1ACE-4D44-8E7F-6D73B5F52D06@googlemail.com> <6594DDFF12B03D4E89690887C24869940270CCB0D6@hasmsx504.ger.corp.intel.com> <4D580EB3.2070701@free.fr> <4D5855BE.5080307@mxc.ca> <6594DDFF12B03D4E89690887C24869940270FC96E7@hasmsx504.ger.corp.intel.com> <6594DDFF12B03D4E89690887C2486994027105D780@hasmsx504.ger.corp.intel.com> <4D5CD946.6040800@free.fr> Message-ID: <4D5CEFE0.5070801@free.fr> Hi Frits, >> You can get the bitwidth using Ty->getPrimitiveSizeInBits(). Thus you only >> have to worry about setting the IEEE flag right. So the switch etc can be >> turned into something like this: >> APFloat FL = APFloat::getAllOnesValue(Ty->getPrimitiveSizeInBits(), >> Ty->isPPC_FP128Ty()); > > I think you meant '!Ty->isPPC_FP128Ty()' there. Nadav's patch got this > wrong too. yup. Ciao, Duncan. From geek4civic at gmail.com Thu Feb 17 06:23:50 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 17 Feb 2011 12:23:50 -0000 Subject: [llvm-commits] [llvm] r125746 - in /llvm/trunk/lib/Target/X86: X86Subtarget.h X86TargetMachine.cpp Message-ID: <20110217122350.E40C42A6C12C@llvm.org> Author: chapuni Date: Thu Feb 17 06:23:50 2011 New Revision: 125746 URL: http://llvm.org/viewvc/llvm-project?rev=125746&view=rev Log: Fix whitespace. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=125746&r1=125745&r2=125746&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Thu Feb 17 06:23:50 2011 @@ -103,7 +103,7 @@ /// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops. /// unsigned MaxInlineSizeThreshold; - + /// TargetTriple - What processor and OS we're targeting. Triple TargetTriple; @@ -166,23 +166,23 @@ bool hasVectorUAMem() const { return HasVectorUAMem; } bool isTargetDarwin() const { return TargetTriple.getOS() == Triple::Darwin; } - + // ELF is a reasonably sane default and the only other X86 targets we // support are Darwin and Windows. Just use "not those". - bool isTargetELF() const { + bool isTargetELF() const { return !isTargetDarwin() && !isTargetWindows() && !isTargetCygMing(); } bool isTargetLinux() const { return TargetTriple.getOS() == Triple::Linux; } bool isTargetWindows() const { return TargetTriple.getOS() == Triple::Win32; } - bool isTargetMingw() const { + bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32 || TargetTriple.getOS() == Triple::MinGW64; } bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; } bool isTargetCygMing() const { return isTargetMingw() || isTargetCygwin(); } - + /// isTargetCOFF - Return true if this is any COFF/Windows target variant. bool isTargetCOFF() const { return isTargetMingw() || isTargetCygwin() || isTargetWindows(); Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=125746&r1=125745&r2=125746&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Thu Feb 17 06:23:50 2011 @@ -65,7 +65,7 @@ } } -extern "C" void LLVMInitializeX86Target() { +extern "C" void LLVMInitializeX86Target() { // Register the target. RegisterTargetMachine X(TheX86_32Target); RegisterTargetMachine Y(TheX86_64Target); @@ -122,7 +122,7 @@ /// X86TargetMachine ctor - Create an X86 target. /// -X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT, +X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT, const std::string &FS, bool is64Bit) : LLVMTargetMachine(T, TT), Subtarget(TT, FS, is64Bit), @@ -234,12 +234,12 @@ JITCodeEmitter &JCE) { // FIXME: Move this to TargetJITInfo! // On Darwin, do not override 64-bit setting made in X86TargetMachine(). - if (DefRelocModel == Reloc::Default && + if (DefRelocModel == Reloc::Default && (!Subtarget.isTargetDarwin() || !Subtarget.is64Bit())) { setRelocationModel(Reloc::Static); Subtarget.setPICStyle(PICStyles::None); } - + PM.add(createX86JITCodeEmitterPass(*this, JCE)); From geek4civic at gmail.com Thu Feb 17 06:24:17 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Thu, 17 Feb 2011 12:24:17 -0000 Subject: [llvm-commits] [llvm] r125747 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp lib/Target/ARM/ARMTargetMachine.cpp lib/Target/MBlaze/MBlazeTargetMachine.cpp lib/Target/X86/X86AsmBackend.cpp lib/Target/X86/X86Subtarget.h lib/Target/X86/X86TargetMachine.cpp test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll Message-ID: <20110217122417.9F4992A6C12C@llvm.org> Author: chapuni Date: Thu Feb 17 06:24:17 2011 New Revision: 125747 URL: http://llvm.org/viewvc/llvm-project?rev=125747&view=rev Log: Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 generally. No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32. In llvm side, i686 and x64 can be treated as similar way. Modified: llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Triple.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/MBlaze/MBlazeTargetMachine.cpp llvm/trunk/lib/Target/X86/X86AsmBackend.cpp llvm/trunk/lib/Target/X86/X86Subtarget.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Thu Feb 17 06:24:17 2011 @@ -84,8 +84,7 @@ FreeBSD, Linux, Lv2, // PS3 - MinGW32, - MinGW64, + MinGW32, // i*86-pc-mingw32, *-w64-mingw32 NetBSD, OpenBSD, Psp, Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Thu Feb 17 06:24:17 2011 @@ -101,7 +101,6 @@ case Linux: return "linux"; case Lv2: return "lv2"; case MinGW32: return "mingw32"; - case MinGW64: return "mingw64"; case NetBSD: return "netbsd"; case OpenBSD: return "openbsd"; case Psp: return "psp"; @@ -318,8 +317,6 @@ return Lv2; else if (OSName.startswith("mingw32")) return MinGW32; - else if (OSName.startswith("mingw64")) - return MinGW64; else if (OSName.startswith("netbsd")) return NetBSD; else if (OSName.startswith("openbsd")) Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Thu Feb 17 06:24:17 2011 @@ -45,7 +45,6 @@ case Triple::Darwin: return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll); case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: llvm_unreachable("ARM does not support Windows COFF format"); Modified: llvm/trunk/lib/Target/MBlaze/MBlazeTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeTargetMachine.cpp?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/lib/Target/MBlaze/MBlazeTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/MBlaze/MBlazeTargetMachine.cpp Thu Feb 17 06:24:17 2011 @@ -41,7 +41,6 @@ llvm_unreachable("MBlaze does not support Darwin MACH-O format"); return NULL; case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: llvm_unreachable("MBlaze does not support Windows COFF format"); Modified: llvm/trunk/lib/Target/X86/X86AsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmBackend.cpp?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmBackend.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmBackend.cpp Thu Feb 17 06:24:17 2011 @@ -428,7 +428,7 @@ switch (Triple(TT).getOS()) { case Triple::Darwin: return new DarwinX86_64AsmBackend(T); - case Triple::MinGW64: + case Triple::MinGW32: case Triple::Cygwin: case Triple::Win32: if (Triple(TT).getEnvironment() == Triple::MachO) Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Thu Feb 17 06:24:17 2011 @@ -175,9 +175,7 @@ bool isTargetLinux() const { return TargetTriple.getOS() == Triple::Linux; } bool isTargetWindows() const { return TargetTriple.getOS() == Triple::Win32; } - bool isTargetMingw() const { - return TargetTriple.getOS() == Triple::MinGW32 || - TargetTriple.getOS() == Triple::MinGW64; } + bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32; } bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; } bool isTargetCygMing() const { return isTargetMingw() || isTargetCygwin(); Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Thu Feb 17 06:24:17 2011 @@ -30,7 +30,6 @@ case Triple::Darwin: return new X86MCAsmInfoDarwin(TheTriple); case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: if (TheTriple.getEnvironment() == Triple::MachO) @@ -53,7 +52,6 @@ case Triple::Darwin: return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); case Triple::MinGW32: - case Triple::MinGW64: case Triple::Cygwin: case Triple::Win32: if (TheTriple.getEnvironment() == Triple::MachO) Modified: llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll Thu Feb 17 06:24:17 2011 @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-mingw32 < %s | FileCheck %s ; CHECK-NOT: -{{[1-9][0-9]*}}(%rsp) define x86_fp80 @a(i64 %x) nounwind readnone { Modified: llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll?rev=125747&r1=125746&r2=125747&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll Thu Feb 17 06:24:17 2011 @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-mingw32 < %s | FileCheck %s ; CHECK: subq $40, %rsp ; CHECK: movaps %xmm8, (%rsp) ; CHECK: movaps %xmm7, 16(%rsp) From baldrick at free.fr Thu Feb 17 06:42:48 2011 From: baldrick at free.fr (Duncan Sands) Date: Thu, 17 Feb 2011 12:42:48 -0000 Subject: [llvm-commits] [llvm] r125748 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Message-ID: <20110217124248.AC1F32A6C12C@llvm.org> Author: baldrick Date: Thu Feb 17 06:42:48 2011 New Revision: 125748 URL: http://llvm.org/viewvc/llvm-project?rev=125748&view=rev Log: Fix wrong logic in promotion of signed mul-with-overflow (I pointed this out at the time but presumably my email got lost). Examples where the previous logic got it wrong: (1) a signed i8 multiply of 64 by 2 overflows, but the high part is zero; (2) a signed i8 multiple of -128 by 2 overflows, but the high part is all ones. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=125748&r1=125747&r2=125748&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Thu Feb 17 06:42:48 2011 @@ -548,16 +548,15 @@ return Res; } - SDValue DAGTypeLegalizer::PromoteIntRes_XMULO(SDNode *N, unsigned ResNo) { // Promote the overflow bit trivially. if (ResNo == 1) return PromoteIntRes_Overflow(N); - + SDValue LHS = N->getOperand(0), RHS = N->getOperand(1); DebugLoc DL = N->getDebugLoc(); - unsigned SmallSize = LHS.getValueType().getSizeInBits(); - + EVT SmallVT = LHS.getValueType(); + // To determine if the result overflowed in a larger type, we extend the input // to the larger type, do the multiply, then check the high bits of the result // to see if the overflow happened. @@ -568,26 +567,22 @@ LHS = ZExtPromotedInteger(LHS); RHS = ZExtPromotedInteger(RHS); } - SDValue Mul = DAG.getNode(ISD::MUL, DL, LHS.getValueType(), LHS, RHS); - - - // For an unsigned overflow, we check to see if the high part is != 0; + + // Overflow occurred iff the high part of the result does not zero/sign-extend + // the low part. SDValue Overflow; if (N->getOpcode() == ISD::UMULO) { + // Unsigned overflow occurred iff the high part is non-zero. SDValue Hi = DAG.getNode(ISD::SRL, DL, Mul.getValueType(), Mul, - DAG.getIntPtrConstant(SmallSize)); - // Overflowed if and only if this is not equal to Res. + DAG.getIntPtrConstant(SmallVT.getSizeInBits())); Overflow = DAG.getSetCC(DL, N->getValueType(1), Hi, DAG.getConstant(0, Hi.getValueType()), ISD::SETNE); } else { - // Signed multiply overflowed if the high part is not 0 and not -1. - SDValue Hi = DAG.getNode(ISD::SRA, DL, Mul.getValueType(), Mul, - DAG.getIntPtrConstant(SmallSize)); - Hi = DAG.getNode(ISD::ADD, DL, Hi.getValueType(), Hi, - DAG.getConstant(1, Hi.getValueType())); - Overflow = DAG.getSetCC(DL, N->getValueType(1), Hi, - DAG.getConstant(1, Hi.getValueType()), ISD::SETUGT); + // Signed overflow occurred iff the high part does not sign extend the low. + SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, Mul.getValueType(), + Mul, DAG.getValueType(SmallVT)); + Overflow = DAG.getSetCC(DL, N->getValueType(1), SExt, Mul, ISD::SETNE); } // Use the calculated overflow everywhere. @@ -595,7 +590,6 @@ return Mul; } - SDValue DAGTypeLegalizer::PromoteIntRes_UDIV(SDNode *N) { // Zero extend the input. SDValue LHS = ZExtPromotedInteger(N->getOperand(0)); From rafael.espindola at gmail.com Thu Feb 17 10:45:04 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Thu, 17 Feb 2011 11:45:04 -0500 Subject: [llvm-commits] [patch] Refactoring of the llvm mangler In-Reply-To: <4D55953A.2070809@gmail.com> References: <4D55953A.2070809@gmail.com> Message-ID: <4D5D5090.9070604@gmail.com> Ping. The fix for PR9177 ended up being a hack where clang knows some of the asm names. A simpler mangler could make it more general (and LTO faster). On 11-02-11 02:59 PM, Rafael Avila de Espindola wrote: > My first idea for fixing PR9177 involved having clang know all about > assembly names. Anton pointed me at how llvm-gcc does it and I think a > similar hack might be sufficient. > > In any case, I wrote a refactoring patch for the llvm mangler that might > be a good thing even if it is not needed for PR9177. > > The patch changes the mangler to use streams and explicitly separates > the add prefix, mangle the name proper and add suffix steps. This makes > it easier to identify (and maybe drop) some of its strange features. > > It also fixes the "FIXME: This logic seems unlikely to be right." :-) Cheers, Rafael From gohman at apple.com Thu Feb 17 12:50:20 2011 From: gohman at apple.com (Dan Gohman) Date: Thu, 17 Feb 2011 18:50:20 -0000 Subject: [llvm-commits] [llvm] r125759 - /llvm/trunk/lib/Target/X86/X86InstrCompiler.td Message-ID: <20110217185020.14CA02A6C12C@llvm.org> Author: djg Date: Thu Feb 17 12:50:19 2011 New Revision: 125759 URL: http://llvm.org/viewvc/llvm-project?rev=125759&view=rev Log: The labyrinthine X86 backend no longer appears to require these patterns. Modified: llvm/trunk/lib/Target/X86/X86InstrCompiler.td Modified: llvm/trunk/lib/Target/X86/X86InstrCompiler.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrCompiler.td?rev=125759&r1=125758&r2=125759&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrCompiler.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrCompiler.td Thu Feb 17 12:50:19 2011 @@ -890,43 +890,6 @@ def : Pat<(X86call (i32 imm:$dst)), (CALLpcrel32 imm:$dst)>, Requires<[CallImmAddr]>; -// X86 specific add which produces a flag. -def : Pat<(addc GR32:$src1, GR32:$src2), - (ADD32rr GR32:$src1, GR32:$src2)>; -def : Pat<(addc GR32:$src1, (load addr:$src2)), - (ADD32rm GR32:$src1, addr:$src2)>; -def : Pat<(addc GR32:$src1, imm:$src2), - (ADD32ri GR32:$src1, imm:$src2)>; -def : Pat<(addc GR32:$src1, i32immSExt8:$src2), - (ADD32ri8 GR32:$src1, i32immSExt8:$src2)>; - -def : Pat<(addc GR64:$src1, GR64:$src2), - (ADD64rr GR64:$src1, GR64:$src2)>; -def : Pat<(addc GR64:$src1, (load addr:$src2)), - (ADD64rm GR64:$src1, addr:$src2)>; -def : Pat<(addc GR64:$src1, i64immSExt8:$src2), - (ADD64ri8 GR64:$src1, i64immSExt8:$src2)>; -def : Pat<(addc GR64:$src1, i64immSExt32:$src2), - (ADD64ri32 GR64:$src1, imm:$src2)>; - -def : Pat<(subc GR32:$src1, GR32:$src2), - (SUB32rr GR32:$src1, GR32:$src2)>; -def : Pat<(subc GR32:$src1, (load addr:$src2)), - (SUB32rm GR32:$src1, addr:$src2)>; -def : Pat<(subc GR32:$src1, imm:$src2), - (SUB32ri GR32:$src1, imm:$src2)>; -def : Pat<(subc GR32:$src1, i32immSExt8:$src2), - (SUB32ri8 GR32:$src1, i32immSExt8:$src2)>; - -def : Pat<(subc GR64:$src1, GR64:$src2), - (SUB64rr GR64:$src1, GR64:$src2)>; -def : Pat<(subc GR64:$src1, (load addr:$src2)), - (SUB64rm GR64:$src1, addr:$src2)>; -def : Pat<(subc GR64:$src1, i64immSExt8:$src2), - (SUB64ri8 GR64:$src1, i64immSExt8:$src2)>; -def : Pat<(subc GR64:$src1, imm:$src2), - (SUB64ri32 GR64:$src1, i64immSExt32:$src2)>; - // Comparisons. // TEST R,R is smaller than CMP R,0 From isanbard at gmail.com Thu Feb 17 13:08:34 2011 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 17 Feb 2011 19:08:34 -0000 Subject: [llvm-commits] [www] r125763 - /www/trunk/index.html Message-ID: <20110217190835.0927A2A6C12C@llvm.org> Author: void Date: Thu Feb 17 13:08:34 2011 New Revision: 125763 URL: http://llvm.org/viewvc/llvm-project?rev=125763&view=rev Log: Add schedule for LLVM 2.9 release. Modified: www/trunk/index.html Modified: www/trunk/index.html URL: http://llvm.org/viewvc/llvm-project/www/trunk/index.html?rev=125763&r1=125762&r2=125763&view=diff ============================================================================== --- www/trunk/index.html (original) +++ www/trunk/index.html Thu Feb 17 13:08:34 2011 @@ -131,7 +131,15 @@

      Upcoming Releases
      -

      The LLVM 2.9 release schedule is TBD

      +

      LLVM 2.9 Tentative Release Schedule

      +
        +
      • March 6th — Branch for release.
      • +
      • March 7th-14th — Testing Phase 1
      • +
      • March 14th-21st — Preparation for Phase 2 (fixing bugs, merging patches)
      • +
      • March 21st-28th — Testing Phase 2
      • +
      • March 28th-April 3rd — Preparation for release
      • +
      • April 3rd — Release
      • +


      From stoklund at 2pi.dk Thu Feb 17 13:13:53 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 17 Feb 2011 19:13:53 -0000 Subject: [llvm-commits] [llvm] r125764 - in /llvm/trunk/lib/CodeGen: RegAllocGreedy.cpp SplitKit.h Message-ID: <20110217191353.43B2A2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 17 13:13:53 2011 New Revision: 125764 URL: http://llvm.org/viewvc/llvm-project?rev=125764&view=rev Log: Split local live ranges. A local live range is live in a single basic block. If such a range fails to allocate, try to find a sub-range that would get a larger spill weight than its interference. Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp llvm/trunk/lib/CodeGen/SplitKit.h Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=125764&r1=125763&r2=125764&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 17 13:13:53 2011 @@ -72,6 +72,10 @@ /// All basic blocks where the current register is live. SmallVector SpillConstraints; + /// For every instruction in SA->UseSlots, store the previous non-copy + /// instruction. + SmallVector PrevSlot; + public: RAGreedy(); @@ -106,11 +110,17 @@ float calcGlobalSplitCost(const BitVector&); void splitAroundRegion(LiveInterval&, unsigned, const BitVector&, SmallVectorImpl&); + void calcGapWeights(unsigned, SmallVectorImpl&); + SlotIndex getPrevMappedIndex(const MachineInstr*); + void calcPrevSlots(); + unsigned nextSplitPoint(unsigned); unsigned tryReassignOrEvict(LiveInterval&, AllocationOrder&, SmallVectorImpl&); unsigned tryRegionSplit(LiveInterval&, AllocationOrder&, SmallVectorImpl&); + unsigned tryLocalSplit(LiveInterval&, AllocationOrder&, + SmallVectorImpl&); unsigned trySplit(LiveInterval&, AllocationOrder&, SmallVectorImpl&); unsigned trySpillInterferences(LiveInterval&, AllocationOrder&, @@ -824,6 +834,271 @@ //===----------------------------------------------------------------------===// +// Local Splitting +//===----------------------------------------------------------------------===// + + +/// calcGapWeights - Compute the maximum spill weight that needs to be evicted +/// in order to use PhysReg between two entries in SA->UseSlots. +/// +/// GapWeight[i] represents the gap between UseSlots[i] and UseSlots[i+1]. +/// +void RAGreedy::calcGapWeights(unsigned PhysReg, + SmallVectorImpl &GapWeight) { + assert(SA->LiveBlocks.size() == 1 && "Not a local interval"); + const SplitAnalysis::BlockInfo &BI = SA->LiveBlocks.front(); + const SmallVectorImpl &Uses = SA->UseSlots; + const unsigned NumGaps = Uses.size()-1; + + // Start and end points for the interference check. + SlotIndex StartIdx = BI.LiveIn ? BI.FirstUse.getBaseIndex() : BI.FirstUse; + SlotIndex StopIdx = BI.LiveOut ? BI.LastUse.getBoundaryIndex() : BI.LastUse; + + GapWeight.assign(NumGaps, 0.0f); + + // Add interference from each overlapping register. + for (const unsigned *AI = TRI->getOverlaps(PhysReg); *AI; ++AI) { + if (!query(const_cast(SA->getParent()), *AI) + .checkInterference()) + continue; + + // We know that VirtReg is a continuous interval from FirstUse to LastUse, + // so we don't need InterferenceQuery. + // + // Interference that overlaps an instruction is counted in both gaps + // surrounding the instruction. The exception is interference before + // StartIdx and after StopIdx. + // + LiveIntervalUnion::SegmentIter IntI = PhysReg2LiveUnion[*AI].find(StartIdx); + for (unsigned Gap = 0; IntI.valid() && IntI.start() < StopIdx; ++IntI) { + // Skip the gaps before IntI. + while (Uses[Gap+1].getBoundaryIndex() < IntI.start()) + if (++Gap == NumGaps) + break; + if (Gap == NumGaps) + break; + + // Update the gaps covered by IntI. + const float weight = IntI.value()->weight; + for (; Gap != NumGaps; ++Gap) { + GapWeight[Gap] = std::max(GapWeight[Gap], weight); + if (Uses[Gap+1].getBaseIndex() >= IntI.stop()) + break; + } + if (Gap == NumGaps) + break; + } + } +} + +/// getPrevMappedIndex - Return the slot index of the last non-copy instruction +/// before MI that has a slot index. If MI is the first mapped instruction in +/// its block, return the block start index instead. +/// +SlotIndex RAGreedy::getPrevMappedIndex(const MachineInstr *MI) { + assert(MI && "Missing MachineInstr"); + const MachineBasicBlock *MBB = MI->getParent(); + MachineBasicBlock::const_iterator B = MBB->begin(), I = MI; + while (I != B) + if (!(--I)->isDebugValue() && !I->isCopy()) + return Indexes->getInstructionIndex(I); + return Indexes->getMBBStartIdx(MBB); +} + +/// calcPrevSlots - Fill in the PrevSlot array with the index of the previous +/// real non-copy instruction for each instruction in SA->UseSlots. +/// +void RAGreedy::calcPrevSlots() { + const SmallVectorImpl &Uses = SA->UseSlots; + PrevSlot.clear(); + PrevSlot.reserve(Uses.size()); + for (unsigned i = 0, e = Uses.size(); i != e; ++i) { + const MachineInstr *MI = Indexes->getInstructionFromIndex(Uses[i]); + PrevSlot.push_back(getPrevMappedIndex(MI).getDefIndex()); + } +} + +/// nextSplitPoint - Find the next index into SA->UseSlots > i such that it may +/// be beneficial to split before UseSlots[i]. +/// +/// 0 is always a valid split point +unsigned RAGreedy::nextSplitPoint(unsigned i) { + const SmallVectorImpl &Uses = SA->UseSlots; + const unsigned Size = Uses.size(); + assert(i != Size && "No split points after the end"); + // Allow split before i when Uses[i] is not adjacent to the previous use. + while (++i != Size && PrevSlot[i].getBaseIndex() <= Uses[i-1].getBaseIndex()) + ; + return i; +} + +/// tryLocalSplit - Try to split VirtReg into smaller intervals inside its only +/// basic block. +/// +unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order, + SmallVectorImpl &NewVRegs) { + assert(SA->LiveBlocks.size() == 1 && "Not a local interval"); + const SplitAnalysis::BlockInfo &BI = SA->LiveBlocks.front(); + + // Note that it is possible to have an interval that is live-in or live-out + // while only covering a single block - A phi-def can use undef values from + // predecessors, and the block could be a single-block loop. + // We don't bother doing anything clever about such a case, we simply assume + // that the interval is continuous from FirstUse to LastUse. We should make + // sure that we don't do anything illegal to such an interval, though. + + const SmallVectorImpl &Uses = SA->UseSlots; + if (Uses.size() <= 2) + return 0; + const unsigned NumGaps = Uses.size()-1; + + DEBUG({ + dbgs() << "tryLocalSplit: "; + for (unsigned i = 0, e = Uses.size(); i != e; ++i) + dbgs() << ' ' << SA->UseSlots[i]; + dbgs() << '\n'; + }); + + // For every use, find the previous mapped non-copy instruction. + // We use this to detect valid split points, and to estimate new interval + // sizes. + calcPrevSlots(); + + unsigned BestBefore = NumGaps; + unsigned BestAfter = 0; + float BestDiff = 0; + + const float blockFreq = SpillPlacer->getBlockFrequency(BI.MBB); + SmallVector GapWeight; + + Order.rewind(); + while (unsigned PhysReg = Order.next()) { + // Keep track of the largest spill weight that would need to be evicted in + // order to make use of PhysReg between UseSlots[i] and UseSlots[i+1]. + calcGapWeights(PhysReg, GapWeight); + + // Try to find the best sequence of gaps to close. + // The new spill weight must be larger than any gap interference. + + // We will split before Uses[SplitBefore] and after Uses[SplitAfter]. + unsigned SplitBefore = 0, SplitAfter = nextSplitPoint(1) - 1; + + // MaxGap should always be max(GapWeight[SplitBefore..SplitAfter-1]). + // It is the spill weight that needs to be evicted. + float MaxGap = GapWeight[0]; + for (unsigned i = 1; i != SplitAfter; ++i) + MaxGap = std::max(MaxGap, GapWeight[i]); + + for (;;) { + // Live before/after split? + const bool LiveBefore = SplitBefore != 0 || BI.LiveIn; + const bool LiveAfter = SplitAfter != NumGaps || BI.LiveOut; + + DEBUG(dbgs() << PrintReg(PhysReg, TRI) << ' ' + << Uses[SplitBefore] << '-' << Uses[SplitAfter] + << " i=" << MaxGap); + + // Stop before the interval gets so big we wouldn't be making progress. + if (!LiveBefore && !LiveAfter) { + DEBUG(dbgs() << " all\n"); + break; + } + // Should the interval be extended or shrunk? + bool Shrink = true; + if (MaxGap < HUGE_VALF) { + // Estimate the new spill weight. + // + // Each instruction reads and writes the register, except the first + // instr doesn't read when !FirstLive, and the last instr doesn't write + // when !LastLive. + // + // We will be inserting copies before and after, so the total number of + // reads and writes is 2 * EstUses. + // + const unsigned EstUses = 2*(SplitAfter - SplitBefore) + + 2*(LiveBefore + LiveAfter); + + // Try to guess the size of the new interval. This should be trivial, + // but the slot index of an inserted copy can be a lot smaller than the + // instruction it is inserted before if there are many dead indexes + // between them. + // + // We measure the distance from the instruction before SplitBefore to + // get a conservative estimate. + // + // The final distance can still be different if inserting copies + // triggers a slot index renumbering. + // + const float EstWeight = normalizeSpillWeight(blockFreq * EstUses, + PrevSlot[SplitBefore].distance(Uses[SplitAfter])); + // Would this split be possible to allocate? + // Never allocate all gaps, we wouldn't be making progress. + float Diff = EstWeight - MaxGap; + DEBUG(dbgs() << " w=" << EstWeight << " d=" << Diff); + if (Diff > 0) { + Shrink = false; + if (Diff > BestDiff) { + DEBUG(dbgs() << " (best)"); + BestDiff = Diff; + BestBefore = SplitBefore; + BestAfter = SplitAfter; + } + } + } + + // Try to shrink. + if (Shrink) { + SplitBefore = nextSplitPoint(SplitBefore); + if (SplitBefore < SplitAfter) { + DEBUG(dbgs() << " shrink\n"); + // Recompute the max when necessary. + if (GapWeight[SplitBefore - 1] >= MaxGap) { + MaxGap = GapWeight[SplitBefore]; + for (unsigned i = SplitBefore + 1; i != SplitAfter; ++i) + MaxGap = std::max(MaxGap, GapWeight[i]); + } + continue; + } + MaxGap = 0; + } + + // Try to extend the interval. + if (SplitAfter >= NumGaps) { + DEBUG(dbgs() << " end\n"); + break; + } + + DEBUG(dbgs() << " extend\n"); + for (unsigned e = nextSplitPoint(SplitAfter + 1) - 1; + SplitAfter != e; ++SplitAfter) + MaxGap = std::max(MaxGap, GapWeight[SplitAfter]); + continue; + } + } + + // Didn't find any candidates? + if (BestBefore == NumGaps) + return 0; + + DEBUG(dbgs() << "Best local split range: " << Uses[BestBefore] + << '-' << Uses[BestAfter] << ", " << BestDiff + << ", " << (BestAfter - BestBefore + 1) << " instrs\n"); + + SmallVector SpillRegs; + LiveRangeEdit LREdit(VirtReg, NewVRegs, SpillRegs); + SplitEditor SE(*SA, *LIS, *VRM, *DomTree, LREdit); + + SE.openIntv(); + SlotIndex SegStart = SE.enterIntvBefore(Uses[BestBefore]); + SlotIndex SegStop = SE.leaveIntvAfter(Uses[BestAfter]); + SE.useIntv(SegStart, SegStop); + SE.closeIntv(); + SE.finish(); + + return 0; +} + +//===----------------------------------------------------------------------===// // Live Range Splitting //===----------------------------------------------------------------------===// @@ -835,9 +1110,9 @@ NamedRegionTimer T("Splitter", TimerGroupName, TimePassesIsEnabled); SA->analyze(&VirtReg); - // Don't attempt splitting on local intervals for now. TBD. + // Local intervals are handled separately. if (LIS->intervalIsInOneMBB(VirtReg)) - return 0; + return tryLocalSplit(VirtReg, Order, NewVRegs); // First try to split around a region spanning multiple blocks. unsigned PhysReg = tryRegionSplit(VirtReg, Order, NewVRegs); Modified: llvm/trunk/lib/CodeGen/SplitKit.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=125764&r1=125763&r2=125764&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SplitKit.h (original) +++ llvm/trunk/lib/CodeGen/SplitKit.h Thu Feb 17 13:13:53 2011 @@ -116,6 +116,9 @@ /// new interval. void clear(); + /// getParent - Return the last analyzed interval. + const LiveInterval &getParent() const { return *CurLI; } + /// hasUses - Return true if MBB has any uses of CurLI. bool hasUses(const MachineBasicBlock *MBB) const { return UsingBlocks.lookup(MBB); From greened at obbligato.org Thu Feb 17 13:18:59 2011 From: greened at obbligato.org (David Greene) Date: Thu, 17 Feb 2011 19:18:59 -0000 Subject: [llvm-commits] [llvm] r125765 - in /llvm/trunk/lib/Target/X86: InstPrinter/X86InstComments.cpp Makefile Utils/ Utils/CMakeLists.txt Utils/Makefile Utils/X86ShuffleDecode.cpp Utils/X86ShuffleDecode.h X86ISelLowering.cpp X86ShuffleDecode.h Message-ID: <20110217191859.719462A6C12C@llvm.org> Author: greened Date: Thu Feb 17 13:18:59 2011 New Revision: 125765 URL: http://llvm.org/viewvc/llvm-project?rev=125765&view=rev Log: [AVX] Recorganize X86ShuffleDecode into its own library (LLVMX86Utils.a) to break cyclic library dependencies between LLVMX86CodeGen.a and LLVMX86AsmParser.a. Previously this code was in a header file and marked static but AVX requires some additional functionality here that won't be used by all clients. Since including unused static functions causes a gcc compiler warning, keeping it as a header would break builds that use -Werror. Putting this in its own library solves both problems at once. Added: llvm/trunk/lib/Target/X86/Utils/ llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt llvm/trunk/lib/Target/X86/Utils/Makefile llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.cpp llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.h Removed: llvm/trunk/lib/Target/X86/X86ShuffleDecode.h Modified: llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp llvm/trunk/lib/Target/X86/Makefile llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp?rev=125765&r1=125764&r2=125765&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp (original) +++ llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp Thu Feb 17 13:18:59 2011 @@ -16,7 +16,7 @@ #include "X86GenInstrNames.inc" #include "llvm/MC/MCInst.h" #include "llvm/Support/raw_ostream.h" -#include "../X86ShuffleDecode.h" +#include "../Utils/X86ShuffleDecode.h" using namespace llvm; //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Makefile?rev=125765&r1=125764&r2=125765&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/Makefile (original) +++ llvm/trunk/lib/Target/X86/Makefile Thu Feb 17 13:18:59 2011 @@ -20,6 +20,6 @@ X86GenCallingConv.inc X86GenSubtarget.inc \ X86GenEDInfo.inc -DIRS = InstPrinter AsmParser Disassembler TargetInfo +DIRS = InstPrinter AsmParser Disassembler TargetInfo Utils include $(LEVEL)/Makefile.common Added: llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt?rev=125765&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt (added) +++ llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt Thu Feb 17 13:18:59 2011 @@ -0,0 +1,6 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +add_llvm_library(LLVMX86Utils + X86ShuffleDecode.cpp + ) +add_dependencies(LLVMX86Utils X86CodeGenTable_gen) Added: llvm/trunk/lib/Target/X86/Utils/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Utils/Makefile?rev=125765&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/Utils/Makefile (added) +++ llvm/trunk/lib/Target/X86/Utils/Makefile Thu Feb 17 13:18:59 2011 @@ -0,0 +1,15 @@ +##===- lib/Target/X86/Utils/Makefile -----------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../../../.. +LIBRARYNAME = LLVMX86Utils + +# Hack: we need to include 'main' x86 target directory to grab private headers +CPP.Flags += -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/.. + +include $(LEVEL)/Makefile.common Added: llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.cpp?rev=125765&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.cpp (added) +++ llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.cpp Thu Feb 17 13:18:59 2011 @@ -0,0 +1,148 @@ +//===-- X86ShuffleDecode.h - X86 shuffle decode logic ---------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Define several functions to decode x86 specific shuffle semantics into a +// generic vector mask. +// +//===----------------------------------------------------------------------===// + +#include "X86ShuffleDecode.h" + +//===----------------------------------------------------------------------===// +// Vector Mask Decoding +//===----------------------------------------------------------------------===// + +namespace llvm { + +void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl &ShuffleMask) { + // Defaults the copying the dest value. + ShuffleMask.push_back(0); + ShuffleMask.push_back(1); + ShuffleMask.push_back(2); + ShuffleMask.push_back(3); + + // Decode the immediate. + unsigned ZMask = Imm & 15; + unsigned CountD = (Imm >> 4) & 3; + unsigned CountS = (Imm >> 6) & 3; + + // CountS selects which input element to use. + unsigned InVal = 4+CountS; + // CountD specifies which element of destination to update. + ShuffleMask[CountD] = InVal; + // ZMask zaps values, potentially overriding the CountD elt. + if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero; + if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero; + if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero; + if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero; +} + +// <3,1> or <6,7,2,3> +void DecodeMOVHLPSMask(unsigned NElts, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = NElts/2; i != NElts; ++i) + ShuffleMask.push_back(NElts+i); + + for (unsigned i = NElts/2; i != NElts; ++i) + ShuffleMask.push_back(i); +} + +// <0,2> or <0,1,4,5> +void DecodeMOVLHPSMask(unsigned NElts, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != NElts/2; ++i) + ShuffleMask.push_back(i); + + for (unsigned i = 0; i != NElts/2; ++i) + ShuffleMask.push_back(NElts+i); +} + +void DecodePSHUFMask(unsigned NElts, unsigned Imm, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != NElts; ++i) { + ShuffleMask.push_back(Imm % NElts); + Imm /= NElts; + } +} + +void DecodePSHUFHWMask(unsigned Imm, + SmallVectorImpl &ShuffleMask) { + ShuffleMask.push_back(0); + ShuffleMask.push_back(1); + ShuffleMask.push_back(2); + ShuffleMask.push_back(3); + for (unsigned i = 0; i != 4; ++i) { + ShuffleMask.push_back(4+(Imm & 3)); + Imm >>= 2; + } +} + +void DecodePSHUFLWMask(unsigned Imm, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != 4; ++i) { + ShuffleMask.push_back((Imm & 3)); + Imm >>= 2; + } + ShuffleMask.push_back(4); + ShuffleMask.push_back(5); + ShuffleMask.push_back(6); + ShuffleMask.push_back(7); +} + +void DecodePUNPCKLMask(unsigned NElts, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != NElts/2; ++i) { + ShuffleMask.push_back(i); + ShuffleMask.push_back(i+NElts); + } +} + +void DecodePUNPCKHMask(unsigned NElts, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != NElts/2; ++i) { + ShuffleMask.push_back(i+NElts/2); + ShuffleMask.push_back(i+NElts+NElts/2); + } +} + +void DecodeSHUFPSMask(unsigned NElts, unsigned Imm, + SmallVectorImpl &ShuffleMask) { + // Part that reads from dest. + for (unsigned i = 0; i != NElts/2; ++i) { + ShuffleMask.push_back(Imm % NElts); + Imm /= NElts; + } + // Part that reads from src. + for (unsigned i = 0; i != NElts/2; ++i) { + ShuffleMask.push_back(Imm % NElts + NElts); + Imm /= NElts; + } +} + +void DecodeUNPCKHPMask(unsigned NElts, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != NElts/2; ++i) { + ShuffleMask.push_back(i+NElts/2); // Reads from dest + ShuffleMask.push_back(i+NElts+NElts/2); // Reads from src + } +} + + +/// DecodeUNPCKLPMask - This decodes the shuffle masks for unpcklps/unpcklpd +/// etc. NElts indicates the number of elements in the vector allowing it to +/// handle different datatypes and vector widths. +void DecodeUNPCKLPMask(unsigned NElts, + SmallVectorImpl &ShuffleMask) { + for (unsigned i = 0; i != NElts/2; ++i) { + ShuffleMask.push_back(i); // Reads from dest + ShuffleMask.push_back(i+NElts); // Reads from src + } +} + +} // llvm namespace Added: llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.h?rev=125765&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.h (added) +++ llvm/trunk/lib/Target/X86/Utils/X86ShuffleDecode.h Thu Feb 17 13:18:59 2011 @@ -0,0 +1,69 @@ +//===-- X86ShuffleDecode.h - X86 shuffle decode logic -----------*-C++-*---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Define several functions to decode x86 specific shuffle semantics into a +// generic vector mask. +// +//===----------------------------------------------------------------------===// + +#ifndef X86_SHUFFLE_DECODE_H +#define X86_SHUFFLE_DECODE_H + +#include "llvm/ADT/SmallVector.h" + +//===----------------------------------------------------------------------===// +// Vector Mask Decoding +//===----------------------------------------------------------------------===// + +namespace llvm { +enum { + SM_SentinelZero = ~0U +}; + +void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl &ShuffleMask); + +// <3,1> or <6,7,2,3> +void DecodeMOVHLPSMask(unsigned NElts, + SmallVectorImpl &ShuffleMask); + +// <0,2> or <0,1,4,5> +void DecodeMOVLHPSMask(unsigned NElts, + SmallVectorImpl &ShuffleMask); + +void DecodePSHUFMask(unsigned NElts, unsigned Imm, + SmallVectorImpl &ShuffleMask); + +void DecodePSHUFHWMask(unsigned Imm, + SmallVectorImpl &ShuffleMask); + +void DecodePSHUFLWMask(unsigned Imm, + SmallVectorImpl &ShuffleMask); + +void DecodePUNPCKLMask(unsigned NElts, + SmallVectorImpl &ShuffleMask); + +void DecodePUNPCKHMask(unsigned NElts, + SmallVectorImpl &ShuffleMask); + +void DecodeSHUFPSMask(unsigned NElts, unsigned Imm, + SmallVectorImpl &ShuffleMask); + +void DecodeUNPCKHPMask(unsigned NElts, + SmallVectorImpl &ShuffleMask); + + +/// DecodeUNPCKLPMask - This decodes the shuffle masks for unpcklps/unpcklpd +/// etc. NElts indicates the number of elements in the vector allowing it to +/// handle different datatypes and vector widths. +void DecodeUNPCKLPMask(unsigned NElts, + SmallVectorImpl &ShuffleMask); + +} // llvm namespace + +#endif Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=125765&r1=125764&r2=125765&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Feb 17 13:18:59 2011 @@ -16,9 +16,9 @@ #include "X86.h" #include "X86InstrBuilder.h" #include "X86ISelLowering.h" -#include "X86ShuffleDecode.h" #include "X86TargetMachine.h" #include "X86TargetObjectFile.h" +#include "Utils/X86ShuffleDecode.h" #include "llvm/CallingConv.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" Removed: llvm/trunk/lib/Target/X86/X86ShuffleDecode.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ShuffleDecode.h?rev=125764&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/X86ShuffleDecode.h (original) +++ llvm/trunk/lib/Target/X86/X86ShuffleDecode.h (removed) @@ -1,155 +0,0 @@ -//===-- X86ShuffleDecode.h - X86 shuffle decode logic ---------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Define several functions to decode x86 specific shuffle semantics into a -// generic vector mask. -// -//===----------------------------------------------------------------------===// - -#ifndef X86_SHUFFLE_DECODE_H -#define X86_SHUFFLE_DECODE_H - -#include "llvm/ADT/SmallVector.h" -using namespace llvm; - -//===----------------------------------------------------------------------===// -// Vector Mask Decoding -//===----------------------------------------------------------------------===// - -enum { - SM_SentinelZero = ~0U -}; - -static inline -void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl &ShuffleMask) { - // Defaults the copying the dest value. - ShuffleMask.push_back(0); - ShuffleMask.push_back(1); - ShuffleMask.push_back(2); - ShuffleMask.push_back(3); - - // Decode the immediate. - unsigned ZMask = Imm & 15; - unsigned CountD = (Imm >> 4) & 3; - unsigned CountS = (Imm >> 6) & 3; - - // CountS selects which input element to use. - unsigned InVal = 4+CountS; - // CountD specifies which element of destination to update. - ShuffleMask[CountD] = InVal; - // ZMask zaps values, potentially overriding the CountD elt. - if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero; - if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero; - if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero; - if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero; -} - -// <3,1> or <6,7,2,3> -static void DecodeMOVHLPSMask(unsigned NElts, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = NElts/2; i != NElts; ++i) - ShuffleMask.push_back(NElts+i); - - for (unsigned i = NElts/2; i != NElts; ++i) - ShuffleMask.push_back(i); -} - -// <0,2> or <0,1,4,5> -static void DecodeMOVLHPSMask(unsigned NElts, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != NElts/2; ++i) - ShuffleMask.push_back(i); - - for (unsigned i = 0; i != NElts/2; ++i) - ShuffleMask.push_back(NElts+i); -} - -static void DecodePSHUFMask(unsigned NElts, unsigned Imm, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != NElts; ++i) { - ShuffleMask.push_back(Imm % NElts); - Imm /= NElts; - } -} - -static void DecodePSHUFHWMask(unsigned Imm, - SmallVectorImpl &ShuffleMask) { - ShuffleMask.push_back(0); - ShuffleMask.push_back(1); - ShuffleMask.push_back(2); - ShuffleMask.push_back(3); - for (unsigned i = 0; i != 4; ++i) { - ShuffleMask.push_back(4+(Imm & 3)); - Imm >>= 2; - } -} - -static void DecodePSHUFLWMask(unsigned Imm, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != 4; ++i) { - ShuffleMask.push_back((Imm & 3)); - Imm >>= 2; - } - ShuffleMask.push_back(4); - ShuffleMask.push_back(5); - ShuffleMask.push_back(6); - ShuffleMask.push_back(7); -} - -static void DecodePUNPCKLMask(unsigned NElts, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != NElts/2; ++i) { - ShuffleMask.push_back(i); - ShuffleMask.push_back(i+NElts); - } -} - -static void DecodePUNPCKHMask(unsigned NElts, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != NElts/2; ++i) { - ShuffleMask.push_back(i+NElts/2); - ShuffleMask.push_back(i+NElts+NElts/2); - } -} - -static void DecodeSHUFPSMask(unsigned NElts, unsigned Imm, - SmallVectorImpl &ShuffleMask) { - // Part that reads from dest. - for (unsigned i = 0; i != NElts/2; ++i) { - ShuffleMask.push_back(Imm % NElts); - Imm /= NElts; - } - // Part that reads from src. - for (unsigned i = 0; i != NElts/2; ++i) { - ShuffleMask.push_back(Imm % NElts + NElts); - Imm /= NElts; - } -} - -static void DecodeUNPCKHPMask(unsigned NElts, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != NElts/2; ++i) { - ShuffleMask.push_back(i+NElts/2); // Reads from dest - ShuffleMask.push_back(i+NElts+NElts/2); // Reads from src - } -} - - -/// DecodeUNPCKLPMask - This decodes the shuffle masks for unpcklps/unpcklpd -/// etc. NElts indicates the number of elements in the vector allowing it to -/// handle different datatypes and vector widths. -static void DecodeUNPCKLPMask(unsigned NElts, - SmallVectorImpl &ShuffleMask) { - for (unsigned i = 0; i != NElts/2; ++i) { - ShuffleMask.push_back(i); // Reads from dest - ShuffleMask.push_back(i+NElts); // Reads from src - } -} - -#endif From viridia at gmail.com Thu Feb 17 13:22:45 2011 From: viridia at gmail.com (Talin) Date: Thu, 17 Feb 2011 11:22:45 -0800 Subject: [llvm-commits] PATCH: Additional convenience methods for ConstantStruct, ConstantArray, and ConstantVector. In-Reply-To: References: Message-ID: Ping...can someone please review this? On Thu, Feb 10, 2011 at 1:40 PM, Talin wrote: > This patch adds a new "get" method to ConstantStruct, ConstantArray and > ConstantVector. The new method accepts a pair of RandomAccessIterators, > similar to other LLVM method signatures. This allows constants to be build > using a small vector or other sequential container type more easily. > > In addition, I've also added an END_WITH_NULL variant for > ConstantStruct::get(). I only added it to ConstantStruct because I figured > that it would be an uncommon use case for arrays and vectors, whereas the > creation of small constant structs of predetermined length is fairly common. > > -- > -- Talin > -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/ac244c0f/attachment.html From chandlerc at google.com Thu Feb 17 14:57:49 2011 From: chandlerc at google.com (Chandler Carruth) Date: Thu, 17 Feb 2011 12:57:49 -0800 Subject: [llvm-commits] [llvm] r125765 - in /llvm/trunk/lib/Target/X86: InstPrinter/X86InstComments.cpp Makefile Utils/ Utils/CMakeLists.txt Utils/Makefile Utils/X86ShuffleDecode.cpp Utils/X86ShuffleDecode.h X86ISelLowering.cpp X86ShuffleDecode.h In-Reply-To: <20110217191859.719462A6C12C@llvm.org> References: <20110217191859.719462A6C12C@llvm.org> Message-ID: On Thu, Feb 17, 2011 at 11:18 AM, David Greene wrote: > Author: greened > Date: Thu Feb 17 13:18:59 2011 > New Revision: 125765 > > URL: http://llvm.org/viewvc/llvm-project?rev=125765&view=rev > Log: > > [AVX] Recorganize X86ShuffleDecode into its own library > (LLVMX86Utils.a) to break cyclic library dependencies between > LLVMX86CodeGen.a and LLVMX86AsmParser.a. Previously this code was in > a header file and marked static but AVX requires some additional > functionality here that won't be used by all clients. Since including > unused static functions causes a gcc compiler warning, keeping it as a > header would break builds that use -Werror. Putting this in its own > library solves both problems at once. > > Added: > llvm/trunk/lib/Target/X86/Utils/ > llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt > While you added the CMake target for this, you didn't update the dependencies of the X86 targets that use this... I now get link failures on my builds. =/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/afc662bb/attachment.html From sabre at nondot.org Thu Feb 17 14:55:29 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 20:55:29 -0000 Subject: [llvm-commits] [llvm] r125774 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Message-ID: <20110217205529.5D63F2A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 14:55:29 2011 New Revision: 125774 URL: http://llvm.org/viewvc/llvm-project?rev=125774&view=rev Log: add is always integer, thanks to Frits for noticing this. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=125774&r1=125773&r2=125774&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Thu Feb 17 14:55:29 2011 @@ -147,7 +147,7 @@ return BinaryOperator::CreateXor(LHS, RHS); // X + X --> X << 1 - if (LHS == RHS && I.getType()->isIntegerTy()) { + if (LHS == RHS) { BinaryOperator *New = BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1)); New->setHasNoSignedWrap(I.hasNoSignedWrap()); From nadav.rotem at intel.com Thu Feb 17 15:22:27 2011 From: nadav.rotem at intel.com (Nadav Rotem) Date: Thu, 17 Feb 2011 21:22:27 -0000 Subject: [llvm-commits] [llvm] r125776 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp test/Transforms/InstCombine/bitcast-vec-uniform.ll Message-ID: <20110217212227.7E7F22A6C12C@llvm.org> Author: nadav Date: Thu Feb 17 15:22:27 2011 New Revision: 125776 URL: http://llvm.org/viewvc/llvm-project?rev=125776&view=rev Log: Enhance constant folding of bitcast operations on vectors of floats. Add getAllOnesValue of FP numbers to Constants and APFloat. Add more tests. Modified: llvm/trunk/include/llvm/ADT/APFloat.h llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/test/Transforms/InstCombine/bitcast-vec-uniform.ll Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=125776&r1=125775&r2=125776&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Thu Feb 17 15:22:27 2011 @@ -246,6 +246,13 @@ static APFloat getSmallestNormalized(const fltSemantics &Sem, bool Negative = false); + /// getAllOnesValue - Returns a float which is bitcasted from + /// an all one value int. + /// + /// \param BitWidth - Select float type + /// \param isIEEE - If 128 bit number, select between PPC and IEEE + static APFloat getAllOnesValue(unsigned BitWidth, bool isIEEE = false); + /// Profile - Used to insert APFloat objects, or objects that contain /// APFloat objects, into FoldingSets. void Profile(FoldingSetNodeID& NID) const; Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=125776&r1=125775&r2=125776&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Feb 17 15:22:27 2011 @@ -3197,6 +3197,12 @@ llvm_unreachable(0); } +APFloat +APFloat::getAllOnesValue(unsigned BitWidth, bool isIEEE) +{ + return APFloat(APInt::getAllOnesValue(BitWidth), isIEEE); +} + APFloat APFloat::getLargest(const fltSemantics &Sem, bool Negative) { APFloat Val(Sem, fcNormal, Negative); Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=125776&r1=125775&r2=125776&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Thu Feb 17 15:22:27 2011 @@ -43,8 +43,7 @@ static Constant *BitCastConstantVector(ConstantVector *CV, const VectorType *DstTy) { - if (CV->isAllOnesValue() && DstTy->getElementType()->isIntegerTy()) - return Constant::getAllOnesValue(DstTy); + if (CV->isAllOnesValue()) return Constant::getAllOnesValue(DstTy); if (CV->isNullValue()) return Constant::getNullValue(DstTy); // If this cast changes element count then we can't handle it here: Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=125776&r1=125775&r2=125776&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Thu Feb 17 15:22:27 2011 @@ -93,7 +93,13 @@ if (const IntegerType *ITy = dyn_cast(Ty)) return ConstantInt::get(Ty->getContext(), APInt::getAllOnesValue(ITy->getBitWidth())); - + + if (Ty->isFloatingPointTy()) { + APFloat FL = APFloat::getAllOnesValue(Ty->getPrimitiveSizeInBits(), + !Ty->isPPC_FP128Ty()); + return ConstantFP::get(Ty->getContext(), FL); + } + SmallVector Elts; const VectorType *VTy = cast(Ty); Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType())); Modified: llvm/trunk/test/Transforms/InstCombine/bitcast-vec-uniform.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/bitcast-vec-uniform.ll?rev=125776&r1=125775&r2=125776&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/bitcast-vec-uniform.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/bitcast-vec-uniform.ll Thu Feb 17 15:22:27 2011 @@ -18,7 +18,8 @@ } ; CHECK: @foo -; CHECK: bitcast +; CHECK-NOT: bitcast +; CHECK: ret ; from MultiSource/Benchmarks/Bullet define <2 x float> @foo() { @@ -27,4 +28,43 @@ } +; CHECK: @foo2 +; CHECK-NOT: bitcast +; CHECK: ret +define <2 x double> @foo2() { + %cast = bitcast i128 -1 to <2 x double> + ret <2 x double> %cast +} + +; CHECK: @foo3 +; CHECK-NOT: bitcast +; CHECK: ret +define <1 x float> @foo3() { + %cast = bitcast i32 -1 to <1 x float> + ret <1 x float> %cast +} + +; CHECK: @foo4 +; CHECK-NOT: bitcast +; CHECK: ret +define float @foo4() { + %cast = bitcast <1 x i32 > to float + ret float %cast +} +; CHECK: @foo5 +; CHECK-NOT: bitcast +; CHECK: ret +define double @foo5() { + %cast = bitcast <2 x i32 > to double + ret double %cast +} + + +; CHECK: @foo6 +; CHECK-NOT: bitcast +; CHECK: ret +define <2 x double> @foo6() { + %cast = bitcast <4 x i32> to <2 x double> + ret <2 x double> %cast +} From clattner at apple.com Thu Feb 17 16:08:57 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 14:08:57 -0800 Subject: [llvm-commits] [patch] Refactoring of the llvm mangler In-Reply-To: <4D55953A.2070809@gmail.com> References: <4D55953A.2070809@gmail.com> Message-ID: <83B15ACB-E9B7-489A-8A13-61A66C159D6B@apple.com> On Feb 11, 2011, at 11:59 AM, Rafael Avila de Espindola wrote: > My first idea for fixing PR9177 involved having clang know all about assembly names. Anton pointed me at how llvm-gcc does it and I think a similar hack might be sufficient. > > In any case, I wrote a refactoring patch for the llvm mangler that might be a good thing even if it is not needed for PR9177. > > The patch changes the mangler to use streams and explicitly separates the add prefix, mangle the name proper and add suffix steps. This makes it easier to identify (and maybe drop) some of its strange features. > > It also fixes the "FIXME: This logic seems unlikely to be right." :-) Hi Rafael, Here are some first thoughts: + void GetPrefix(raw_ostream &Out, ManglerPrefixTy PrefixTy, StringRef Name); Please follow the naming convention for new code, these should be "getPrefix". + Out.flush(); return OutContext.GetOrCreateSymbol(NameStr.str()); You can just use Out.str(), which does a flush before returning the string. How does this make LTO faster? It seems that the major change here is to change the SmallString to a raw_ostream, which seems ok, but but also does seem to require adding raw_svector_ostream's around now. Almost all the clients actually do want to fill in a SmallString after all :) -Chris From greened at obbligato.org Thu Feb 17 16:15:42 2011 From: greened at obbligato.org (David A. Greene) Date: Thu, 17 Feb 2011 16:15:42 -0600 Subject: [llvm-commits] [llvm] r125765 - in /llvm/trunk/lib/Target/X86: InstPrinter/X86InstComments.cpp Makefile Utils/ Utils/CMakeLists.txt Utils/Makefile Utils/X86ShuffleDecode.cpp Utils/X86ShuffleDecode.h X86ISelLowering.cpp X86ShuffleDecode.h In-Reply-To: (Chandler Carruth's message of "Thu, 17 Feb 2011 12:57:49 -0800") References: <20110217191859.719462A6C12C@llvm.org> Message-ID: Chandler Carruth writes: > Added: > ? ?llvm/trunk/lib/Target/X86/Utils/ > ? ?llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt > > While you added the CMake target for this, you didn't update the dependencies of the X86 targets that use this... I now get link failures on my builds. > =/ So what needs to be done? I never use CMake so I don't know the first thing about it. I made my best guess at what would be needed. -Dave From sabre at nondot.org Thu Feb 17 16:21:26 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 22:21:26 -0000 Subject: [llvm-commits] [llvm] r125785 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombinePHI.cpp test/Transforms/InstCombine/phi.ll Message-ID: <20110217222127.010612A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 16:21:26 2011 New Revision: 125785 URL: http://llvm.org/viewvc/llvm-project?rev=125785&view=rev Log: fix instcombine merging GEPs through a PHI to only make the result inbounds if all of the inputs are inbounds. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp llvm/trunk/test/Transforms/InstCombine/phi.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp?rev=125785&r1=125784&r2=125785&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp Thu Feb 17 16:21:26 2011 @@ -118,6 +118,8 @@ // especially bad when the PHIs are in the header of a loop. bool NeededPhi = false; + bool AllInBounds = true; + // Scan to see if all operands are the same opcode, and all have one use. for (unsigned i = 1; i != PN.getNumIncomingValues(); ++i) { GetElementPtrInst *GEP= dyn_cast(PN.getIncomingValue(i)); @@ -125,6 +127,8 @@ GEP->getNumOperands() != FirstInst->getNumOperands()) return 0; + AllInBounds &= GEP->isInBounds(); + // Keep track of whether or not all GEPs are of alloca pointers. if (AllBasePointersAreAllocas && (!isa(GEP->getOperand(0)) || @@ -202,11 +206,11 @@ } Value *Base = FixedOperands[0]; - return cast(FirstInst)->isInBounds() ? - GetElementPtrInst::CreateInBounds(Base, FixedOperands.begin()+1, - FixedOperands.end()) : + GetElementPtrInst *NewGEP = GetElementPtrInst::Create(Base, FixedOperands.begin()+1, FixedOperands.end()); + if (AllInBounds) NewGEP->setIsInbounds(); + return NewGEP; } Modified: llvm/trunk/test/Transforms/InstCombine/phi.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/phi.ll?rev=125785&r1=125784&r2=125785&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/phi.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/phi.ll Thu Feb 17 16:21:26 2011 @@ -125,7 +125,7 @@ define i32* @test8({ i32, i32 } *%A, i1 %b) { BB0: - %X = getelementptr { i32, i32 } *%A, i32 0, i32 1 + %X = getelementptr inbounds { i32, i32 } *%A, i32 0, i32 1 br i1 %b, label %BB1, label %BB2 BB1: @@ -139,7 +139,7 @@ ; CHECK: @test8 ; CHECK-NOT: phi ; CHECK: BB2: -; CHECK-NEXT: %B = getelementptr +; CHECK-NEXT: %B = getelementptr %0 ; CHECK-NEXT: ret i32* %B } @@ -525,3 +525,4 @@ ; CHECK: Exit: ; CHECK-NEXT: ret i32 %B } + From ofv at wanadoo.es Thu Feb 17 16:25:15 2011 From: ofv at wanadoo.es (=?utf-8?Q?=C3=93scar_Fuentes?=) Date: Thu, 17 Feb 2011 23:25:15 +0100 Subject: [llvm-commits] [llvm] r125765 - in /llvm/trunk/lib/Target/X86: InstPrinter/X86InstComments.cpp Makefile Utils/ Utils/CMakeLists.txt Utils/Makefile Utils/X86ShuffleDecode.cpp Utils/X86ShuffleDecode.h X86ISelLowering.cpp X86ShuffleDecode.h References: <20110217191859.719462A6C12C@llvm.org> Message-ID: <877hcymh84.fsf@wanadoo.es> greened at obbligato.org (David A. Greene) writes: > Chandler Carruth writes: > >> Added: >> ? ?llvm/trunk/lib/Target/X86/Utils/ >> ? ?llvm/trunk/lib/Target/X86/Utils/CMakeLists.txt >> >> While you added the CMake target for this, you didn't update the >> dependencies of the X86 targets that use this... I now get link >> failures on my builds. >> =/ > > So what needs to be done? I never use CMake so I don't know the first > thing about it. I made my best guess at what would be needed. I'll fix it. From ofv at wanadoo.es Thu Feb 17 16:26:11 2011 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 17 Feb 2011 22:26:11 -0000 Subject: [llvm-commits] [llvm] r125786 - in /llvm/trunk: CMakeLists.txt cmake/modules/LLVMLibDeps.cmake Message-ID: <20110217222611.C95E72A6C12C@llvm.org> Author: ofv Date: Thu Feb 17 16:26:11 2011 New Revision: 125786 URL: http://llvm.org/viewvc/llvm-project?rev=125786&view=rev Log: New library: LLVMX86Utils. Modified: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/modules/LLVMLibDeps.cmake Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=125786&r1=125785&r2=125786&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Feb 17 16:26:11 2011 @@ -266,6 +266,9 @@ set(LLVM_ENUM_DISASSEMBLERS "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n") endif() + if( EXISTS ${td}/Utils/CMakeLists.txt ) + add_subdirectory(${td}/Utils) + endif() set(CURRENT_LLVM_TARGET) endforeach(t) Modified: llvm/trunk/cmake/modules/LLVMLibDeps.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMLibDeps.cmake?rev=125786&r1=125785&r2=125786&view=diff ============================================================================== --- llvm/trunk/cmake/modules/LLVMLibDeps.cmake (original) +++ llvm/trunk/cmake/modules/LLVMLibDeps.cmake Thu Feb 17 16:26:11 2011 @@ -57,10 +57,11 @@ set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport) set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMTarget LLVMipa) set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport LLVMTarget LLVMX86Info) -set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMMC LLVMSupport) -set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter LLVMX86Info) +set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMMC LLVMSupport LLVMX86Utils) +set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMX86AsmPrinter LLVMX86Info LLVMX86Utils) set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info) set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport) +set(MSVC_LIB_DEPS_LLVMX86Utils LLVMSupport) set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreInfo) set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport) set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport) From sabre at nondot.org Thu Feb 17 16:32:54 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 22:32:54 -0000 Subject: [llvm-commits] [llvm] r125787 - /llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp Message-ID: <20110217223254.E7D222A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 16:32:54 2011 New Revision: 125787 URL: http://llvm.org/viewvc/llvm-project?rev=125787&view=rev Log: fix typo Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp?rev=125787&r1=125786&r2=125787&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp Thu Feb 17 16:32:54 2011 @@ -209,7 +209,7 @@ GetElementPtrInst *NewGEP = GetElementPtrInst::Create(Base, FixedOperands.begin()+1, FixedOperands.end()); - if (AllInBounds) NewGEP->setIsInbounds(); + if (AllInBounds) NewGEP->setIsInBounds(); return NewGEP; } From stoklund at 2pi.dk Thu Feb 17 16:53:48 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 17 Feb 2011 22:53:48 -0000 Subject: [llvm-commits] [llvm] r125789 - in /llvm/trunk/lib/CodeGen: RegAllocBasic.cpp RegAllocGreedy.cpp Message-ID: <20110217225348.BA70E2A6C12C@llvm.org> Author: stoklund Date: Thu Feb 17 16:53:48 2011 New Revision: 125789 URL: http://llvm.org/viewvc/llvm-project?rev=125789&view=rev Log: Add basic register allocator statistics. Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=125789&r1=125788&r2=125789&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Thu Feb 17 16:53:48 2011 @@ -20,6 +20,7 @@ #include "VirtRegMap.h" #include "VirtRegRewriter.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Function.h" #include "llvm/PassAnalysisSupport.h" @@ -48,6 +49,10 @@ using namespace llvm; +STATISTIC(NumAssigned , "Number of registers assigned"); +STATISTIC(NumUnassigned , "Number of registers unassigned"); +STATISTIC(NumNewQueued , "Number of new live ranges queued"); + static RegisterRegAlloc basicRegAlloc("basic", "basic register allocator", createBasicRegisterAllocator); @@ -242,12 +247,14 @@ assert(!VRM->hasPhys(VirtReg.reg) && "Duplicate VirtReg assignment"); VRM->assignVirt2Phys(VirtReg.reg, PhysReg); PhysReg2LiveUnion[PhysReg].unify(VirtReg); + ++NumAssigned; } void RegAllocBase::unassign(LiveInterval &VirtReg, unsigned PhysReg) { assert(VRM->getPhys(VirtReg.reg) == PhysReg && "Inconsistent unassign"); PhysReg2LiveUnion[PhysReg].extract(VirtReg); VRM->clearVirt(VirtReg.reg); + ++NumUnassigned; } // Top-level driver to manage the queue of unassigned VirtRegs and call the @@ -287,6 +294,7 @@ "expect split value in virtual register"); VirtRegQ.push(std::make_pair(getPriority(SplitVirtReg), SplitVirtReg->reg)); + ++NumNewQueued; } } } Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=125789&r1=125788&r2=125789&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Thu Feb 17 16:53:48 2011 @@ -22,6 +22,7 @@ #include "SplitKit.h" #include "VirtRegMap.h" #include "VirtRegRewriter.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Function.h" #include "llvm/PassAnalysisSupport.h" @@ -45,6 +46,11 @@ using namespace llvm; +STATISTIC(NumGlobalSplits, "Number of split global live ranges"); +STATISTIC(NumLocalSplits, "Number of split local live ranges"); +STATISTIC(NumReassigned, "Number of interferences reassigned"); +STATISTIC(NumEvicted, "Number of interferences evicted"); + static RegisterRegAlloc greedyRegAlloc("greedy", "greedy register allocator", createGreedyRegisterAllocator); @@ -265,6 +271,7 @@ TRI->getName(OldAssign) << " to " << TRI->getName(PhysReg) << '\n'); unassign(InterferingVReg, OldAssign); assign(InterferingVReg, PhysReg); + ++NumReassigned; return true; } return false; @@ -307,6 +314,7 @@ if (BestVirt) { DEBUG(dbgs() << "evicting lighter " << *BestVirt << '\n'); unassign(*BestVirt, VRM->getPhys(BestVirt->reg)); + ++NumEvicted; NewVRegs.push_back(BestVirt); return BestPhys; } @@ -782,6 +790,7 @@ // per-block segments? The current approach allows the stack region to // separate into connected components. Some components may be allocatable. SE.finish(); + ++NumGlobalSplits; if (VerifyEnabled) { MF->verify(this, "After splitting live range around region"); @@ -1094,6 +1103,7 @@ SE.useIntv(SegStart, SegStop); SE.closeIntv(); SE.finish(); + ++NumLocalSplits; return 0; } From sabre at nondot.org Thu Feb 17 17:01:49 2011 From: sabre at nondot.org (Chris Lattner) Date: Thu, 17 Feb 2011 23:01:49 -0000 Subject: [llvm-commits] [llvm] r125790 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombinePHI.cpp test/Transforms/InstCombine/phi.ll Message-ID: <20110217230149.4D0C92A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 17:01:49 2011 New Revision: 125790 URL: http://llvm.org/viewvc/llvm-project?rev=125790&view=rev Log: have instcombine preserve nsw/nuw/exact when sinking common operations through a phi. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp llvm/trunk/test/Transforms/InstCombine/phi.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp?rev=125790&r1=125789&r2=125790&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp Thu Feb 17 17:01:49 2011 @@ -31,22 +31,37 @@ const Type *LHSType = LHSVal->getType(); const Type *RHSType = RHSVal->getType(); + bool isNUW = false, isNSW = false, isExact = false; + if (OverflowingBinaryOperator *BO = + dyn_cast(FirstInst)) { + isNUW = BO->hasNoUnsignedWrap(); + isNSW = BO->hasNoSignedWrap(); + } else if (PossiblyExactOperator *PEO = + dyn_cast(FirstInst)) + isExact = PEO->isExact(); + // Scan to see if all operands are the same opcode, and all have one use. for (unsigned i = 1; i != PN.getNumIncomingValues(); ++i) { Instruction *I = dyn_cast(PN.getIncomingValue(i)); if (!I || I->getOpcode() != Opc || !I->hasOneUse() || // Verify type of the LHS matches so we don't fold cmp's of different - // types or GEP's with different index types. + // types. I->getOperand(0)->getType() != LHSType || I->getOperand(1)->getType() != RHSType) return 0; // If they are CmpInst instructions, check their predicates - if (Opc == Instruction::ICmp || Opc == Instruction::FCmp) - if (cast(I)->getPredicate() != - cast(FirstInst)->getPredicate()) + if (CmpInst *CI = dyn_cast(I)) + if (CI->getPredicate() != cast(FirstInst)->getPredicate()) return 0; + if (isNUW) + isNUW = cast(I)->hasNoUnsignedWrap(); + if (isNSW) + isNSW = cast(I)->hasNoSignedWrap(); + if (isExact) + isExact = cast(I)->isExact(); + // Keep track of which operand needs a phi node. if (I->getOperand(0) != LHSVal) LHSVal = 0; if (I->getOperand(1) != RHSVal) RHSVal = 0; @@ -97,11 +112,17 @@ } } - if (BinaryOperator *BinOp = dyn_cast(FirstInst)) - return BinaryOperator::Create(BinOp->getOpcode(), LHSVal, RHSVal); - CmpInst *CIOp = cast(FirstInst); - return CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(), - LHSVal, RHSVal); + if (CmpInst *CIOp = dyn_cast(FirstInst)) + return CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(), + LHSVal, RHSVal); + + BinaryOperator *BinOp = cast(FirstInst); + BinaryOperator *NewBinOp = + BinaryOperator::Create(BinOp->getOpcode(), LHSVal, RHSVal); + if (isNUW) NewBinOp->setHasNoUnsignedWrap(); + if (isNSW) NewBinOp->setHasNoSignedWrap(); + if (isExact) NewBinOp->setIsExact(); + return NewBinOp; } Instruction *InstCombiner::FoldPHIArgGEPIntoPHI(PHINode &PN) { @@ -373,6 +394,7 @@ // code size and simplifying code. Constant *ConstantOp = 0; const Type *CastSrcTy = 0; + bool isNUW = false, isNSW = false, isExact = false; if (isa(FirstInst)) { CastSrcTy = FirstInst->getOperand(0)->getType(); @@ -389,6 +411,14 @@ ConstantOp = dyn_cast(FirstInst->getOperand(1)); if (ConstantOp == 0) return FoldPHIArgBinOpIntoPHI(PN); + + if (OverflowingBinaryOperator *BO = + dyn_cast(FirstInst)) { + isNUW = BO->hasNoUnsignedWrap(); + isNSW = BO->hasNoSignedWrap(); + } else if (PossiblyExactOperator *PEO = + dyn_cast(FirstInst)) + isExact = PEO->isExact(); } else { return 0; // Cannot fold this operation. } @@ -404,6 +434,13 @@ } else if (I->getOperand(1) != ConstantOp) { return 0; } + + if (isNUW) + isNUW = cast(I)->hasNoUnsignedWrap(); + if (isNSW) + isNSW = cast(I)->hasNoSignedWrap(); + if (isExact) + isExact = cast(I)->isExact(); } // Okay, they are all the same operation. Create a new PHI node of the @@ -438,8 +475,13 @@ if (CastInst *FirstCI = dyn_cast(FirstInst)) return CastInst::Create(FirstCI->getOpcode(), PhiVal, PN.getType()); - if (BinaryOperator *BinOp = dyn_cast(FirstInst)) - return BinaryOperator::Create(BinOp->getOpcode(), PhiVal, ConstantOp); + if (BinaryOperator *BinOp = dyn_cast(FirstInst)) { + BinOp = BinaryOperator::Create(BinOp->getOpcode(), PhiVal, ConstantOp); + if (isNUW) BinOp->setHasNoUnsignedWrap(); + if (isNSW) BinOp->setHasNoSignedWrap(); + if (isExact) BinOp->setIsExact(); + return BinOp; + } CmpInst *CIOp = cast(FirstInst); return CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(), Modified: llvm/trunk/test/Transforms/InstCombine/phi.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/phi.ll?rev=125790&r1=125789&r2=125790&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/phi.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/phi.ll Thu Feb 17 17:01:49 2011 @@ -526,3 +526,21 @@ ; CHECK-NEXT: ret i32 %B } +define i32 @test24(i32 %A, i1 %cond) { +BB0: + %X = add nuw nsw i32 %A, 1 + br i1 %cond, label %BB1, label %BB2 + +BB1: + %Y = add nuw i32 %A, 1 + br label %BB2 + +BB2: + %C = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ] + ret i32 %C +; CHECK: @test24 +; CHECK-NOT: phi +; CHECK: BB2: +; CHECK-NEXT: %C = add nuw i32 %A, 1 +; CHECK-NEXT: ret i32 %C +} From clattner at apple.com Thu Feb 17 17:10:18 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:10:18 -0800 Subject: [llvm-commits] [Review request] Have Correlated Value Propagation handle instruction operands. In-Reply-To: <4D517367.9050105@free.fr> References: <4D517367.9050105@free.fr> Message-ID: On Feb 8, 2011, at 8:46 AM, Duncan Sands wrote: > Hi Frits, > >>> Do you done any measurements of the compile-time impact of this? >> >> No, sorry. Duncan Sands was worried about this too... > > it is very expensive. I ran some comparisons and it is very visible that with > your patch compilation is much slower. The obvious thing to do is to keep your > logic but only analyse a small set of instructions, for example the ones it used > to analyse (Select, PHI, I/FCmp, Load, Store) plus branch instructions. Sadly > the result is disappointing: it catches way less stuff than my pass. I then > tried with your original patch, i.e. analysing all instructions. It still > catches way less stuff than my pass if I judge by the number of lines of bitcode > removed. I don't understand this since indeed LVI knows lots of tricks, so it > is probably worth trying to understand why correlated value propagation/LVI is > not doing a better job. One way to speed this up is to only look at values that have multiple uses. If X only has a single use (which is a very common case for instructions) it is unlikely to be simplifyable. -Chris From clattner at apple.com Thu Feb 17 17:11:22 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:11:22 -0800 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <20110208190442.036ED2A6C12C@llvm.org> References: <20110208190442.036ED2A6C12C@llvm.org> Message-ID: <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> On Feb 8, 2011, at 11:04 AM, David Greene wrote: > Author: greened > Date: Tue Feb 8 13:04:41 2011 > New Revision: 125105 > > URL: http://llvm.org/viewvc/llvm-project?rev=125105&view=rev > Log: > > [AVX] Implement BUILD_VECTOR lowering for 256-bit vectors. For > anything but the simplest of cases, lower a 256-bit BUILD_VECTOR by > splitting it into 128-bit parts and recombining. Hi David, Why add the "disable-256bit" command line option? Please remove it, -Chris From clattner at apple.com Thu Feb 17 17:15:23 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:15:23 -0800 Subject: [llvm-commits] my 2nd attempt at now-infamous PR889 In-Reply-To: References: Message-ID: <221A2263-9E96-45D8-A085-D53C649B1FA3@apple.com> On Feb 16, 2011, at 9:13 PM, pawel kunio wrote: > Hello, > In a meantime of preparing 2 tests for PR9067, I came with my 2nd and hopefully now more > successful attempt at now-infamous PR889 devirtualize Value destructor. > > Please find patches for llvm and clang attached to this mail. As I can see from mingw build > environment, it will need moving PseudoSourceValue.cpp from lib/CodeGen to lib/VMCore > after applying patch (seems not to be required on vc build env, as order of libraries given > to linker is not meaningful there). > > Please note that destructors have been moved into protected part of interface as well as > empty destructors were implemented for all Value-derived classes to help in catching all > destructions. Hi Pawel, Thank you for working on this! Unfortunately, this patch is way too monolithic to review like this though, could you split it out into a series of obvious changes? Doug recently "devirtualized" the clang decl hierarchy by devirtualizing one method at a time, which worked really well. -Chris From clattner at apple.com Thu Feb 17 17:22:45 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:22:45 -0800 Subject: [llvm-commits] [PATCH] Patch (WIP) to custom-lower 64-bit relational comparisons on x86-32 In-Reply-To: References: Message-ID: <9B03BD52-6B0C-4784-8FC1-02C6EAC9B57D@apple.com> On Feb 16, 2011, at 4:25 PM, Eli Friedman wrote: > I'm mainly looking for feedback as to whether this seems like > generally a good idea... I haven't seen any compiler use this > particular implementation of relational comparisons. This looks pretty spiffy to me. A couple of requests though: 1. Please make this work for i128 on x86-64. 2. Please change the if/else sequence to use a switch with a default case that explodes. 4. Please fit in 80 columns 8. I think you only need to do the setOperationAction when building for 32-bit. 16. Does the code handle weird conditions like "COND_P"? -Chris From clattner at apple.com Thu Feb 17 17:27:33 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:27:33 -0800 Subject: [llvm-commits] patch: fix broken code generation with r125471 and newer when preferred alignment of some data type is is bigger than stack alignment In-Reply-To: <8E2B3382-17E2-4E2B-9507-D18D96BC5893@iki.fi> References: <8E2B3382-17E2-4E2B-9507-D18D96BC5893@iki.fi> Message-ID: On Feb 14, 2011, at 11:11 AM, Heikki Kultala wrote: > Hi Heikki, This patch isn't correct. If a stack slot claims to be (e.g.) 32-byte aligned, then InferPtrAlignment can return 32 bytes. It is up to the target to provide this guarantee (by doing dynamic stack realignment) otherwise other things will fail. You can see this at work on X86 (for example): $ cat t.c void foo() { int x __attribute__((aligned(128))); bar(&x); } $ clang t.c -S -o - -m32 -O3 _foo: ## @foo ## BB#0: ## %entry pushl %ebp movl %esp, %ebp andl $-128, %esp subl $256, %esp ## imm = 0x100 leal 128(%esp), %eax movl %eax, (%esp) calll _bar movl %ebp, %esp popl %ebp ret If your target isn't aligning things properly, then attribute(aligned) is broken. -Chris From joerg at bec.de Thu Feb 17 17:22:19 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Thu, 17 Feb 2011 23:22:19 -0000 Subject: [llvm-commits] [llvm] r125792 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Message-ID: <20110217232219.858842A6C12C@llvm.org> Author: joerg Date: Thu Feb 17 17:22:19 2011 New Revision: 125792 URL: http://llvm.org/viewvc/llvm-project?rev=125792&view=rev Log: Check that MnemonicAlias doesn't map back to the same string. Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=125792&r1=125791&r2=125792&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Thu Feb 17 17:22:19 2011 @@ -1881,6 +1881,8 @@ AliasWithNoPredicate = i; continue; } + if (R->getValueAsString("ToMnemonic") == I->first) + throw TGError(R->getLoc(), "MnemonicAlias to the same string"); if (!MatchCode.empty()) MatchCode += "else "; From greened at obbligato.org Thu Feb 17 17:34:06 2011 From: greened at obbligato.org (David A. Greene) Date: Thu, 17 Feb 2011 17:34:06 -0600 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> (Chris Lattner's message of "Thu, 17 Feb 2011 15:11:22 -0800") References: <20110208190442.036ED2A6C12C@llvm.org> <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> Message-ID: Chris Lattner writes: > Why add the "disable-256bit" command line option? Please remove it, For debugging purposes. Should I add this as a target option instead? -David From dpatel at apple.com Thu Feb 17 17:33:27 2011 From: dpatel at apple.com (Devang Patel) Date: Thu, 17 Feb 2011 23:33:27 -0000 Subject: [llvm-commits] [llvm] r125794 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SDNodeDbgValue.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/dbg-value-inlined-parameter.ll Message-ID: <20110217233327.D53A82A6C12C@llvm.org> Author: dpatel Date: Thu Feb 17 17:33:27 2011 New Revision: 125794 URL: http://llvm.org/viewvc/llvm-project?rev=125794&view=rev Log: Do not lose debug info of an inlined function argument even if the argument is only used through GEPs. Added: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=125794&r1=125793&r2=125794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Feb 17 17:33:27 2011 @@ -100,10 +100,6 @@ return DbgValMap[Node]; } - void removeSDDbgValues(const SDNode *Node) { - DbgValMap.erase(Node); - } - typedef SmallVector::iterator DbgIterator; DbgIterator DbgBegin() { return DbgValues.begin(); } DbgIterator DbgEnd() { return DbgValues.end(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 17 17:33:27 2011 @@ -87,6 +87,9 @@ // If someone requests legalization of the new node, return itself. if (From != To) LegalizedNodes.insert(std::make_pair(To, To)); + + // Transfer SDDbgValues. + DAG.TransferDbgValues(From, To); } public: Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h?rev=125794&r1=125793&r2=125794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h Thu Feb 17 17:33:27 2011 @@ -83,14 +83,6 @@ // Returns the SDNode* for a register ref SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; } - // setSDNode - If underlying SDNode is replaced by another node then - // SelectionDAG can use this to transfer DbgValue. - void setSDNode(SDNode *N, unsigned R) { - assert (kind==SDNODE); - u.s.Node = N; - u.s.ResNo = R; - } - // Returns the ResNo for a register ref unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 17 17:33:27 2011 @@ -5508,12 +5508,14 @@ SDNode *FromNode = From.getNode(); SDNode *ToNode = To.getNode(); SmallVector &DVs = GetDbgValues(FromNode); - DbgInfo->removeSDDbgValues(FromNode); for (SmallVector::iterator I = DVs.begin(), E = DVs.end(); I != E; ++I) { - if ((*I)->getKind() == SDDbgValue::SDNODE) { - AddDbgValue(*I, ToNode, false); - (*I)->setSDNode(ToNode, To.getResNo()); + SDDbgValue *Dbg = *I; + if (Dbg->getKind() == SDDbgValue::SDNODE) { + SDDbgValue *Clone = getDbgValue(Dbg->getMDPtr(), ToNode, To.getResNo(), + Dbg->getOffset(), Dbg->getDebugLoc(), + Dbg->getOrder()); + AddDbgValue(Clone, ToNode, false); } } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125794&r1=125793&r2=125794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 17 17:33:27 2011 @@ -4287,7 +4287,7 @@ N.getResNo(), Offset, dl, SDNodeOrder); DAG.AddDbgValue(SDV, N.getNode(), false); } - } else if (isa(V) && !V->use_empty() ) { + } else if (!V->use_empty() ) { // Do not call getValue(V) yet, as we don't want to generate code. // Remember it for later. DanglingDebugInfo DDI(&DI, dl, SDNodeOrder); Added: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll?rev=125794&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll (added) +++ llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll Thu Feb 17 17:33:27 2011 @@ -0,0 +1,86 @@ +; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s + +;CHECK: DW_TAG_inlined_subroutine +;CHECK-NEXT: DW_AT_abstract_origin +;CHECK-NEXT: DW_AT_low_pc +;CHECK-NEXT: DW_AT_high_pc +;CHECK-NEXT: DW_AT_call_file +;CHECK-NEXT: DW_AT_call_line +;CHECK-NEXT: DW_TAG_formal_parameter +;CHECK-NEXT: .ascii "sp" ## DW_AT_name + +%struct.S1 = type { float*, i32 } + + at p = common global %struct.S1 zeroinitializer, align 8 + +define i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp { +entry: + tail call void @llvm.dbg.value(metadata !{%struct.S1* %sp}, i64 0, metadata !9), !dbg !20 + tail call void @llvm.dbg.value(metadata !{i32 %nums}, i64 0, metadata !18), !dbg !21 + %tmp2 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 1, !dbg !22 + store i32 %nums, i32* %tmp2, align 4, !dbg !22, !tbaa !24 + %call = tail call float* @bar(i32 %nums) nounwind optsize, !dbg !27 + %tmp5 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 0, !dbg !27 + store float* %call, float** %tmp5, align 8, !dbg !27, !tbaa !28 + %cmp = icmp ne float* %call, null, !dbg !29 + %cond = zext i1 %cmp to i32, !dbg !29 + ret i32 %cond, !dbg !29 +} + +declare float* @bar(i32) optsize + +define void @foobar() nounwind optsize ssp { +entry: + tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !9) nounwind, !dbg !31 + tail call void @llvm.dbg.value(metadata !34, i64 0, metadata !18) nounwind, !dbg !35 + store i32 1, i32* getelementptr inbounds (%struct.S1* @p, i64 0, i32 1), align 8, !dbg !36, !tbaa !24 + %call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37 + store float* %call.i, float** getelementptr inbounds (%struct.S1* @p, i64 0, i32 0), align 8, !dbg !37, !tbaa !28 + ret void, !dbg !38 +} + +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +!llvm.dbg.sp = !{!0, !6} +!llvm.dbg.lv.foo = !{!9, !18} +!llvm.dbg.gv = !{!19} + +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (%struct.S1*, i32)* @foo} ; [ DW_TAG_subprogram ] +!1 = metadata !{i32 589865, metadata !"nm2.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"nm2.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 125693)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{metadata !5} +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] +!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"", metadata !1, i32 15, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foobar} ; [ DW_TAG_subprogram ] +!7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!8 = metadata !{null} +!9 = metadata !{i32 590081, metadata !0, metadata !"sp", metadata !1, i32 7, metadata !10, i32 0} ; [ DW_TAG_arg_variable ] +!10 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] +!11 = metadata !{i32 589846, metadata !2, metadata !"S1", metadata !1, i32 4, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ] +!12 = metadata !{i32 589843, metadata !2, metadata !"S1", metadata !1, i32 1, i64 128, i64 64, i32 0, i32 0, i32 0, metadata !13, i32 0, i32 0} ; [ DW_TAG_structure_type ] +!13 = metadata !{metadata !14, metadata !17} +!14 = metadata !{i32 589837, metadata !1, metadata !"m", metadata !1, i32 2, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_member ] +!15 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] +!16 = metadata !{i32 589860, metadata !2, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] +!17 = metadata !{i32 589837, metadata !1, metadata !"nums", metadata !1, i32 3, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ] +!18 = metadata !{i32 590081, metadata !0, metadata !"nums", metadata !1, i32 7, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!19 = metadata !{i32 589876, i32 0, metadata !2, metadata !"p", metadata !"p", metadata !"", metadata !1, i32 14, metadata !11, i32 0, i32 1, %struct.S1* @p} ; [ DW_TAG_variable ] +!20 = metadata !{i32 7, i32 13, metadata !0, null} +!21 = metadata !{i32 7, i32 21, metadata !0, null} +!22 = metadata !{i32 9, i32 3, metadata !23, null} +!23 = metadata !{i32 589835, metadata !0, i32 8, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] +!24 = metadata !{metadata !"int", metadata !25} +!25 = metadata !{metadata !"omnipotent char", metadata !26} +!26 = metadata !{metadata !"Simple C/C++ TBAA", null} +!27 = metadata !{i32 10, i32 3, metadata !23, null} +!28 = metadata !{metadata !"any pointer", metadata !25} +!29 = metadata !{i32 11, i32 3, metadata !23, null} +!30 = metadata !{%struct.S1* @p} +!31 = metadata !{i32 7, i32 13, metadata !0, metadata !32} +!32 = metadata !{i32 16, i32 3, metadata !33, null} +!33 = metadata !{i32 589835, metadata !6, i32 15, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] +!34 = metadata !{i32 1} +!35 = metadata !{i32 7, i32 21, metadata !0, metadata !32} +!36 = metadata !{i32 9, i32 3, metadata !23, metadata !32} +!37 = metadata !{i32 10, i32 3, metadata !23, metadata !32} +!38 = metadata !{i32 17, i32 1, metadata !33, null} From joerg at bec.de Thu Feb 17 17:36:39 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Thu, 17 Feb 2011 23:36:39 -0000 Subject: [llvm-commits] [llvm] r125795 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td test/MC/X86/x86-32-coverage.s test/MC/X86/x86_64-encoding.s Message-ID: <20110217233639.97DD92A6C12C@llvm.org> Author: joerg Date: Thu Feb 17 17:36:39 2011 New Revision: 125795 URL: http://llvm.org/viewvc/llvm-project?rev=125795&view=rev Log: Recognize leavel and leaveq aliases for leave. Validate encoding of leave in 64bit mode. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/test/MC/X86/x86-32-coverage.s llvm/trunk/test/MC/X86/x86_64-encoding.s Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=125795&r1=125794&r2=125795&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Feb 17 17:36:39 2011 @@ -1293,6 +1293,9 @@ // lret maps to lretl, it is not ambiguous with lretq. def : MnemonicAlias<"lret", "lretl">; +def : MnemonicAlias<"leavel", "leave">, Requires<[In32BitMode]>; +def : MnemonicAlias<"leaveq", "leave">, Requires<[In64BitMode]>; + def : MnemonicAlias<"pop", "popl">, Requires<[In32BitMode]>; def : MnemonicAlias<"pop", "popq">, Requires<[In64BitMode]>; def : MnemonicAlias<"popf", "popfl">, Requires<[In32BitMode]>; Modified: llvm/trunk/test/MC/X86/x86-32-coverage.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-32-coverage.s?rev=125795&r1=125794&r2=125795&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-32-coverage.s (original) +++ llvm/trunk/test/MC/X86/x86-32-coverage.s Thu Feb 17 17:36:39 2011 @@ -267,6 +267,9 @@ // CHECK: leave leave +// CHECK: leave + leavel + // CHECK: seto %bl seto %bl @@ -3330,6 +3333,10 @@ // CHECK: encoding: [0xc9] leave +// CHECK: leave +// CHECK: encoding: [0xc9] + leavel + // CHECK: seto %bl // CHECK: encoding: [0x0f,0x90,0xc3] seto %bl Modified: llvm/trunk/test/MC/X86/x86_64-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86_64-encoding.s?rev=125795&r1=125794&r2=125795&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86_64-encoding.s (original) +++ llvm/trunk/test/MC/X86/x86_64-encoding.s Thu Feb 17 17:36:39 2011 @@ -148,3 +148,10 @@ // CHECK: encoding: [0x48,0x0f,0xae,0x08] fxrstorq (%rax) +// CHECK: leave +// CHECK: encoding: [0xc9] + leave + +// CHECK: leave +// CHECK: encoding: [0xc9] + leaveq From clattner at apple.com Thu Feb 17 17:52:25 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:52:25 -0800 Subject: [llvm-commits] [llvm] r125105 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: References: <20110208190442.036ED2A6C12C@llvm.org> <829B9D03-9FBC-4D64-B717-A75D868E885E@apple.com> Message-ID: On Feb 17, 2011, at 3:34 PM, David A. Greene wrote: > Chris Lattner writes: > > >> Why add the "disable-256bit" command line option? Please remove it, > > For debugging purposes. Should I add this as a target option instead? What is the use case? Is this a temporary hack that will be removed later or something you intend to keep around forever? -Chris From clattner at apple.com Thu Feb 17 17:55:08 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 15:55:08 -0800 Subject: [llvm-commits] PATCH: Additional convenience methods for ConstantStruct, ConstantArray, and ConstantVector. In-Reply-To: References: Message-ID: <4870E518-6F19-4879-A5B6-5A0A5F6F5F90@apple.com> On Feb 10, 2011, at 1:40 PM, Talin wrote: > This patch adds a new "get" method to ConstantStruct, ConstantArray and ConstantVector. The new method accepts a pair of RandomAccessIterators, similar to other LLVM method signatures. This allows constants to be build using a small vector or other sequential container type more easily. Hi Talin, I don't think that this is the right way to go. Generic random access iterators are not guaranteed to be contiguous in memory (e.g. std::deque). Doesn't ArrayRef solve this need? > In addition, I've also added an END_WITH_NULL variant for ConstantStruct::get(). I only added it to ConstantStruct because I figured that it would be an uncommon use case for arrays and vectors, whereas the creation of small constant structs of predetermined length is fairly common. This part seems fine to me, -Chris From fvbommel at gmail.com Thu Feb 17 18:10:22 2011 From: fvbommel at gmail.com (Frits van Bommel) Date: Fri, 18 Feb 2011 01:10:22 +0100 Subject: [llvm-commits] [Review request] Have Correlated Value Propagation handle instruction operands. In-Reply-To: References: <4D517367.9050105@free.fr> Message-ID: On Fri, Feb 18, 2011 at 12:10 AM, Chris Lattner wrote: > One way to speed this up is to only look at values that have multiple uses. ?If X only has a single use (which is a very common case for instructions) it is unlikely to be simplifyable. That sounds plausible enough. Updated patch attached in case anyone wants to test this. It didn't break any tests, so that's good :). Of course, Duncan did say this simplifies away 'way less' code than his pass so all of this may be moot... -------------- next part -------------- A non-text attachment was scrubbed... Name: correlated-value-prop-operands-v2.patch Type: text/x-patch Size: 6760 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/4c38386b/attachment.bin From viridia at gmail.com Thu Feb 17 18:17:41 2011 From: viridia at gmail.com (Talin) Date: Thu, 17 Feb 2011 16:17:41 -0800 Subject: [llvm-commits] PATCH: Additional convenience methods for ConstantStruct, ConstantArray, and ConstantVector. In-Reply-To: <4870E518-6F19-4879-A5B6-5A0A5F6F5F90@apple.com> References: <4870E518-6F19-4879-A5B6-5A0A5F6F5F90@apple.com> Message-ID: On Thu, Feb 17, 2011 at 3:55 PM, Chris Lattner wrote: > > On Feb 10, 2011, at 1:40 PM, Talin wrote: > > > This patch adds a new "get" method to ConstantStruct, ConstantArray and > ConstantVector. The new method accepts a pair of RandomAccessIterators, > similar to other LLVM method signatures. This allows constants to be build > using a small vector or other sequential container type more easily. > > Hi Talin, > > I don't think that this is the right way to go. Generic random access > iterators are not guaranteed to be contiguous in memory (e.g. std::deque). > OK - I was just following the patterns that I saw used elsewhere in LLVM. > > Doesn't ArrayRef solve this need? > Yes, although you'll have to manually call the ArrayRef constructor in cases like this instead of having it be implicit, but that's not a huge deal for me. > > > In addition, I've also added an END_WITH_NULL variant for > ConstantStruct::get(). I only added it to ConstantStruct because I figured > that it would be an uncommon use case for arrays and vectors, whereas the > creation of small constant structs of predetermined length is fairly common. > > This part seems fine to me, > Good cause this is the part I really care about :) Should I wait until you've converted ConstantStruct and friends to use ArrayRef before sending you a new patch? (I'd do it myself, except as you've discovered there may be other projects broken by such changes and you're in a better position to detect and correct those.) -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/012f0249/attachment.html From stoklund at 2pi.dk Thu Feb 17 18:32:47 2011 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 18 Feb 2011 00:32:47 -0000 Subject: [llvm-commits] [llvm] r125802 - in /llvm/trunk/lib/CodeGen: RegAllocBasic.cpp SpillPlacement.cpp Message-ID: <20110218003247.320C62A6C12C@llvm.org> Author: stoklund Date: Thu Feb 17 18:32:47 2011 New Revision: 125802 URL: http://llvm.org/viewvc/llvm-project?rev=125802&view=rev Log: Trim debugging output. Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp llvm/trunk/lib/CodeGen/SpillPlacement.cpp Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=125802&r1=125801&r2=125802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Thu Feb 17 18:32:47 2011 @@ -244,6 +244,8 @@ } void RegAllocBase::assign(LiveInterval &VirtReg, unsigned PhysReg) { + DEBUG(dbgs() << "assigning " << PrintReg(VirtReg.reg, TRI) + << " to " << PrintReg(PhysReg, TRI) << '\n'); assert(!VRM->hasPhys(VirtReg.reg) && "Duplicate VirtReg assignment"); VRM->assignVirt2Phys(VirtReg.reg, PhysReg); PhysReg2LiveUnion[PhysReg].unify(VirtReg); @@ -251,6 +253,8 @@ } void RegAllocBase::unassign(LiveInterval &VirtReg, unsigned PhysReg) { + DEBUG(dbgs() << "unassigning " << PrintReg(VirtReg.reg, TRI) + << " from " << PrintReg(PhysReg, TRI) << '\n'); assert(VRM->getPhys(VirtReg.reg) == PhysReg && "Inconsistent unassign"); PhysReg2LiveUnion[PhysReg].extract(VirtReg); VRM->clearVirt(VirtReg.reg); @@ -280,11 +284,9 @@ VirtRegVec SplitVRegs; unsigned AvailablePhysReg = selectOrSplit(VirtReg, SplitVRegs); - if (AvailablePhysReg) { - DEBUG(dbgs() << "allocating: " << TRI->getName(AvailablePhysReg) - << " for " << VirtReg << '\n'); + if (AvailablePhysReg) assign(VirtReg, AvailablePhysReg); - } + for (VirtRegVec::iterator I = SplitVRegs.begin(), E = SplitVRegs.end(); I != E; ++I) { LiveInterval* SplitVirtReg = *I; Modified: llvm/trunk/lib/CodeGen/SpillPlacement.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SpillPlacement.cpp?rev=125802&r1=125801&r2=125802&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SpillPlacement.cpp (original) +++ llvm/trunk/lib/CodeGen/SpillPlacement.cpp Thu Feb 17 18:32:47 2011 @@ -204,19 +204,15 @@ /// Set a bit in NodeMask for each active node. void SpillPlacement:: prepareNodes(const SmallVectorImpl &LiveBlocks) { - DEBUG(dbgs() << "Building Hopfield network from " << LiveBlocks.size() - << " constraint blocks:\n"); for (SmallVectorImpl::const_iterator I = LiveBlocks.begin(), E = LiveBlocks.end(); I != E; ++I) { MachineBasicBlock *MBB = MF->getBlockNumbered(I->Number); float Freq = getBlockFrequency(MBB); - DEBUG(dbgs() << " BB#" << I->Number << format(", Freq = %.1f", Freq)); // Is this a transparent block? Link ingoing and outgoing bundles. if (I->Entry == DontCare && I->Exit == DontCare) { unsigned ib = bundles->getBundle(I->Number, 0); unsigned ob = bundles->getBundle(I->Number, 1); - DEBUG(dbgs() << ", transparent EB#" << ib << " -> EB#" << ob << '\n'); // Ignore self-loops. if (ib == ob) @@ -241,7 +237,6 @@ unsigned ib = bundles->getBundle(I->Number, 0); activate(ib); nodes[ib].addBias(Freq * Bias[I->Entry], 1); - DEBUG(dbgs() << format(", entry EB#%u %+.1f", ib, Freq * Bias[I->Entry])); } // Live-out from block? @@ -249,10 +244,7 @@ unsigned ob = bundles->getBundle(I->Number, 1); activate(ob); nodes[ob].addBias(Freq * Bias[I->Exit], 0); - DEBUG(dbgs() << format(", exit EB#%u %+.1f", ob, Freq * Bias[I->Exit])); } - - DEBUG(dbgs() << '\n'); } } @@ -260,7 +252,6 @@ /// maximum number of iterations is reached. /// @param Linked - Numbers of linked nodes that need updating. void SpillPlacement::iterate(const SmallVectorImpl &Linked) { - DEBUG(dbgs() << "Iterating over " << Linked.size() << " linked nodes:\n"); if (Linked.empty()) return; @@ -278,8 +269,6 @@ unsigned n = *I; bool C = nodes[n].update(nodes); Changed |= C; - DEBUG(dbgs() << " \\EB#" << n << format(" = %+2.0f", nodes[n].Value) - << (C ? " *\n" : "\n")); } if (!Changed) return; @@ -291,8 +280,6 @@ unsigned n = *I; bool C = nodes[n].update(nodes); Changed |= C; - DEBUG(dbgs() << " /EB#" << n << format(" = %+2.0f", nodes[n].Value) - << (C ? " *\n" : "\n")); } if (!Changed) return; @@ -312,7 +299,6 @@ // Update all active nodes, and find the ones that are actually linked to // something so their value may change when iterating. - DEBUG(dbgs() << "Network has " << RegBundles.count() << " active nodes:\n"); SmallVector Linked; for (int n = RegBundles.find_first(); n>=0; n = RegBundles.find_next(n)) { nodes[n].update(nodes); @@ -320,17 +306,6 @@ // change its value ever again, so exclude it from iterations. if (!nodes[n].Links.empty() && !nodes[n].mustSpill()) Linked.push_back(n); - - DEBUG({ - dbgs() << " EB#" << n << format(" = %+2.0f", nodes[n].Value) - << format(", Bias %+.2f", nodes[n].Bias) - << format(", Freq %.1f/%.1f", nodes[n].Frequency[0], - nodes[n].Frequency[1]); - for (unsigned i = 0, e = nodes[n].Links.size(); i != e; ++i) - dbgs() << format(", %.2f -> EB#%u", nodes[n].Links[i].first, - nodes[n].Links[i].second); - dbgs() << '\n'; - }); } // Iterate the network to convergence. From bob.wilson at apple.com Thu Feb 17 18:39:11 2011 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 18 Feb 2011 00:39:11 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r125803 - in /llvm-gcc-4.2/trunk: build_gcc gcc/Makefile.in gcc/mklibgcc.in Message-ID: <20110218003911.B0E222A6C12C@llvm.org> Author: bwilson Date: Thu Feb 17 18:39:11 2011 New Revision: 125803 URL: http://llvm.org/viewvc/llvm-project?rev=125803&view=rev Log: Radar 8710868: Build a separate version of libcc_kext.a for each ARM slice. Combine them together into a single fat library, as is already done for x86. Modified: llvm-gcc-4.2/trunk/build_gcc llvm-gcc-4.2/trunk/gcc/Makefile.in llvm-gcc-4.2/trunk/gcc/mklibgcc.in Modified: llvm-gcc-4.2/trunk/build_gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=125803&r1=125802&r2=125803&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/build_gcc (original) +++ llvm-gcc-4.2/trunk/build_gcc Thu Feb 17 18:39:11 2011 @@ -397,14 +397,25 @@ # LLVM LOCAL Support for non /usr $DEST_ROOT D=`echo $DT/$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS` mv $D/static/libgcc.a $D/libgcc_static.a || exit 1 - mv $D/kext/libgcc.a $D/libcc_kext.a || exit 1 - rm -r $D/static $D/kext || exit 1 + # LLVM LOCAL begin ARM slice-specific kext libraries + rm -r $D/static || exit 1 + if [ -e $D/kext/libgcc.a ]; then + mv $D/kext/libgcc.a $D/libcc_kext.a || exit 1 + rm -r $D/kext || exit 1 + fi + # LLVM LOCAL end ARM slice-specific kext libraries # glue together kext64 stuff if [ -e $D/kext64/libgcc.a ]; then libtool -static $D/{kext64/libgcc.a,libcc_kext.a} -o $D/libcc_kext1.a 2>&1 | grep -v 'has no symbols' mv $D/libcc_kext1.a $D/libcc_kext.a rm -rf $D/kext64 fi + # LLVM LOCAL begin ARM slice-specific kext libraries + if [ $t = 'arm' ]; then + libtool -static $D/kext*/libgcc.a -o $D/libcc_kext.a 2>&1 | grep -v 'has no symbols' + rm -rf $D/kext* || exit 1 + fi + # LLVM LOCAL end ARM slice-specific kext libraries done # Build the cross-hosted compilers. 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=125803&r1=125802&r2=125803&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Thu Feb 17 18:39:11 2011 @@ -1689,12 +1689,27 @@ # LLVM LOCAL begin libcc_kext ifneq (,$(findstring darwin,$(target))) -APPLE_EXTRA_MULTI := static;@static at fno-pic kext;@Dmalloc=kern_os_malloc at Dfree=kern_os_free at DLIBCC_KEXT@static at fno-pic@fno-exceptions at fno-non-call-exceptions$(KEXT_EXTRA_FLAGS) $(if $(findstring i686,$(target)),kext64;@mkernel at m64@Dmalloc=kern_os_malloc at Dfree=kern_os_free at DLIBCC_KEXT$(KEXT_EXTRA_FLAGS)) +APPLE_KEXT_FLAGS := Dmalloc=kern_os_malloc at Dfree=kern_os_free at DLIBCC_KEXT@static at fno-pic@fno-exceptions at fno-non-call-exceptions$(KEXT_EXTRA_FLAGS) +APPLE_KEXT64_FLAGS := mkernel at m64@Dmalloc=kern_os_malloc at Dfree=kern_os_free at DLIBCC_KEXT$(KEXT_EXTRA_FLAGS) +APPLE_EXTRA_MULTI := \ + static;@static at fno-pic \ + $(if $(findstring arm,$(target)),,kext;@$(APPLE_KEXT_FLAGS)) \ + $(if $(findstring i686,$(target)),kext64;@$(APPLE_KEXT64_FLAGS)) endif # LLVM LOCAL end libcc_kext +# LLVM LOCAL Set apple_extra_multi with a separate kext for each ARM slice. libgcc.mk: config.status Makefile mklibgcc $(LIB2ADD) $(LIB2ADD_ST) specs \ xgcc$(exeext) stamp-as stamp-collect-ld stamp-nm + apple_extra_multi="$(APPLE_EXTRA_MULTI)"; \ + for multilib in `$(GCC_FOR_TARGET) --print-multi-lib`; do \ + multilib_dir=`echo $$multilib | sed -e "s/;.*//"`; \ + if [ "$$multilib_dir" != "." ]; then \ + if echo v5 v6 v7 | grep $$multilib_dir > /dev/null 2>&1; then \ + apple_extra_multi="$$apple_extra_multi kext$${multilib}@$(APPLE_KEXT_FLAGS)"; \ + fi; \ + fi; \ + done; \ objext='$(objext)' \ LIB1ASMFUNCS='$(LIB1ASMFUNCS)' \ LIB2FUNCS_ST='$(LIB2FUNCS_ST)' \ @@ -1727,7 +1742,7 @@ D128PBIT='$(D128PBIT)' \ D128PBIT_FUNCS='$(D128PBIT_FUNCS)' \ APPLE_LOCAL='APPLE LOCAL libcc_kext' \ - MULTILIBS="`$(GCC_FOR_TARGET) --print-multi-lib` $(APPLE_EXTRA_MULTI)" \ + MULTILIBS="`$(GCC_FOR_TARGET) --print-multi-lib` $$apple_extra_multi" \ EXTRA_MULTILIB_PARTS='$(EXTRA_MULTILIB_PARTS)' \ SHLIB_LINK='$(SHLIB_LINK)' \ SHLIB_INSTALL='$(SHLIB_INSTALL)' \ Modified: llvm-gcc-4.2/trunk/gcc/mklibgcc.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/mklibgcc.in?rev=125803&r1=125802&r2=125803&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/mklibgcc.in (original) +++ llvm-gcc-4.2/trunk/gcc/mklibgcc.in Thu Feb 17 18:39:11 2011 @@ -827,7 +827,13 @@ # Shared libraries. # APPLE LOCAL libcc_kext - if [ "$libgcc_s_so" -a "$dir" != "static" -a "$dir" != "kext" -a "$dir" != "kext64" ]; then + # LLVM LOCAL begin ARM slice-specific kext libraries + kextdir= + if echo "$dir" | grep kext > /dev/null 2>&1; then + kextdir=1 + fi + # LLVM LOCAL end ARM slice-specific kext libraries + if [ "$libgcc_s_so" -a "$dir" != "static" -a "X$kextdir" = "X" ]; then echo "" echo "$libgcc_s_so: stmp-dirs $libunwind_so" echo " $SHLIB_LINK" \ @@ -908,7 +914,13 @@ shlib_slibdir_qual="/$os_multilib_dir" fi # APPLE LOCAL libcc_kext - if [ "$dir" != "static" -a "$dir" != "kext" -a "$dir" != "kext64" ]; then + # LLVM LOCAL begin ARM slice-specific kext libraries + kextdir= + if echo "$dir" | grep kext > /dev/null 2>&1; then + kextdir=1 + fi + # LLVM LOCAL end ARM slice-specific kext libraries + if [ "$dir" != "static" -a "X$kextdir" = "X" ]; then echo " $SHLIB_INSTALL" \ | sed -e "s%@multilib_dir@%$dir%g" \ -e "s%@shlib_base_name@%libgcc_s%g" \ From akyrtzi at gmail.com Thu Feb 17 18:47:07 2011 From: akyrtzi at gmail.com (Argyrios Kyrtzidis) Date: Fri, 18 Feb 2011 00:47:07 -0000 Subject: [llvm-commits] [llvm] r125804 - /llvm/trunk/lib/Support/Mutex.cpp Message-ID: <20110218004707.40ACB2A6C12C@llvm.org> Author: akirtzidis Date: Thu Feb 17 18:47:07 2011 New Revision: 125804 URL: http://llvm.org/viewvc/llvm-project?rev=125804&view=rev Log: Check the errorcode. Modified: llvm/trunk/lib/Support/Mutex.cpp Modified: llvm/trunk/lib/Support/Mutex.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Mutex.cpp?rev=125804&r1=125803&r2=125804&view=diff ============================================================================== --- llvm/trunk/lib/Support/Mutex.cpp (original) +++ llvm/trunk/lib/Support/Mutex.cpp Thu Feb 17 18:47:07 2011 @@ -78,6 +78,7 @@ #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) // Make it a process local mutex errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); + assert(errorcode == 0); #endif // Initialize the mutex From joerg at bec.de Thu Feb 17 18:48:12 2011 From: joerg at bec.de (Joerg Sonnenberger) Date: Fri, 18 Feb 2011 00:48:12 -0000 Subject: [llvm-commits] [llvm] r125805 - in /llvm/trunk: lib/Target/X86/X86InstrSSE.td test/MC/X86/x86-32.s test/MC/X86/x86-64.s Message-ID: <20110218004812.2230E2A6C12C@llvm.org> Author: joerg Date: Thu Feb 17 18:48:11 2011 New Revision: 125805 URL: http://llvm.org/viewvc/llvm-project?rev=125805&view=rev Log: Recognize monitor/mwait with explicit register arguments Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/MC/X86/x86-32.s llvm/trunk/test/MC/X86/x86-64.s Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=125805&r1=125804&r2=125805&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Feb 17 18:48:11 2011 @@ -3673,6 +3673,14 @@ def MWAITrr : I<0x01, MRM_C9, (outs), (ins), "mwait", []>, TB, Requires<[HasSSE3]>; +def : InstAlias<"mwait %eax, %ecx", (MWAITrr)>, Requires<[In32BitMode]>; +def : InstAlias<"mwait %rax, %rcx", (MWAITrr)>, Requires<[In64BitMode]>; + +def : InstAlias<"monitor %eax, %ecx, %edx", (MONITORrrr)>, + Requires<[In32BitMode]>; +def : InstAlias<"monitor %rax, %rcx, %rdx", (MONITORrrr)>, + Requires<[In64BitMode]>; + //===---------------------------------------------------------------------===// // Non-Instruction Patterns //===---------------------------------------------------------------------===// Modified: llvm/trunk/test/MC/X86/x86-32.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-32.s?rev=125805&r1=125804&r2=125805&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-32.s (original) +++ llvm/trunk/test/MC/X86/x86-32.s Thu Feb 17 18:48:11 2011 @@ -15,9 +15,15 @@ monitor // CHECK: monitor // CHECK: encoding: [0x0f,0x01,0xc8] + monitor %eax, %ecx, %edx +// CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] mwait // CHECK: mwait // CHECK: encoding: [0x0f,0x01,0xc9] + mwait %eax, %ecx +// CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] vmcall // CHECK: vmcall Modified: llvm/trunk/test/MC/X86/x86-64.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86-64.s?rev=125805&r1=125804&r2=125805&view=diff ============================================================================== --- llvm/trunk/test/MC/X86/x86-64.s (original) +++ llvm/trunk/test/MC/X86/x86-64.s Thu Feb 17 18:48:11 2011 @@ -2,6 +2,18 @@ // RUN: FileCheck < %t %s // RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s + monitor +// CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] + monitor %rax, %rcx, %rdx +// CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] + mwait +// CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] + mwait %rax, %rcx +// CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] // Suffix inference: From dmalyshev at accesssoftek.com Thu Feb 17 19:06:06 2011 From: dmalyshev at accesssoftek.com (Danil Malyshev) Date: Thu, 17 Feb 2011 17:06:06 -0800 Subject: [llvm-commits] Fix LLVM tools filename extensions in regress tests for Windows Message-ID: <6AE1604EE3EC5F4296C096518C6B77EE17DD290816@mail.accesssoftek.com> Hello All Some tests on Windows use the "not" utility and fail with an error "program not executable". The reason for this error is that the name of the executable file sended to the "not" without the extension. Attached patch fixes this problem - for each an llvm tool added the file extension. This is a Windows-specific patch and it does not affect any other platform. Tested in the MinGW. The patch fixes the following tests: LLVM :: Assembler/2002-07-25-ParserAssertionFailure.ll LLVM :: Assembler/2003-04-15-ConstantInitAssertion.ll LLVM :: Assembler/2003-05-21-MalformedShiftCrash.ll LLVM :: Assembler/2003-05-21-MalformedStructCrash.ll LLVM :: Assembler/2003-11-11-ImplicitRename.ll LLVM :: Assembler/2003-11-24-SymbolTableCrash.ll LLVM :: Assembler/2003-12-30-TypeMapInvalidMemory.ll LLVM :: Assembler/2004-03-30-UnclosedFunctionCrash.ll LLVM :: Assembler/2004-11-28-InvalidTypeCrash.ll LLVM :: Assembler/2006-09-28-CrashOnInvalid.ll LLVM :: Assembler/2007-01-02-Undefined-Arg-Type.ll LLVM :: Assembler/2007-01-16-CrashOnBadCast.ll LLVM :: Assembler/2007-01-16-CrashOnBadCast2.ll LLVM :: Assembler/2007-03-18-InvalidNumberedVar.ll LLVM :: Assembler/2007-08-06-AliasInvalid.ll LLVM :: Assembler/2007-11-26-AttributeOverload.ll LLVM :: Assembler/2008-02-18-IntPointerCrash.ll LLVM :: Assembler/2008-09-02-FunctionNotes2.ll LLVM :: Assembler/align-inst-alloca.ll LLVM :: Assembler/align-inst-load.ll LLVM :: Assembler/align-inst-store.ll LLVM :: Assembler/extractvalue-invalid-idx.ll LLVM :: Assembler/getelementptr_struct.ll LLVM :: Assembler/insertvalue-invalid-idx.ll LLVM :: Bitcode/null-type.ll LLVM :: CodeGen/X86/GC/badreadproto.ll LLVM :: CodeGen/X86/GC/badrootproto.ll LLVM :: CodeGen/X86/GC/badwriteproto.ll LLVM :: CodeGen/X86/GC/fat.ll LLVM :: CodeGen/X86/GC/outside.ll LLVM :: CodeGen/X86/label-redefinition.ll LLVM :: CodeGen/X86/nosse-error1.ll LLVM :: CodeGen/X86/nosse-error2.ll LLVM :: Feature/globalredefinition3.ll LLVM :: Linker/link-messages.ll LLVM :: Linker/redefinition.ll LLVM :: MC/AsmParser/dash-n.s LLVM :: MC/AsmParser/directive_abort.s LLVM :: MC/AsmParser/equ.s LLVM :: MC/AsmParser/expr_symbol_modifiers.s LLVM :: MC/AsmParser/macros-parsing.s LLVM :: MC/AsmParser/paren.s LLVM :: MC/AsmParser/variables-invalid.s LLVM :: MC/ELF/bad-section.s LLVM :: MC/ELF/diff2.s LLVM :: MC/ELF/invalid-symver.s LLVM :: MC/X86/x86_errors.s LLVM :: Other/2009-09-14-function-elements.ll LLVM :: Other/invalid-commandline-option.ll LLVM :: TableGen/BitsInitOverflow.td LLVM :: TableGen/UnterminatedComment.td LLVM :: Verifier/2002-04-13-RetTypes.ll LLVM :: Verifier/2002-11-05-GetelementptrPointers.ll LLVM :: Verifier/2004-05-21-SwitchConstantMismatch.ll LLVM :: Verifier/2005-03-21-UndefinedTypeReference.ll LLVM :: Verifier/2006-10-15-AddrLabel.ll LLVM :: Verifier/2006-12-12-IntrinsicDefine.ll LLVM :: Verifier/2007-12-21-InvokeParamAttrs.ll LLVM :: Verifier/2008-01-11-VarargAttrs.ll LLVM :: Verifier/2008-03-01-AllocaSized.ll LLVM :: Verifier/2008-08-22-MemCpyAlignment.ll LLVM :: Verifier/2008-11-15-RetVoid.ll LLVM :: Verifier/2009-05-29-InvokeResult1.ll LLVM :: Verifier/2009-05-29-InvokeResult2.ll LLVM :: Verifier/2009-05-29-InvokeResult3.ll LLVM :: Verifier/2010-08-07-PointerIntrinsic.ll LLVM :: Verifier/AmbiguousPhi.ll LLVM :: Verifier/PhiGrouping.ll LLVM :: Verifier/SelfReferential.ll LLVM :: Verifier/aliasing-chain.ll LLVM :: Verifier/byval-1.ll LLVM :: Verifier/byval-2.ll LLVM :: Verifier/gcread-ptrptr.ll LLVM :: Verifier/gcroot-alloca.ll LLVM :: Verifier/gcroot-meta.ll LLVM :: Verifier/gcroot-ptrptr.ll LLVM :: Verifier/gcwrite-ptrptr.ll LLVM :: Verifier/invoke-1.ll LLVM :: Verifier/invoke-2.ll Thank you, Danil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/32507d87/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: fix-exp-01.patch Type: application/octet-stream Size: 1073 bytes Desc: fix-exp-01.patch Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/32507d87/attachment-0001.obj From pwalton at mozilla.com Thu Feb 17 19:51:29 2011 From: pwalton at mozilla.com (Patrick Walton) Date: Thu, 17 Feb 2011 17:51:29 -0800 Subject: [llvm-commits] [PATCH] Expose Type::getName() to the C bindings Message-ID: <4D5DD0A1.7030800@mozilla.com> Hi everyone, Currently, the LLVM C bindings allow names for types to be registered. However, a consumer can't get those names back out again. This patch adds an API for it. Thanks, Patrick -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: pcwalton-type-names.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/a0a924d8/attachment.pl From peter at pcc.me.uk Thu Feb 17 20:59:21 2011 From: peter at pcc.me.uk (Peter Collingbourne) Date: Fri, 18 Feb 2011 02:59:21 -0000 Subject: [llvm-commits] [llvm] r125824 - /llvm/trunk/tools/opt/opt.cpp Message-ID: <20110218025921.5F5DC2A6C12C@llvm.org> Author: pcc Date: Thu Feb 17 20:59:21 2011 New Revision: 125824 URL: http://llvm.org/viewvc/llvm-project?rev=125824&view=rev Log: Make -disable-simplify-libcalls work with -std-compile-opts Modified: llvm/trunk/tools/opt/opt.cpp Modified: llvm/trunk/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=125824&r1=125823&r2=125824&view=diff ============================================================================== --- llvm/trunk/tools/opt/opt.cpp (original) +++ llvm/trunk/tools/opt/opt.cpp Thu Feb 17 20:59:21 2011 @@ -427,7 +427,7 @@ /*OptimizeSize=*/ false, /*UnitAtATime=*/ true, /*UnrollLoops=*/ true, - /*SimplifyLibCalls=*/ true, + !DisableSimplifyLibCalls, /*HaveExceptions=*/ true, InliningPass); } From resistor at mac.com Thu Feb 17 22:21:03 2011 From: resistor at mac.com (Owen Anderson) Date: Thu, 17 Feb 2011 20:21:03 -0800 Subject: [llvm-commits] [llvm] r115927 - in /llvm/trunk: include/llvm-c/Core.h include/llvm/InitializePasses.h lib/Transforms/Scalar/Scalar.cpp lib/Transforms/Utils/CMakeLists.txt lib/Transforms/Utils/Utils.cpp lib/VMCore/Core.cpp In-Reply-To: <8ABF54E8-A00D-4046-BAEB-99C22BB8849A@apple.com> References: <20101007175547.E941F2A6C12E@llvm.org> <9638033B-44C4-4936-A2C8-A88090FCD719@apple.com> <77D9A52D-0465-4752-A69C-1A7E030D1083@mac.com> <8ABF54E8-A00D-4046-BAEB-99C22BB8849A@apple.com> Message-ID: <85674857-3E92-4CE6-A3AE-5AD1EE9B4340@mac.com> On Jan 17, 2011, at 9:33 AM, Chris Lattner wrote: > > On Jan 16, 2011, at 12:51 AM, Owen Anderson wrote: >> That is still the case. There's two kinds of clients that we care about: >> >> 1) clang and similar clients, which know upfront which set of passes they care about. Their passes are explicitly initialized when they call createFooPass(). Since they never call the global initializeScalarOpts(), they don't link in Scalar.cpp, instead only linking in those passes for which they call createFooPass(). >> >> 2) opt and kin, which need to link/initialize all passes available, so that they can be available from the command line. These clients do call initializeScalarOpts(), thus forcing linkage of all the passes as desired. > > Ok, how about following the existing pattern of putting this in a header file instead of a .cpp file? With this header, is "LinkAllPasses" needed? Can we remove LinkAllPasses and just use "InitializeAllPasses" instead? We can do that, if you want, but we'll still want to have separate headers for LinkAllPasses() vs. LinkAllCodeGen(), etc., so that opt doesn't have to link in all of CodeGen, and vice-versa for llc. --Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/534146de/attachment.html From sabre at nondot.org Thu Feb 17 22:25:21 2011 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Feb 2011 04:25:21 -0000 Subject: [llvm-commits] [llvm] r125827 - /llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Message-ID: <20110218042521.2EA5F2A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 22:25:21 2011 New Revision: 125827 URL: http://llvm.org/viewvc/llvm-project?rev=125827&view=rev Log: Don't unroll loops whose header block's address is taken. This is part of a futile attempt to not "break" bizzaro code like this: l1: printf("l1: %p\n", &&l1); ++x; if( x < 3 ) goto l1; Previously we'd fold &&l1 to 1, which is fine per our semantics but not helpful to the user. Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=125827&r1=125826&r2=125827&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Thu Feb 17 22:25:21 2011 @@ -96,7 +96,7 @@ } /// Unroll the given loop by Count. The loop must be in LCSSA form. Returns true -/// if unrolling was succesful, or false if the loop was unmodified. Unrolling +/// if unrolling was successful, or false if the loop was unmodified. Unrolling /// can only fail when the loop's latch block is not terminated by a conditional /// branch instruction. However, if the trip count (and multiple) are not known, /// loop unrolling will mostly produce more code that is no faster. @@ -105,7 +105,8 @@ /// /// If a LoopPassManager is passed in, and the loop is fully removed, it will be /// removed from the LoopPassManager as well. LPM can also be NULL. -bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) { +bool llvm::UnrollLoop(Loop *L, unsigned Count, + LoopInfo *LI, LPPassManager *LPM) { BasicBlock *Preheader = L->getLoopPreheader(); if (!Preheader) { DEBUG(dbgs() << " Can't unroll; loop preheader-insertion failed.\n"); @@ -127,6 +128,13 @@ " Can't unroll; loop not terminated by a conditional branch.\n"); return false; } + + if (Header->hasAddressTaken()) { + // The loop-rotate pass can be helpful to avoid this in many cases. + DEBUG(dbgs() << + " Won't unroll loop: address of header block is taken.\n"); + return false; + } // Notify ScalarEvolution that the loop will be substantially changed, // if not outright eliminated. From sabre at nondot.org Thu Feb 17 22:41:42 2011 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Feb 2011 04:41:42 -0000 Subject: [llvm-commits] [llvm] r125828 - in /llvm/trunk: include/llvm/Constant.h include/llvm/GlobalValue.h lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp Message-ID: <20110218044142.EBCF52A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 22:41:42 2011 New Revision: 125828 URL: http://llvm.org/viewvc/llvm-project?rev=125828&view=rev Log: hoist GlobalValue::removeDeadConstantUsers up to being a method on Constant. Modified: llvm/trunk/include/llvm/Constant.h llvm/trunk/include/llvm/GlobalValue.h llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Globals.cpp Modified: llvm/trunk/include/llvm/Constant.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=125828&r1=125827&r2=125828&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constant.h (original) +++ llvm/trunk/include/llvm/Constant.h Thu Feb 17 22:41:42 2011 @@ -141,16 +141,22 @@ assert(0 && "Constants that do not have operands cannot be using 'From'!"); } - static Constant* getNullValue(const Type* Ty); + static Constant *getNullValue(const Type* Ty); /// @returns the value for an integer constant of the given type that has all /// its bits set to true. /// @brief Get the all ones value - static Constant* getAllOnesValue(const Type* Ty); + static Constant *getAllOnesValue(const Type* Ty); /// getIntegerValue - Return the value for an integer or pointer constant, /// or a vector thereof, with the given scalar value. - static Constant* getIntegerValue(const Type* Ty, const APInt &V); + static Constant *getIntegerValue(const Type* Ty, const APInt &V); + + /// removeDeadConstantUsers - If there are any dead constant users dangling + /// off of this constant, remove them. This method is useful for clients + /// that want to check to see if a global is unused, but don't want to deal + /// with potentially dead constants hanging off of the globals. + void removeDeadConstantUsers() const; }; } // End llvm namespace Modified: llvm/trunk/include/llvm/GlobalValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=125828&r1=125827&r2=125828&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalValue.h (original) +++ llvm/trunk/include/llvm/GlobalValue.h Thu Feb 17 22:41:42 2011 @@ -282,12 +282,6 @@ inline Module *getParent() { return Parent; } inline const Module *getParent() const { return Parent; } - /// removeDeadConstantUsers - If there are any dead constant users dangling - /// off of this global value, remove them. This method is useful for clients - /// that want to check to see if a global is unused, but don't want to deal - /// with potentially dead constants hanging off of the globals. - void removeDeadConstantUsers() const; - // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GlobalValue *) { return true; } static inline bool classof(const Value *V) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=125828&r1=125827&r2=125828&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Thu Feb 17 22:41:42 2011 @@ -262,6 +262,59 @@ } +/// removeDeadUsersOfConstant - If the specified constantexpr is dead, remove +/// it. This involves recursively eliminating any dead users of the +/// constantexpr. +static bool removeDeadUsersOfConstant(const Constant *C) { + if (isa(C)) return false; // Cannot remove this + + while (!C->use_empty()) { + const Constant *User = dyn_cast(C->use_back()); + if (!User) return false; // Non-constant usage; + if (!removeDeadUsersOfConstant(User)) + return false; // Constant wasn't dead + } + + const_cast(C)->destroyConstant(); + return true; +} + + +/// removeDeadConstantUsers - If there are any dead constant users dangling +/// off of this constant, remove them. This method is useful for clients +/// that want to check to see if a global is unused, but don't want to deal +/// with potentially dead constants hanging off of the globals. +void Constant::removeDeadConstantUsers() const { + Value::const_use_iterator I = use_begin(), E = use_end(); + Value::const_use_iterator LastNonDeadUser = E; + while (I != E) { + const Constant *User = dyn_cast(*I); + if (User == 0) { + LastNonDeadUser = I; + ++I; + continue; + } + + if (!removeDeadUsersOfConstant(User)) { + // If the constant wasn't dead, remember that this was the last live use + // and move on to the next constant. + LastNonDeadUser = I; + ++I; + continue; + } + + // If the constant was dead, then the iterator is invalidated. + if (LastNonDeadUser == E) { + I = use_begin(); + if (I == E) break; + } else { + I = LastNonDeadUser; + ++I; + } + } +} + + //===----------------------------------------------------------------------===// // ConstantInt Modified: llvm/trunk/lib/VMCore/Globals.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=125828&r1=125827&r2=125828&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Globals.cpp (original) +++ llvm/trunk/lib/VMCore/Globals.cpp Thu Feb 17 22:41:42 2011 @@ -26,23 +26,6 @@ // GlobalValue Class //===----------------------------------------------------------------------===// -/// removeDeadUsersOfConstant - If the specified constantexpr is dead, remove -/// it. This involves recursively eliminating any dead users of the -/// constantexpr. -static bool removeDeadUsersOfConstant(const Constant *C) { - if (isa(C)) return false; // Cannot remove this - - while (!C->use_empty()) { - const Constant *User = dyn_cast(C->use_back()); - if (!User) return false; // Non-constant usage; - if (!removeDeadUsersOfConstant(User)) - return false; // Constant wasn't dead - } - - const_cast(C)->destroyConstant(); - return true; -} - bool GlobalValue::isMaterializable() const { return getParent() && getParent()->isMaterializable(this); } @@ -56,38 +39,6 @@ getParent()->Dematerialize(this); } -/// removeDeadConstantUsers - If there are any dead constant users dangling -/// off of this global value, remove them. This method is useful for clients -/// that want to check to see if a global is unused, but don't want to deal -/// with potentially dead constants hanging off of the globals. -void GlobalValue::removeDeadConstantUsers() const { - Value::const_use_iterator I = use_begin(), E = use_end(); - Value::const_use_iterator LastNonDeadUser = E; - while (I != E) { - if (const Constant *User = dyn_cast(*I)) { - if (!removeDeadUsersOfConstant(User)) { - // If the constant wasn't dead, remember that this was the last live use - // and move on to the next constant. - LastNonDeadUser = I; - ++I; - } else { - // If the constant was dead, then the iterator is invalidated. - if (LastNonDeadUser == E) { - I = use_begin(); - if (I == E) break; - } else { - I = LastNonDeadUser; - ++I; - } - } - } else { - LastNonDeadUser = I; - ++I; - } - } -} - - /// Override destroyConstant to make sure it doesn't get called on /// GlobalValue's because they shouldn't be treated like other constants. void GlobalValue::destroyConstant() { From sabre at nondot.org Thu Feb 17 22:43:07 2011 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Feb 2011 04:43:07 -0000 Subject: [llvm-commits] [llvm] r125829 - in /llvm/trunk: lib/Transforms/Scalar/JumpThreading.cpp test/Transforms/JumpThreading/indirectbr.ll Message-ID: <20110218044307.111EB2A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 22:43:06 2011 New Revision: 125829 URL: http://llvm.org/viewvc/llvm-project?rev=125829&view=rev Log: prevent jump threading from merging blocks when their address is taken (and used!). This prevents merging the blocks (invalidating the block addresses) in a case like this: #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) void foo() { printf("%p\n", _THIS_IP_); printf("%p\n", _THIS_IP_); printf("%p\n", _THIS_IP_); } which fixes PR4151. Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp llvm/trunk/test/Transforms/JumpThreading/indirectbr.ll Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=125829&r1=125828&r2=125829&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Thu Feb 17 22:43:06 2011 @@ -606,6 +606,16 @@ return MinSucc; } +static bool hasAddressTakenAndUsed(BasicBlock *BB) { + if (!BB->hasAddressTaken()) return false; + + // If the block has its address taken, it may be a tree of dead constants + // hanging off of it. These shouldn't keep the block alive. + BlockAddress *BA = BlockAddress::get(BB); + BA->removeDeadConstantUsers(); + return !BA->use_empty(); +} + /// ProcessBlock - If there are any predecessors whose control can be threaded /// through to a successor, transform them now. bool JumpThreading::ProcessBlock(BasicBlock *BB) { @@ -621,7 +631,7 @@ // predecessors of our predecessor block. if (BasicBlock *SinglePred = BB->getSinglePredecessor()) { if (SinglePred->getTerminator()->getNumSuccessors() == 1 && - SinglePred != BB) { + SinglePred != BB && !hasAddressTakenAndUsed(BB)) { // If SinglePred was a loop header, BB becomes one. if (LoopHeaders.erase(SinglePred)) LoopHeaders.insert(BB); Modified: llvm/trunk/test/Transforms/JumpThreading/indirectbr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/indirectbr.ll?rev=125829&r1=125828&r2=125829&view=diff ============================================================================== --- llvm/trunk/test/Transforms/JumpThreading/indirectbr.ll (original) +++ llvm/trunk/test/Transforms/JumpThreading/indirectbr.ll Thu Feb 17 22:43:06 2011 @@ -44,7 +44,9 @@ ; Check constant folding of indirectbr ; CHECK: void @test2 -; CHECK-NEXT: : +; CHECK: entry: +; CHECK-NEXT: br label %L1 +; CHECK: L1: ; CHECK-NEXT: call void @bar ; CHECK-NEXT: ret void define void @test2() nounwind { @@ -59,3 +61,34 @@ call void @baz() ret void } + + +; PR4151 +; Don't merge address-taken blocks. + at .str = private unnamed_addr constant [4 x i8] c"%p\0A\00" + +; CHECK: @test3 +; CHECK: __here: +; CHECK: blockaddress(@test3, %__here) +; CHECK: __here1: +; CHECK: blockaddress(@test3, %__here1) +; CHECK: __here3: +; CHECK: blockaddress(@test3, %__here3) +define void @test3() nounwind ssp noredzone { +entry: + br label %__here + +__here: ; preds = %entry + %call = call i32 (...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i64 ptrtoint (i8* blockaddress(@test3, %__here) to i64)) nounwind noredzone + br label %__here1 + +__here1: ; preds = %__here + %call2 = call i32 (...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i64 ptrtoint (i8* blockaddress(@test3, %__here1) to i64)) nounwind noredzone + br label %__here3 + +__here3: ; preds = %__here1 + %call4 = call i32 (...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i64 ptrtoint (i8* blockaddress(@test3, %__here3) to i64)) nounwind noredzone + ret void +} + +declare i32 @printf(...) noredzone From zwarich at apple.com Thu Feb 17 22:58:10 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Fri, 18 Feb 2011 04:58:10 -0000 Subject: [llvm-commits] [llvm] r125830 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SDNodeDbgValue.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/dbg-value-inlined-parameter.ll Message-ID: <20110218045810.747542A6C12C@llvm.org> Author: zwarich Date: Thu Feb 17 22:58:10 2011 New Revision: 125830 URL: http://llvm.org/viewvc/llvm-project?rev=125830&view=rev Log: Roll out r125794 to help diagnose the llvm-gcc-i386-linux-selfhost failure. Removed: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=125830&r1=125829&r2=125830&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Feb 17 22:58:10 2011 @@ -100,6 +100,10 @@ return DbgValMap[Node]; } + void removeSDDbgValues(const SDNode *Node) { + DbgValMap.erase(Node); + } + typedef SmallVector::iterator DbgIterator; DbgIterator DbgBegin() { return DbgValues.begin(); } DbgIterator DbgEnd() { return DbgValues.end(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=125830&r1=125829&r2=125830&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 17 22:58:10 2011 @@ -87,9 +87,6 @@ // If someone requests legalization of the new node, return itself. if (From != To) LegalizedNodes.insert(std::make_pair(To, To)); - - // Transfer SDDbgValues. - DAG.TransferDbgValues(From, To); } public: Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h?rev=125830&r1=125829&r2=125830&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h Thu Feb 17 22:58:10 2011 @@ -83,6 +83,14 @@ // Returns the SDNode* for a register ref SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; } + // setSDNode - If underlying SDNode is replaced by another node then + // SelectionDAG can use this to transfer DbgValue. + void setSDNode(SDNode *N, unsigned R) { + assert (kind==SDNODE); + u.s.Node = N; + u.s.ResNo = R; + } + // Returns the ResNo for a register ref unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125830&r1=125829&r2=125830&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 17 22:58:10 2011 @@ -5508,14 +5508,12 @@ SDNode *FromNode = From.getNode(); SDNode *ToNode = To.getNode(); SmallVector &DVs = GetDbgValues(FromNode); + DbgInfo->removeSDDbgValues(FromNode); for (SmallVector::iterator I = DVs.begin(), E = DVs.end(); I != E; ++I) { - SDDbgValue *Dbg = *I; - if (Dbg->getKind() == SDDbgValue::SDNODE) { - SDDbgValue *Clone = getDbgValue(Dbg->getMDPtr(), ToNode, To.getResNo(), - Dbg->getOffset(), Dbg->getDebugLoc(), - Dbg->getOrder()); - AddDbgValue(Clone, ToNode, false); + if ((*I)->getKind() == SDDbgValue::SDNODE) { + AddDbgValue(*I, ToNode, false); + (*I)->setSDNode(ToNode, To.getResNo()); } } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125830&r1=125829&r2=125830&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 17 22:58:10 2011 @@ -4287,7 +4287,7 @@ N.getResNo(), Offset, dl, SDNodeOrder); DAG.AddDbgValue(SDV, N.getNode(), false); } - } else if (!V->use_empty() ) { + } else if (isa(V) && !V->use_empty() ) { // Do not call getValue(V) yet, as we don't want to generate code. // Remember it for later. DanglingDebugInfo DDI(&DI, dl, SDNodeOrder); Removed: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll?rev=125829&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll (original) +++ llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll (removed) @@ -1,86 +0,0 @@ -; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s - -;CHECK: DW_TAG_inlined_subroutine -;CHECK-NEXT: DW_AT_abstract_origin -;CHECK-NEXT: DW_AT_low_pc -;CHECK-NEXT: DW_AT_high_pc -;CHECK-NEXT: DW_AT_call_file -;CHECK-NEXT: DW_AT_call_line -;CHECK-NEXT: DW_TAG_formal_parameter -;CHECK-NEXT: .ascii "sp" ## DW_AT_name - -%struct.S1 = type { float*, i32 } - - at p = common global %struct.S1 zeroinitializer, align 8 - -define i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp { -entry: - tail call void @llvm.dbg.value(metadata !{%struct.S1* %sp}, i64 0, metadata !9), !dbg !20 - tail call void @llvm.dbg.value(metadata !{i32 %nums}, i64 0, metadata !18), !dbg !21 - %tmp2 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 1, !dbg !22 - store i32 %nums, i32* %tmp2, align 4, !dbg !22, !tbaa !24 - %call = tail call float* @bar(i32 %nums) nounwind optsize, !dbg !27 - %tmp5 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 0, !dbg !27 - store float* %call, float** %tmp5, align 8, !dbg !27, !tbaa !28 - %cmp = icmp ne float* %call, null, !dbg !29 - %cond = zext i1 %cmp to i32, !dbg !29 - ret i32 %cond, !dbg !29 -} - -declare float* @bar(i32) optsize - -define void @foobar() nounwind optsize ssp { -entry: - tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !9) nounwind, !dbg !31 - tail call void @llvm.dbg.value(metadata !34, i64 0, metadata !18) nounwind, !dbg !35 - store i32 1, i32* getelementptr inbounds (%struct.S1* @p, i64 0, i32 1), align 8, !dbg !36, !tbaa !24 - %call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37 - store float* %call.i, float** getelementptr inbounds (%struct.S1* @p, i64 0, i32 0), align 8, !dbg !37, !tbaa !28 - ret void, !dbg !38 -} - -declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone - -!llvm.dbg.sp = !{!0, !6} -!llvm.dbg.lv.foo = !{!9, !18} -!llvm.dbg.gv = !{!19} - -!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (%struct.S1*, i32)* @foo} ; [ DW_TAG_subprogram ] -!1 = metadata !{i32 589865, metadata !"nm2.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] -!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"nm2.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 125693)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] -!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] -!4 = metadata !{metadata !5} -!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] -!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"", metadata !1, i32 15, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foobar} ; [ DW_TAG_subprogram ] -!7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] -!8 = metadata !{null} -!9 = metadata !{i32 590081, metadata !0, metadata !"sp", metadata !1, i32 7, metadata !10, i32 0} ; [ DW_TAG_arg_variable ] -!10 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] -!11 = metadata !{i32 589846, metadata !2, metadata !"S1", metadata !1, i32 4, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ] -!12 = metadata !{i32 589843, metadata !2, metadata !"S1", metadata !1, i32 1, i64 128, i64 64, i32 0, i32 0, i32 0, metadata !13, i32 0, i32 0} ; [ DW_TAG_structure_type ] -!13 = metadata !{metadata !14, metadata !17} -!14 = metadata !{i32 589837, metadata !1, metadata !"m", metadata !1, i32 2, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_member ] -!15 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] -!16 = metadata !{i32 589860, metadata !2, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] -!17 = metadata !{i32 589837, metadata !1, metadata !"nums", metadata !1, i32 3, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ] -!18 = metadata !{i32 590081, metadata !0, metadata !"nums", metadata !1, i32 7, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] -!19 = metadata !{i32 589876, i32 0, metadata !2, metadata !"p", metadata !"p", metadata !"", metadata !1, i32 14, metadata !11, i32 0, i32 1, %struct.S1* @p} ; [ DW_TAG_variable ] -!20 = metadata !{i32 7, i32 13, metadata !0, null} -!21 = metadata !{i32 7, i32 21, metadata !0, null} -!22 = metadata !{i32 9, i32 3, metadata !23, null} -!23 = metadata !{i32 589835, metadata !0, i32 8, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] -!24 = metadata !{metadata !"int", metadata !25} -!25 = metadata !{metadata !"omnipotent char", metadata !26} -!26 = metadata !{metadata !"Simple C/C++ TBAA", null} -!27 = metadata !{i32 10, i32 3, metadata !23, null} -!28 = metadata !{metadata !"any pointer", metadata !25} -!29 = metadata !{i32 11, i32 3, metadata !23, null} -!30 = metadata !{%struct.S1* @p} -!31 = metadata !{i32 7, i32 13, metadata !0, metadata !32} -!32 = metadata !{i32 16, i32 3, metadata !33, null} -!33 = metadata !{i32 589835, metadata !6, i32 15, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] -!34 = metadata !{i32 1} -!35 = metadata !{i32 7, i32 21, metadata !0, metadata !32} -!36 = metadata !{i32 9, i32 3, metadata !23, metadata !32} -!37 = metadata !{i32 10, i32 3, metadata !23, metadata !32} -!38 = metadata !{i32 17, i32 1, metadata !33, null} From zwarich at apple.com Thu Feb 17 23:02:06 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 17 Feb 2011 21:02:06 -0800 Subject: [llvm-commits] [llvm] r125794 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SDNodeDbgValue.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/dbg-value-inlined-parameter.ll In-Reply-To: <20110217233327.D53A82A6C12C@llvm.org> References: <20110217233327.D53A82A6C12C@llvm.org> Message-ID: <38F35C11-B253-4EBC-9A91-4B912F5FED02@apple.com> I'm going to roll this out to help diagnose the failure on the llvm-gcc-i386-linux-selfhost bot. It is the only significant change in the blamed revision range. Sorry about that! Cameron On Feb 17, 2011, at 3:33 PM, Devang Patel wrote: > Author: dpatel > Date: Thu Feb 17 17:33:27 2011 > New Revision: 125794 > > URL: http://llvm.org/viewvc/llvm-project?rev=125794&view=rev > Log: > Do not lose debug info of an inlined function argument even if the argument is only used through GEPs. > > Added: > llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll > Modified: > llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=125794&r1=125793&r2=125794&view=diff > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Feb 17 17:33:27 2011 > @@ -100,10 +100,6 @@ > return DbgValMap[Node]; > } > > - void removeSDDbgValues(const SDNode *Node) { > - DbgValMap.erase(Node); > - } > - > typedef SmallVector::iterator DbgIterator; > DbgIterator DbgBegin() { return DbgValues.begin(); } > DbgIterator DbgEnd() { return DbgValues.end(); } > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 17 17:33:27 2011 > @@ -87,6 +87,9 @@ > // If someone requests legalization of the new node, return itself. > if (From != To) > LegalizedNodes.insert(std::make_pair(To, To)); > + > + // Transfer SDDbgValues. > + DAG.TransferDbgValues(From, To); > } > > public: > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h?rev=125794&r1=125793&r2=125794&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h Thu Feb 17 17:33:27 2011 > @@ -83,14 +83,6 @@ > // Returns the SDNode* for a register ref > SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; } > > - // setSDNode - If underlying SDNode is replaced by another node then > - // SelectionDAG can use this to transfer DbgValue. > - void setSDNode(SDNode *N, unsigned R) { > - assert (kind==SDNODE); > - u.s.Node = N; > - u.s.ResNo = R; > - } > - > // Returns the ResNo for a register ref > unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; } > > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 17 17:33:27 2011 > @@ -5508,12 +5508,14 @@ > SDNode *FromNode = From.getNode(); > SDNode *ToNode = To.getNode(); > SmallVector &DVs = GetDbgValues(FromNode); > - DbgInfo->removeSDDbgValues(FromNode); > for (SmallVector::iterator I = DVs.begin(), E = DVs.end(); > I != E; ++I) { > - if ((*I)->getKind() == SDDbgValue::SDNODE) { > - AddDbgValue(*I, ToNode, false); > - (*I)->setSDNode(ToNode, To.getResNo()); > + SDDbgValue *Dbg = *I; > + if (Dbg->getKind() == SDDbgValue::SDNODE) { > + SDDbgValue *Clone = getDbgValue(Dbg->getMDPtr(), ToNode, To.getResNo(), > + Dbg->getOffset(), Dbg->getDebugLoc(), > + Dbg->getOrder()); > + AddDbgValue(Clone, ToNode, false); > } > } > } > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125794&r1=125793&r2=125794&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 17 17:33:27 2011 > @@ -4287,7 +4287,7 @@ > N.getResNo(), Offset, dl, SDNodeOrder); > DAG.AddDbgValue(SDV, N.getNode(), false); > } > - } else if (isa(V) && !V->use_empty() ) { > + } else if (!V->use_empty() ) { > // Do not call getValue(V) yet, as we don't want to generate code. > // Remember it for later. > DanglingDebugInfo DDI(&DI, dl, SDNodeOrder); > > Added: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll?rev=125794&view=auto > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll (added) > +++ llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll Thu Feb 17 17:33:27 2011 > @@ -0,0 +1,86 @@ > +; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s > + > +;CHECK: DW_TAG_inlined_subroutine > +;CHECK-NEXT: DW_AT_abstract_origin > +;CHECK-NEXT: DW_AT_low_pc > +;CHECK-NEXT: DW_AT_high_pc > +;CHECK-NEXT: DW_AT_call_file > +;CHECK-NEXT: DW_AT_call_line > +;CHECK-NEXT: DW_TAG_formal_parameter > +;CHECK-NEXT: .ascii "sp" ## DW_AT_name > + > +%struct.S1 = type { float*, i32 } > + > + at p = common global %struct.S1 zeroinitializer, align 8 > + > +define i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp { > +entry: > + tail call void @llvm.dbg.value(metadata !{%struct.S1* %sp}, i64 0, metadata !9), !dbg !20 > + tail call void @llvm.dbg.value(metadata !{i32 %nums}, i64 0, metadata !18), !dbg !21 > + %tmp2 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 1, !dbg !22 > + store i32 %nums, i32* %tmp2, align 4, !dbg !22, !tbaa !24 > + %call = tail call float* @bar(i32 %nums) nounwind optsize, !dbg !27 > + %tmp5 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 0, !dbg !27 > + store float* %call, float** %tmp5, align 8, !dbg !27, !tbaa !28 > + %cmp = icmp ne float* %call, null, !dbg !29 > + %cond = zext i1 %cmp to i32, !dbg !29 > + ret i32 %cond, !dbg !29 > +} > + > +declare float* @bar(i32) optsize > + > +define void @foobar() nounwind optsize ssp { > +entry: > + tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !9) nounwind, !dbg !31 > + tail call void @llvm.dbg.value(metadata !34, i64 0, metadata !18) nounwind, !dbg !35 > + store i32 1, i32* getelementptr inbounds (%struct.S1* @p, i64 0, i32 1), align 8, !dbg !36, !tbaa !24 > + %call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37 > + store float* %call.i, float** getelementptr inbounds (%struct.S1* @p, i64 0, i32 0), align 8, !dbg !37, !tbaa !28 > + ret void, !dbg !38 > +} > + > +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone > + > +!llvm.dbg.sp = !{!0, !6} > +!llvm.dbg.lv.foo = !{!9, !18} > +!llvm.dbg.gv = !{!19} > + > +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (%struct.S1*, i32)* @foo} ; [ DW_TAG_subprogram ] > +!1 = metadata !{i32 589865, metadata !"nm2.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] > +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"nm2.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 125693)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] > +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] > +!4 = metadata !{metadata !5} > +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] > +!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"", metadata !1, i32 15, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foobar} ; [ DW_TAG_subprogram ] > +!7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] > +!8 = metadata !{null} > +!9 = metadata !{i32 590081, metadata !0, metadata !"sp", metadata !1, i32 7, metadata !10, i32 0} ; [ DW_TAG_arg_variable ] > +!10 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] > +!11 = metadata !{i32 589846, metadata !2, metadata !"S1", metadata !1, i32 4, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ] > +!12 = metadata !{i32 589843, metadata !2, metadata !"S1", metadata !1, i32 1, i64 128, i64 64, i32 0, i32 0, i32 0, metadata !13, i32 0, i32 0} ; [ DW_TAG_structure_type ] > +!13 = metadata !{metadata !14, metadata !17} > +!14 = metadata !{i32 589837, metadata !1, metadata !"m", metadata !1, i32 2, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_member ] > +!15 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] > +!16 = metadata !{i32 589860, metadata !2, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] > +!17 = metadata !{i32 589837, metadata !1, metadata !"nums", metadata !1, i32 3, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ] > +!18 = metadata !{i32 590081, metadata !0, metadata !"nums", metadata !1, i32 7, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] > +!19 = metadata !{i32 589876, i32 0, metadata !2, metadata !"p", metadata !"p", metadata !"", metadata !1, i32 14, metadata !11, i32 0, i32 1, %struct.S1* @p} ; [ DW_TAG_variable ] > +!20 = metadata !{i32 7, i32 13, metadata !0, null} > +!21 = metadata !{i32 7, i32 21, metadata !0, null} > +!22 = metadata !{i32 9, i32 3, metadata !23, null} > +!23 = metadata !{i32 589835, metadata !0, i32 8, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] > +!24 = metadata !{metadata !"int", metadata !25} > +!25 = metadata !{metadata !"omnipotent char", metadata !26} > +!26 = metadata !{metadata !"Simple C/C++ TBAA", null} > +!27 = metadata !{i32 10, i32 3, metadata !23, null} > +!28 = metadata !{metadata !"any pointer", metadata !25} > +!29 = metadata !{i32 11, i32 3, metadata !23, null} > +!30 = metadata !{%struct.S1* @p} > +!31 = metadata !{i32 7, i32 13, metadata !0, metadata !32} > +!32 = metadata !{i32 16, i32 3, metadata !33, null} > +!33 = metadata !{i32 589835, metadata !6, i32 15, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] > +!34 = metadata !{i32 1} > +!35 = metadata !{i32 7, i32 21, metadata !0, metadata !32} > +!36 = metadata !{i32 9, i32 3, metadata !23, metadata !32} > +!37 = metadata !{i32 10, i32 3, metadata !23, metadata !32} > +!38 = metadata !{i32 17, i32 1, metadata !33, null} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From geek4civic at gmail.com Thu Feb 17 23:02:45 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 14:02:45 +0900 Subject: [llvm-commits] [Review request][Win64] Use pushq/popq GPRs in function prologue/epilogue In-Reply-To: References: Message-ID: Ping. It would also resolve potential issue if other x86-64 targets had a new calling conversions to preserve XMMs. ...Takumi On Mon, Feb 7, 2011 at 8:49 PM, NAKAMURA Takumi wrote: > Anton, > > I attached an updated patch, refined and comments added, thank you. > It is at; https://github.com/chapuni/LLVM/commit/8da7419f8170e5a11063eb8e992ecb1ad40f9f6a > > > On the github, Anton wrote; >> View Commit: https://github.com/chapuni/LLVM/commit/d719f1b1ba5f01823e00904c1599adf356089a1d > >> This will pessimize non-win64 targets. Basically, the problem is that you cannot use pushq/popq for high xmm regs, which are callee-saved on win64-only (but not on linux / darwin, for example). > > I thought the patch does not affect to non-win64 targets, but it might > be dubious to check whether regs are GPR or not. > I rewrote checking expressions. > > I am sorry if I missed your point. > >> Another problem is function prologue emission. Have you verified that you always have proper stack frame? Even in case when high xmm regs (xmm5, etc.) are spilled? > > As far as spiller emits in order [pushq GPRs...] and [mov xmm to fp], > and restorer emits in order [mov xmm from fp] and [popq GPRs], > emitPrologue() and emitEpilogue() will emit adjusting %rsp onto proper place. > And I can expect spiller can place XMMs i128 aligned. > > ; for example > define void @foo() nounwind { > entry: > ?tail call void (...)* @bar() nounwind > ?tail call void asm sideeffect "nop", > "~{si},~{di},~{xmm13},~{xmm11},~{xmm15},~{dirflag},~{fpsr},~{flags}"() > nounwind > ?ret void > } > declare void @bar(...) > > #### -mtriple=x86_64-mingw32 > foo: > ? ? ? ?pushq ? %rsi > ? ? ? ?pushq ? %rdi > ? ? ? ?subq ? ?$88, %rsp > ? ? ? ?movaps ?%xmm15, 32(%rsp) ? ? ? ?# 16-byte Spill > ? ? ? ?movaps ?%xmm13, 48(%rsp) ? ? ? ?# 16-byte Spill > ? ? ? ?movaps ?%xmm11, 64(%rsp) ? ? ? ?# 16-byte Spill > ? ? ? ?callq ? bar > ? ? ? ?#APP > ? ? ? ?nop > ? ? ? ?#NO_APP > ? ? ? ?movaps ?64(%rsp), %xmm11 ? ? ? ?# 16-byte Reload > ? ? ? ?movaps ?48(%rsp), %xmm13 ? ? ? ?# 16-byte Reload > ? ? ? ?movaps ?32(%rsp), %xmm15 ? ? ? ?# 16-byte Reload > ? ? ? ?addq ? ?$88, %rsp > ? ? ? ?popq ? ?%rdi > ? ? ? ?popq ? ?%rsi > ? ? ? ?ret > > And also, I have checked to build clang by 3 stage. > (x64-clang can build and test clang and llvm) > > > ...Takumi > From geek4civic at gmail.com Thu Feb 17 23:07:38 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 14:07:38 +0900 Subject: [llvm-commits] [PATCH] fix complation on mingw32 In-Reply-To: <4CFCCAA7.1030808@netfarm.it> References: <4CFCCAA7.1030808@netfarm.it> Message-ID: Good afternoon Gianluigi, On Mon, Dec 6, 2010 at 8:36 PM, Gianluigi Tiesi wrote: > ::write() needs inclusion of io.h either on msvc and mingw > so the correct ifdef is _WIN32 It would also be possible, though, I guess shall supply write() on mingw. ...Takumi From sabre at nondot.org Thu Feb 17 23:05:01 2011 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Feb 2011 05:05:01 -0000 Subject: [llvm-commits] [llvm] r125831 - /llvm/trunk/test/Transforms/LoopUnroll/basic.ll Message-ID: <20110218050501.964862A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 23:05:01 2011 New Revision: 125831 URL: http://llvm.org/viewvc/llvm-project?rev=125831&view=rev Log: add a testcase for r125827 Added: llvm/trunk/test/Transforms/LoopUnroll/basic.ll Added: llvm/trunk/test/Transforms/LoopUnroll/basic.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/basic.ll?rev=125831&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopUnroll/basic.ll (added) +++ llvm/trunk/test/Transforms/LoopUnroll/basic.ll Thu Feb 17 23:05:01 2011 @@ -0,0 +1,24 @@ +; RUN: opt < %s -loop-unroll -S | FileCheck %s + + +; This should not unroll since the address of the loop header is taken. + +; CHECK: @test1 +; CHECK: store i8* blockaddress(@test1, %l1), i8** %P +; CHECK: l1: +; CHECK-NEXT: phi i32 +; rdar://8287027 +define i32 @test1(i8** %P) nounwind ssp { +entry: + store i8* blockaddress(@test1, %l1), i8** %P + br label %l1 + +l1: ; preds = %l1, %entry + %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ] + %inc = add nsw i32 %x.0, 1 + %exitcond = icmp eq i32 %inc, 3 + br i1 %exitcond, label %l2, label %l1 + +l2: ; preds = %l1 + ret i32 0 +} From sabre at nondot.org Thu Feb 17 23:35:49 2011 From: sabre at nondot.org (Chris Lattner) Date: Fri, 18 Feb 2011 05:35:49 -0000 Subject: [llvm-commits] [llvm] r125832 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <20110218053549.7F2852A6C12C@llvm.org> Author: lattner Date: Thu Feb 17 23:35:49 2011 New Revision: 125832 URL: http://llvm.org/viewvc/llvm-project?rev=125832&view=rev Log: add a poor division by constant case. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=125832&r1=125831&r2=125832&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Thu Feb 17 23:35:49 2011 @@ -1884,3 +1884,40 @@ ret //===---------------------------------------------------------------------===// + +This: +char t(char c) { + return c/3; +} + +Compiles to: $clang t.c -S -o - -O3 -mkernel -fomit-frame-pointer + +_t: ## @t + movslq %edi, %rax + imulq $-1431655765, %rax, %rcx ## imm = 0xFFFFFFFFAAAAAAAB + shrq $32, %rcx + addl %ecx, %eax + movl %eax, %ecx + shrl $31, %ecx + shrl %eax + addl %ecx, %eax + movsbl %al, %eax + ret + +GCC gets: + +_t: + movl $86, %eax + imulb %dil + shrw $8, %ax + sarb $7, %dil + subb %dil, %al + movsbl %al,%eax + ret + +which is nicer. This also happens for int, not just char. + +//===---------------------------------------------------------------------===// + + + From zwarich at apple.com Fri Feb 18 00:05:49 2011 From: zwarich at apple.com (Cameron Zwarich) Date: Thu, 17 Feb 2011 22:05:49 -0800 Subject: [llvm-commits] [llvm] r125794 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SDNodeDbgValue.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/dbg-value-inlined-parameter.ll In-Reply-To: <38F35C11-B253-4EBC-9A91-4B912F5FED02@apple.com> References: <20110217233327.D53A82A6C12C@llvm.org> <38F35C11-B253-4EBC-9A91-4B912F5FED02@apple.com> Message-ID: The build has made it further, so it looks like this was the problem. Cameron On Feb 17, 2011, at 9:02 PM, Cameron Zwarich wrote: > I'm going to roll this out to help diagnose the failure on the llvm-gcc-i386-linux-selfhost bot. It is the only significant change in the blamed revision range. Sorry about that! > > Cameron > > On Feb 17, 2011, at 3:33 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Thu Feb 17 17:33:27 2011 >> New Revision: 125794 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=125794&view=rev >> Log: >> Do not lose debug info of an inlined function argument even if the argument is only used through GEPs. >> >> Added: >> llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll >> Modified: >> llvm/trunk/include/llvm/CodeGen/SelectionDAG.h >> llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp >> llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h >> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> >> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Feb 17 17:33:27 2011 >> @@ -100,10 +100,6 @@ >> return DbgValMap[Node]; >> } >> >> - void removeSDDbgValues(const SDNode *Node) { >> - DbgValMap.erase(Node); >> - } >> - >> typedef SmallVector::iterator DbgIterator; >> DbgIterator DbgBegin() { return DbgValues.begin(); } >> DbgIterator DbgEnd() { return DbgValues.end(); } >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 17 17:33:27 2011 >> @@ -87,6 +87,9 @@ >> // If someone requests legalization of the new node, return itself. >> if (From != To) >> LegalizedNodes.insert(std::make_pair(To, To)); >> + >> + // Transfer SDDbgValues. >> + DAG.TransferDbgValues(From, To); >> } >> >> public: >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h Thu Feb 17 17:33:27 2011 >> @@ -83,14 +83,6 @@ >> // Returns the SDNode* for a register ref >> SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; } >> >> - // setSDNode - If underlying SDNode is replaced by another node then >> - // SelectionDAG can use this to transfer DbgValue. >> - void setSDNode(SDNode *N, unsigned R) { >> - assert (kind==SDNODE); >> - u.s.Node = N; >> - u.s.ResNo = R; >> - } >> - >> // Returns the ResNo for a register ref >> unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; } >> >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 17 17:33:27 2011 >> @@ -5508,12 +5508,14 @@ >> SDNode *FromNode = From.getNode(); >> SDNode *ToNode = To.getNode(); >> SmallVector &DVs = GetDbgValues(FromNode); >> - DbgInfo->removeSDDbgValues(FromNode); >> for (SmallVector::iterator I = DVs.begin(), E = DVs.end(); >> I != E; ++I) { >> - if ((*I)->getKind() == SDDbgValue::SDNODE) { >> - AddDbgValue(*I, ToNode, false); >> - (*I)->setSDNode(ToNode, To.getResNo()); >> + SDDbgValue *Dbg = *I; >> + if (Dbg->getKind() == SDDbgValue::SDNODE) { >> + SDDbgValue *Clone = getDbgValue(Dbg->getMDPtr(), ToNode, To.getResNo(), >> + Dbg->getOffset(), Dbg->getDebugLoc(), >> + Dbg->getOrder()); >> + AddDbgValue(Clone, ToNode, false); >> } >> } >> } >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 17 17:33:27 2011 >> @@ -4287,7 +4287,7 @@ >> N.getResNo(), Offset, dl, SDNodeOrder); >> DAG.AddDbgValue(SDV, N.getNode(), false); >> } >> - } else if (isa(V) && !V->use_empty() ) { >> + } else if (!V->use_empty() ) { >> // Do not call getValue(V) yet, as we don't want to generate code. >> // Remember it for later. >> DanglingDebugInfo DDI(&DI, dl, SDNodeOrder); >> >> Added: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll?rev=125794&view=auto >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll (added) >> +++ llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll Thu Feb 17 17:33:27 2011 >> @@ -0,0 +1,86 @@ >> +; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s >> + >> +;CHECK: DW_TAG_inlined_subroutine >> +;CHECK-NEXT: DW_AT_abstract_origin >> +;CHECK-NEXT: DW_AT_low_pc >> +;CHECK-NEXT: DW_AT_high_pc >> +;CHECK-NEXT: DW_AT_call_file >> +;CHECK-NEXT: DW_AT_call_line >> +;CHECK-NEXT: DW_TAG_formal_parameter >> +;CHECK-NEXT: .ascii "sp" ## DW_AT_name >> + >> +%struct.S1 = type { float*, i32 } >> + >> + at p = common global %struct.S1 zeroinitializer, align 8 >> + >> +define i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp { >> +entry: >> + tail call void @llvm.dbg.value(metadata !{%struct.S1* %sp}, i64 0, metadata !9), !dbg !20 >> + tail call void @llvm.dbg.value(metadata !{i32 %nums}, i64 0, metadata !18), !dbg !21 >> + %tmp2 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 1, !dbg !22 >> + store i32 %nums, i32* %tmp2, align 4, !dbg !22, !tbaa !24 >> + %call = tail call float* @bar(i32 %nums) nounwind optsize, !dbg !27 >> + %tmp5 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 0, !dbg !27 >> + store float* %call, float** %tmp5, align 8, !dbg !27, !tbaa !28 >> + %cmp = icmp ne float* %call, null, !dbg !29 >> + %cond = zext i1 %cmp to i32, !dbg !29 >> + ret i32 %cond, !dbg !29 >> +} >> + >> +declare float* @bar(i32) optsize >> + >> +define void @foobar() nounwind optsize ssp { >> +entry: >> + tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !9) nounwind, !dbg !31 >> + tail call void @llvm.dbg.value(metadata !34, i64 0, metadata !18) nounwind, !dbg !35 >> + store i32 1, i32* getelementptr inbounds (%struct.S1* @p, i64 0, i32 1), align 8, !dbg !36, !tbaa !24 >> + %call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37 >> + store float* %call.i, float** getelementptr inbounds (%struct.S1* @p, i64 0, i32 0), align 8, !dbg !37, !tbaa !28 >> + ret void, !dbg !38 >> +} >> + >> +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone >> + >> +!llvm.dbg.sp = !{!0, !6} >> +!llvm.dbg.lv.foo = !{!9, !18} >> +!llvm.dbg.gv = !{!19} >> + >> +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (%struct.S1*, i32)* @foo} ; [ DW_TAG_subprogram ] >> +!1 = metadata !{i32 589865, metadata !"nm2.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] >> +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"nm2.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 125693)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] >> +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] >> +!4 = metadata !{metadata !5} >> +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] >> +!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"", metadata !1, i32 15, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foobar} ; [ DW_TAG_subprogram ] >> +!7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] >> +!8 = metadata !{null} >> +!9 = metadata !{i32 590081, metadata !0, metadata !"sp", metadata !1, i32 7, metadata !10, i32 0} ; [ DW_TAG_arg_variable ] >> +!10 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] >> +!11 = metadata !{i32 589846, metadata !2, metadata !"S1", metadata !1, i32 4, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ] >> +!12 = metadata !{i32 589843, metadata !2, metadata !"S1", metadata !1, i32 1, i64 128, i64 64, i32 0, i32 0, i32 0, metadata !13, i32 0, i32 0} ; [ DW_TAG_structure_type ] >> +!13 = metadata !{metadata !14, metadata !17} >> +!14 = metadata !{i32 589837, metadata !1, metadata !"m", metadata !1, i32 2, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_member ] >> +!15 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] >> +!16 = metadata !{i32 589860, metadata !2, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] >> +!17 = metadata !{i32 589837, metadata !1, metadata !"nums", metadata !1, i32 3, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ] >> +!18 = metadata !{i32 590081, metadata !0, metadata !"nums", metadata !1, i32 7, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] >> +!19 = metadata !{i32 589876, i32 0, metadata !2, metadata !"p", metadata !"p", metadata !"", metadata !1, i32 14, metadata !11, i32 0, i32 1, %struct.S1* @p} ; [ DW_TAG_variable ] >> +!20 = metadata !{i32 7, i32 13, metadata !0, null} >> +!21 = metadata !{i32 7, i32 21, metadata !0, null} >> +!22 = metadata !{i32 9, i32 3, metadata !23, null} >> +!23 = metadata !{i32 589835, metadata !0, i32 8, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] >> +!24 = metadata !{metadata !"int", metadata !25} >> +!25 = metadata !{metadata !"omnipotent char", metadata !26} >> +!26 = metadata !{metadata !"Simple C/C++ TBAA", null} >> +!27 = metadata !{i32 10, i32 3, metadata !23, null} >> +!28 = metadata !{metadata !"any pointer", metadata !25} >> +!29 = metadata !{i32 11, i32 3, metadata !23, null} >> +!30 = metadata !{%struct.S1* @p} >> +!31 = metadata !{i32 7, i32 13, metadata !0, metadata !32} >> +!32 = metadata !{i32 16, i32 3, metadata !33, null} >> +!33 = metadata !{i32 589835, metadata !6, i32 15, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] >> +!34 = metadata !{i32 1} >> +!35 = metadata !{i32 7, i32 21, metadata !0, metadata !32} >> +!36 = metadata !{i32 9, i32 3, metadata !23, metadata !32} >> +!37 = metadata !{i32 10, i32 3, metadata !23, metadata !32} >> +!38 = metadata !{i32 17, i32 1, metadata !33, null} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Fri Feb 18 00:13:56 2011 From: clattner at apple.com (Chris Lattner) Date: Thu, 17 Feb 2011 22:13:56 -0800 Subject: [llvm-commits] [llvm] r115927 - in /llvm/trunk: include/llvm-c/Core.h include/llvm/InitializePasses.h lib/Transforms/Scalar/Scalar.cpp lib/Transforms/Utils/CMakeLists.txt lib/Transforms/Utils/Utils.cpp lib/VMCore/Core.cpp In-Reply-To: <85674857-3E92-4CE6-A3AE-5AD1EE9B4340@mac.com> References: <20101007175547.E941F2A6C12E@llvm.org> <9638033B-44C4-4936-A2C8-A88090FCD719@apple.com> <77D9A52D-0465-4752-A69C-1A7E030D1083@mac.com> <8ABF54E8-A00D-4046-BAEB-99C22BB8849A@apple.com> <85674857-3E92-4CE6-A3AE-5AD1EE9B4340@mac.com> Message-ID: On Feb 17, 2011, at 8:21 PM, Owen Anderson wrote: >>> >>> 1) clang and similar clients, which know upfront which set of passes they care about. Their passes are explicitly initialized when they call createFooPass(). Since they never call the global initializeScalarOpts(), they don't link in Scalar.cpp, instead only linking in those passes for which they call createFooPass(). >>> >>> 2) opt and kin, which need to link/initialize all passes available, so that they can be available from the command line. These clients do call initializeScalarOpts(), thus forcing linkage of all the passes as desired. >> >> Ok, how about following the existing pattern of putting this in a header file instead of a .cpp file? With this header, is "LinkAllPasses" needed? Can we remove LinkAllPasses and just use "InitializeAllPasses" instead? > > We can do that, if you want, but we'll still want to have separate headers for LinkAllPasses() vs. LinkAllCodeGen(), etc., so that opt doesn't have to link in all of CodeGen, and vice-versa for llc. Sure, I'm just looking to *reduce* the number of places that have to be touched to add a new pass. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110217/dca729d4/attachment.html From geek4civic at gmail.com Fri Feb 18 00:47:22 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 15:47:22 +0900 Subject: [llvm-commits] Fix LLVM tools filename extensions in regress tests for Windows In-Reply-To: <6AE1604EE3EC5F4296C096518C6B77EE17DD290816@mail.accesssoftek.com> References: <6AE1604EE3EC5F4296C096518C6B77EE17DD290816@mail.accesssoftek.com> Message-ID: Danil, Thank you, it works for me. Checked on msys and vs8. Daniel, may I commit this? Or please give us any comments, thank you. ...Takumi From geek4civic at gmail.com Fri Feb 18 01:06:58 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 16:06:58 +0900 Subject: [llvm-commits] [Review Request] Target/X86: Tweak va_arg for Win64 not to miss taking va_start when number of fixed args > 4. Message-ID: --- lib/Target/X86/X86ISelLowering.cpp | 8 +++++--- test/CodeGen/X86/win64_vararg.ll | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) --- It just works for me, though, I am not confident of its way. Let me know whoever would know better way, thank you. ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Target-X86-Tweak-va_arg-for-Win64-not-to-miss-ta.patch.txt Type: text/x-patch Size: 2565 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/120d261a/attachment-0001.bin From geek4civic at gmail.com Fri Feb 18 01:07:00 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 16:07:00 +0900 Subject: [llvm-commits] [Review Request] Target/X86: Tweak va_arg for Win64 not to miss taking va_start when number of fixed args > 4. Message-ID: --- lib/Target/X86/X86ISelLowering.cpp | 8 +++++--- test/CodeGen/X86/win64_vararg.ll | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) --- It just works for me, though, I am not confident of its way. Let me know whoever would know better way, thank you. ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Target-X86-Tweak-va_arg-for-Win64-not-to-miss-ta.patch.txt Type: text/x-patch Size: 2565 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/824694a1/attachment.bin From wilsons at start.ca Fri Feb 18 01:28:17 2011 From: wilsons at start.ca (Stephen Wilson) Date: Fri, 18 Feb 2011 02:28:17 -0500 Subject: [llvm-commits] [PATCH] Support building LLDB. Message-ID: This patch lets LLDB build as an LLVM subproject. LLDB is not built in parallel with the rest of the tools directory as it depends on Clang. Index: tools/Makefile =================================================================== --- tools/Makefile (revision 125832) +++ tools/Makefile (working copy) @@ -12,6 +12,10 @@ # Build clang if present. OPTIONAL_PARALLEL_DIRS := clang +# Build LLDB if present. Note LLDB must be built last as it depends on the +# wider LLVM infrastructure (including Clang). +OPTIONAL_DIRS := lldb + # NOTE: The tools are organized into five groups of four consisting of one # large and three small executables. This is done to minimize memory load # in parallel builds. Please retain this ordering. @@ -26,7 +30,8 @@ # Let users override the set of tools to build from the command line. ifdef ONLY_TOOLS OPTIONAL_PARALLEL_DIRS := - PARALLEL_DIRS := $(ONLY_TOOLS) + OPTIONAL_DIRS := $(findstring lldb,$(ONLY_TOOLS)) + PARALLEL_DIRS := $(filter-out lldb,$(ONLY_TOOLS)) endif include $(LEVEL)/Makefile.config From geek4civic at gmail.com Fri Feb 18 01:30:53 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 16:30:53 +0900 Subject: [llvm-commits] [Review Request] Target/X86: Tweak alloca and add a testcase for mingw64 and msvcrt on Win64. [PR8778] Message-ID: --- lib/Target/X86/X86FrameLowering.cpp | 19 +++++++-- lib/Target/X86/X86ISelLowering.cpp | 57 +++++++++++++++++++-------- lib/Target/X86/X86InstrControl.td | 10 +++++ test/CodeGen/X86/win64_alloca_dynalloca.ll | 55 +++++++++++++++++++++++++++ test/CodeGen/X86/win_chkstk.ll | 2 +- 5 files changed, 120 insertions(+), 23 deletions(-) create mode 100644 test/CodeGen/X86/win64_alloca_dynalloca.ll -- It introduces W64ALLOCA. I would attempt to rework, if there is a way to avoid W64ALLOCA. It is incompatible to TDM-GCC. ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Target-X86-Tweak-alloca-and-add-a-testcase-for-m.patch.txt Type: text/x-patch Size: 9150 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/8bb9d685/attachment.bin From geek4civic at gmail.com Fri Feb 18 01:46:00 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 16:46:00 +0900 Subject: [llvm-commits] [Review Request] lib/Target/X86/X86FastISel.cpp: [PR6275] Fix for Win32's dllimport function. Message-ID: Function must not be GlobalVariable. FIXME: Are latter conditions needed to check? --- lib/Target/X86/X86FastISel.cpp | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) --- I am dubious in one point; // Can't handle TLS or DLLImport. // FIXME: Are they needed? if (const GlobalVariable *GVar = dyn_cast(GV)) if (GVar->isThreadLocal() || GVar->hasDLLImportLinkage()) return false; Let me know if this clause could be eliminated, thank you. ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-lib-Target-X86-X86FastISel.cpp-PR6275-Fix-for-Wi.patch.txt Type: text/x-patch Size: 685 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/afea6dda/attachment.bin From baldrick at free.fr Fri Feb 18 02:07:00 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 18 Feb 2011 09:07:00 +0100 Subject: [llvm-commits] [llvm] r125794 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SDNodeDbgValue.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/dbg-value-inlined-parameter.ll In-Reply-To: <38F35C11-B253-4EBC-9A91-4B912F5FED02@apple.com> References: <20110217233327.D53A82A6C12C@llvm.org> <38F35C11-B253-4EBC-9A91-4B912F5FED02@apple.com> Message-ID: <4D5E28A4.3000701@free.fr> > I'm going to roll this out to help diagnose the failure on the llvm-gcc-i386-linux-selfhost bot. It is the only significant change in the blamed revision range. Sorry about that! Thanks Cameron - hopefully this will fix the i386 dragonegg buildbot which also blew up. Ciao, Duncan. > > Cameron > > On Feb 17, 2011, at 3:33 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Thu Feb 17 17:33:27 2011 >> New Revision: 125794 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=125794&view=rev >> Log: >> Do not lose debug info of an inlined function argument even if the argument is only used through GEPs. >> >> Added: >> llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll >> Modified: >> llvm/trunk/include/llvm/CodeGen/SelectionDAG.h >> llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp >> llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h >> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> >> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) >> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Feb 17 17:33:27 2011 >> @@ -100,10 +100,6 @@ >> return DbgValMap[Node]; >> } >> >> - void removeSDDbgValues(const SDNode *Node) { >> - DbgValMap.erase(Node); >> - } >> - >> typedef SmallVector::iterator DbgIterator; >> DbgIterator DbgBegin() { return DbgValues.begin(); } >> DbgIterator DbgEnd() { return DbgValues.end(); } >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 17 17:33:27 2011 >> @@ -87,6 +87,9 @@ >> // If someone requests legalization of the new node, return itself. >> if (From != To) >> LegalizedNodes.insert(std::make_pair(To, To)); >> + >> + // Transfer SDDbgValues. >> + DAG.TransferDbgValues(From, To); >> } >> >> public: >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h Thu Feb 17 17:33:27 2011 >> @@ -83,14 +83,6 @@ >> // Returns the SDNode* for a register ref >> SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; } >> >> - // setSDNode - If underlying SDNode is replaced by another node then >> - // SelectionDAG can use this to transfer DbgValue. >> - void setSDNode(SDNode *N, unsigned R) { >> - assert (kind==SDNODE); >> - u.s.Node = N; >> - u.s.ResNo = R; >> - } >> - >> // Returns the ResNo for a register ref >> unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; } >> >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 17 17:33:27 2011 >> @@ -5508,12 +5508,14 @@ >> SDNode *FromNode = From.getNode(); >> SDNode *ToNode = To.getNode(); >> SmallVector &DVs = GetDbgValues(FromNode); >> - DbgInfo->removeSDDbgValues(FromNode); >> for (SmallVector::iterator I = DVs.begin(), E = DVs.end(); >> I != E; ++I) { >> - if ((*I)->getKind() == SDDbgValue::SDNODE) { >> - AddDbgValue(*I, ToNode, false); >> - (*I)->setSDNode(ToNode, To.getResNo()); >> + SDDbgValue *Dbg = *I; >> + if (Dbg->getKind() == SDDbgValue::SDNODE) { >> + SDDbgValue *Clone = getDbgValue(Dbg->getMDPtr(), ToNode, To.getResNo(), >> + Dbg->getOffset(), Dbg->getDebugLoc(), >> + Dbg->getOrder()); >> + AddDbgValue(Clone, ToNode, false); >> } >> } >> } >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=125794&r1=125793&r2=125794&view=diff >> ============================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Feb 17 17:33:27 2011 >> @@ -4287,7 +4287,7 @@ >> N.getResNo(), Offset, dl, SDNodeOrder); >> DAG.AddDbgValue(SDV, N.getNode(), false); >> } >> - } else if (isa(V)&& !V->use_empty() ) { >> + } else if (!V->use_empty() ) { >> // Do not call getValue(V) yet, as we don't want to generate code. >> // Remember it for later. >> DanglingDebugInfo DDI(&DI, dl, SDNodeOrder); >> >> Added: llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll?rev=125794&view=auto >> ============================================================================== >> --- llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll (added) >> +++ llvm/trunk/test/CodeGen/X86/dbg-value-inlined-parameter.ll Thu Feb 17 17:33:27 2011 >> @@ -0,0 +1,86 @@ >> +; RUN: llc -mtriple=x86_64-apple-darwin< %s | FileCheck %s >> + >> +;CHECK: DW_TAG_inlined_subroutine >> +;CHECK-NEXT: DW_AT_abstract_origin >> +;CHECK-NEXT: DW_AT_low_pc >> +;CHECK-NEXT: DW_AT_high_pc >> +;CHECK-NEXT: DW_AT_call_file >> +;CHECK-NEXT: DW_AT_call_line >> +;CHECK-NEXT: DW_TAG_formal_parameter >> +;CHECK-NEXT: .ascii "sp" ## DW_AT_name >> + >> +%struct.S1 = type { float*, i32 } >> + >> + at p = common global %struct.S1 zeroinitializer, align 8 >> + >> +define i32 @foo(%struct.S1* nocapture %sp, i32 %nums) nounwind optsize ssp { >> +entry: >> + tail call void @llvm.dbg.value(metadata !{%struct.S1* %sp}, i64 0, metadata !9), !dbg !20 >> + tail call void @llvm.dbg.value(metadata !{i32 %nums}, i64 0, metadata !18), !dbg !21 >> + %tmp2 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 1, !dbg !22 >> + store i32 %nums, i32* %tmp2, align 4, !dbg !22, !tbaa !24 >> + %call = tail call float* @bar(i32 %nums) nounwind optsize, !dbg !27 >> + %tmp5 = getelementptr inbounds %struct.S1* %sp, i64 0, i32 0, !dbg !27 >> + store float* %call, float** %tmp5, align 8, !dbg !27, !tbaa !28 >> + %cmp = icmp ne float* %call, null, !dbg !29 >> + %cond = zext i1 %cmp to i32, !dbg !29 >> + ret i32 %cond, !dbg !29 >> +} >> + >> +declare float* @bar(i32) optsize >> + >> +define void @foobar() nounwind optsize ssp { >> +entry: >> + tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !9) nounwind, !dbg !31 >> + tail call void @llvm.dbg.value(metadata !34, i64 0, metadata !18) nounwind, !dbg !35 >> + store i32 1, i32* getelementptr inbounds (%struct.S1* @p, i64 0, i32 1), align 8, !dbg !36, !tbaa !24 >> + %call.i = tail call float* @bar(i32 1) nounwind optsize, !dbg !37 >> + store float* %call.i, float** getelementptr inbounds (%struct.S1* @p, i64 0, i32 0), align 8, !dbg !37, !tbaa !28 >> + ret void, !dbg !38 >> +} >> + >> +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone >> + >> +!llvm.dbg.sp = !{!0, !6} >> +!llvm.dbg.lv.foo = !{!9, !18} >> +!llvm.dbg.gv = !{!19} >> + >> +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 (%struct.S1*, i32)* @foo} ; [ DW_TAG_subprogram ] >> +!1 = metadata !{i32 589865, metadata !"nm2.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ] >> +!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"nm2.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 125693)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] >> +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] >> +!4 = metadata !{metadata !5} >> +!5 = metadata !{i32 589860, metadata !2, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] >> +!6 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"", metadata !1, i32 15, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, void ()* @foobar} ; [ DW_TAG_subprogram ] >> +!7 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] >> +!8 = metadata !{null} >> +!9 = metadata !{i32 590081, metadata !0, metadata !"sp", metadata !1, i32 7, metadata !10, i32 0} ; [ DW_TAG_arg_variable ] >> +!10 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] >> +!11 = metadata !{i32 589846, metadata !2, metadata !"S1", metadata !1, i32 4, i64 0, i64 0, i64 0, i32 0, metadata !12} ; [ DW_TAG_typedef ] >> +!12 = metadata !{i32 589843, metadata !2, metadata !"S1", metadata !1, i32 1, i64 128, i64 64, i32 0, i32 0, i32 0, metadata !13, i32 0, i32 0} ; [ DW_TAG_structure_type ] >> +!13 = metadata !{metadata !14, metadata !17} >> +!14 = metadata !{i32 589837, metadata !1, metadata !"m", metadata !1, i32 2, i64 64, i64 64, i64 0, i32 0, metadata !15} ; [ DW_TAG_member ] >> +!15 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !16} ; [ DW_TAG_pointer_type ] >> +!16 = metadata !{i32 589860, metadata !2, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ] >> +!17 = metadata !{i32 589837, metadata !1, metadata !"nums", metadata !1, i32 3, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ] >> +!18 = metadata !{i32 590081, metadata !0, metadata !"nums", metadata !1, i32 7, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] >> +!19 = metadata !{i32 589876, i32 0, metadata !2, metadata !"p", metadata !"p", metadata !"", metadata !1, i32 14, metadata !11, i32 0, i32 1, %struct.S1* @p} ; [ DW_TAG_variable ] >> +!20 = metadata !{i32 7, i32 13, metadata !0, null} >> +!21 = metadata !{i32 7, i32 21, metadata !0, null} >> +!22 = metadata !{i32 9, i32 3, metadata !23, null} >> +!23 = metadata !{i32 589835, metadata !0, i32 8, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] >> +!24 = metadata !{metadata !"int", metadata !25} >> +!25 = metadata !{metadata !"omnipotent char", metadata !26} >> +!26 = metadata !{metadata !"Simple C/C++ TBAA", null} >> +!27 = metadata !{i32 10, i32 3, metadata !23, null} >> +!28 = metadata !{metadata !"any pointer", metadata !25} >> +!29 = metadata !{i32 11, i32 3, metadata !23, null} >> +!30 = metadata !{%struct.S1* @p} >> +!31 = metadata !{i32 7, i32 13, metadata !0, metadata !32} >> +!32 = metadata !{i32 16, i32 3, metadata !33, null} >> +!33 = metadata !{i32 589835, metadata !6, i32 15, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ] >> +!34 = metadata !{i32 1} >> +!35 = metadata !{i32 7, i32 21, metadata !0, metadata !32} >> +!36 = metadata !{i32 9, i32 3, metadata !23, metadata !32} >> +!37 = metadata !{i32 10, i32 3, metadata !23, metadata !32} >> +!38 = metadata !{i32 17, i32 1, metadata !33, null} >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From pawel.kunio at gmail.com Fri Feb 18 05:51:56 2011 From: pawel.kunio at gmail.com (pawel kunio) Date: Fri, 18 Feb 2011 13:51:56 +0200 Subject: [llvm-commits] my 2nd attempt at now-infamous PR889 In-Reply-To: <221A2263-9E96-45D8-A085-D53C649B1FA3@apple.com> References: <221A2263-9E96-45D8-A085-D53C649B1FA3@apple.com> Message-ID: Hello, Let me state the steps taken, so that we can try to schedule partial patch sending for review: 1 adding missing trivial empty destructors to Value-derived classes for avoiding of calls to compiler-generated destructors. 2 implementing deleter2 which will call specific destructor based on Value-type could be using mock delete ptr implementation in first release to make build not break, to be replaced later with real implementation. 3 replacing calls to delete Value* with calls to deleter2. 4 adding special iplist2 as future replacement of iplist to enforce element destruction by deleter2 instead of operator delete. 5 replacing iplist uses with iplist2. 6 adding realThis to User to retrieve the real allocated pointer from User* (which is kind of fake due to tweaked placement new used for allocating User). 7 changing visibility of destructors to protected to cause the compiler to expose the now-banned destructor calls (responsibility of which will be taken by deleter2 method). 8 making deleter2 friend of Value-derived classes to make detructors visible to deleter2 9 finally due to ld problem which is used with gcc compiler for building llvm on some platforms, PseudoSourceValue had to be moved to lib/VMCore from lib/CodeGen. 10 in lib/CodeGen/pseudosourcevalue.cpp, PSVGlobalsTy had to be modified to create and destroy Values dynamically. Please note that 3,4,5 make up some 60-70% of this patch as well as its hard to separate out clearly 4 from 5. Please state which steps would You see included in separate partial patches to make work easier to be scheduled and managed from Your side. (on a side note review tool like used in google chrome would be great replacement of this process, sigh). Also if possible please refer me to more specific workitems by Doug, so that I can try to reproduce his way of solving similar issue. Best regards, Pawel Kunio On Fri, Feb 18, 2011 at 1:15 AM, Chris Lattner wrote: > > On Feb 16, 2011, at 9:13 PM, pawel kunio wrote: > > > Hello, > > In a meantime of preparing 2 tests for PR9067, I came with my 2nd and > hopefully now more > > successful attempt at now-infamous PR889 devirtualize Value destructor. > > > > Please find patches for llvm and clang attached to this mail. As I can > see from mingw build > > environment, it will need moving PseudoSourceValue.cpp from lib/CodeGen > to lib/VMCore > > after applying patch (seems not to be required on vc build env, as order > of libraries given > > to linker is not meaningful there). > > > > Please note that destructors have been moved into protected part of > interface as well as > > empty destructors were implemented for all Value-derived classes to help > in catching all > > destructions. > > Hi Pawel, > > Thank you for working on this! Unfortunately, this patch is way too > monolithic to review like this though, could you split it out into a series > of obvious changes? Doug recently "devirtualized" the clang decl hierarchy > by devirtualizing one method at a time, which worked really well. > > -Chris > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/d8111b84/attachment.html From geek4civic at gmail.com Fri Feb 18 06:34:38 2011 From: geek4civic at gmail.com (NAKAMURA Takumi) Date: Fri, 18 Feb 2011 21:34:38 +0900 Subject: [llvm-commits] [Review Request] lib/MC/WinCOFFStreamer.cpp: [PR8354] Emit .bss as .bss${foobar} instead of .bss$linkonce_{foobar} and emit local storage without IMAGE_SCN_LNK_COMDAT. Message-ID: --- lib/MC/WinCOFFStreamer.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) --- I had used the patch in bugs. http://llvm.org/bugs/show_bug.cgi?id=8354#c2 It is improved version. WinCOFFStreamer::AddCommonSymbol() can emit symbols's alignment as section alignment, though, .lcomm's alignment is not emitted for now. Now, each common symbols would be emitted as individual section .bss${foobar}. It might be overkill. :p Checked with 3-stage clang build on Windows x64. ...Takumi -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-lib-MC-WinCOFFStreamer.cpp-PR8354-Emit-.bss-as-..patch.txt Type: text/x-patch Size: 1131 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110218/e9c392e6/attachment.bin From aggarwa4 at illinois.edu Fri Feb 18 09:39:21 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Fri, 18 Feb 2011 15:39:21 -0000 Subject: [llvm-commits] [poolalloc] r125834 - /poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Message-ID: <20110218153921.93A962A6C12C@llvm.org> Author: aggarwa4 Date: Fri Feb 18 09:39:21 2011 New Revision: 125834 URL: http://llvm.org/viewvc/llvm-project?rev=125834&view=rev Log: Merge GEPs with single use, even if they are not struct type. Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Modified: poolalloc/trunk/lib/AssistDS/MergeGEP.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/MergeGEP.cpp?rev=125834&r1=125833&r2=125834&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/MergeGEP.cpp (original) +++ poolalloc/trunk/lib/AssistDS/MergeGEP.cpp Fri Feb 18 09:39:21 2011 @@ -35,7 +35,7 @@ bool changed = false; bool found; do { - found = false; + found = false; for (Module::iterator F = M.begin(); F != M.end(); ++F){ for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE; I++) { @@ -44,11 +44,6 @@ GetElementPtrInst *GEP = cast(I); if(!isa(GEP->getType()->getElementType())) continue; - for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP); - I != E; ++I) { - if (isa(*I)) { - gep_type_iterator II = I; - if(++II == E){ std::vector worklist; for (Value::use_iterator UI = GEP->use_begin(), UE = GEP->use_end(); UI != UE; ++UI){ @@ -73,9 +68,6 @@ found = true; changed = true; } - } - } - } } } std::vector worklist; @@ -106,8 +98,6 @@ Indices.end(), GEP->getName()+ "mod", GEP); - //GEP->dump(); - //GEPNew->dump(); GEP->replaceAllUsesWith(GEPNew); GEP->eraseFromParent(); changed = true; From benny.kra at googlemail.com Fri Feb 18 10:11:40 2011 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Fri, 18 Feb 2011 16:11:40 -0000 Subject: [llvm-commits] [llvm] r125842 - /llvm/trunk/include/llvm/Intrinsics.td Message-ID: <20110218161140.799772A6C12C@llvm.org> Author: d0k Date: Fri Feb 18 10:11:40 2011 New Revision: 125842 URL: http://llvm.org/viewvc/llvm-project?rev=125842&view=rev Log: The objectsize intrinsic doesn't access any memory. Modified: llvm/trunk/include/llvm/Intrinsics.td Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=125842&r1=125841&r2=125842&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Fri Feb 18 10:11:40 2011 @@ -259,7 +259,7 @@ // Internal interface for object size checking def int_objectsize : Intrinsic<[llvm_anyint_ty], [llvm_ptr_ty, llvm_i1_ty], - [IntrReadArgMem]>, + [IntrNoMem]>, GCCBuiltin<"__builtin_object_size">; //===-------------------- Bit Manipulation Intrinsics ---------------------===// From baldrick at free.fr Fri Feb 18 10:25:37 2011 From: baldrick at free.fr (Duncan Sands) Date: Fri, 18 Feb 2011 16:25:37 -0000 Subject: [llvm-commits] [llvm] r125843 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/icmp.ll test/Transforms/InstCombine/sub.ll Message-ID: <20110218162537.D56652A6C12C@llvm.org> Author: baldrick Date: Fri Feb 18 10:25:37 2011 New Revision: 125843 URL: http://llvm.org/viewvc/llvm-project?rev=125843&view=rev Log: Add some transforms of the kind X-Y>X -> 0>Y which are valid when there is no overflow. These subsume some existing equality transforms, so zap those. Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp llvm/trunk/test/Transforms/InstCombine/icmp.ll llvm/trunk/test/Transforms/InstCombine/sub.ll Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=125843&r1=125842&r2=125843&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original) +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri Feb 18 10:25:37 2011 @@ -2267,7 +2267,7 @@ return new ICmpInst(Pred, Constant::getNullValue(Op0->getType()), C == Op0 ? D : C); - // icmp (X+Y), (X+Z) -> icmp Y,Z for equalities or if there is no overflow. + // icmp (X+Y), (X+Z) -> icmp Y, Z for equalities or if there is no overflow. if (A && C && (A == C || A == D || B == C || B == D) && NoOp0WrapProblem && NoOp1WrapProblem && // Try not to increase register pressure. @@ -2286,12 +2286,26 @@ if (BO1 && BO1->getOpcode() == Instruction::Sub) C = BO1->getOperand(0), D = BO1->getOperand(1); - // icmp (Y-X), (Z-X) -> icmp Y,Z for equalities or if there is no overflow. + // icmp (X-Y), X -> icmp 0, Y for equalities or if there is no overflow. + if (A == Op1 && NoOp0WrapProblem) + return new ICmpInst(Pred, Constant::getNullValue(Op1->getType()), B); + + // icmp X, (X-Y) -> icmp Y, 0 for equalities or if there is no overflow. + if (C == Op0 && NoOp1WrapProblem) + return new ICmpInst(Pred, D, Constant::getNullValue(Op0->getType())); + + // icmp (Y-X), (Z-X) -> icmp Y, Z for equalities or if there is no overflow. if (B && D && B == D && NoOp0WrapProblem && NoOp1WrapProblem && // Try not to increase register pressure. BO0->hasOneUse() && BO1->hasOneUse()) return new ICmpInst(Pred, A, C); + // icmp (X-Y), (X-Z) -> icmp Z, Y for equalities or if there is no overflow. + if (A && C && A == C && NoOp0WrapProblem && NoOp1WrapProblem && + // Try not to increase register pressure. + BO0->hasOneUse() && BO1->hasOneUse()) + return new ICmpInst(Pred, D, B); + if (BO0 && BO1 && BO0->getOpcode() == BO1->getOpcode() && BO0->hasOneUse() && BO1->hasOneUse() && BO0->getOperand(1) == BO1->getOperand(1)) { @@ -2375,12 +2389,7 @@ if (I.isEquality()) { Value *A, *B, *C, *D; - - // -x == -y --> x == y - if (match(Op0, m_Neg(m_Value(A))) && - match(Op1, m_Neg(m_Value(B)))) - return new ICmpInst(I.getPredicate(), A, B); - + if (match(Op0, m_Xor(m_Value(A), m_Value(B)))) { if (A == Op1 || B == Op1) { // (A^B) == A -> B == 0 Value *OtherVal = A == Op1 ? B : A; @@ -2415,16 +2424,6 @@ Constant::getNullValue(A->getType())); } - // (A-B) == A -> B == 0 - if (match(Op0, m_Sub(m_Specific(Op1), m_Value(B)))) - return new ICmpInst(I.getPredicate(), B, - Constant::getNullValue(B->getType())); - - // A == (A-B) -> B == 0 - if (match(Op1, m_Sub(m_Specific(Op0), m_Value(B)))) - return new ICmpInst(I.getPredicate(), B, - Constant::getNullValue(B->getType())); - // (X&Z) == (Y&Z) -> (X^Y) & Z == 0 if (Op0->hasOneUse() && Op1->hasOneUse() && match(Op0, m_And(m_Value(A), m_Value(B))) && Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=125843&r1=125842&r2=125843&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Fri Feb 18 10:25:37 2011 @@ -235,6 +235,7 @@ } ; CHECK: @test25 +; X + Z > Y + Z -> X > Y if there is no overflow. ; CHECK: %c = icmp sgt i32 %x, %y ; CHECK: ret i1 %c define i1 @test25(i32 %x, i32 %y, i32 %z) { @@ -245,11 +246,134 @@ } ; CHECK: @test26 -; CHECK: %c = icmp sgt i32 %x, %y +; X + Z > Y + Z -> X > Y if there is no overflow. +; CHECK: %c = icmp ugt i32 %x, %y ; CHECK: ret i1 %c define i1 @test26(i32 %x, i32 %y, i32 %z) { + %lhs = add nuw i32 %x, %z + %rhs = add nuw i32 %y, %z + %c = icmp ugt i32 %lhs, %rhs + ret i1 %c +} + +; CHECK: @test27 +; X - Z > Y - Z -> X > Y if there is no overflow. +; CHECK: %c = icmp sgt i32 %x, %y +; CHECK: ret i1 %c +define i1 @test27(i32 %x, i32 %y, i32 %z) { %lhs = sub nsw i32 %x, %z %rhs = sub nsw i32 %y, %z %c = icmp sgt i32 %lhs, %rhs ret i1 %c } + +; CHECK: @test28 +; X - Z > Y - Z -> X > Y if there is no overflow. +; CHECK: %c = icmp ugt i32 %x, %y +; CHECK: ret i1 %c +define i1 @test28(i32 %x, i32 %y, i32 %z) { + %lhs = sub nuw i32 %x, %z + %rhs = sub nuw i32 %y, %z + %c = icmp ugt i32 %lhs, %rhs + ret i1 %c +} + +; CHECK: @test29 +; X + Y > X -> Y > 0 if there is no overflow. +; CHECK: %c = icmp sgt i32 %y, 0 +; CHECK: ret i1 %c +define i1 @test29(i32 %x, i32 %y) { + %lhs = add nsw i32 %x, %y + %c = icmp sgt i32 %lhs, %x + ret i1 %c +} + +; CHECK: @test30 +; X + Y > X -> Y > 0 if there is no overflow. +; CHECK: %c = icmp ne i32 %y, 0 +; CHECK: ret i1 %c +define i1 @test30(i32 %x, i32 %y) { + %lhs = add nuw i32 %x, %y + %c = icmp ugt i32 %lhs, %x + ret i1 %c +} + +; CHECK: @test31 +; X > X + Y -> 0 > Y if there is no overflow. +; CHECK: %c = icmp slt i32 %y, 0 +; CHECK: ret i1 %c +define i1 @test31(i32 %x, i32 %y) { + %rhs = add nsw i32 %x, %y + %c = icmp sgt i32 %x, %rhs + ret i1 %c +} + +; CHECK: @test32 +; X > X + Y -> 0 > Y if there is no overflow. +; CHECK: ret i1 false +define i1 @test32(i32 %x, i32 %y) { + %rhs = add nuw i32 %x, %y + %c = icmp ugt i32 %x, %rhs + ret i1 %c +} + +; CHECK: @test33 +; X - Y > X -> 0 > Y if there is no overflow. +; CHECK: %c = icmp slt i32 %y, 0 +; CHECK: ret i1 %c +define i1 @test33(i32 %x, i32 %y) { + %lhs = sub nsw i32 %x, %y + %c = icmp sgt i32 %lhs, %x + ret i1 %c +} + +; CHECK: @test34 +; X - Y > X -> 0 > Y if there is no overflow. +; CHECK: ret i1 false +define i1 @test34(i32 %x, i32 %y) { + %lhs = sub nuw i32 %x, %y + %c = icmp ugt i32 %lhs, %x + ret i1 %c +} + +; CHECK: @test35 +; X > X - Y -> Y > 0 if there is no overflow. +; CHECK: %c = icmp sgt i32 %y, 0 +; CHECK: ret i1 %c +define i1 @test35(i32 %x, i32 %y) { + %rhs = sub nsw i32 %x, %y + %c = icmp sgt i32 %x, %rhs + ret i1 %c +} + +; CHECK: @test36 +; X > X - Y -> Y > 0 if there is no overflow. +; CHECK: %c = icmp ne i32 %y, 0 +; CHECK: ret i1 %c +define i1 @test36(i32 %x, i32 %y) { + %rhs = sub nuw i32 %x, %y + %c = icmp ugt i32 %x, %rhs + ret i1 %c +} + +; CHECK: @test37 +; X - Y > X - Z -> Z > Y if there is no overflow. +; CHECK: %c = icmp sgt i32 %z, %y +; CHECK: ret i1 %c +define i1 @test37(i32 %x, i32 %y, i32 %z) { + %lhs = sub nsw i32 %x, %y + %rhs = sub nsw i32 %x, %z + %c = icmp sgt i32 %lhs, %rhs + ret i1 %c +} + +; CHECK: @test38 +; X - Y > X - Z -> Z > Y if there is no overflow. +; CHECK: %c = icmp ugt i32 %z, %y +; CHECK: ret i1 %c +define i1 @test38(i32 %x, i32 %y, i32 %z) { + %lhs = sub nuw i32 %x, %y + %rhs = sub nuw i32 %x, %z + %c = icmp ugt i32 %lhs, %rhs + ret i1 %c +} Modified: llvm/trunk/test/Transforms/InstCombine/sub.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sub.ll?rev=125843&r1=125842&r2=125843&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/sub.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/sub.ll Fri Feb 18 10:25:37 2011 @@ -209,7 +209,7 @@ %tmp5 = icmp eq i32 %tmp2, %tmp4 ret i1 %tmp5 ; CHECK: @test22 -; CHECK: %tmp5 = icmp eq i32 %a, %b +; CHECK: %tmp5 = icmp eq i32 %b, %a ; CHECK: ret i1 %tmp5 } From daniel at zuster.org Fri Feb 18 10:32:51 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:32:51 -0000 Subject: [llvm-commits] [zorg] r125844 - /zorg/trunk/zorg/buildbot/util/reloading.py Message-ID: <20110218163251.A57CF2A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 18 10:32:51 2011 New Revision: 125844 URL: http://llvm.org/viewvc/llvm-project?rev=125844&view=rev Log: buildbot: Add a helper module for reloading changed modules. - Only a partial solution, because it doesn't deal with any dependencies among modules. Added: zorg/trunk/zorg/buildbot/util/reloading.py Added: zorg/trunk/zorg/buildbot/util/reloading.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/util/reloading.py?rev=125844&view=auto ============================================================================== --- zorg/trunk/zorg/buildbot/util/reloading.py (added) +++ zorg/trunk/zorg/buildbot/util/reloading.py Fri Feb 18 10:32:51 2011 @@ -0,0 +1,44 @@ +""" +Helper module for defining a utility which will reload all of the +modules used in the system. + +This is important when using buildbot's reload command. +""" + +import os +import sys + +time_cache = {} + +def path_starts_with_one_of(path, paths): + for p in paths: + if path.startswith(p): + return True + +def reload_all(only_paths = [], log = False): + # Reload all modules in sys.modules which have changed. + for module in sys.modules.values(): + if not hasattr(module, '__file__'): + continue + path = getattr(module, '__file__') + if not path: + continue + if os.path.splitext(path)[1] in ['.pyc', '.pyo', '.pyd']: + path = path[:-1] + + # Never reload ourselves, we don't want to kill the cache. + if path == __file__: + continue + + # If we were given a limited path list, only reload modules + # with paths under that. + if only_paths and not path_starts_with_one_of(path, only_paths): + continue + + if os.path.isfile(path): + mtime = os.stat(path).st_mtime + if path not in time_cache or mtime != time_cache[path]: + if log: + print >>sys.stderr, "note: reloading %r" % path + time_cache[path] = mtime + reload(module) From rafael.espindola at gmail.com Fri Feb 18 10:37:07 2011 From: rafael.espindola at gmail.com (Rafael Avila de Espindola) Date: Fri, 18 Feb 2011 11:37:07 -0500 Subject: [llvm-commits] [PATCH] Expose Type::getName() to the C bindings In-Reply-To: <4D5DD0A1.7030800@mozilla.com> References: <4D5DD0A1.7030800@mozilla.com> Message-ID: <4D5EA033.6000101@gmail.com> On 11-02-17 08:51 PM, Patrick Walton wrote: > Hi everyone, > > Currently, the LLVM C bindings allow names for types to be registered. > However, a consumer can't get those names back out again. This patch > adds an API for it. The patch is OK. Do you need me to commit it? > Thanks, > Patrick Cheers, Rafael From rafael.espindola at gmail.com Fri Feb 18 10:35:37 2011 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 18 Feb 2011 16:35:37 -0000 Subject: [llvm-commits] [llvm] r125845 - in /llvm/trunk: include/llvm-c/Core.h lib/VMCore/Core.cpp Message-ID: <20110218163537.B55962A6C12C@llvm.org> Author: rafael Date: Fri Feb 18 10:35:37 2011 New Revision: 125845 URL: http://llvm.org/viewvc/llvm-project?rev=125845&view=rev Log: Expose getTypeName to the C API. Patch by Patrick Walton. Modified: llvm/trunk/include/llvm-c/Core.h llvm/trunk/lib/VMCore/Core.cpp Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=125845&r1=125844&r2=125845&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Fri Feb 18 10:35:37 2011 @@ -322,6 +322,7 @@ LLVMBool LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty); void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name); LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name); +const char *LLVMGetTypeName(LLVMModuleRef M, LLVMTypeRef Ty); /** See Module::dump. */ void LLVMDumpModule(LLVMModuleRef M); Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=125845&r1=125844&r2=125845&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Fri Feb 18 10:35:37 2011 @@ -128,6 +128,10 @@ return wrap(unwrap(M)->getTypeByName(Name)); } +const char *LLVMGetTypeName(LLVMModuleRef M, LLVMTypeRef Ty) { + return unwrap(M)->getTypeName(unwrap(Ty)).c_str(); +} + void LLVMDumpModule(LLVMModuleRef M) { unwrap(M)->dump(); } From daniel at zuster.org Fri Feb 18 10:40:08 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:08 -0000 Subject: [llvm-commits] [zorg] r125848 - in /zorg/trunk/llvmlab: ./ README.txt llvmlab/ llvmlab/__init__.py llvmlab/ui/ llvmlab/ui/__init__.py llvmlab/ui/app.py setup.py Message-ID: <20110218164008.29BE82A6C12E@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:07 2011 New Revision: 125848 URL: http://llvm.org/viewvc/llvm-project?rev=125848&view=rev Log: llvmlab: Start sketching lab.llvm.org web app. - Let's try a web app with Flask, eh? Added: zorg/trunk/llvmlab/ zorg/trunk/llvmlab/README.txt zorg/trunk/llvmlab/llvmlab/ zorg/trunk/llvmlab/llvmlab/__init__.py zorg/trunk/llvmlab/llvmlab/ui/ zorg/trunk/llvmlab/llvmlab/ui/__init__.py zorg/trunk/llvmlab/llvmlab/ui/app.py zorg/trunk/llvmlab/setup.py Added: zorg/trunk/llvmlab/README.txt URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/README.txt?rev=125848&view=auto ============================================================================== --- zorg/trunk/llvmlab/README.txt (added) +++ zorg/trunk/llvmlab/README.txt Fri Feb 18 10:40:07 2011 @@ -0,0 +1,5 @@ +====================== + lab.llvm.org Web App +====================== + +This directory and its subdirectories contain the lab.llvm.org web app. Added: zorg/trunk/llvmlab/llvmlab/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/__init__.py?rev=125848&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/__init__.py (added) +++ zorg/trunk/llvmlab/llvmlab/__init__.py Fri Feb 18 10:40:07 2011 @@ -0,0 +1,6 @@ +__author__ = 'Daniel Dunbar' +__email__ = 'daniel at zuster.org' +__versioninfo__ = (0, 1, 0) +__version__ = '.'.join(map(str, __versioninfo__)) + 'dev' + +__all__ = [] Added: zorg/trunk/llvmlab/llvmlab/ui/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/__init__.py?rev=125848&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/__init__.py (added) +++ zorg/trunk/llvmlab/llvmlab/ui/__init__.py Fri Feb 18 10:40:07 2011 @@ -0,0 +1 @@ +__all__ = [] Added: zorg/trunk/llvmlab/llvmlab/ui/app.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/app.py?rev=125848&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/app.py (added) +++ zorg/trunk/llvmlab/llvmlab/ui/app.py Fri Feb 18 10:40:07 2011 @@ -0,0 +1,9 @@ +from flask import Flask +app = Flask(__name__) + + at app.route('/') +def index(): + return "Ceci n'est pas un laboratoire." + +if __name__ == '__main__': + app.run() Added: zorg/trunk/llvmlab/setup.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/setup.py?rev=125848&view=auto ============================================================================== --- zorg/trunk/llvmlab/setup.py (added) +++ zorg/trunk/llvmlab/setup.py Fri Feb 18 10:40:07 2011 @@ -0,0 +1,42 @@ +import llvmlab +import os + +from setuptools import setup, find_packages + +# setuptools expects to be invoked from within the directory of setup.py, but it +# is nice to allow: +# python path/to/setup.py install +# to work (for scripts, etc.) +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +setup( + name = "llvmlab", + version = llvmlab.__version__, + + author = llvmlab.__author__, + author_email = llvmlab.__email__, + url = 'http://lab.llvm.org', + license = 'BSD', + + description = "lab.llvm.org Web App", + keywords = 'web testing performance development llvm', + + classifiers=[ + 'Development Status :: 1 - Planning', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + ('License :: OSI Approved :: ' + 'University of Illinois/NCSA Open Source License'), + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Progamming Language :: Python', + 'Topic :: Software Development :: Quality Assurance', + 'Topic :: Software Development :: Testing', + ], + + zip_safe = False, + + packages = find_packages(), + + install_requires=['Flask'], +) From daniel at zuster.org Fri Feb 18 10:40:11 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:11 -0000 Subject: [llvm-commits] [zorg] r125850 - in /zorg/trunk/llvmlab/llvmlab/ui: app.py static/ static/favicon.ico Message-ID: <20110218164011.36BF62A6C12F@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:11 2011 New Revision: 125850 URL: http://llvm.org/viewvc/llvm-project?rev=125850&view=rev Log: llvmlab: Add a favicon. Also, use debugger by default when started from command line. Added: zorg/trunk/llvmlab/llvmlab/ui/static/ zorg/trunk/llvmlab/llvmlab/ui/static/favicon.ico Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/app.py?rev=125850&r1=125849&r2=125850&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/app.py (original) +++ zorg/trunk/llvmlab/llvmlab/ui/app.py Fri Feb 18 10:40:11 2011 @@ -1,9 +1,17 @@ -from flask import Flask -app = Flask(__name__) +import flask +from flask import redirect, url_for + +# Construct the Flask application. +app = flask.Flask(__name__) @app.route('/') def index(): return "Ceci n'est pas un laboratoire." + at app.route('/favicon.ico') +def favicon_ico(): + return redirect(url_for('static', filename='favicon.ico')) + if __name__ == '__main__': + app.debug = True app.run() Added: zorg/trunk/llvmlab/llvmlab/ui/static/favicon.ico URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/static/favicon.ico?rev=125850&view=auto ============================================================================== Binary files zorg/trunk/llvmlab/llvmlab/ui/static/favicon.ico (added) and zorg/trunk/llvmlab/llvmlab/ui/static/favicon.ico Fri Feb 18 10:40:11 2011 differ From daniel at zuster.org Fri Feb 18 10:40:14 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:14 -0000 Subject: [llvm-commits] [zorg] r125852 - in /zorg/trunk/llvmlab/llvmlab/ui: app.py static/style.css templates/ templates/index.html Message-ID: <20110218164014.E884B2A6C130@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:14 2011 New Revision: 125852 URL: http://llvm.org/viewvc/llvm-project?rev=125852&view=rev Log: llvmlab: Move index page into a template. Added: zorg/trunk/llvmlab/llvmlab/ui/static/style.css zorg/trunk/llvmlab/llvmlab/ui/templates/ zorg/trunk/llvmlab/llvmlab/ui/templates/index.html Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/app.py?rev=125852&r1=125851&r2=125852&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/app.py (original) +++ zorg/trunk/llvmlab/llvmlab/ui/app.py Fri Feb 18 10:40:14 2011 @@ -1,12 +1,12 @@ import flask -from flask import redirect, url_for +from flask import redirect, render_template, url_for # Construct the Flask application. app = flask.Flask(__name__) @app.route('/') def index(): - return "Ceci n'est pas un laboratoire." + return render_template("index.html") @app.route('/favicon.ico') def favicon_ico(): Added: zorg/trunk/llvmlab/llvmlab/ui/static/style.css URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/static/style.css?rev=125852&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/static/style.css (added) +++ zorg/trunk/llvmlab/llvmlab/ui/static/style.css Fri Feb 18 10:40:14 2011 @@ -0,0 +1,6 @@ +body { + background-color: #F0F3FF; + font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, + Helvetica, sans-serif; + font-size: small; +} Added: zorg/trunk/llvmlab/llvmlab/ui/templates/index.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/index.html?rev=125852&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/index.html (added) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/index.html Fri Feb 18 10:40:14 2011 @@ -0,0 +1,12 @@ + + + + lab.llvm.org + + + +Ceci n'est pas un laboratoire. + + From daniel at zuster.org Fri Feb 18 10:40:18 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:18 -0000 Subject: [llvm-commits] [zorg] r125853 - in /zorg/trunk/llvmlab/llvmlab/ui: static/style.css templates/index.html templates/layout.html Message-ID: <20110218164018.531992A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:18 2011 New Revision: 125853 URL: http://llvm.org/viewvc/llvm-project?rev=125853&view=rev Log: llvmlab: Factor out top-level layout template. Added: zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Modified: zorg/trunk/llvmlab/llvmlab/ui/static/style.css zorg/trunk/llvmlab/llvmlab/ui/templates/index.html Modified: zorg/trunk/llvmlab/llvmlab/ui/static/style.css URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/static/style.css?rev=125853&r1=125852&r2=125853&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/static/style.css (original) +++ zorg/trunk/llvmlab/llvmlab/ui/static/style.css Fri Feb 18 10:40:18 2011 @@ -4,3 +4,33 @@ Helvetica, sans-serif; font-size: small; } + +div.body { + color: #000; + margin: 20px; +} +div.body a { + color: #333; +} + +div.header { + background-color: #50505A; + color: #FFF; + font-size: 125%; + padding: 10px 10px; + text-align: left; +} +div.header a { + color: #FFF; +} + +div.footer { + background-color: #50505A; + color: #FFF; + font-size: 75%; + padding: 10px 10px; + text-align: right; +} +div.footer a { + color: #FFF; +} Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/index.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/index.html?rev=125853&r1=125852&r2=125853&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/index.html (original) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/index.html Fri Feb 18 10:40:18 2011 @@ -1,12 +1,7 @@ - - - - lab.llvm.org - - - +{% extends "layout.html" %} +{% block title %}home{% endblock %} +{% block body %} + Ceci n'est pas un laboratoire. - - + +{% endblock %} Added: zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html?rev=125853&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html (added) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Fri Feb 18 10:40:18 2011 @@ -0,0 +1,21 @@ + + + + + {{ self.title() }} + + + +
      + {# + #}lab.llvm.org | {{ self.title() }} +
      +
      {% block body %}{% endblock %}
      + + + From daniel at zuster.org Fri Feb 18 10:40:20 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:20 -0000 Subject: [llvm-commits] [zorg] r125854 - /zorg/trunk/llvmlab/llvmlab/TODO.txt Message-ID: <20110218164020.B57782A6C12E@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:20 2011 New Revision: 125854 URL: http://llvm.org/viewvc/llvm-project?rev=125854&view=rev Log: llvmlab: Sketch a TODO list. Added: zorg/trunk/llvmlab/llvmlab/TODO.txt Added: zorg/trunk/llvmlab/llvmlab/TODO.txt URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/TODO.txt?rev=125854&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/TODO.txt (added) +++ zorg/trunk/llvmlab/llvmlab/TODO.txt Fri Feb 18 10:40:20 2011 @@ -0,0 +1,29 @@ +====== + TODO +====== + +Go-Live Requirements +==================== + + - Config Logic + + - User Login + + o Expect superset of committer list. + + o Keep auth info with lab.llvm.org user cred, svn access will be an + attribute. + + o Attributes: user name, SSH key, committer name, email, commit access?, + machine access?, lab.llvm.org info (machine list, sponsor list)? + + - Machine List + + - Sponsor List + + - Intro Web Page + +Other +===== + + - Dashboard From daniel at zuster.org Fri Feb 18 10:40:27 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:27 -0000 Subject: [llvm-commits] [zorg] r125856 - in /zorg/trunk/llvmlab/llvmlab: user.py util.py Message-ID: <20110218164027.7D3EC2A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:27 2011 New Revision: 125856 URL: http://llvm.org/viewvc/llvm-project?rev=125856&view=rev Log: llvmlab: Sketch User objects. Added: zorg/trunk/llvmlab/llvmlab/user.py zorg/trunk/llvmlab/llvmlab/util.py Added: zorg/trunk/llvmlab/llvmlab/user.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/user.py?rev=125856&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/user.py (added) +++ zorg/trunk/llvmlab/llvmlab/user.py Fri Feb 18 10:40:27 2011 @@ -0,0 +1,28 @@ +""" +LLVM-Lab User Objects +""" + +from llvmlab import util + +class User(util.simple_repr_mixin): + @staticmethod + def fromdata(data): + version = data['version'] + if version != 0: + raise ValueError, "Unknown version" + + return User(data['id'], data['passhash'], + data['name'], data['email']) + + def todata(self): + return { 'version' : 0, + 'id' : self.id, + 'passhash' : self.passhash, + 'name' : self.name, + 'email' : self.email } + + def __init__(self, id, passhash, name, email): + self.id = id + self.passhash = passhash + self.name = name + self.email = email Added: zorg/trunk/llvmlab/llvmlab/util.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/util.py?rev=125856&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/util.py (added) +++ zorg/trunk/llvmlab/llvmlab/util.py Fri Feb 18 10:40:27 2011 @@ -0,0 +1,12 @@ +__all__ = [] + +def sorted(items): + items = list(items) + items.sort() + return items + +class simple_repr_mixin(object): + def __repr__(self): + return "%s(%s)" % (self.__class__.__name__, + ", ".join("%s=%r" % (k,v) + for k,v in sorted(self.__dict__.items()))) From daniel at zuster.org Fri Feb 18 10:40:24 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:24 -0000 Subject: [llvm-commits] [zorg] r125855 - in /zorg/trunk/llvmlab: llvmlab/TODO.txt llvmlab/llvmlabtool/ llvmlab/llvmlabtool/__init__.py llvmlab/llvmlabtool/lab.cfg.sample llvmlab/llvmlabtool/main.py llvmlab/ui/app.py llvmlab/ui/templates/layout.html setup.py Message-ID: <20110218164024.C39542A6C12D@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:24 2011 New Revision: 125855 URL: http://llvm.org/viewvc/llvm-project?rev=125855&view=rev Log: llvmlab: Add basic llvmlab tool and config file. Added: zorg/trunk/llvmlab/llvmlab/llvmlabtool/ zorg/trunk/llvmlab/llvmlab/llvmlabtool/__init__.py zorg/trunk/llvmlab/llvmlab/llvmlabtool/lab.cfg.sample zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py Modified: zorg/trunk/llvmlab/llvmlab/TODO.txt zorg/trunk/llvmlab/llvmlab/ui/app.py zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html zorg/trunk/llvmlab/setup.py Modified: zorg/trunk/llvmlab/llvmlab/TODO.txt URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/TODO.txt?rev=125855&r1=125854&r2=125855&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/TODO.txt (original) +++ zorg/trunk/llvmlab/llvmlab/TODO.txt Fri Feb 18 10:40:24 2011 @@ -5,8 +5,6 @@ Go-Live Requirements ==================== - - Config Logic - - User Login o Expect superset of committer list. Added: zorg/trunk/llvmlab/llvmlab/llvmlabtool/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/llvmlabtool/__init__.py?rev=125855&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/llvmlabtool/__init__.py (added) +++ zorg/trunk/llvmlab/llvmlab/llvmlabtool/__init__.py Fri Feb 18 10:40:24 2011 @@ -0,0 +1,3 @@ +__all__ = ['main'] + +from main import main Added: zorg/trunk/llvmlab/llvmlab/llvmlabtool/lab.cfg.sample URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/llvmlabtool/lab.cfg.sample?rev=125855&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/llvmlabtool/lab.cfg.sample (added) +++ zorg/trunk/llvmlab/llvmlab/llvmlabtool/lab.cfg.sample Fri Feb 18 10:40:24 2011 @@ -0,0 +1,20 @@ +# -*- Python -*- + +""" +LLVM Lab Configuration File +""" + +# Server administrator information. +ADMIN_LOGIN = %(admin_login)r +ADMIN_PASSHASH = %(admin_passhash)r +ADMIN_NAME = %(admin_name)r +ADMIN_EMAIL = %(admin_email)r + +# Should server run in debug mode? +DEBUG = %(debug_server)r + +# Secret key for this server instance. +SECRET_KEY = %(secret_key)r + +# Path to the managed data file. +DATA_PATH = %(data_path)r Added: zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py?rev=125855&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py (added) +++ zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py Fri Feb 18 10:40:24 2011 @@ -0,0 +1,110 @@ +"""Implements the command line 'llvmlab' tool.""" + +import hashlib +import os +import random +import shutil +import sys + +import flask + +def action_create(name, args): + """create an llvmlab installation""" + + import llvmlab + from optparse import OptionParser, OptionGroup + parser = OptionParser("%%prog %s [options] " % name) + parser.add_option("-f", "--force", dest="force", action="store_true", + help="overwrite existing files") + + group = OptionGroup(parser, "CONFIG OPTIONS") + group.add_option("", "--admin-login", dest="admin_login", + help="administrator login [%default]", default='admin') + group.add_option("", "--admin-name", dest="admin_name", + help="administrator name [%default]", + default='Administrator') + group.add_option("", "--admin-password", dest="admin_password", + help="administrator password [%default]", default='admin') + group.add_option("", "--admin-email", dest="admin_email", + help="administrator email [%default]", + default='admin at example.com') + + group.add_option("", "--debug-server", dest="debug_server", + help="run server in debug mode [%default]", + action="store_true", default=False) + parser.add_option_group(group) + + (opts, args) = parser.parse_args(args) + + if len(args) != 1: + parser.error("invalid number of arguments") + + basepath, = args + basepath = os.path.abspath(basepath) + cfg_path = os.path.join(basepath, 'lab.cfg') + data_path = os.path.join(basepath, 'lab-data.json') + + if not os.path.exists(basepath): + try: + os.mkdir(basepath) + except: + parser.error("unable to create directory: %r" % basepath) + elif not os.path.isdir(basepath): + parser.error("%r exists but is not a directory" % basepath) + + if not opts.force: + if os.path.exists(cfg_path): + parser.error("%r exists (use --force to override)" % cfg_path) + if os.path.exists(data_path): + parser.error("%r exists (use --force to override)" % data_path) + + # Construct the config file. + sample_cfg_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), + "lab.cfg.sample") + sample_cfg_file = open(sample_cfg_path, "rb") + sample_cfg_data = sample_cfg_file.read() + sample_cfg_file.close() + + # Fill in the sample config. + secret_key = hashlib.sha1(str(random.getrandbits(256))).hexdigest() + cfg_options = dict(opts.__dict__) + cfg_options['admin_passhash'] = hashlib.sha256( + opts.admin_password + secret_key).hexdigest() + cfg_options['secret_key'] = secret_key + cfg_options['data_path'] = data_path + cfg_data = sample_cfg_data % cfg_options + + # Write the initial config file. + cfg_file = open(cfg_path, 'w') + cfg_file.write(cfg_data) + cfg_file.close() + + # Write the initial (empty) data file. + data_file = open(data_path, 'w') + flask.json.dump({}, data_file, indent=2) + print >>data_file + data_file.close() + +### + +commands = dict((name[7:], f) for name,f in locals().items() + if name.startswith('action_')) + +def usage(): + print >>sys.stderr, "Usage: %s command [options]" % ( + os.path.basename(sys.argv[0])) + print >>sys.stderr + print >>sys.stderr, "Available commands:" + cmds_width = max(map(len, commands)) + for name,func in sorted(commands.items()): + print >>sys.stderr, " %-*s - %s" % (cmds_width, name, func.__doc__) + sys.exit(1) + +def main(): + import sys + + if len(sys.argv) < 2 or sys.argv[1] not in commands: + usage() + + cmd = sys.argv[1] + commands[cmd](cmd, sys.argv[2:]) Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/app.py?rev=125855&r1=125854&r2=125855&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/app.py (original) +++ zorg/trunk/llvmlab/llvmlab/ui/app.py Fri Feb 18 10:40:24 2011 @@ -1,9 +1,14 @@ +import os + import flask from flask import redirect, render_template, url_for # Construct the Flask application. app = flask.Flask(__name__) +# Load the configuration file. +app.config.from_envvar("LLVMLAB_CONFIG") + @app.route('/') def index(): return render_template("index.html") @@ -13,5 +18,5 @@ return redirect(url_for('static', filename='favicon.ico')) if __name__ == '__main__': - app.debug = True + app.debug = app.config['DEBUG'] app.run() Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html?rev=125855&r1=125854&r2=125855&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html (original) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Fri Feb 18 10:40:24 2011 @@ -15,7 +15,11 @@
      {% block body %}{% endblock %}
      Modified: zorg/trunk/llvmlab/setup.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/setup.py?rev=125855&r1=125854&r2=125855&view=diff ============================================================================== --- zorg/trunk/llvmlab/setup.py (original) +++ zorg/trunk/llvmlab/setup.py Fri Feb 18 10:40:24 2011 @@ -35,8 +35,11 @@ ], zip_safe = False, - packages = find_packages(), - + entry_points = { + 'console_scripts': [ + 'llvmlab = llvmlab.llvmlabtool:main', + ], + }, install_requires=['Flask'], ) From daniel at zuster.org Fri Feb 18 10:40:32 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:32 -0000 Subject: [llvm-commits] [zorg] r125858 - /zorg/trunk/llvmlab/llvmlab/ui/app.py Message-ID: <20110218164032.DAB8A2A6C12D@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:32 2011 New Revision: 125858 URL: http://llvm.org/viewvc/llvm-project?rev=125858&view=rev Log: llvmlab: Load data on application startup. Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/app.py?rev=125858&r1=125857&r2=125858&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/app.py (original) +++ zorg/trunk/llvmlab/llvmlab/ui/app.py Fri Feb 18 10:40:32 2011 @@ -3,12 +3,46 @@ import flask from flask import redirect, render_template, url_for +import llvmlab.data +import llvmlab.user + +def load_llvmlab_data(app): + """load_llvmlab_data(app) -> data.Data + + Load the LLVM-Lab data for the given application. + """ + + data_path = app.config["DATA_PATH"] + data_file = open(data_path, "rb") + data_object = flask.json.load(data_file) + data_file.close() + + # Create the internal Data object. + data = llvmlab.data.Data.fromdata(data_object) + + # Set the admin pseudo-user. + data.set_admin_user(llvmlab.user.User( + id = app.config['ADMIN_LOGIN'], + passhash = app.config['ADMIN_PASSHASH'], + name = app.config['ADMIN_NAME'], + email = app.config['ADMIN_EMAIL'])) + + return data + +### + # Construct the Flask application. app = flask.Flask(__name__) # Load the configuration file. app.config.from_envvar("LLVMLAB_CONFIG") +# Load the LLVM-Lab database. +app.config.data = load_llvmlab_data(app) + +### +# Routing + @app.route('/') def index(): return render_template("index.html") @@ -17,6 +51,8 @@ def favicon_ico(): return redirect(url_for('static', filename='favicon.ico')) +### + if __name__ == '__main__': app.debug = app.config['DEBUG'] app.run() From daniel at zuster.org Fri Feb 18 10:40:30 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:30 -0000 Subject: [llvm-commits] [zorg] r125857 - in /zorg/trunk/llvmlab/llvmlab: data.py llvmlabtool/main.py Message-ID: <20110218164030.47D412A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:30 2011 New Revision: 125857 URL: http://llvm.org/viewvc/llvm-project?rev=125857&view=rev Log: llvmlab: Sketch top-level data object. Added: zorg/trunk/llvmlab/llvmlab/data.py Modified: zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py Added: zorg/trunk/llvmlab/llvmlab/data.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/data.py?rev=125857&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/data.py (added) +++ zorg/trunk/llvmlab/llvmlab/data.py Fri Feb 18 10:40:30 2011 @@ -0,0 +1,35 @@ +""" +LLVM-Lab Data Management +""" + +from llvmlab import util +from llvmlab import user + +class Data(util.simple_repr_mixin): + @staticmethod + def fromdata(data): + version = data['version'] + if version != 0: + raise ValueError, "Unknown version" + + users = [user.User.fromdata(u) + for u in data['users']] + return Data(users) + + def todata(self): + return { 'version' : 0, + 'users' : [u.todata() + for u in self.users.values() + if u is not self.admin_user] } + + def __init__(self, users): + self.users = dict((u.id, u) for u in users) + self.admin_user = None + + def set_admin_user(self, user): + if user.id in self.users: + raise ValueError, "database contains admin user %r" % user.id + + self.admin_user = user + self.users[user.id] = user + Modified: zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py?rev=125857&r1=125856&r2=125857&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py (original) +++ zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py Fri Feb 18 10:40:30 2011 @@ -7,6 +7,7 @@ import sys import flask +import llvmlab.data def action_create(name, args): """create an llvmlab installation""" @@ -79,9 +80,12 @@ cfg_file.write(cfg_data) cfg_file.close() + # Create the inital data file. + data = llvmlab.data.Data(users = []) + # Write the initial (empty) data file. data_file = open(data_path, 'w') - flask.json.dump({}, data_file, indent=2) + flask.json.dump(data.todata(), data_file, indent=2) print >>data_file data_file.close() From daniel at zuster.org Fri Feb 18 10:40:36 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:36 -0000 Subject: [llvm-commits] [zorg] r125859 - in /zorg/trunk/llvmlab/llvmlab/ui: app.py templates/users.html Message-ID: <20110218164036.487902A6C12D@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:36 2011 New Revision: 125859 URL: http://llvm.org/viewvc/llvm-project?rev=125859&view=rev Log: llvmlab: Add users info page. - Will be behind login, eventually. Added: zorg/trunk/llvmlab/llvmlab/ui/templates/users.html Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py Modified: zorg/trunk/llvmlab/llvmlab/ui/app.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/app.py?rev=125859&r1=125858&r2=125859&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/app.py (original) +++ zorg/trunk/llvmlab/llvmlab/ui/app.py Fri Feb 18 10:40:36 2011 @@ -51,6 +51,10 @@ def favicon_ico(): return redirect(url_for('static', filename='favicon.ico')) + at app.route('/users') +def users(): + return render_template("users.html") + ### if __name__ == '__main__': Added: zorg/trunk/llvmlab/llvmlab/ui/templates/users.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/users.html?rev=125859&view=auto ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/users.html (added) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/users.html Fri Feb 18 10:40:36 2011 @@ -0,0 +1,15 @@ +{% extends "layout.html" %} +{% block title %}users{% endblock %} +{% block body %} + + + +{% for user in config.data.users.values() %} + + + + +{% endfor %} +
      User NameUser Email
      {{ user.name }}{{ user.email }}
      + +{% endblock %} From daniel at zuster.org Fri Feb 18 10:40:39 2011 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 18 Feb 2011 16:40:39 -0000 Subject: [llvm-commits] [zorg] r125860 - in /zorg/trunk/llvmlab/llvmlab/ui: static/style.css templates/layout.html Message-ID: <20110218164039.5B0F82A6C12C@llvm.org> Author: ddunbar Date: Fri Feb 18 10:40:39 2011 New Revision: 125860 URL: http://llvm.org/viewvc/llvm-project?rev=125860&view=rev Log: llvmlab: Add support for using flask.flash(). Modified: zorg/trunk/llvmlab/llvmlab/ui/static/style.css zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Modified: zorg/trunk/llvmlab/llvmlab/ui/static/style.css URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/static/style.css?rev=125860&r1=125859&r2=125860&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/static/style.css (original) +++ zorg/trunk/llvmlab/llvmlab/ui/static/style.css Fri Feb 18 10:40:39 2011 @@ -34,3 +34,12 @@ div.footer a { color: #FFF; } + +div.flash_messages { + margin: 10px; +} +div.flash_message { + background: #CEE5F5; + padding: 10px; + border: 1px solid #AACBE2; +} Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html?rev=125860&r1=125859&r2=125860&view=diff ============================================================================== --- zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html (original) +++ zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Fri Feb 18 10:40:39 2011 @@ -12,6 +12,11 @@ {# #}lab.llvm.org | {{ self.title() }}
  • +
    + {% for message in get_flashed_messages() %} +
    {{ message }}
    + {% endfor %} +
    {% block body %}{% endblock %}