[llvm-commits] [llvm] r45260 - /llvm/trunk/include/llvm/IntrinsicsX86.td
Author: evancheng Date: Thu Dec 20 03:35:28 2007 New Revision: 45260 URL: http://llvm.org/viewvc/llvm-project?rev=45260&view=rev Log: Type specification didn't match gcc's. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=45260&r1=45259&r2=45260&view=diff == --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Thu Dec 20 03:35:28 2007 @@ -341,7 +341,7 @@ llvm_i32_ty], [IntrNoMem]>; def int_x86_sse2_psra_w : GCCBuiltin<"__builtin_ia32_psraw128">, Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, - llvm_v4i32_ty], [IntrNoMem]>; + llvm_v8i16_ty], [IntrNoMem]>; def int_x86_sse2_psra_d : GCCBuiltin<"__builtin_ia32_psrad128">, Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45259 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Author: evancheng Date: Thu Dec 20 03:25:31 2007 New Revision: 45259 URL: http://llvm.org/viewvc/llvm-project?rev=45259&view=rev Log: More accurate checks for two-address constraints. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=45259&r1=45258&r2=45259&view=diff == --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Dec 20 03:25:31 2007 @@ -1064,9 +1064,11 @@ std::vector SethiUllmanNumbers; const TargetInstrInfo *TII; +const MRegisterInfo *MRI; public: -explicit BURegReductionPriorityQueue(const TargetInstrInfo *tii) - : TII(tii) {} +explicit BURegReductionPriorityQueue(const TargetInstrInfo *tii, + const MRegisterInfo *mri) + : TII(tii), MRI(mri) {} void initNodes(DenseMap > &sumap, std::vector &sunits) { @@ -1314,6 +1316,33 @@ return false; } +/// canClobberPhysRegDefs - True if SU would clobber one of SuccSU's +/// physical register def. +static bool canClobberPhysRegDefs(SUnit *SuccSU, SUnit *SU, + const TargetInstrInfo *TII, + const MRegisterInfo *MRI) { + SDNode *N = SuccSU->Node; + unsigned NumDefs = TII->getNumDefs(N->getTargetOpcode()); + const unsigned *ImpDefs = TII->getImplicitDefs(N->getTargetOpcode()); + if (!ImpDefs) +return false; + const unsigned *SUImpDefs = TII->getImplicitDefs(SU->Node->getTargetOpcode()); + if (!SUImpDefs) +return false; + for (unsigned i = NumDefs, e = N->getNumValues(); i != e; ++i) { +MVT::ValueType VT = N->getValueType(i); +if (VT == MVT::Flag || VT == MVT::Other) + continue; +unsigned Reg = ImpDefs[i - NumDefs]; +for (;*SUImpDefs; ++SUImpDefs) { + unsigned SUReg = *SUImpDefs; + if (MRI->regsOverlap(Reg, SUReg)) +return true; +} + } + return false; +} + /// AddPseudoTwoAddrDeps - If two nodes share an operand and one of them uses /// it as a def&use operand. Add a pseudo control edge from it to the other /// node (if it won't create a cycle) so the two-address one will be scheduled @@ -1346,18 +1375,20 @@ I != E; ++I) { if (I->isCtrl) continue; SUnit *SuccSU = I->Dep; - // Don't constrain nodes with implicit defs. It can create cycles - // plus it may increase register pressures. - if (SuccSU == SU || SuccSU->hasPhysRegDefs) + if (SuccSU == SU) continue; // Be conservative. Ignore if nodes aren't at roughly the same // depth and height. if (SuccSU->Height < SU->Height && (SU->Height - SuccSU->Height) > 1) continue; - if (SuccSU->Depth > SU->Depth && (SuccSU->Depth - SU->Depth) > 1) -continue; if (!SuccSU->Node || !SuccSU->Node->isTargetOpcode()) continue; + // Don't constrain nodes with physical register defs if the + // predecessor can cloober them. + if (SuccSU->hasPhysRegDefs) { +if (canClobberPhysRegDefs(SuccSU, SU, TII, MRI)) + continue; + } // Don't constraint extract_subreg / insert_subreg these may be // coalesced away. We don't them close to their uses. unsigned SuccOpc = SuccSU->Node->getTargetOpcode(); @@ -1547,8 +1578,9 @@ SelectionDAG *DAG, MachineBasicBlock *BB) { const TargetInstrInfo *TII = DAG->getTarget().getInstrInfo(); + const MRegisterInfo *MRI = DAG->getTarget().getRegisterInfo(); return new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), true, - new BURegReductionPriorityQueue(TII)); + new BURegReductionPriorityQueue(TII, MRI)); } llvm::ScheduleDAG* llvm::createTDRRListDAGScheduler(SelectionDAGISel *IS, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] [llvm] r45221 - /llvm/trunk/l ib/Target/PowerPC/PPCTargetAsmInfo.cpp
> > The EH will work (modulo bugs) if you pass -enable-eh; however, > > the top-level Makefile currently sets -enable-correct-eh-support. > > What is the difference these days? Should the top-level makefile be > changed? They are not at all the same: -enable-eh turns on dwarf eh support, while -enable-correct-eh-support turns on sj/lj lowering. If you turn on both than you get -enable-eh on all targets, whether or not it supports dwarf eh (check out LLVMTargetMachine.cpp: the LowerInvoke pass is only scheduled if -enable-eh is not turned on). This is kind of problematic because in the testsuite we really want: -enable-eh on targets that support dwarf eh, and -enable-correct-eh-support otherwise. Presumably what needs to be done is: pass both options in the Makefile, and schedule a LowerInvoke pass if the target does not support dwarf eh or -enable-eh is not turned on. (The LowerInvoke pass itself returns without doing anything if -enable-correct-eh-support is not turned on). Ciao, Duncan. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45261 - /llvm/trunk/include/llvm/ADT/OwningPtr.h
Author: lattner Date: Thu Dec 20 13:14:02 2007 New Revision: 45261 URL: http://llvm.org/viewvc/llvm-project?rev=45261&view=rev Log: add new smart pointer for clang. Added: llvm/trunk/include/llvm/ADT/OwningPtr.h Added: llvm/trunk/include/llvm/ADT/OwningPtr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/OwningPtr.h?rev=45261&view=auto == --- llvm/trunk/include/llvm/ADT/OwningPtr.h (added) +++ llvm/trunk/include/llvm/ADT/OwningPtr.h Thu Dec 20 13:14:02 2007 @@ -0,0 +1,79 @@ +//===- llvm/ADT/OwningPtr.h - Smart ptr that owns the pointee ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Chris Lattner and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===--===// +// +// This file defines and implements the OwningPtr class. +// +//===--===// + +#ifndef LLVM_ADT_OWNING_PTR_H +#define LLVM_ADT_OWNING_PTR_H + +#include + +namespace llvm { + +/// OwningPtr smart pointer - OwningPtr mimics a built-in pointer except that it +/// guarantees deletion of the object pointed to, either on destruction of the +/// OwningPtr or via an explicit reset(). Once created, ownership of the +/// pointee object can be taken away from OwningPtr by using the take method. +template +class OwningPtr { + OwningPtr(OwningPtr const &); // DO NOT IMPLEMENT + OwningPtr &operator=(OwningPtr const &); // DO NOT IMPLEMENT + T *Ptr; +public: + explicit OwningPtr(T *P = 0) : Ptr(P) {} + + ~OwningPtr() { +delete Ptr; + } + + /// reset - Change the current pointee to the specified pointer. Note that + /// calling this with any pointer (including a null pointer) deletes the + /// current pointer. + void reset(T *P = 0) { +if (P == Ptr) return; +T *Tmp = Ptr; +Ptr = P; +delete Tmp; + } + + /// take - Reset the owning pointer to null and return its pointer. This does + /// not delete the pointer before returning it. + T *take() { +T *Tmp = Ptr; +Ptr = 0; +return Tmp; + } + + T &operator*() const { +assert(Ptr && "Cannot dereference null pointer"); +return *Ptr; + } + + T *operator->() const { return Ptr; } + T *get() const { return Ptr; } + operator bool() const { return Ptr != 0; } + bool operator!() const { return Ptr == 0; } + + void swap(OwningPtr &RHS) { +T *Tmp = RHS.Ptr; +RHS.Ptr = Ptr; +Ptr = Tmp; + } +}; + +template +inline void swap(OwningPtr &a, OwningPtr &b) { + a.swap(b); +} + +} // end namespace llvm + +#endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [poolalloc] r45264 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp
Author: criswell Date: Thu Dec 20 13:47:14 2007 New Revision: 45264 URL: http://llvm.org/viewvc/llvm-project?rev=45264&view=rev Log: Updated to use PointerType::getUnqual() to get pointer types. 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=45264&r1=45263&r2=45264&view=diff == --- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original) +++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Thu Dec 20 13:47:14 2007 @@ -121,7 +121,7 @@ // argument node. DSNodeHandle& EndNH = Graph.getNodeForValue(&*(++(I->arg_begin(; EndNH.getNode()->clearNodeFlags()->setModifiedMarker(); -EndNH.getNode()->mergeTypeInfo(PointerType::get(Type::Int8Ty), +EndNH.getNode()->mergeTypeInfo(PointerType::getUnqual(Type::Int8Ty), EndNH.getOffset(), false); DSNodeHandle &Link = EndNH.getLink(0); Link.mergeWith(Str); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45266 - /llvm/trunk/include/llvm/ADT/OwningPtr.h
Author: kremenek Date: Thu Dec 20 13:53:47 2007 New Revision: 45266 URL: http://llvm.org/viewvc/llvm-project?rev=45266&view=rev Log: Added OwningArrayPtr smart pointer class to provide an analogous class to OwningPtr except that it works for pointers to arrays. Modified: llvm/trunk/include/llvm/ADT/OwningPtr.h Modified: llvm/trunk/include/llvm/ADT/OwningPtr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/OwningPtr.h?rev=45266&r1=45265&r2=45266&view=diff == --- llvm/trunk/include/llvm/ADT/OwningPtr.h (original) +++ llvm/trunk/include/llvm/ADT/OwningPtr.h Thu Dec 20 13:53:47 2007 @@ -74,6 +74,60 @@ a.swap(b); } +/// OwningArrayPtr smart pointer - OwningArrayPtr provides the same +/// functionality as OwningPtr, except that it works for array types. +template +class OwningArrayPtr { + OwningArrayPtr(OwningArrayPtr const &);// DO NOT IMPLEMENT + OwningArrayPtr &operator=(OwningArrayPtr const &); // DO NOT IMPLEMENT + T *Ptr; +public: + explicit OwningArrayPtr(T *P = 0) : Ptr(P) {} + + ~OwningArrayPtr() { +delete [] Ptr; + } + + /// reset - Change the current pointee to the specified pointer. Note that + /// calling this with any pointer (including a null pointer) deletes the + /// current pointer. + void reset(T *P = 0) { +if (P == Ptr) return; +T *Tmp = Ptr; +Ptr = P; +delete Tmp; + } + + /// take - Reset the owning pointer to null and return its pointer. This does + /// not delete the pointer before returning it. + T *take() { +T *Tmp = Ptr; +Ptr = 0; +return Tmp; + } + + T &operator[](std::ptrdiff_t i) const { +assert(Ptr && "Cannot dereference null pointer"); +return Ptr[i]; + } + + T *get() const { return Ptr; } + operator bool() const { return Ptr != 0; } + bool operator!() const { return Ptr == 0; } + + void swap(OwningArrayPtr &RHS) { +T *Tmp = RHS.Ptr; +RHS.Ptr = Ptr; +Ptr = Tmp; + } +}; + +template +inline void swap(OwningArrayPtr &a, OwningArrayPtr &b) { + a.swap(b); +} + + } // end namespace llvm #endif ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [poolalloc] r45267 - in /poolalloc/trunk/lib/PoolAllocate: AccessTrace.cpp Heuristic.cpp PointerCompress.cpp PoolAllocate.cpp PoolOptimize.cpp TransformFunctionBody.cpp
Author: criswell Date: Thu Dec 20 13:56:51 2007 New Revision: 45267 URL: http://llvm.org/viewvc/llvm-project?rev=45267&view=rev Log: Updated code to use PointerType::getUnqual() to get pointer types. Disabled the dependence of the ConvertUnsafeAllocas pass; this appears to be a performance hack that is not strictly needed and should be implemented within the SAFECode passes. Modified: poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp poolalloc/trunk/lib/PoolAllocate/PoolOptimize.cpp poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp?rev=45267&r1=45266&r2=45267&view=diff == --- poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/AccessTrace.cpp Thu Dec 20 13:56:51 2007 @@ -63,7 +63,7 @@ } void PoolAccessTrace::InitializeLibraryFunctions(Module &M) { - VoidPtrTy = PointerType::get(Type::Int8Ty); + VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); AccessTraceInitFn = M.getOrInsertFunction("poolaccesstraceinit", Type::VoidTy,NULL); Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp?rev=45267&r1=45266&r2=45267&view=diff == --- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Thu Dec 20 13:56:51 2007 @@ -311,7 +311,7 @@ } else if (N->isArray() && !N->isNodeCompletelyFolded()) { // We never pool allocate array nodes. PoolDescriptors[N] = -Constant::getNullValue(PointerType::get(PoolDescType)); +Constant::getNullValue(PointerType::getUnqual(PoolDescType)); ++NumNonprofit; #endif } else { @@ -349,7 +349,7 @@ // If this node has predecessors that are in different pools, don't // pool allocate this node. PoolDescriptors[N] = - Constant::getNullValue(PointerType::get(PoolDescType)); + Constant::getNullValue(PointerType::getUnqual(PoolDescType)); ++NumNonprofit; } else if (PredPool) { // If all of the predecessors of this node are already in a pool, @@ -370,7 +370,7 @@ // reason to pool allocate it, don't. assert(PredPool == 0); PoolDescriptors[N] = - Constant::getNullValue(PointerType::get(PoolDescType)); + Constant::getNullValue(PointerType::getUnqual(PoolDescType)); ++NumNonprofit; } } Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=45267&r1=45266&r2=45267&view=diff == --- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original) +++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Thu Dec 20 13:56:51 2007 @@ -690,7 +690,7 @@ // The compressed type for the pool. FIXME: NOTE: This only works if 'Val' // pointed to the start of a node! - const Type *NTy = PointerType::get(PI->getNewType()); + const Type *NTy = PointerType::getUnqual(PI->getNewType()); //Check if we have a pointer to an array of Original Types this happens if //you do a malloc of [n x OrigTy] for a pool of Type OrigTy @@ -699,7 +699,7 @@ cast(GEPI.getOperand(0)->getType())->getElementType(); if(isa(PT)) { if (cast(PT)->getElementType() == PI->getNode()->getType()) -NTy = PointerType::get(ArrayType::get(PI->getNewType(), +NTy = PointerType::getUnqual(ArrayType::get(PI->getNewType(), cast(PT)->getNumElements())); } } @@ -776,7 +776,7 @@ Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, LI.getOperand(0)->getName()+".pp", &LI); const Type *DestTy = LoadingCompressedPtr ? MEMUINTTYPE : LI.getType(); - SrcPtr = CastInst::createPointerCast(SrcPtr, PointerType::get(DestTy), + SrcPtr = CastInst::createPointerCast(SrcPtr, PointerType::getUnqual(DestTy), SrcPtr->getName(), &LI); std::string OldName = LI.getName(); LI.setName(""); Value *NewLoad = new LoadInst(SrcPtr, OldName, &LI); @@ -843,7 +843,7 @@ SI.getOperand(1)->getName()+".pp", &SI); DestPtr = CastInst::createPointe
[llvm-commits] [llvm] r45268 - in /llvm/trunk/lib/Target/X86: X86InstrFormats.td X86InstrSSE.td
Author: evancheng Date: Thu Dec 20 13:57:09 2007 New Revision: 45268 URL: http://llvm.org/viewvc/llvm-project?rev=45268&view=rev Log: Fix JIT encoding for CMPSD as well. Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=45268&r1=45267&r2=45268&view=diff == --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Thu Dec 20 13:57:09 2007 @@ -156,11 +156,15 @@ // SSE2 Instruction Templates: // // SDI - SSE2 instructions with XD prefix. +// SDIi8 - SSE2 instructions with ImmT == Imm8 and XD prefix. // PDI - SSE2 instructions with TB and OpSize prefixes. // PDIi8 - SSE2 instructions with ImmT == Imm8 and TB and OpSize prefixes. class SDI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XD, Requires<[HasSSE2]>; +class SDIi8 o, Format F, dag outs, dag ins, string asm, +list pattern> + : Ii8, XD, Requires<[HasSSE2]>; class PDI o, Format F, dag outs, dag ins, string asm, list pattern> : I, TB, OpSize, Requires<[HasSSE2]>; class PDIi8 o, Format F, dag outs, dag ins, string asm, Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=45268&r1=45267&r2=45268&view=diff == --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Thu Dec 20 13:57:09 2007 @@ -1085,10 +1085,10 @@ // Comparison instructions let isTwoAddress = 1 in { - def CMPSDrr : SDI<0xC2, MRMSrcReg, + def CMPSDrr : SDIi8<0xC2, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src1, FR64:$src, SSECC:$cc), "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; - def CMPSDrm : SDI<0xC2, MRMSrcMem, + def CMPSDrm : SDIi8<0xC2, MRMSrcMem, (outs FR64:$dst), (ins FR64:$src1, f64mem:$src, SSECC:$cc), "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; } @@ -1105,12 +1105,12 @@ // Aliases to match intrinsics which expect XMM operand(s). let isTwoAddress = 1 in { - def Int_CMPSDrr : SDI<0xC2, MRMSrcReg, + def Int_CMPSDrr : SDIi8<0xC2, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), "cmp${cc}sd\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, VR128:$src, imm:$cc))]>; - def Int_CMPSDrm : SDI<0xC2, MRMSrcMem, + def Int_CMPSDrm : SDIi8<0xC2, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f64mem:$src, SSECC:$cc), "cmp${cc}sd\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc-4.2] r45270 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Author: johannes Date: Thu Dec 20 16:52:10 2007 New Revision: 45270 URL: http://llvm.org/viewvc/llvm-project?rev=45270&view=rev Log: Assume unsized types do not have the same size in gcc and llvm. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45270&r1=45269&r2=45270&view=diff == --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Dec 20 16:52:10 2007 @@ -295,7 +295,7 @@ /// isSequentialCompatible - Return true if the specified gcc array or pointer /// type and the corresponding LLVM SequentialType lay out their components -/// identically in memory. +/// identically in memory. We assume that objects without a known size do not. bool isSequentialCompatible(tree_node *type) { assert((TREE_CODE(type) == ARRAY_TYPE || TREE_CODE(type) == POINTER_TYPE || @@ -303,7 +303,7 @@ // This relies on gcc types with constant size mapping to LLVM types with the // same size. It is possible for the component type not to have a size: // struct foo; extern foo bar[]; - return !TYPE_SIZE(TREE_TYPE(type)) || + return TYPE_SIZE(TREE_TYPE(type)) && isInt64(TYPE_SIZE(TREE_TYPE(type)), true); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45274 - /llvm/trunk/include/llvm/ADT/scoped_ptr.h
Author: kremenek Date: Thu Dec 20 18:15:29 2007 New Revision: 45274 URL: http://llvm.org/viewvc/llvm-project?rev=45274&view=rev Log: Removed scoped_ptr, as its functionality is subsumed by OwningPtr. Removed: llvm/trunk/include/llvm/ADT/scoped_ptr.h Removed: llvm/trunk/include/llvm/ADT/scoped_ptr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/scoped_ptr.h?rev=45273&view=auto == --- llvm/trunk/include/llvm/ADT/scoped_ptr.h (original) +++ llvm/trunk/include/llvm/ADT/scoped_ptr.h (removed) @@ -1,124 +0,0 @@ -//===- llvm/ADT/scoped_ptr.h - basic smart pointer --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// -// -// This file defines the scoped_ptr smart pointer: scoped_ptr mimics a built-in -// pointer except that it guarantees deletion of the object pointed to, either -// on destruction of the scoped_ptr or via an explicit reset(). scoped_ptr is a -// simple solution for simple needs. -// -//===--===// -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file llvm/docs/BOOST_LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt ) -// -// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm -// -#ifndef LLVM_SCOPED_PTR_H_INCLUDED -#define LLVM_SCOPED_PTR_H_INCLUDED - -#include - -namespace llvm { - -// verify that types are complete for increased safety -template -inline void checked_delete(T * x) { - // intentionally complex - simplification causes warnings in some compilers. - typedef char type_must_be_complete[sizeof(T) ? 1 : -1]; - (void)sizeof(type_must_be_complete); - delete x; -} - -/// scoped_ptr mimics a built-in pointer except that it guarantees deletion -/// of the object pointed to, either on destruction of the scoped_ptr or via -/// an explicit reset(). scoped_ptr is a simple solution for simple needs; -/// use shared_ptr or std::auto_ptr if your needs are more complex. -template -class scoped_ptr {// noncopyable - T *ptr; - scoped_ptr(scoped_ptr const &); // DO NOT IMPLEMENT - scoped_ptr & operator=(scoped_ptr const &); // DO NOT IMPLEMENT - typedef scoped_ptr this_type; -public: - typedef T element_type; - - explicit scoped_ptr(T * p = 0): ptr(p) {} // never throws - - ~scoped_ptr() { // never throws -llvm::checked_delete(ptr); - } - - /// reset - Change the current pointee to the specified pointer. Note that - /// calling this with any pointer (including a null pointer) deletes the - /// current pointer. - void reset(T *p = 0) { -// catch self-reset errors -assert((p == 0 || p != ptr) && "scoped_ptr: self-reset error"); -T *tmp = ptr; -ptr = p; -delete tmp; - } - - /// take - Reset the scoped pointer to null and return its pointer. This does - /// not delete the pointer before returning it. - T *take() { -T *P = ptr; -ptr = 0; -return P; - } - - T& operator*() const { -assert(ptr != 0 && "scoped_ptr: Trying to dereference a null pointer"); -return *ptr; - } - - T* operator->() const { -assert(ptr != 0 && "scoped_ptr: Trying to dereference a null pointer"); -return ptr; - } - - T* get() const { -return ptr; - } - - // implicit conversion to "bool" - typedef T * this_type::*unspecified_bool_type; - - operator unspecified_bool_type() const {// never throws -return ptr == 0? 0: &this_type::ptr; - } - - bool operator!() const { // never throws -return ptr == 0; - } - - void swap(scoped_ptr &b) {// never throws -T * tmp = b.ptr; -b.ptr = ptr; -ptr = tmp; - } -}; - -template inline void swap(scoped_ptr &a, scoped_ptr &b) { - // never throws - a.swap(b); -} - -// get_pointer(p) is a generic way to say p.get() -template inline T * get_pointer(scoped_ptr const &p) { - return p.get(); -} - -} // namespace llvm - -#endif // #ifndef LLVM_SCOPED_PTR_HPP_INCLUDED ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc-4.2] r45275 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Author: evancheng Date: Thu Dec 20 18:24:17 2007 New Revision: 45275 URL: http://llvm.org/viewvc/llvm-project?rev=45275&view=rev Log: Bug fix: parameter is i32 so create a v4i32 and then cast it to v8i16. 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=45275&r1=45274&r2=45275&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 Thu Dec 20 18:24:17 2007 @@ -191,6 +191,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psra_w); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); +Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); Result = Builder.CreateCall(psraw, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45278 - /llvm/trunk/include/llvm/IntrinsicsX86.td
Author: evancheng Date: Thu Dec 20 19:30:39 2007 New Revision: 45278 URL: http://llvm.org/viewvc/llvm-project?rev=45278&view=rev Log: Add a few more missing gcc builtin's. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=45278&r1=45277&r2=45278&view=diff == --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Thu Dec 20 19:30:39 2007 @@ -315,25 +315,25 @@ // Integer shift ops. let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". - def int_x86_sse2_psll_w : + def int_x86_sse2_psll_w : GCCBuiltin<"__builtin_ia32_psllw128">, Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, - llvm_v4i32_ty], [IntrNoMem]>; - def int_x86_sse2_psll_d : + llvm_v8i16_ty], [IntrNoMem]>; + def int_x86_sse2_psll_d : GCCBuiltin<"__builtin_ia32_pslld128">, Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>; - def int_x86_sse2_psll_q : + def int_x86_sse2_psll_q : GCCBuiltin<"__builtin_ia32_psllq128">, Intrinsic<[llvm_v2i64_ty, llvm_v2i64_ty, - llvm_v4i32_ty], [IntrNoMem]>; + llvm_v2i64_ty], [IntrNoMem]>; def int_x86_sse2_psll_dq : GCCBuiltin<"__builtin_ia32_pslldqi128">, Intrinsic<[llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem]>; - def int_x86_sse2_psrl_w : + def int_x86_sse2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw128">, Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty], [IntrNoMem]>; - def int_x86_sse2_psrl_d : + def int_x86_sse2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld128">, Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>; - def int_x86_sse2_psrl_q : + def int_x86_sse2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq128">, Intrinsic<[llvm_v2i64_ty, llvm_v2i64_ty, llvm_v4i32_ty], [IntrNoMem]>; def int_x86_sse2_psrl_dq : GCCBuiltin<"__builtin_ia32_psrldqi128">, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc-4.2] r45279 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Author: evancheng Date: Thu Dec 20 19:31:34 2007 New Revision: 45279 URL: http://llvm.org/viewvc/llvm-project?rev=45279&view=rev Log: More bug fixes: add necessary bitcast's. 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=45279&r1=45278&r2=45279&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 Thu Dec 20 19:31:34 2007 @@ -89,6 +89,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_w); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); +Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); Result = Builder.CreateCall(psllw, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; @@ -123,6 +124,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psll_q); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); +Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); Result = Builder.CreateCall(psllq, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; @@ -140,6 +142,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psrl_w); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); +Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); Result = Builder.CreateCall(psrlw, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; @@ -174,6 +177,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_psrl_q); Value *Undef = UndefValue::get(Type::Int32Ty); Ops[1] = BuildVector(Ops[1], Undef, Undef, Undef, NULL); +Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "tmp"); Result = Builder.CreateCall(psrlq, Ops.begin(), Ops.begin()+2, "tmp"); Result = Builder.CreateBitCast(Result, ResultType, "tmp"); return true; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45280 - /llvm/trunk/lib/Target/X86/README-SSE.txt
Author: evancheng Date: Thu Dec 20 19:31:58 2007 New Revision: 45280 URL: http://llvm.org/viewvc/llvm-project?rev=45280&view=rev Log: New entry. Modified: llvm/trunk/lib/Target/X86/README-SSE.txt Modified: llvm/trunk/lib/Target/X86/README-SSE.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=45280&r1=45279&r2=45280&view=diff == --- llvm/trunk/lib/Target/X86/README-SSE.txt (original) +++ llvm/trunk/lib/Target/X86/README-SSE.txt Thu Dec 20 19:31:58 2007 @@ -741,3 +741,18 @@ //===-===// + +#include +int t1(double d) { return signbit(d); } + +This currently compiles to: + subl$12, %esp + movsd 16(%esp), %xmm0 + movsd %xmm0, (%esp) + movl4(%esp), %eax + shrl$31, %eax + addl$12, %esp + ret + +We should use movmskp{s|d} instead. + ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits