From sabre at nondot.org Mon Sep 21 00:52:45 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 05:52:45 -0000 Subject: [llvm-commits] [llvm] r82438 - /llvm/trunk/include/llvm/Operator.h Message-ID: <200909210552.n8L5qj8L024293@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 00:52:45 2009 New Revision: 82438 URL: http://llvm.org/viewvc/llvm-project?rev=82438&view=rev Log: add a helper method. Modified: llvm/trunk/include/llvm/Operator.h Modified: llvm/trunk/include/llvm/Operator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Operator.h?rev=82438&r1=82437&r2=82438&view=diff ============================================================================== --- llvm/trunk/include/llvm/Operator.h (original) +++ llvm/trunk/include/llvm/Operator.h Mon Sep 21 00:52:45 2009 @@ -274,6 +274,18 @@ return true; } + /// hasAllConstantIndices - Return true if all of the indices of this GEP are + /// constant integers. If so, the result pointer and the first operand have + /// a constant offset between them. + bool hasAllConstantIndices() const { + for (const_op_iterator I = idx_begin(), E = idx_end(); I != E; ++I) { + if (!isa(I)) + return false; + } + return true; + } + + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GEPOperator *) { return true; } static inline bool classof(const GetElementPtrInst *) { return true; } From sabre at nondot.org Mon Sep 21 00:57:11 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 05:57:11 -0000 Subject: [llvm-commits] [llvm] r82439 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/rle.ll Message-ID: <200909210557.n8L5vCvo024902@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 00:57:11 2009 New Revision: 82439 URL: http://llvm.org/viewvc/llvm-project?rev=82439&view=rev Log: Improve GVN to be able to forward substitute a small load from a piece of a large store when both are in the same block. This allows clang to compile the testcase in PR4216 to this code: _test_bitfield: movl 4(%esp), %eax movl %eax, %ecx andl $-65536, %ecx orl $32962, %eax andl $40186, %eax orl %ecx, %eax ret This is not ideal, but is a whole lot better than the code produced by llvm-gcc: _test_bitfield: movw $-32574, %ax orw 4(%esp), %ax andw $-25350, %ax movw %ax, 4(%esp) movw 7(%esp), %cx shlw $8, %cx movzbl 6(%esp), %edx orw %cx, %dx movzwl %dx, %ecx shll $16, %ecx movzwl %ax, %eax orl %ecx, %eax ret and dramatically better than that produced by gcc 4.2: _test_bitfield: pushl %ebx call L3 "L00000000001$pb": L3: popl %ebx movl 8(%esp), %eax leal 0(,%eax,4), %edx sarb $7, %dl movl %eax, %ecx andl $7168, %ecx andl $-7201, %ebx movzbl %dl, %edx andl $1, %edx sall $5, %edx orl %ecx, %ebx orl %edx, %ebx andl $24, %eax andl $-58336, %ebx orl %eax, %ebx orl $32962, %ebx movl %ebx, %eax popl %ebx ret Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/test/Transforms/GVN/rle.ll Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82439&r1=82438&r2=82439&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 00:57:11 2009 @@ -23,6 +23,7 @@ #include "llvm/Function.h" #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" +#include "llvm/Operator.h" #include "llvm/Value.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DepthFirstIterator.h" @@ -38,6 +39,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" @@ -1341,6 +1343,153 @@ return true; } +/// GetBaseWithConstantOffset - Analyze the specified pointer to see if it can +/// be expressed as a base pointer plus a constant offset. Return the base and +/// offset to the caller. +static Value *GetBaseWithConstantOffset(Value *Ptr, int64_t &Offset, + const TargetData *TD) { + Operator *PtrOp = dyn_cast(Ptr); + if (PtrOp == 0) return Ptr; + + // Just look through bitcasts. + if (PtrOp->getOpcode() == Instruction::BitCast) + return GetBaseWithConstantOffset(PtrOp->getOperand(0), Offset, TD); + + // If this is a GEP with constant indices, we can look through it. + GEPOperator *GEP = dyn_cast(PtrOp); + if (GEP == 0 || !GEP->hasAllConstantIndices()) return Ptr; + + gep_type_iterator GTI = gep_type_begin(GEP); + for (User::op_iterator I = GEP->idx_begin(), E = GEP->idx_end(); I != E; + ++I, ++GTI) { + ConstantInt *OpC = cast(*I); + if (OpC->isZero()) continue; + + // Handle a struct and array indices which add their offset to the pointer. + if (const StructType *STy = dyn_cast(*GTI)) { + Offset += TD->getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); + } else { + uint64_t Size = TD->getTypeAllocSize(GTI.getIndexedType()); + Offset += OpC->getSExtValue()*Size; + } + } + + // Re-sign extend from the pointer size if needed to get overflow edge cases + // right. + unsigned PtrSize = TD->getPointerSizeInBits(); + if (PtrSize < 64) + Offset = (Offset << (64-PtrSize)) >> (64-PtrSize); + + return GetBaseWithConstantOffset(GEP->getPointerOperand(), Offset, TD); +} + + +/// HandleLoadFromClobberingStore - This function is called when we have a +/// memdep query of a load that ends up being a clobbering store. This means +/// that the store *may* provide bits used by the load but we can't be sure +/// because the pointers don't mustalias. Check this case to see if there is +/// anything more we can do before we give up. +static Value *HandleLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, + const TargetData *TD) { + int64_t StoreOffset = 0, LoadOffset = 0; + Value *StoreBase = + GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); + Value *LoadBase = + GetBaseWithConstantOffset(L->getPointerOperand(), LoadOffset, TD); + if (StoreBase != LoadBase) + return 0; + + // If the load and store are to the exact same address, they should have been + // a must alias. AA must have gotten confused. + // FIXME: Study to see if/when this happens. + if (LoadOffset == StoreOffset) { +#if 0 + errs() << "STORE/LOAD DEP WITH COMMON POINTER MISSED:\n" + << "Base = " << *StoreBase << "\n" + << "Store Ptr = " << *DepSI->getPointerOperand() << "\n" + << "Store Offs = " << StoreOffset << " - " << *DepSI << "\n" + << "Load Ptr = " << *L->getPointerOperand() << "\n" + << "Load Offs = " << LoadOffset << " - " << *L << "\n\n"; + errs() << "'" << L->getParent()->getParent()->getName() << "'" + << *L->getParent(); +#endif + return 0; + } + + // If the load and store don't overlap at all, the store doesn't provide + // anything to the load. In this case, they really don't alias at all, AA + // must have gotten confused. + // FIXME: Investigate cases where this bails out, e.g. rdar://7238614. Then + // remove this check, as it is duplicated with what we have below. + uint64_t StoreSize = TD->getTypeSizeInBits(DepSI->getOperand(0)->getType()); + uint64_t LoadSize = TD->getTypeSizeInBits(L->getType()); + + if ((StoreSize & 7) | (LoadSize & 7)) + return 0; + StoreSize >>= 3; // Convert to bytes. + LoadSize >>= 3; + + + bool isAAFailure = false; + if (StoreOffset < LoadOffset) { + isAAFailure = StoreOffset+int64_t(StoreSize) <= LoadOffset; + } else { + isAAFailure = LoadOffset+int64_t(LoadSize) <= StoreOffset; + } + if (isAAFailure) { +#if 0 + errs() << "STORE LOAD DEP WITH COMMON BASE:\n" + << "Base = " << *StoreBase << "\n" + << "Store Ptr = " << *DepSI->getPointerOperand() << "\n" + << "Store Offs = " << StoreOffset << " - " << *DepSI << "\n" + << "Load Ptr = " << *L->getPointerOperand() << "\n" + << "Load Offs = " << LoadOffset << " - " << *L << "\n\n"; + errs() << "'" << L->getParent()->getParent()->getName() << "'" + << *L->getParent(); +#endif + return 0; + } + + // If the Load isn't completely contained within the stored bits, we don't + // have all the bits to feed it. We could do something crazy in the future + // (issue a smaller load then merge the bits in) but this seems unlikely to be + // valuable. + if (StoreOffset > LoadOffset || + StoreOffset+StoreSize < LoadOffset+LoadSize) + return 0; + + // Adjust LoadOffset to be relative from the start of StoreOffset. + LoadOffset -= StoreOffset; + + Value *SrcVal = DepSI->getOperand(0); + + LLVMContext &Ctx = SrcVal->getType()->getContext(); + + // Compute which bits of the stored value are being used by the load. Convert + // to an integer type to start with. + if (isa(SrcVal->getType())) + SrcVal = new PtrToIntInst(SrcVal, TD->getIntPtrType(Ctx), "tmp", L); + if (!isa(SrcVal->getType())) + SrcVal = new BitCastInst(SrcVal, IntegerType::get(Ctx, StoreSize*8), "", L); + + // Shift the bits to the least significant depending on endianness. + unsigned ShiftAmt; + if (TD->isLittleEndian()) { + ShiftAmt = LoadOffset*8; + } else { + ShiftAmt = StoreSize-LoadSize-LoadOffset; + } + + SrcVal = BinaryOperator::CreateLShr(SrcVal, + ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", L); + + SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), "", L); + + return CoerceAvailableValueToLoadType(SrcVal, L->getType(), L, *TD); +} + + + /// processLoad - Attempt to eliminate a load, first by eliminating it /// locally, and then attempting non-local elimination if that fails. bool GVN::processLoad(LoadInst *L, SmallVectorImpl &toErase) { @@ -1352,7 +1501,12 @@ // If the value isn't available, don't do anything! if (Dep.isClobber()) { - // FIXME: In the future, we should handle things like: + // FIXME: We should handle memset/memcpy/memmove as dependent instructions + // to forward the value if available. + //if (isa(Dep.getInst())) + //errs() << "LOAD DEPENDS ON MEM: " << *L << "\n" << *Dep.getInst()<<"\n\n"; + + // Check to see if we have something like this: // store i32 123, i32* %P // %A = bitcast i32* %P to i8* // %B = gep i8* %A, i32 1 @@ -1362,6 +1516,21 @@ // a common base + constant offset, and if the previous store (or memset) // completely covers this load. This sort of thing can happen in bitfield // access code. + if (StoreInst *DepSI = dyn_cast(Dep.getInst())) + if (const TargetData *TD = getAnalysisIfAvailable()) + if (Value *AvailVal = HandleLoadFromClobberingStore(L, DepSI, TD)) { + DEBUG(errs() << "GVN COERCED STORE BITS:\n" << *DepSI << '\n' + << *AvailVal << '\n' << *L << "\n\n\n"); + + // Replace the load! + L->replaceAllUsesWith(AvailVal); + if (isa(AvailVal->getType())) + MD->invalidateCachedPointerInfo(AvailVal); + toErase.push_back(L); + NumGVNLoad++; + return true; + } + DEBUG( // fast print dep, using operator<< on instruction would be too slow errs() << "GVN: load "; @@ -1429,12 +1598,6 @@ return true; } - // FIXME: We should handle memset/memcpy/memmove as dependent instructions to - // forward the value if available. - //if (isa(DepInst)) - // errs() << "LOAD DEPENDS ON MEM: " << *L << "\n" << *DepInst << "\n\n"; - - // If this load really doesn't depend on anything, then we must be loading an // undef value. This can happen when loading for a fresh allocation with no // intervening stores, for example. Modified: llvm/trunk/test/Transforms/GVN/rle.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/rle.ll?rev=82439&r1=82438&r2=82439&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/rle.ll (original) +++ llvm/trunk/test/Transforms/GVN/rle.ll Mon Sep 21 00:57:11 2009 @@ -141,6 +141,35 @@ ; CHECK: ret i8 %A } +;; non-local i32/float -> i8 load forwarding. This also tests that the "P3" +;; bitcast equivalence can be properly phi translated. +define i8 @coerce_mustalias_nonlocal1(i32* %P, i1 %cond) { + %P2 = bitcast i32* %P to float* + br i1 %cond, label %T, label %F +T: + store i32 42, i32* %P + br label %Cont + +F: + store float 1.0, float* %P2 + br label %Cont + +Cont: + %P3 = bitcast i32* %P to i8* + %A = load i8* %P3 + ret i8 %A + +;; FIXME: This is disabled because this caused a miscompile in the llvm-gcc +;; bootstrap, see r82411 +; +; HECK: @coerce_mustalias_nonlocal1 +; HECK: Cont: +; HECK: %A = phi i8 [ +; HECK-NOT: load +; HECK: ret i8 %A +} + + ;; non-local i32 -> i8 partial redundancy load forwarding. define i8 @coerce_mustalias_pre0(i32* %P, i1 %cond) { %P3 = bitcast i32* %P to i8* @@ -165,3 +194,24 @@ ; CHECK: ret i8 %A } +;;===----------------------------------------------------------------------===;; +;; Store -> Load and Load -> Load forwarding where src and dst are different +;; types, and the reload is an offset from the store pointer. +;;===----------------------------------------------------------------------===;; + +;; i32 -> f32 forwarding. +define i8 @coerce_offset0(i32 %V, i32* %P) { + store i32 %V, i32* %P + + %P2 = bitcast i32* %P to i8* + %P3 = getelementptr i8* %P2, i32 2 + + %A = load i8* %P3 + ret i8 %A +; CHECK: @coerce_offset0 +; CHECK-NOT: load +; CHECK: ret i8 +} + + + From sabre at nondot.org Mon Sep 21 00:57:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 05:57:47 -0000 Subject: [llvm-commits] [llvm] r82440 - /llvm/trunk/test/Transforms/GVN/rle.ll Message-ID: <200909210557.n8L5vlci024988@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 00:57:47 2009 New Revision: 82440 URL: http://llvm.org/viewvc/llvm-project?rev=82440&view=rev Log: add pr# Modified: llvm/trunk/test/Transforms/GVN/rle.ll Modified: llvm/trunk/test/Transforms/GVN/rle.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/rle.ll?rev=82440&r1=82439&r2=82440&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/rle.ll (original) +++ llvm/trunk/test/Transforms/GVN/rle.ll Mon Sep 21 00:57:47 2009 @@ -200,6 +200,7 @@ ;;===----------------------------------------------------------------------===;; ;; i32 -> f32 forwarding. +;; PR4216 define i8 @coerce_offset0(i32 %V, i32* %P) { store i32 %V, i32* %P From daniel at zuster.org Mon Sep 21 00:58:35 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 21 Sep 2009 05:58:35 -0000 Subject: [llvm-commits] [llvm] r82441 - in /llvm/trunk/lib: ExecutionEngine/JIT/JITDwarfEmitter.cpp Target/ARM/ARMCodeEmitter.cpp Message-ID: <200909210558.n8L5waxL025137@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 00:58:35 2009 New Revision: 82441 URL: http://llvm.org/viewvc/llvm-project?rev=82441&view=rev Log: Register the MachineModuleInfo for the ARM JIT, and update JITDwarfEmitter to assert if the setModuleInfo hasn't been called. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=82441&r1=82440&r2=82441&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Mon Sep 21 00:58:35 2009 @@ -30,7 +30,7 @@ #include "llvm/Target/TargetRegisterInfo.h" using namespace llvm; -JITDwarfEmitter::JITDwarfEmitter(JIT& theJit) : Jit(theJit) {} +JITDwarfEmitter::JITDwarfEmitter(JIT& theJit) : MMI(0), Jit(theJit) {} unsigned char* JITDwarfEmitter::EmitDwarfTable(MachineFunction& F, @@ -38,6 +38,8 @@ unsigned char* StartFunction, unsigned char* EndFunction, unsigned char* &EHFramePtr) { + assert(MMI && "MachineModuleInfo not registered!"); + const TargetMachine& TM = F.getTarget(); TD = TM.getTargetData(); stackGrowthDirection = TM.getFrameInfo()->getStackGrowthDirection(); @@ -206,6 +208,8 @@ unsigned char* JITDwarfEmitter::EmitExceptionTable(MachineFunction* MF, unsigned char* StartFunction, unsigned char* EndFunction) const { + assert(MMI && "MachineModuleInfo not registered!"); + // Map all labels and get rid of any dead landing pads. MMI->TidyLandingPads(); Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=82441&r1=82440&r2=82441&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Mon Sep 21 00:58:35 2009 @@ -31,6 +31,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" @@ -67,6 +68,11 @@ const std::vector *MJTEs; bool IsPIC; + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); + MachineFunctionPass::getAnalysisUsage(AU); + } + public: static char ID; explicit Emitter(TargetMachine &tm, CodeEmitter &mce) @@ -204,6 +210,7 @@ MJTEs = &MF.getJumpTableInfo()->getJumpTables(); IsPIC = TM.getRelocationModel() == Reloc::PIC_; JTI->Initialize(MF, IsPIC); + MCE.setModuleInfo(&getAnalysis()); do { DEBUG(errs() << "JITTing function '" From sabre at nondot.org Mon Sep 21 01:04:08 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 06:04:08 -0000 Subject: [llvm-commits] [llvm] r82442 - /llvm/trunk/lib/Target/README.txt Message-ID: <200909210604.n8L648Kj025899@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 01:04:07 2009 New Revision: 82442 URL: http://llvm.org/viewvc/llvm-project?rev=82442&view=rev Log: add a note 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=82442&r1=82441&r2=82442&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Mon Sep 21 01:04:07 2009 @@ -220,7 +220,20 @@ ... which would only do one 32-bit XOR per loop iteration instead of two. It would also be nice to recognize the reg->size doesn't alias reg->node[i], but -alas... +alas. + +//===---------------------------------------------------------------------===// + +This should be optimized to one 'and' and one 'or', from PR4216: + +define i32 @test_bitfield(i32 %bf.prev.low) nounwind ssp { +entry: + %bf.prev.lo.cleared10 = or i32 %bf.prev.low, 32962 ; [#uses=1] + %0 = and i32 %bf.prev.low, -65536 ; [#uses=1] + %1 = and i32 %bf.prev.lo.cleared10, 40186 ; [#uses=1] + %2 = or i32 %1, %0 ; [#uses=1] + ret i32 %2 +} //===---------------------------------------------------------------------===// From sabre at nondot.org Mon Sep 21 01:22:46 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 06:22:46 -0000 Subject: [llvm-commits] [llvm] r82443 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200909210622.n8L6MkRo028216@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 01:22:46 2009 New Revision: 82443 URL: http://llvm.org/viewvc/llvm-project?rev=82443&view=rev Log: split HandleLoadFromClobberingStore in two pieces: one that does the analysis, one that does the xform. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82443&r1=82442&r2=82443&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 01:22:46 2009 @@ -1384,20 +1384,22 @@ } -/// HandleLoadFromClobberingStore - This function is called when we have a +/// AnalyzeLoadFromClobberingStore - This function is called when we have a /// memdep query of a load that ends up being a clobbering store. This means /// that the store *may* provide bits used by the load but we can't be sure /// because the pointers don't mustalias. Check this case to see if there is -/// anything more we can do before we give up. -static Value *HandleLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, - const TargetData *TD) { +/// anything more we can do before we give up. This returns -1 if we have to +/// give up, or a byte number in the stored value of the piece that feeds the +/// load. +static int AnalyzeLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, + const TargetData *TD) { int64_t StoreOffset = 0, LoadOffset = 0; Value *StoreBase = GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); Value *LoadBase = GetBaseWithConstantOffset(L->getPointerOperand(), LoadOffset, TD); if (StoreBase != LoadBase) - return 0; + return -1; // If the load and store are to the exact same address, they should have been // a must alias. AA must have gotten confused. @@ -1413,7 +1415,7 @@ errs() << "'" << L->getParent()->getParent()->getName() << "'" << *L->getParent(); #endif - return 0; + return -1; } // If the load and store don't overlap at all, the store doesn't provide @@ -1425,7 +1427,7 @@ uint64_t LoadSize = TD->getTypeSizeInBits(L->getType()); if ((StoreSize & 7) | (LoadSize & 7)) - return 0; + return -1; StoreSize >>= 3; // Convert to bytes. LoadSize >>= 3; @@ -1447,7 +1449,7 @@ errs() << "'" << L->getParent()->getParent()->getName() << "'" << *L->getParent(); #endif - return 0; + return -1; } // If the Load isn't completely contained within the stored bits, we don't @@ -1456,36 +1458,50 @@ // valuable. if (StoreOffset > LoadOffset || StoreOffset+StoreSize < LoadOffset+LoadSize) - return 0; + return -1; - // Adjust LoadOffset to be relative from the start of StoreOffset. - LoadOffset -= StoreOffset; + // Okay, we can do this transformation. Return the number of bytes into the + // store that the load is. + return LoadOffset-StoreOffset; +} - Value *SrcVal = DepSI->getOperand(0); +/// GetStoreValueForLoad - This function is called when we have a +/// memdep query of a load that ends up being a clobbering store. This means +/// that the store *may* provide bits used by the load but we can't be sure +/// because the pointers don't mustalias. Check this case to see if there is +/// anything more we can do before we give up. +static Value *GetStoreValueForLoad(Value *SrcVal, int Offset,const Type *LoadTy, + Instruction *InsertPt, const TargetData *TD){ LLVMContext &Ctx = SrcVal->getType()->getContext(); + + uint64_t StoreSize = TD->getTypeSizeInBits(SrcVal->getType())/8; + uint64_t LoadSize = TD->getTypeSizeInBits(LoadTy)/8; + // Compute which bits of the stored value are being used by the load. Convert // to an integer type to start with. if (isa(SrcVal->getType())) - SrcVal = new PtrToIntInst(SrcVal, TD->getIntPtrType(Ctx), "tmp", L); + SrcVal = new PtrToIntInst(SrcVal, TD->getIntPtrType(Ctx), "tmp", InsertPt); if (!isa(SrcVal->getType())) - SrcVal = new BitCastInst(SrcVal, IntegerType::get(Ctx, StoreSize*8), "", L); + SrcVal = new BitCastInst(SrcVal, IntegerType::get(Ctx, StoreSize*8), + "tmp", InsertPt); // Shift the bits to the least significant depending on endianness. unsigned ShiftAmt; if (TD->isLittleEndian()) { - ShiftAmt = LoadOffset*8; + ShiftAmt = Offset*8; } else { - ShiftAmt = StoreSize-LoadSize-LoadOffset; + ShiftAmt = StoreSize-LoadSize-Offset; } SrcVal = BinaryOperator::CreateLShr(SrcVal, - ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", L); + ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", InsertPt); - SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), "", L); + SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), + "tmp", InsertPt); - return CoerceAvailableValueToLoadType(SrcVal, L->getType(), L, *TD); + return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, *TD); } @@ -1517,8 +1533,11 @@ // completely covers this load. This sort of thing can happen in bitfield // access code. if (StoreInst *DepSI = dyn_cast(Dep.getInst())) - if (const TargetData *TD = getAnalysisIfAvailable()) - if (Value *AvailVal = HandleLoadFromClobberingStore(L, DepSI, TD)) { + if (const TargetData *TD = getAnalysisIfAvailable()) { + int Offset = AnalyzeLoadFromClobberingStore(L, DepSI, TD); + if (Offset != -1) { + Value *AvailVal = GetStoreValueForLoad(DepSI->getOperand(0), Offset, + L->getType(), L, TD); DEBUG(errs() << "GVN COERCED STORE BITS:\n" << *DepSI << '\n' << *AvailVal << '\n' << *L << "\n\n\n"); @@ -1530,6 +1549,7 @@ NumGVNLoad++; return true; } + } DEBUG( // fast print dep, using operator<< on instruction would be too slow From sabre at nondot.org Mon Sep 21 01:24:16 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 06:24:16 -0000 Subject: [llvm-commits] [llvm] r82444 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200909210624.n8L6OGBj028423@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 01:24:16 2009 New Revision: 82444 URL: http://llvm.org/viewvc/llvm-project?rev=82444&view=rev Log: move some functions, add a comment. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82444&r1=82443&r2=82444&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 01:24:16 2009 @@ -1022,9 +1022,173 @@ return new BitCastInst(StoredVal, LoadedTy, "bitcast", InsertPt); } +/// GetBaseWithConstantOffset - Analyze the specified pointer to see if it can +/// be expressed as a base pointer plus a constant offset. Return the base and +/// offset to the caller. +static Value *GetBaseWithConstantOffset(Value *Ptr, int64_t &Offset, + const TargetData *TD) { + Operator *PtrOp = dyn_cast(Ptr); + if (PtrOp == 0) return Ptr; + + // Just look through bitcasts. + if (PtrOp->getOpcode() == Instruction::BitCast) + return GetBaseWithConstantOffset(PtrOp->getOperand(0), Offset, TD); + + // If this is a GEP with constant indices, we can look through it. + GEPOperator *GEP = dyn_cast(PtrOp); + if (GEP == 0 || !GEP->hasAllConstantIndices()) return Ptr; + + gep_type_iterator GTI = gep_type_begin(GEP); + for (User::op_iterator I = GEP->idx_begin(), E = GEP->idx_end(); I != E; + ++I, ++GTI) { + ConstantInt *OpC = cast(*I); + if (OpC->isZero()) continue; + + // Handle a struct and array indices which add their offset to the pointer. + if (const StructType *STy = dyn_cast(*GTI)) { + Offset += TD->getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); + } else { + uint64_t Size = TD->getTypeAllocSize(GTI.getIndexedType()); + Offset += OpC->getSExtValue()*Size; + } + } + + // Re-sign extend from the pointer size if needed to get overflow edge cases + // right. + unsigned PtrSize = TD->getPointerSizeInBits(); + if (PtrSize < 64) + Offset = (Offset << (64-PtrSize)) >> (64-PtrSize); + + return GetBaseWithConstantOffset(GEP->getPointerOperand(), Offset, TD); +} + + +/// AnalyzeLoadFromClobberingStore - This function is called when we have a +/// memdep query of a load that ends up being a clobbering store. This means +/// that the store *may* provide bits used by the load but we can't be sure +/// because the pointers don't mustalias. Check this case to see if there is +/// anything more we can do before we give up. This returns -1 if we have to +/// give up, or a byte number in the stored value of the piece that feeds the +/// load. +static int AnalyzeLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, + const TargetData *TD) { + int64_t StoreOffset = 0, LoadOffset = 0; + Value *StoreBase = + GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); + Value *LoadBase = + GetBaseWithConstantOffset(L->getPointerOperand(), LoadOffset, TD); + if (StoreBase != LoadBase) + return -1; + + // If the load and store are to the exact same address, they should have been + // a must alias. AA must have gotten confused. + // FIXME: Study to see if/when this happens. + if (LoadOffset == StoreOffset) { +#if 0 + errs() << "STORE/LOAD DEP WITH COMMON POINTER MISSED:\n" + << "Base = " << *StoreBase << "\n" + << "Store Ptr = " << *DepSI->getPointerOperand() << "\n" + << "Store Offs = " << StoreOffset << " - " << *DepSI << "\n" + << "Load Ptr = " << *L->getPointerOperand() << "\n" + << "Load Offs = " << LoadOffset << " - " << *L << "\n\n"; + errs() << "'" << L->getParent()->getParent()->getName() << "'" + << *L->getParent(); +#endif + return -1; + } + + // If the load and store don't overlap at all, the store doesn't provide + // anything to the load. In this case, they really don't alias at all, AA + // must have gotten confused. + // FIXME: Investigate cases where this bails out, e.g. rdar://7238614. Then + // remove this check, as it is duplicated with what we have below. + uint64_t StoreSize = TD->getTypeSizeInBits(DepSI->getOperand(0)->getType()); + uint64_t LoadSize = TD->getTypeSizeInBits(L->getType()); + + if ((StoreSize & 7) | (LoadSize & 7)) + return -1; + StoreSize >>= 3; // Convert to bytes. + LoadSize >>= 3; + + + bool isAAFailure = false; + if (StoreOffset < LoadOffset) { + isAAFailure = StoreOffset+int64_t(StoreSize) <= LoadOffset; + } else { + isAAFailure = LoadOffset+int64_t(LoadSize) <= StoreOffset; + } + if (isAAFailure) { +#if 0 + errs() << "STORE LOAD DEP WITH COMMON BASE:\n" + << "Base = " << *StoreBase << "\n" + << "Store Ptr = " << *DepSI->getPointerOperand() << "\n" + << "Store Offs = " << StoreOffset << " - " << *DepSI << "\n" + << "Load Ptr = " << *L->getPointerOperand() << "\n" + << "Load Offs = " << LoadOffset << " - " << *L << "\n\n"; + errs() << "'" << L->getParent()->getParent()->getName() << "'" + << *L->getParent(); +#endif + return -1; + } + + // If the Load isn't completely contained within the stored bits, we don't + // have all the bits to feed it. We could do something crazy in the future + // (issue a smaller load then merge the bits in) but this seems unlikely to be + // valuable. + if (StoreOffset > LoadOffset || + StoreOffset+StoreSize < LoadOffset+LoadSize) + return -1; + + // Okay, we can do this transformation. Return the number of bytes into the + // store that the load is. + return LoadOffset-StoreOffset; +} + + +/// GetStoreValueForLoad - This function is called when we have a +/// memdep query of a load that ends up being a clobbering store. This means +/// that the store *may* provide bits used by the load but we can't be sure +/// because the pointers don't mustalias. Check this case to see if there is +/// anything more we can do before we give up. +static Value *GetStoreValueForLoad(Value *SrcVal, int Offset,const Type *LoadTy, + Instruction *InsertPt, const TargetData *TD){ + LLVMContext &Ctx = SrcVal->getType()->getContext(); + + uint64_t StoreSize = TD->getTypeSizeInBits(SrcVal->getType())/8; + uint64_t LoadSize = TD->getTypeSizeInBits(LoadTy)/8; + + + // Compute which bits of the stored value are being used by the load. Convert + // to an integer type to start with. + if (isa(SrcVal->getType())) + SrcVal = new PtrToIntInst(SrcVal, TD->getIntPtrType(Ctx), "tmp", InsertPt); + if (!isa(SrcVal->getType())) + SrcVal = new BitCastInst(SrcVal, IntegerType::get(Ctx, StoreSize*8), + "tmp", InsertPt); + + // Shift the bits to the least significant depending on endianness. + unsigned ShiftAmt; + if (TD->isLittleEndian()) { + ShiftAmt = Offset*8; + } else { + ShiftAmt = StoreSize-LoadSize-Offset; + } + + SrcVal = BinaryOperator::CreateLShr(SrcVal, + ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", InsertPt); + + SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), + "tmp", InsertPt); + + return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, *TD); +} + +/// GetAvailableBlockValues - Given the ValuesPerBlock list, convert all of the +/// available values to values of the expected LoadTy in their blocks and insert +/// the new values into BlockReplValues. static void GetAvailableBlockValues(DenseMap &BlockReplValues, - SmallVector, 16> &ValuesPerBlock, const Type *LoadTy, const TargetData *TD) { @@ -1343,169 +1507,6 @@ return true; } -/// GetBaseWithConstantOffset - Analyze the specified pointer to see if it can -/// be expressed as a base pointer plus a constant offset. Return the base and -/// offset to the caller. -static Value *GetBaseWithConstantOffset(Value *Ptr, int64_t &Offset, - const TargetData *TD) { - Operator *PtrOp = dyn_cast(Ptr); - if (PtrOp == 0) return Ptr; - - // Just look through bitcasts. - if (PtrOp->getOpcode() == Instruction::BitCast) - return GetBaseWithConstantOffset(PtrOp->getOperand(0), Offset, TD); - - // If this is a GEP with constant indices, we can look through it. - GEPOperator *GEP = dyn_cast(PtrOp); - if (GEP == 0 || !GEP->hasAllConstantIndices()) return Ptr; - - gep_type_iterator GTI = gep_type_begin(GEP); - for (User::op_iterator I = GEP->idx_begin(), E = GEP->idx_end(); I != E; - ++I, ++GTI) { - ConstantInt *OpC = cast(*I); - if (OpC->isZero()) continue; - - // Handle a struct and array indices which add their offset to the pointer. - if (const StructType *STy = dyn_cast(*GTI)) { - Offset += TD->getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); - } else { - uint64_t Size = TD->getTypeAllocSize(GTI.getIndexedType()); - Offset += OpC->getSExtValue()*Size; - } - } - - // Re-sign extend from the pointer size if needed to get overflow edge cases - // right. - unsigned PtrSize = TD->getPointerSizeInBits(); - if (PtrSize < 64) - Offset = (Offset << (64-PtrSize)) >> (64-PtrSize); - - return GetBaseWithConstantOffset(GEP->getPointerOperand(), Offset, TD); -} - - -/// AnalyzeLoadFromClobberingStore - This function is called when we have a -/// memdep query of a load that ends up being a clobbering store. This means -/// that the store *may* provide bits used by the load but we can't be sure -/// because the pointers don't mustalias. Check this case to see if there is -/// anything more we can do before we give up. This returns -1 if we have to -/// give up, or a byte number in the stored value of the piece that feeds the -/// load. -static int AnalyzeLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, - const TargetData *TD) { - int64_t StoreOffset = 0, LoadOffset = 0; - Value *StoreBase = - GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); - Value *LoadBase = - GetBaseWithConstantOffset(L->getPointerOperand(), LoadOffset, TD); - if (StoreBase != LoadBase) - return -1; - - // If the load and store are to the exact same address, they should have been - // a must alias. AA must have gotten confused. - // FIXME: Study to see if/when this happens. - if (LoadOffset == StoreOffset) { -#if 0 - errs() << "STORE/LOAD DEP WITH COMMON POINTER MISSED:\n" - << "Base = " << *StoreBase << "\n" - << "Store Ptr = " << *DepSI->getPointerOperand() << "\n" - << "Store Offs = " << StoreOffset << " - " << *DepSI << "\n" - << "Load Ptr = " << *L->getPointerOperand() << "\n" - << "Load Offs = " << LoadOffset << " - " << *L << "\n\n"; - errs() << "'" << L->getParent()->getParent()->getName() << "'" - << *L->getParent(); -#endif - return -1; - } - - // If the load and store don't overlap at all, the store doesn't provide - // anything to the load. In this case, they really don't alias at all, AA - // must have gotten confused. - // FIXME: Investigate cases where this bails out, e.g. rdar://7238614. Then - // remove this check, as it is duplicated with what we have below. - uint64_t StoreSize = TD->getTypeSizeInBits(DepSI->getOperand(0)->getType()); - uint64_t LoadSize = TD->getTypeSizeInBits(L->getType()); - - if ((StoreSize & 7) | (LoadSize & 7)) - return -1; - StoreSize >>= 3; // Convert to bytes. - LoadSize >>= 3; - - - bool isAAFailure = false; - if (StoreOffset < LoadOffset) { - isAAFailure = StoreOffset+int64_t(StoreSize) <= LoadOffset; - } else { - isAAFailure = LoadOffset+int64_t(LoadSize) <= StoreOffset; - } - if (isAAFailure) { -#if 0 - errs() << "STORE LOAD DEP WITH COMMON BASE:\n" - << "Base = " << *StoreBase << "\n" - << "Store Ptr = " << *DepSI->getPointerOperand() << "\n" - << "Store Offs = " << StoreOffset << " - " << *DepSI << "\n" - << "Load Ptr = " << *L->getPointerOperand() << "\n" - << "Load Offs = " << LoadOffset << " - " << *L << "\n\n"; - errs() << "'" << L->getParent()->getParent()->getName() << "'" - << *L->getParent(); -#endif - return -1; - } - - // If the Load isn't completely contained within the stored bits, we don't - // have all the bits to feed it. We could do something crazy in the future - // (issue a smaller load then merge the bits in) but this seems unlikely to be - // valuable. - if (StoreOffset > LoadOffset || - StoreOffset+StoreSize < LoadOffset+LoadSize) - return -1; - - // Okay, we can do this transformation. Return the number of bytes into the - // store that the load is. - return LoadOffset-StoreOffset; -} - - -/// GetStoreValueForLoad - This function is called when we have a -/// memdep query of a load that ends up being a clobbering store. This means -/// that the store *may* provide bits used by the load but we can't be sure -/// because the pointers don't mustalias. Check this case to see if there is -/// anything more we can do before we give up. -static Value *GetStoreValueForLoad(Value *SrcVal, int Offset,const Type *LoadTy, - Instruction *InsertPt, const TargetData *TD){ - LLVMContext &Ctx = SrcVal->getType()->getContext(); - - uint64_t StoreSize = TD->getTypeSizeInBits(SrcVal->getType())/8; - uint64_t LoadSize = TD->getTypeSizeInBits(LoadTy)/8; - - - // Compute which bits of the stored value are being used by the load. Convert - // to an integer type to start with. - if (isa(SrcVal->getType())) - SrcVal = new PtrToIntInst(SrcVal, TD->getIntPtrType(Ctx), "tmp", InsertPt); - if (!isa(SrcVal->getType())) - SrcVal = new BitCastInst(SrcVal, IntegerType::get(Ctx, StoreSize*8), - "tmp", InsertPt); - - // Shift the bits to the least significant depending on endianness. - unsigned ShiftAmt; - if (TD->isLittleEndian()) { - ShiftAmt = Offset*8; - } else { - ShiftAmt = StoreSize-LoadSize-Offset; - } - - SrcVal = BinaryOperator::CreateLShr(SrcVal, - ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", InsertPt); - - SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), - "tmp", InsertPt); - - return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, *TD); -} - - - /// processLoad - Attempt to eliminate a load, first by eliminating it /// locally, and then attempting non-local elimination if that fails. bool GVN::processLoad(LoadInst *L, SmallVectorImpl &toErase) { From evan.cheng at apple.com Mon Sep 21 01:25:18 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 06:25:18 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82445 - /llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 Message-ID: <200909210625.n8L6PImC028559@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 21 01:25:17 2009 New Revision: 82445 URL: http://llvm.org/viewvc/llvm-project?rev=82445&view=rev Log: Document -O means -O2 instead of -O1. Modified: llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 Modified: llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1?rev=82445&r1=82444&r2=82445&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 (original) +++ llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 Mon Sep 21 01:25:17 2009 @@ -27,6 +27,8 @@ Enables Link Time Optimization. Link Time Optimization is performed by ld(1) transparently using the LLVM optimizer. The object file generated contains intermediate LLVM bitcode instead of Mach-O objects. This option disables debugging information. .It Fl O4 Enables Link Time Optimization in addition to all optimizations enabled at -O3. +.It Fl O +Unlike gcc, -O means -O2 instead of -O1. .El .Pp .Sh SEE ALSO From sabre at nondot.org Mon Sep 21 01:30:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 06:30:24 -0000 Subject: [llvm-commits] [llvm] r82446 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200909210630.n8L6UOlj029192@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 01:30:24 2009 New Revision: 82446 URL: http://llvm.org/viewvc/llvm-project?rev=82446&view=rev Log: convert an std::pair to an explicit struct. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82446&r1=82445&r2=82446&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 01:30:24 2009 @@ -1183,19 +1183,32 @@ return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, *TD); } +struct AvailableValueInBlock { + /// BB - The basic block in question. + BasicBlock *BB; + /// V - The value that is live out of the block. + Value *V; + + static AvailableValueInBlock get(BasicBlock *BB, Value *V) { + AvailableValueInBlock Res; + Res.BB = BB; + Res.V = V; + return Res; + } +}; + /// GetAvailableBlockValues - Given the ValuesPerBlock list, convert all of the /// available values to values of the expected LoadTy in their blocks and insert /// the new values into BlockReplValues. static void GetAvailableBlockValues(DenseMap &BlockReplValues, - const SmallVector, 16> &ValuesPerBlock, + const SmallVector &ValuesPerBlock, const Type *LoadTy, const TargetData *TD) { for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) { - BasicBlock *BB = ValuesPerBlock[i].first; - Value *AvailableVal = ValuesPerBlock[i].second; + BasicBlock *BB = ValuesPerBlock[i].BB; + Value *AvailableVal = ValuesPerBlock[i].V; Value *&BlockEntry = BlockReplValues[BB]; if (BlockEntry) continue; @@ -1205,7 +1218,7 @@ AvailableVal = CoerceAvailableValueToLoadType(AvailableVal, LoadTy, BB->getTerminator(), *TD); DEBUG(errs() << "GVN COERCED NONLOCAL VAL:\n" - << *ValuesPerBlock[i].second << '\n' + << *ValuesPerBlock[i].V << '\n' << *AvailableVal << '\n' << "\n\n\n"); } BlockEntry = AvailableVal; @@ -1244,7 +1257,7 @@ // where we have a value available in repl, also keep track of whether we see // dependencies that produce an unknown value for the load (such as a call // that could potentially clobber the load). - SmallVector, 16> ValuesPerBlock; + SmallVector ValuesPerBlock; SmallVector UnavailableBlocks; const TargetData *TD = 0; @@ -1262,12 +1275,12 @@ // Loading the allocation -> undef. if (isa(DepInst) || isMalloc(DepInst)) { - ValuesPerBlock.push_back(std::make_pair(DepBB, - UndefValue::get(LI->getType()))); + ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, + UndefValue::get(LI->getType()))); continue; } - if (StoreInst* S = dyn_cast(DepInst)) { + if (StoreInst *S = dyn_cast(DepInst)) { // Reject loads and stores that are to the same address but are of // different types if we have to. if (S->getOperand(0)->getType() != LI->getType()) { @@ -1284,9 +1297,10 @@ } } - ValuesPerBlock.push_back(std::make_pair(DepBB, S->getOperand(0))); + ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, + S->getOperand(0))); - } else if (LoadInst* LD = dyn_cast(DepInst)) { + } else if (LoadInst *LD = dyn_cast(DepInst)) { // If the types mismatch and we can't handle it, reject reuse of the load. if (LD->getType() != LI->getType()) { if (TD == 0) @@ -1301,7 +1315,7 @@ continue; } } - ValuesPerBlock.push_back(std::make_pair(DepBB, LD)); + ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, LD)); } else { // FIXME: Handle memset/memcpy. UnavailableBlocks.push_back(DepBB); @@ -1332,7 +1346,8 @@ return true; } - ValuesPerBlock.push_back(std::make_pair((*I)->getParent(), *I)); + ValuesPerBlock.push_back(AvailableValueInBlock::get((*I)->getParent(), + *I)); } DEBUG(errs() << "GVN REMOVING NONLOCAL LOAD: " << *LI << '\n'); @@ -1397,13 +1412,13 @@ // to eliminate LI even if we insert uses in the other predecessors, we will // end up increasing code size. Reject this by scanning for LI. for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) - if (ValuesPerBlock[i].second == LI) + if (ValuesPerBlock[i].V == LI) return false; if (isSinglePred) { bool isHot = false; for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) - if (Instruction *I = dyn_cast(ValuesPerBlock[i].second)) + if (Instruction *I = dyn_cast(ValuesPerBlock[i].V)) // "Hot" Instruction is in some loop (because it dominates its dep. // instruction). if (DT->dominates(LI, I)) { @@ -1426,7 +1441,7 @@ DenseMap FullyAvailableBlocks; for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) - FullyAvailableBlocks[ValuesPerBlock[i].first] = true; + FullyAvailableBlocks[ValuesPerBlock[i].BB] = true; for (unsigned i = 0, e = UnavailableBlocks.size(); i != e; ++i) FullyAvailableBlocks[UnavailableBlocks[i]] = false; @@ -1489,7 +1504,7 @@ SmallPtrSet &p = phiMap[LI->getPointerOperand()]; for (SmallPtrSet::iterator I = p.begin(), E = p.end(); I != E; ++I) - ValuesPerBlock.push_back(std::make_pair((*I)->getParent(), *I)); + ValuesPerBlock.push_back(AvailableValueInBlock::get((*I)->getParent(), *I)); DenseMap BlockReplValues; GetAvailableBlockValues(BlockReplValues, ValuesPerBlock, LI->getType(), TD); From sabre at nondot.org Mon Sep 21 01:48:08 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 06:48:08 -0000 Subject: [llvm-commits] [llvm] r82447 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/rle.ll Message-ID: <200909210648.n8L6m8hA031426@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 01:48:08 2009 New Revision: 82447 URL: http://llvm.org/viewvc/llvm-project?rev=82447&view=rev Log: enable non-local analysis and PRE of large store -> little load. This doesn't kick in too much because of phi translation issues, but this can be resolved in the future. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/test/Transforms/GVN/rle.ll Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82447&r1=82446&r2=82447&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 01:48:08 2009 @@ -1026,7 +1026,7 @@ /// be expressed as a base pointer plus a constant offset. Return the base and /// offset to the caller. static Value *GetBaseWithConstantOffset(Value *Ptr, int64_t &Offset, - const TargetData *TD) { + const TargetData &TD) { Operator *PtrOp = dyn_cast(Ptr); if (PtrOp == 0) return Ptr; @@ -1046,16 +1046,16 @@ // Handle a struct and array indices which add their offset to the pointer. if (const StructType *STy = dyn_cast(*GTI)) { - Offset += TD->getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); + Offset += TD.getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); } else { - uint64_t Size = TD->getTypeAllocSize(GTI.getIndexedType()); + uint64_t Size = TD.getTypeAllocSize(GTI.getIndexedType()); Offset += OpC->getSExtValue()*Size; } } // Re-sign extend from the pointer size if needed to get overflow edge cases // right. - unsigned PtrSize = TD->getPointerSizeInBits(); + unsigned PtrSize = TD.getPointerSizeInBits(); if (PtrSize < 64) Offset = (Offset << (64-PtrSize)) >> (64-PtrSize); @@ -1071,12 +1071,12 @@ /// give up, or a byte number in the stored value of the piece that feeds the /// load. static int AnalyzeLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, - const TargetData *TD) { + const TargetData &TD) { int64_t StoreOffset = 0, LoadOffset = 0; Value *StoreBase = - GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); + GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); Value *LoadBase = - GetBaseWithConstantOffset(L->getPointerOperand(), LoadOffset, TD); + GetBaseWithConstantOffset(L->getPointerOperand(), LoadOffset, TD); if (StoreBase != LoadBase) return -1; @@ -1102,8 +1102,8 @@ // must have gotten confused. // FIXME: Investigate cases where this bails out, e.g. rdar://7238614. Then // remove this check, as it is duplicated with what we have below. - uint64_t StoreSize = TD->getTypeSizeInBits(DepSI->getOperand(0)->getType()); - uint64_t LoadSize = TD->getTypeSizeInBits(L->getType()); + uint64_t StoreSize = TD.getTypeSizeInBits(DepSI->getOperand(0)->getType()); + uint64_t LoadSize = TD.getTypeSizeInBits(L->getType()); if ((StoreSize & 7) | (LoadSize & 7)) return -1; @@ -1150,37 +1150,40 @@ /// that the store *may* provide bits used by the load but we can't be sure /// because the pointers don't mustalias. Check this case to see if there is /// anything more we can do before we give up. -static Value *GetStoreValueForLoad(Value *SrcVal, int Offset,const Type *LoadTy, - Instruction *InsertPt, const TargetData *TD){ +static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset, + const Type *LoadTy, + Instruction *InsertPt, const TargetData &TD){ LLVMContext &Ctx = SrcVal->getType()->getContext(); - uint64_t StoreSize = TD->getTypeSizeInBits(SrcVal->getType())/8; - uint64_t LoadSize = TD->getTypeSizeInBits(LoadTy)/8; + uint64_t StoreSize = TD.getTypeSizeInBits(SrcVal->getType())/8; + uint64_t LoadSize = TD.getTypeSizeInBits(LoadTy)/8; // Compute which bits of the stored value are being used by the load. Convert // to an integer type to start with. if (isa(SrcVal->getType())) - SrcVal = new PtrToIntInst(SrcVal, TD->getIntPtrType(Ctx), "tmp", InsertPt); + SrcVal = new PtrToIntInst(SrcVal, TD.getIntPtrType(Ctx), "tmp", InsertPt); if (!isa(SrcVal->getType())) SrcVal = new BitCastInst(SrcVal, IntegerType::get(Ctx, StoreSize*8), "tmp", InsertPt); // Shift the bits to the least significant depending on endianness. unsigned ShiftAmt; - if (TD->isLittleEndian()) { + if (TD.isLittleEndian()) { ShiftAmt = Offset*8; } else { ShiftAmt = StoreSize-LoadSize-Offset; } - SrcVal = BinaryOperator::CreateLShr(SrcVal, - ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", InsertPt); + if (ShiftAmt) + SrcVal = BinaryOperator::CreateLShr(SrcVal, + ConstantInt::get(SrcVal->getType(), ShiftAmt), "tmp", InsertPt); + + if (LoadSize != StoreSize) + SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), + "tmp", InsertPt); - SrcVal = new TruncInst(SrcVal, IntegerType::get(Ctx, LoadSize*8), - "tmp", InsertPt); - - return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, *TD); + return CoerceAvailableValueToLoadType(SrcVal, LoadTy, InsertPt, TD); } struct AvailableValueInBlock { @@ -1188,11 +1191,15 @@ BasicBlock *BB; /// V - The value that is live out of the block. Value *V; + /// Offset - The byte offset in V that is interesting for the load query. + unsigned Offset; - static AvailableValueInBlock get(BasicBlock *BB, Value *V) { + static AvailableValueInBlock get(BasicBlock *BB, Value *V, + unsigned Offset = 0) { AvailableValueInBlock Res; Res.BB = BB; Res.V = V; + Res.Offset = Offset; return Res; } }; @@ -1209,14 +1216,23 @@ for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) { BasicBlock *BB = ValuesPerBlock[i].BB; Value *AvailableVal = ValuesPerBlock[i].V; + unsigned Offset = ValuesPerBlock[i].Offset; Value *&BlockEntry = BlockReplValues[BB]; if (BlockEntry) continue; if (AvailableVal->getType() != LoadTy) { assert(TD && "Need target data to handle type mismatch case"); - AvailableVal = CoerceAvailableValueToLoadType(AvailableVal, LoadTy, - BB->getTerminator(), *TD); + AvailableVal = GetStoreValueForLoad(AvailableVal, Offset, LoadTy, + BB->getTerminator(), *TD); + + if (Offset) { + DEBUG(errs() << "GVN COERCED NONLOCAL VAL:\n" + << *ValuesPerBlock[i].V << '\n' + << *AvailableVal << '\n' << "\n\n\n"); + } + + DEBUG(errs() << "GVN COERCED NONLOCAL VAL:\n" << *ValuesPerBlock[i].V << '\n' << *AvailableVal << '\n' << "\n\n\n"); @@ -1267,6 +1283,24 @@ MemDepResult DepInfo = Deps[i].second; if (DepInfo.isClobber()) { + // If the dependence is to a store that writes to a superset of the bits + // read by the load, we can extract the bits we need for the load from the + // stored value. + if (StoreInst *DepSI = dyn_cast(DepInfo.getInst())) { + if (TD == 0) + TD = getAnalysisIfAvailable(); + if (TD) { + int Offset = AnalyzeLoadFromClobberingStore(LI, DepSI, *TD); + if (Offset != -1) { + ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, + DepSI->getOperand(0), + Offset)); + continue; + } + } + } + + // FIXME: Handle memset/memcpy. UnavailableBlocks.push_back(DepBB); continue; } @@ -1299,8 +1333,10 @@ ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, S->getOperand(0))); - - } else if (LoadInst *LD = dyn_cast(DepInst)) { + continue; + } + + if (LoadInst *LD = dyn_cast(DepInst)) { // If the types mismatch and we can't handle it, reject reuse of the load. if (LD->getType() != LI->getType()) { if (TD == 0) @@ -1316,11 +1352,11 @@ } } ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, LD)); - } else { - // FIXME: Handle memset/memcpy. - UnavailableBlocks.push_back(DepBB); continue; } + + UnavailableBlocks.push_back(DepBB); + continue; } // If we have no predecessors that produce a known value for this load, exit @@ -1550,10 +1586,10 @@ // access code. if (StoreInst *DepSI = dyn_cast(Dep.getInst())) if (const TargetData *TD = getAnalysisIfAvailable()) { - int Offset = AnalyzeLoadFromClobberingStore(L, DepSI, TD); + int Offset = AnalyzeLoadFromClobberingStore(L, DepSI, *TD); if (Offset != -1) { Value *AvailVal = GetStoreValueForLoad(DepSI->getOperand(0), Offset, - L->getType(), L, TD); + L->getType(), L, *TD); DEBUG(errs() << "GVN COERCED STORE BITS:\n" << *DepSI << '\n' << *AvailVal << '\n' << *L << "\n\n\n"); Modified: llvm/trunk/test/Transforms/GVN/rle.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/rle.ll?rev=82447&r1=82446&r2=82447&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/rle.ll (original) +++ llvm/trunk/test/Transforms/GVN/rle.ll Mon Sep 21 01:48:08 2009 @@ -199,7 +199,7 @@ ;; types, and the reload is an offset from the store pointer. ;;===----------------------------------------------------------------------===;; -;; i32 -> f32 forwarding. +;; i32 -> i8 forwarding. ;; PR4216 define i8 @coerce_offset0(i32 %V, i32* %P) { store i32 %V, i32* %P @@ -214,5 +214,55 @@ ; CHECK: ret i8 } +;; non-local i32/float -> i8 load forwarding. +define i8 @coerce_offset_nonlocal0(i32* %P, i1 %cond) { + %P2 = bitcast i32* %P to float* + %P3 = bitcast i32* %P to i8* + %P4 = getelementptr i8* %P3, i32 2 + br i1 %cond, label %T, label %F +T: + store i32 42, i32* %P + br label %Cont + +F: + store float 1.0, float* %P2 + br label %Cont + +Cont: + %A = load i8* %P4 + ret i8 %A + +; CHECK: @coerce_offset_nonlocal0 +; CHECK: Cont: +; CHECK: %A = phi i8 [ +; CHECK-NOT: load +; CHECK: ret i8 %A +} + + +;; non-local i32 -> i8 partial redundancy load forwarding. +define i8 @coerce_offset_pre0(i32* %P, i1 %cond) { + %P3 = bitcast i32* %P to i8* + %P4 = getelementptr i8* %P3, i32 2 + br i1 %cond, label %T, label %F +T: + store i32 42, i32* %P + br label %Cont + +F: + br label %Cont + +Cont: + %A = load i8* %P4 + ret i8 %A + +; CHECK: @coerce_offset_pre0 +; CHECK: F: +; CHECK: load i8* %P4 +; CHECK: Cont: +; CHECK: %A = phi i8 [ +; CHECK-NOT: load +; CHECK: ret i8 %A +} From stoklund at 2pi.dk Mon Sep 21 02:19:08 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 21 Sep 2009 07:19:08 -0000 Subject: [llvm-commits] [llvm] r82448 - /llvm/trunk/lib/CodeGen/MachineVerifier.cpp Message-ID: <200909210719.n8L7J9vb002821@zion.cs.uiuc.edu> Author: stoklund Date: Mon Sep 21 02:19:08 2009 New Revision: 82448 URL: http://llvm.org/viewvc/llvm-project?rev=82448&view=rev Log: Verify that phi instructions refer to MBBs in the CFG. The machine code verifier no longer tolerates phi instructions with noop operands. All MBBs on a phi instruction must be in the CFG. Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp Modified: llvm/trunk/lib/CodeGen/MachineVerifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineVerifier.cpp?rev=82448&r1=82447&r2=82448&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineVerifier.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineVerifier.cpp Mon Sep 21 02:19:08 2009 @@ -592,13 +592,14 @@ } break; } - // Can PHI instrs refer to MBBs not in the CFG? X86 and ARM do. - // case MachineOperand::MO_MachineBasicBlock: - // if (MI->getOpcode() == TargetInstrInfo::PHI) { - // if (!MO->getMBB()->isSuccessor(MI->getParent())) - // report("PHI operand is not in the CFG", MO, MONum); - // } - // break; + + case MachineOperand::MO_MachineBasicBlock: + if (MI->getOpcode() == TargetInstrInfo::PHI) { + if (!MO->getMBB()->isSuccessor(MI->getParent())) + report("PHI operand is not in the CFG", MO, MONum); + } + break; + default: break; } From xerxes at zafena.se Mon Sep 21 03:08:31 2009 From: xerxes at zafena.se (Xerxes Ranby) Date: Mon, 21 Sep 2009 08:08:31 -0000 Subject: [llvm-commits] [llvm] r82449 - /llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt Message-ID: <200909210808.n8L88Vsr022284@zion.cs.uiuc.edu> Author: xranby Date: Mon Sep 21 03:08:29 2009 New Revision: 82449 URL: http://llvm.org/viewvc/llvm-project?rev=82449&view=rev Log: Update cmake. Modified: llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt Modified: llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt?rev=82449&r1=82448&r2=82449&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt Mon Sep 21 03:08:29 2009 @@ -4,6 +4,7 @@ add_llvm_library(LLVMJIT Intercept.cpp JIT.cpp + JITDebugRegisterer.cpp JITDwarfEmitter.cpp JITEmitter.cpp JITMemoryManager.cpp From baldrick at free.fr Mon Sep 21 04:40:08 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 09:40:08 -0000 Subject: [llvm-commits] [gcc-plugin] r82450 - in /gcc-plugin/trunk/utils: ./ target.cpp Message-ID: <200909210940.n8L9e9vi002094@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 04:40:06 2009 New Revision: 82450 URL: http://llvm.org/viewvc/llvm-project?rev=82450&view=rev Log: Add a helper for printing info extracted from the target triple. Added: gcc-plugin/trunk/utils/ gcc-plugin/trunk/utils/target.cpp Added: gcc-plugin/trunk/utils/target.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/utils/target.cpp?rev=82450&view=auto ============================================================================== --- gcc-plugin/trunk/utils/target.cpp (added) +++ gcc-plugin/trunk/utils/target.cpp Mon Sep 21 04:40:06 2009 @@ -0,0 +1,68 @@ +#include +#include + +#include + +using namespace llvm; + +static void PrintTriple(Triple &T) { + std::cout << T.getTriple() << "\n"; +} +static void PrintArchName(Triple &T) { + std::cout << T.getArchName().str() << "\n"; +} +static void PrintVendorName(Triple &T) { + std::cout << T.getVendorName().str() << "\n"; +} +static void PrintOSName(Triple &T) { + std::cout << T.getOSName().str() << "\n"; +} +static void PrintEnvironmentName(Triple &T) { + std::cout << T.getEnvironmentName().str() << "\n"; +} +static void PrintOSAndEnvironmentName(Triple &T) { + std::cout << T.getOSAndEnvironmentName().str() << "\n"; +} +static void PrintArchTypePrefix(Triple &T) { + std::cout << T.getArchTypePrefix(T.getArch()) << "\n"; +} + +struct Option { + const char *Name; + void (*Action)(Triple &); +}; + +static Option Options[] = { + { "-t", PrintTriple }, + { "-a", PrintArchName }, + { "-v", PrintVendorName }, + { "-o", PrintOSName }, + { "-e", PrintEnvironmentName }, + { "-oe", PrintOSAndEnvironmentName }, + { "-p", PrintArchTypePrefix }, + { NULL, NULL } +}; + +int main(int argc, char **argv) { + Triple T(TARGET_NAME); + + for (int i = 1; i < argc; ++i) { + bool Found = false; + for (Option *O = Options; O->Name; ++O) + if (!strcmp(argv[i], O->Name)) { + Found = true; + O->Action(T); + break; + } + if (!Found) { + std::cerr << "Unknown option \"" << argv[i] << "\"\n"; + std::cerr << "Usage: " << argv[0]; + for (Option *O = Options; O->Name; ++O) + std::cerr << " " << O->Name; + std::cerr << "\n"; + return 1; + } + } + + return 0; +} From baldrick at free.fr Mon Sep 21 05:29:28 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 10:29:28 -0000 Subject: [llvm-commits] [gcc-plugin] r82451 - in /gcc-plugin/trunk: Makefile get_arch_dir i386/ x86/ x86/llvm-target.cpp x86/llvm-target.h Message-ID: <200909211029.n8LATS7w008698@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 05:29:27 2009 New Revision: 82451 URL: http://llvm.org/viewvc/llvm-project?rev=82451&view=rev Log: Rename the i386 directory to x86. GCC uses i386, but LLVM uses x86. Don't get the target directory using GCC's config.gcc, use the new target util instead. Added: gcc-plugin/trunk/x86/ - copied from r81761, gcc-plugin/trunk/i386/ gcc-plugin/trunk/x86/llvm-target.cpp - copied unchanged from r82316, gcc-plugin/trunk/i386/llvm-target.cpp gcc-plugin/trunk/x86/llvm-target.h - copied unchanged from r82316, gcc-plugin/trunk/i386/llvm-target.h Removed: gcc-plugin/trunk/get_arch_dir gcc-plugin/trunk/i386/ Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=82451&r1=82450&r2=82451&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Mon Sep 21 05:29:27 2009 @@ -1,34 +1,60 @@ GCCSOURCE_DIR=$(HOME)/GCC/src/ GCCOBJECT_DIR=$(HOME)/GCC/objects/ -#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin) +# Point LLVM_CONFIG to the just built llvm-config to use an LLVM build rather +# than the installed version of LLVM. +LLVM_CONFIG=llvm-config # Replace with an informative string when doing a release. REVISION:=$(shell svnversion -n .) - TARGET_TRIPLE:=$(shell $(GCCOBJECT_DIR)/gcc/xgcc -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//") -ARCH_DIR:=$(shell TARGET_TRIPLE=$(TARGET_TRIPLE) GCCSOURCE_DIR=$(GCCSOURCE_DIR) $(SHELL) ./get_arch_dir) -C_SOURCE_FILES=llvm-cache.c -CPP_SOURCE_FILES=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp \ - $(ARCH_DIR)/llvm-target.cpp llvm-types.cpp bits_and_bobs.cpp -PLUGIN_OBJECT_FILES=$(C_SOURCE_FILES:.c=.o) $(CPP_SOURCE_FILES:.cpp=.o) +PLUGIN=llvm.so +PLUGIN_C=llvm-cache.c +PLUGIN_CPP=llvm-convert.cpp llvm-backend.cpp llvm-debug.cpp llvm-types.cpp \ + bits_and_bobs.cpp +PLUGIN_C_OBJECTS=$(PLUGIN_C:.c=.o) +PLUGIN_CPP_OBJECTS=$(PLUGIN_CPP:.cpp=.o) +PLUGIN_OBJECTS=$(PLUGIN_C_OBJECTS) $(PLUGIN_CPP_OBJECTS) + +TARGET_CPP=$(shell $(TARGET_UTIL) -p)/llvm-target.cpp +TARGET_OBJECT=llvm-target.o + +TARGET_UTIL=./target +TARGET_UTIL_OBJECTS=utils/target.o GENGTYPE_INPUT=$(PWD)/llvm-cache.c GENGTYPE_OUTPUT=$(PWD)/gt-llvm-cache.h CFLAGS+=-Wall -Werror -fPIC -g -O2 -CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" \ - -DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR) -CFLAGS+=-I$(GCCOBJECT_DIR)/gcc -I$(GCCOBJECT_DIR)/gcc/include \ - -I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \ - -I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \ - -I$(GCCOBJECT_DIR)/libdecnumber -I. -CXXFLAGS+=$(CFLAGS) $(shell llvm-config --cppflags) +CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" -DTARGET_NAME=\"$(TARGET_TRIPLE)\" +CXXFLAGS+=$(CFLAGS) $(shell $(LLVM_CONFIG) --cppflags) + +LDFLAGS+=$(shell $(LLVM_CONFIG) --libs analysis core ipo scalaropts target) \ + $(shell $(LLVM_CONFIG) --ldflags) + +PLUGIN_CFLAGS+=-I$(GCCOBJECT_DIR)/gcc -I$(GCCOBJECT_DIR)/gcc/include \ + -I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \ + -I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \ + -I$(GCCOBJECT_DIR)/libdecnumber -I$(shell $(TARGET_UTIL) -p) +PLUGIN_CXXFLAGS+=$(PLUGIN_CFLAGS) + +default: $(PLUGIN) + +$(TARGET_UTIL): $(TARGET_UTIL_OBJECTS) + $(CXX) $^ -o $@ $(CXXFLAGS) $(LDFLAGS) + +$(PLUGIN_C_OBJECTS): %.o : %.c + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PLUGIN_CFLAGS) $< + +$(PLUGIN_CPP_OBJECTS): %.o : %.cpp + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) $< -LDFLAGS+=$(shell llvm-config --ldflags) $(shell llvm-config --libs analysis core ipo scalaropts target x86) +$(TARGET_OBJECT): + $(CXX) -c $(TARGET_CPP) -o $@ $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) -I. -llvm.so: $(PLUGIN_OBJECT_FILES) - $(CXX) -shared $^ -o $@ $(LDFLAGS) +$(PLUGIN): $(TARGET_UTIL) $(PLUGIN_OBJECTS) $(TARGET_OBJECT) + $(CXX) -shared $(PLUGIN_OBJECTS) $(TARGET_OBJECT) -o $@ $(LDFLAGS) \ + $(shell $(LLVM_CONFIG) --libs $(shell $(TARGET_UTIL) -p)) llvm-cache.o: gt-llvm-cache.h @@ -40,4 +66,4 @@ sed -i "s/ggc_root_tab .*\[\]/ggc_root_tab gt_pch_rc__gt_llvm_cache_h[]/" $(GENGTYPE_OUTPUT) clean:: - rm -f *.o *.so $(ARCH_DIR)/*.o + rm -f *.o */*.o $(PLUGIN) $(TARGET_UTIL) Removed: gcc-plugin/trunk/get_arch_dir URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/get_arch_dir?rev=82450&view=auto ============================================================================== --- gcc-plugin/trunk/get_arch_dir (original) +++ gcc-plugin/trunk/get_arch_dir (removed) @@ -1,3 +0,0 @@ -export target=$TARGET_TRIPLE -. $GCCSOURCE_DIR/gcc/config.gcc -echo $cpu_type From baldrick at free.fr Mon Sep 21 07:12:04 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 12:12:04 -0000 Subject: [llvm-commits] [gcc-plugin] r82452 - /gcc-plugin/trunk/llvm-backend.cpp Message-ID: <200909211212.n8LCC5B4022000@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 07:12:03 2009 New Revision: 82452 URL: http://llvm.org/viewvc/llvm-project?rev=82452&view=rev Log: In the plugin, it's not the gcc backend that specifies the target. Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=82452&r1=82451&r2=82452&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Mon Sep 21 07:12:03 2009 @@ -286,7 +286,7 @@ //TODO} #ifndef LLVM_TARGET_NAME -#error LLVM_TARGET_NAME macro not specified by GCC backend +#error LLVM_TARGET_NAME macro not specified #endif namespace llvm { From baldrick at free.fr Mon Sep 21 08:35:50 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 13:35:50 -0000 Subject: [llvm-commits] [gcc-plugin] r82453 - in /gcc-plugin/trunk: Makefile darwin/ darwin/llvm-os.h linux/ linux/llvm-os.h llvm-backend.cpp Message-ID: <200909211335.n8LDZoVn032522@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 08:35:50 2009 New Revision: 82453 URL: http://llvm.org/viewvc/llvm-project?rev=82453&view=rev Log: Add support for -fpic. Added: gcc-plugin/trunk/darwin/ gcc-plugin/trunk/darwin/llvm-os.h gcc-plugin/trunk/linux/ gcc-plugin/trunk/linux/llvm-os.h Modified: gcc-plugin/trunk/Makefile gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=82453&r1=82452&r2=82453&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Mon Sep 21 08:35:50 2009 @@ -35,7 +35,8 @@ PLUGIN_CFLAGS+=-I$(GCCOBJECT_DIR)/gcc -I$(GCCOBJECT_DIR)/gcc/include \ -I$(GCCSOURCE_DIR)/gcc -I$(GCCSOURCE_DIR)/include \ -I$(GCCSOURCE_DIR)/libcpp/include -I$(GCCSOURCE_DIR)/libdecnumber \ - -I$(GCCOBJECT_DIR)/libdecnumber -I$(shell $(TARGET_UTIL) -p) + -I$(GCCOBJECT_DIR)/libdecnumber -I$(shell $(TARGET_UTIL) -p) \ + -I$(shell $(TARGET_UTIL) -o) PLUGIN_CXXFLAGS+=$(PLUGIN_CFLAGS) default: $(PLUGIN) Added: gcc-plugin/trunk/darwin/llvm-os.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/darwin/llvm-os.h?rev=82453&view=auto ============================================================================== --- gcc-plugin/trunk/darwin/llvm-os.h (added) +++ gcc-plugin/trunk/darwin/llvm-os.h Mon Sep 21 08:35:50 2009 @@ -0,0 +1,45 @@ +/* Darwin specific definitions +Copyright (C) 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#ifndef LLVM_OS_H +#define LLVM_OS_H + +/* Darwin X86-64 only supports PIC code generation. */ +#if defined (TARGET_386) +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if ((TARGET_64BIT) || flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") +#elif defined (TARGET_ARM) +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static"); \ +#else /* !TARGET_386 && !TARGET_ARM */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") +#endif /* !TARGET_386 && !TARGET_ARM */ + +#endif /* LLVM_OS_H */ Added: gcc-plugin/trunk/linux/llvm-os.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/linux/llvm-os.h?rev=82453&view=auto ============================================================================== --- gcc-plugin/trunk/linux/llvm-os.h (added) +++ gcc-plugin/trunk/linux/llvm-os.h Mon Sep 21 08:35:50 2009 @@ -0,0 +1,31 @@ +/* Linux specific definitions +Copyright (C) 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#ifndef LLVM_OS_H +#define LLVM_OS_H + +/* Yes, we support PIC codegen for linux targets! */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else \ + argvec.push_back ("--relocation-model=static"); + +#endif /* LLVM_OS_H */ Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=82453&r1=82452&r2=82453&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Mon Sep 21 08:35:50 2009 @@ -86,6 +86,7 @@ #include "llvm-internal.h" #include "llvm-debug.h" #include "llvm-target.h" +#include "llvm-os.h" #include "bits_and_bobs.h" extern "C" { #include "llvm-cache.h" @@ -324,9 +325,9 @@ //TODO#ifdef LLVM_SET_RED_ZONE_FLAG //TODO LLVM_SET_RED_ZONE_FLAG(flag_disable_red_zone) //TODO#endif -//TODO#ifdef LLVM_SET_TARGET_OPTIONS -//TODO LLVM_SET_TARGET_OPTIONS(Args); -//TODO#endif +#ifdef LLVM_SET_TARGET_OPTIONS + LLVM_SET_TARGET_OPTIONS(Args); +#endif //TODO#ifdef LLVM_SET_MACHINE_OPTIONS //TODO LLVM_SET_MACHINE_OPTIONS(Args); //TODO#endif From nunoplopes at sapo.pt Mon Sep 21 09:11:56 2009 From: nunoplopes at sapo.pt (Nuno Lopes) Date: Mon, 21 Sep 2009 14:11:56 -0000 Subject: [llvm-commits] [llvm] r82454 - /llvm/trunk/lib/VMCore/Mangler.cpp Message-ID: <200909211411.n8LEBu0h004766@zion.cs.uiuc.edu> Author: nlopes Date: Mon Sep 21 09:11:56 2009 New Revision: 82454 URL: http://llvm.org/viewvc/llvm-project?rev=82454&view=rev Log: initialize SymbolsCanStartWithDigit to false by default Modified: llvm/trunk/lib/VMCore/Mangler.cpp Modified: llvm/trunk/lib/VMCore/Mangler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=82454&r1=82453&r2=82454&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Mangler.cpp (original) +++ llvm/trunk/lib/VMCore/Mangler.cpp Mon Sep 21 09:11:56 2009 @@ -208,7 +208,7 @@ const char *linkerPrivatePrefix) : Prefix(prefix), PrivatePrefix(privatePrefix), LinkerPrivatePrefix(linkerPrivatePrefix), UseQuotes(false), - NextAnonGlobalID(1) { + SymbolsCanStartWithDigit(false), NextAnonGlobalID(1) { std::fill(AcceptableChars, array_endof(AcceptableChars), 0); // Letters and numbers are acceptable. From gohman at apple.com Mon Sep 21 10:18:33 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 15:18:33 -0000 Subject: [llvm-commits] [llvm] r82455 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Message-ID: <200909211518.n8LFIX9R013487@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 10:18:33 2009 New Revision: 82455 URL: http://llvm.org/viewvc/llvm-project?rev=82455&view=rev Log: Fix this assertion string to mention subreg_to_reg. 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=82455&r1=82454&r2=82455&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Sep 21 10:18:33 2009 @@ -1296,8 +1296,8 @@ if (SrcSubIdx && SrcSubIdx != DstSubIdx) { // r1025 = INSERT_SUBREG r1025, r1024<2>, 2 Then r1024 has already been // coalesced to a larger register so the subreg indices cancel out. - DEBUG(errs() << "\tSource of insert_subreg is already coalesced " - << "to another register.\n"); + DEBUG(errs() << "\tSource of insert_subreg or subreg_to_reg is already " + "coalesced to another register.\n"); return false; // Not coalescable. } } else if (!tii_->isMoveInstr(*CopyMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)){ From foldr at codedgers.com Mon Sep 21 10:53:44 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Mon, 21 Sep 2009 15:53:44 -0000 Subject: [llvm-commits] [llvm] r82456 - /llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Message-ID: <200909211553.n8LFrick017996@zion.cs.uiuc.edu> Author: foldr Date: Mon Sep 21 10:53:44 2009 New Revision: 82456 URL: http://llvm.org/viewvc/llvm-project?rev=82456&view=rev Log: Use raw_ostream::indent instead of passing strings. Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=82456&r1=82455&r2=82456&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Mon Sep 21 10:53:44 2009 @@ -39,10 +39,11 @@ //===----------------------------------------------------------------------===// /// Constants -// Indentation strings. -const char * Indent1 = " "; -const char * Indent2 = " "; -const char * Indent3 = " "; +// Indentation. +unsigned TabWidth = 4; +unsigned Indent1 = TabWidth*1; +unsigned Indent2 = TabWidth*2; +unsigned Indent3 = TabWidth*3; // Default help string. const char * DefaultHelpString = "NO HELP MESSAGE PROVIDED"; @@ -1024,7 +1025,7 @@ /// EmitCaseConstructHandler. bool EmitCaseTest2Args(const std::string& TestName, const DagInit& d, - const char* IndentLevel, + unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O) { checkNumberOfArguments(&d, 2); @@ -1042,8 +1043,9 @@ if (!OptDesc.isList()) throw OptName + ": incorrect option type - should be a list!"; const std::string& VarName = OptDesc.GenVariableName(); - O << "std::find(" << VarName << ".begin(),\n" - << IndentLevel << Indent1 << VarName << ".end(), \"" + O << "std::find(" << VarName << ".begin(),\n"; + O.indent(IndentLevel + Indent1) + << VarName << ".end(), \"" << OptArg << "\") != " << VarName << ".end()"; return true; } @@ -1053,28 +1055,31 @@ // Forward declaration. // EmitLogicalOperationTest and EmitCaseTest are mutually recursive. -void EmitCaseTest(const DagInit& d, const char* IndentLevel, +void EmitCaseTest(const DagInit& d, unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O); /// EmitLogicalOperationTest - Helper function used by /// EmitCaseConstructHandler. void EmitLogicalOperationTest(const DagInit& d, const char* LogicOp, - const char* IndentLevel, + unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O) { O << '('; for (unsigned j = 0, NumArgs = d.getNumArgs(); j < NumArgs; ++j) { const DagInit& InnerTest = InitPtrToDag(d.getArg(j)); EmitCaseTest(InnerTest, IndentLevel, OptDescs, O); - if (j != NumArgs - 1) - O << ")\n" << IndentLevel << Indent1 << ' ' << LogicOp << " ("; - else + if (j != NumArgs - 1) { + O << ")\n"; + O.indent(IndentLevel + Indent1) << ' ' << LogicOp << " ("; + } + else { O << ')'; + } } } -void EmitLogicalNot(const DagInit& d, const char* IndentLevel, +void EmitLogicalNot(const DagInit& d, unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O) { checkNumberOfArguments(&d, 1); @@ -1085,7 +1090,7 @@ } /// EmitCaseTest - Helper function used by EmitCaseConstructHandler. -void EmitCaseTest(const DagInit& d, const char* IndentLevel, +void EmitCaseTest(const DagInit& d, unsigned IndentLevel, const OptionDescriptions& OptDescs, raw_ostream& O) { const std::string& TestName = d.getOperator()->getAsString(); @@ -1107,9 +1112,9 @@ // Emit code that handles the 'case' construct. // Takes a function object that should emit code for every case clause. // Callback's type is -// void F(Init* Statement, const char* IndentLevel, raw_ostream& O). +// void F(Init* Statement, unsigned IndentLevel, raw_ostream& O). template -void EmitCaseConstructHandler(const Init* Dag, const char* IndentLevel, +void EmitCaseConstructHandler(const Init* Dag, unsigned IndentLevel, F Callback, bool EmitElseIf, const OptionDescriptions& OptDescs, raw_ostream& O) { @@ -1131,10 +1136,10 @@ if (i+2 != numArgs) throw std::string("The 'default' clause should be the last in the" "'case' construct!"); - O << IndentLevel << "else {\n"; + O.indent(IndentLevel) << "else {\n"; } else { - O << IndentLevel << ((i != 0 && EmitElseIf) ? "else if (" : "if ("); + O.indent(IndentLevel) << ((i != 0 && EmitElseIf) ? "else if (" : "if ("); EmitCaseTest(Test, IndentLevel, OptDescs, O); O << ") {\n"; } @@ -1149,13 +1154,13 @@ const DagInit* nd = dynamic_cast(arg); if (nd && (nd->getOperator()->getAsString() == "case")) { // Handle the nested 'case'. - EmitCaseConstructHandler(nd, (std::string(IndentLevel) + Indent1).c_str(), + EmitCaseConstructHandler(nd, (IndentLevel + Indent1), Callback, EmitElseIf, OptDescs, O); } else { - Callback(arg, (std::string(IndentLevel) + Indent1).c_str(), O); + Callback(arg, (IndentLevel + Indent1), O); } - O << IndentLevel << "}\n"; + O.indent(IndentLevel) << "}\n"; } } @@ -1309,7 +1314,7 @@ /// EmitCmdLineVecFill - Emit code that fills in the command line /// vector. Helper function used by EmitGenerateActionMethod(). void EmitCmdLineVecFill(const Init* CmdLine, const std::string& ToolName, - bool IsJoin, const char* IndentLevel, + bool IsJoin, unsigned IndentLevel, raw_ostream& O) { StrVector StrVec; TokenizeCmdline(InitPtrToString(CmdLine), StrVec); @@ -1335,16 +1340,18 @@ for (; I != E; ++I) { const std::string& cmd = *I; assert(!cmd.empty()); - O << IndentLevel; + O.indent(IndentLevel); if (cmd.at(0) == '$') { if (cmd == "$INFILE") { - if (IsJoin) + if (IsJoin) { O << "for (PathVector::const_iterator B = inFiles.begin()" - << ", E = inFiles.end();\n" - << IndentLevel << "B != E; ++B)\n" - << IndentLevel << Indent1 << "vec.push_back(B->str());\n"; - else + << ", E = inFiles.end();\n"; + O.indent(IndentLevel) << "B != E; ++B)\n"; + O.indent(IndentLevel + Indent1) << "vec.push_back(B->str());\n"; + } + else { O << "vec.push_back(inFile.str());\n"; + } } else if (cmd == "$OUTFILE") { O << "vec.push_back(out_file);\n"; @@ -1359,7 +1366,7 @@ O << "vec.push_back(\"" << cmd << "\");\n"; } } - O << IndentLevel << "cmd = "; + O.indent(IndentLevel) << "cmd = "; if (StrVec[0][0] == '$') SubstituteSpecialCommands(StrVec.begin(), StrVec.end(), O); @@ -1378,11 +1385,10 @@ EmitCmdLineVecFillCallback(bool J, const std::string& TN) : IsJoin(J), ToolName(TN) {} - void operator()(const Init* Statement, const char* IndentLevel, + void operator()(const Init* Statement, unsigned IndentLevel, raw_ostream& O) const { - EmitCmdLineVecFill(Statement, ToolName, IsJoin, - IndentLevel, O); + EmitCmdLineVecFill(Statement, ToolName, IsJoin, IndentLevel, O); } }; @@ -1390,53 +1396,56 @@ /// implement EmitActionHandler. Emits code for /// handling the (forward) and (forward_as) option properties. void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D, - const char* Indent, + unsigned IndentLevel, const std::string& NewName, raw_ostream& O) { const std::string& Name = NewName.empty() ? ("-" + D.Name) : NewName; + unsigned IndentLevel1 = IndentLevel + Indent1; switch (D.Type) { case OptionType::Switch: - O << Indent << "vec.push_back(\"" << Name << "\");\n"; + O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n"; break; case OptionType::Parameter: - O << Indent << "vec.push_back(\"" << Name << "\");\n"; - O << Indent << "vec.push_back(" << D.GenVariableName() << ");\n"; + O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n"; + O.indent(IndentLevel) << "vec.push_back(" << D.GenVariableName() << ");\n"; break; case OptionType::Prefix: - O << Indent << "vec.push_back(\"" << Name << "\" + " - << D.GenVariableName() << ");\n"; + O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\" + " + << D.GenVariableName() << ");\n"; break; case OptionType::PrefixList: - O << Indent << "for (" << D.GenTypeDeclaration() - << "::iterator B = " << D.GenVariableName() << ".begin(),\n" - << Indent << "E = " << D.GenVariableName() << ".end(); B != E;) {\n" - << Indent << Indent1 << "vec.push_back(\"" << Name << "\" + " - << "*B);\n" - << Indent << Indent1 << "++B;\n"; + O.indent(IndentLevel) + << "for (" << D.GenTypeDeclaration() + << "::iterator B = " << D.GenVariableName() << ".begin(),\n"; + O.indent(IndentLevel) + << "E = " << D.GenVariableName() << ".end(); B != E;) {\n"; + O.indent(IndentLevel1) << "vec.push_back(\"" << Name << "\" + " << "*B);\n"; + O.indent(IndentLevel1) << "++B;\n"; for (int i = 1, j = D.MultiVal; i < j; ++i) { - O << Indent << Indent1 << "vec.push_back(*B);\n" - << Indent << Indent1 << "++B;\n"; + O.indent(IndentLevel1) << "vec.push_back(*B);\n"; + O.indent(IndentLevel1) << "++B;\n"; } - O << Indent << "}\n"; + O.indent(IndentLevel) << "}\n"; break; case OptionType::ParameterList: - O << Indent << "for (" << D.GenTypeDeclaration() - << "::iterator B = " << D.GenVariableName() << ".begin(),\n" - << Indent << "E = " << D.GenVariableName() - << ".end() ; B != E;) {\n" - << Indent << Indent1 << "vec.push_back(\"" << Name << "\");\n"; + O.indent(IndentLevel) + << "for (" << D.GenTypeDeclaration() << "::iterator B = " + << D.GenVariableName() << ".begin(),\n"; + O.indent(IndentLevel) << "E = " << D.GenVariableName() + << ".end() ; B != E;) {\n"; + O.indent(IndentLevel1) << "vec.push_back(\"" << Name << "\");\n"; for (int i = 0, j = D.MultiVal; i < j; ++i) { - O << Indent << Indent1 << "vec.push_back(*B);\n" - << Indent << Indent1 << "++B;\n"; + O.indent(IndentLevel1) << "vec.push_back(*B);\n"; + O.indent(IndentLevel1) << "++B;\n"; } - O << Indent << "}\n"; + O.indent(IndentLevel) << "}\n"; break; case OptionType::Alias: default: @@ -1450,7 +1459,7 @@ class EmitActionHandler { const OptionDescriptions& OptDescs; - void processActionDag(const Init* Statement, const char* IndentLevel, + void processActionDag(const Init* Statement, unsigned IndentLevel, raw_ostream& O) const { const DagInit& Dag = InitPtrToDag(Statement); @@ -1464,10 +1473,10 @@ for (StrVector::const_iterator B = Out.begin(), E = Out.end(); B != E; ++B) - O << IndentLevel << "vec.push_back(\"" << *B << "\");\n"; + O.indent(IndentLevel) << "vec.push_back(\"" << *B << "\");\n"; } else if (ActionName == "error") { - O << IndentLevel << "throw std::runtime_error(\"" << + O.indent(IndentLevel) << "throw std::runtime_error(\"" << (Dag.getNumArgs() >= 1 ? InitPtrToString(Dag.getArg(0)) : "Unknown error!") << "\");\n"; @@ -1488,10 +1497,10 @@ else if (ActionName == "output_suffix") { checkNumberOfArguments(&Dag, 1); const std::string& OutSuf = InitPtrToString(Dag.getArg(0)); - O << IndentLevel << "output_suffix = \"" << OutSuf << "\";\n"; + O.indent(IndentLevel) << "output_suffix = \"" << OutSuf << "\";\n"; } else if (ActionName == "stop_compilation") { - O << IndentLevel << "stop_compilation = true;\n"; + O.indent(IndentLevel) << "stop_compilation = true;\n"; } else if (ActionName == "unpack_values") { checkNumberOfArguments(&Dag, 1); @@ -1502,15 +1511,17 @@ throw std::string("Can't use unpack_values with multi-valued options!"); if (D.isList()) { - O << IndentLevel << "for (" << D.GenTypeDeclaration() - << "::iterator B = " << D.GenVariableName() << ".begin(),\n" - << IndentLevel << "E = " << D.GenVariableName() - << ".end(); B != E; ++B)\n" - << IndentLevel << Indent1 << "llvm::SplitString(*B, vec, \",\");\n"; + O.indent(IndentLevel) + << "for (" << D.GenTypeDeclaration() + << "::iterator B = " << D.GenVariableName() << ".begin(),\n"; + O.indent(IndentLevel) + << "E = " << D.GenVariableName() << ".end(); B != E; ++B)\n"; + O.indent(IndentLevel + Indent1) + << "llvm::SplitString(*B, vec, \",\");\n"; } else if (D.isParameter()){ - O << Indent3 << "llvm::SplitString(" - << D.GenVariableName() << ", vec, \",\");\n"; + O.indent(IndentLevel) << "llvm::SplitString(" + << D.GenVariableName() << ", vec, \",\");\n"; } else { throw "Option '" + D.Name + @@ -1525,7 +1536,7 @@ EmitActionHandler(const OptionDescriptions& OD) : OptDescs(OD) {} - void operator()(const Init* Statement, const char* IndentLevel, + void operator()(const Init* Statement, unsigned IndentLevel, raw_ostream& O) const { if (typeid(*Statement) == typeid(ListInit)) { @@ -1546,29 +1557,31 @@ const OptionDescriptions& OptDescs, bool IsJoin, raw_ostream& O) { if (IsJoin) - O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"; + O.indent(Indent1) << "Action GenerateAction(const PathVector& inFiles,\n"; else - O << Indent1 << "Action GenerateAction(const sys::Path& inFile,\n"; + O.indent(Indent1) << "Action GenerateAction(const sys::Path& inFile,\n"; - O << Indent2 << "bool HasChildren,\n" - << Indent2 << "const llvm::sys::Path& TempDir,\n" - << Indent2 << "const InputLanguagesSet& InLangs,\n" - << Indent2 << "const LanguageMap& LangMap) const\n" - << Indent1 << "{\n" - << Indent2 << "std::string cmd;\n" - << Indent2 << "std::vector vec;\n" - << Indent2 << "bool stop_compilation = !HasChildren;\n" - << Indent2 << "const char* output_suffix = \"" << D.OutputSuffix << "\";\n" - << Indent2 << "std::string out_file;\n\n"; + O.indent(Indent2) << "bool HasChildren,\n"; + O.indent(Indent2) << "const llvm::sys::Path& TempDir,\n"; + O.indent(Indent2) << "const InputLanguagesSet& InLangs,\n"; + O.indent(Indent2) << "const LanguageMap& LangMap) const\n"; + O.indent(Indent1) << "{\n"; + O.indent(Indent2) << "std::string cmd;\n"; + O.indent(Indent2) << "std::vector vec;\n"; + O.indent(Indent2) << "bool stop_compilation = !HasChildren;\n"; + O.indent(Indent2) << "const char* output_suffix = \"" + << D.OutputSuffix << "\";\n"; + O.indent(Indent2) << "std::string out_file;\n\n"; // For every understood option, emit handling code. if (D.Actions) EmitCaseConstructHandler(D.Actions, Indent2, EmitActionHandler(OptDescs), false, OptDescs, O); - O << '\n' << Indent2 - << "out_file = OutFilename(" << (IsJoin ? "sys::Path(),\n" : "inFile,\n") - << Indent3 << "TempDir, stop_compilation, output_suffix).str();\n\n"; + O << '\n'; + O.indent(Indent2) + << "out_file = OutFilename(" << (IsJoin ? "sys::Path(),\n" : "inFile,\n"); + O.indent(Indent3) << "TempDir, stop_compilation, output_suffix).str();\n\n"; // cmd_line is either a string or a 'case' construct. if (!D.CmdLine) @@ -1582,14 +1595,15 @@ // Handle the Sink property. if (D.isSink()) { - O << Indent2 << "if (!" << SinkOptionName << ".empty()) {\n" - << Indent3 << "vec.insert(vec.end(), " - << SinkOptionName << ".begin(), " << SinkOptionName << ".end());\n" - << Indent2 << "}\n"; + O.indent(Indent2) << "if (!" << SinkOptionName << ".empty()) {\n"; + O.indent(Indent3) << "vec.insert(vec.end(), " + << SinkOptionName << ".begin(), " << SinkOptionName + << ".end());\n"; + O.indent(Indent2) << "}\n"; } - O << Indent2 << "return Action(cmd, vec, stop_compilation, out_file);\n" - << Indent1 << "}\n\n"; + O.indent(Indent2) << "return Action(cmd, vec, stop_compilation, out_file);\n"; + O.indent(Indent1) << "}\n\n"; } /// EmitGenerateActionMethods - Emit two GenerateAction() methods for @@ -1597,18 +1611,20 @@ void EmitGenerateActionMethods (const ToolDescription& ToolDesc, const OptionDescriptions& OptDescs, raw_ostream& O) { - if (!ToolDesc.isJoin()) - O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n" - << Indent2 << "bool HasChildren,\n" - << Indent2 << "const llvm::sys::Path& TempDir,\n" - << Indent2 << "const InputLanguagesSet& InLangs,\n" - << Indent2 << "const LanguageMap& LangMap) const\n" - << Indent1 << "{\n" - << Indent2 << "throw std::runtime_error(\"" << ToolDesc.Name - << " is not a Join tool!\");\n" - << Indent1 << "}\n\n"; - else + if (!ToolDesc.isJoin()) { + O.indent(Indent1) << "Action GenerateAction(const PathVector& inFiles,\n"; + O.indent(Indent2) << "bool HasChildren,\n"; + O.indent(Indent2) << "const llvm::sys::Path& TempDir,\n"; + O.indent(Indent2) << "const InputLanguagesSet& InLangs,\n"; + O.indent(Indent2) << "const LanguageMap& LangMap) const\n"; + O.indent(Indent1) << "{\n"; + O.indent(Indent2) << "throw std::runtime_error(\"" << ToolDesc.Name + << " is not a Join tool!\");\n"; + O.indent(Indent1) << "}\n\n"; + } + else { EmitGenerateActionMethod(ToolDesc, OptDescs, true, O); + } EmitGenerateActionMethod(ToolDesc, OptDescs, false, O); } @@ -1616,34 +1632,34 @@ /// EmitInOutLanguageMethods - Emit the [Input,Output]Language() /// methods for a given Tool class. void EmitInOutLanguageMethods (const ToolDescription& D, raw_ostream& O) { - O << Indent1 << "const char** InputLanguages() const {\n" - << Indent2 << "return InputLanguages_;\n" - << Indent1 << "}\n\n"; + O.indent(Indent1) << "const char** InputLanguages() const {\n"; + O.indent(Indent2) << "return InputLanguages_;\n"; + O.indent(Indent1) << "}\n\n"; if (D.OutLanguage.empty()) throw "Tool " + D.Name + " has no 'out_language' property!"; - O << Indent1 << "const char* OutputLanguage() const {\n" - << Indent2 << "return \"" << D.OutLanguage << "\";\n" - << Indent1 << "}\n\n"; + O.indent(Indent1) << "const char* OutputLanguage() const {\n"; + O.indent(Indent2) << "return \"" << D.OutLanguage << "\";\n"; + O.indent(Indent1) << "}\n\n"; } /// EmitNameMethod - Emit the Name() method for a given Tool class. void EmitNameMethod (const ToolDescription& D, raw_ostream& O) { - O << Indent1 << "const char* Name() const {\n" - << Indent2 << "return \"" << D.Name << "\";\n" - << Indent1 << "}\n\n"; + O.indent(Indent1) << "const char* Name() const {\n"; + O.indent(Indent2) << "return \"" << D.Name << "\";\n"; + O.indent(Indent1) << "}\n\n"; } /// EmitIsJoinMethod - Emit the IsJoin() method for a given Tool /// class. void EmitIsJoinMethod (const ToolDescription& D, raw_ostream& O) { - O << Indent1 << "bool IsJoin() const {\n"; + O.indent(Indent1) << "bool IsJoin() const {\n"; if (D.isJoin()) - O << Indent2 << "return true;\n"; + O.indent(Indent2) << "return true;\n"; else - O << Indent2 << "return false;\n"; - O << Indent1 << "}\n\n"; + O.indent(Indent2) << "return false;\n"; + O.indent(Indent1) << "}\n\n"; } /// EmitStaticMemberDefinitions - Emit static member definitions for a @@ -1673,8 +1689,8 @@ else O << "Tool"; - O << "{\nprivate:\n" - << Indent1 << "static const char* InputLanguages_[];\n\n"; + O << "{\nprivate:\n"; + O.indent(Indent1) << "static const char* InputLanguages_[];\n\n"; O << "public:\n"; EmitNameMethod(D, O); @@ -1804,9 +1820,9 @@ const ListInit* Suffixes = LangToSuffixes->getValueAsListInit("suffixes"); for (unsigned i = 0; i < Suffixes->size(); ++i) - O << Indent1 << "langMap[\"" - << InitPtrToString(Suffixes->getElement(i)) - << "\"] = \"" << Lang << "\";\n"; + O.indent(Indent1) << "langMap[\"" + << InitPtrToString(Suffixes->getElement(i)) + << "\"] = \"" << Lang << "\";\n"; } } @@ -1815,21 +1831,22 @@ /// IncDecWeight - Helper function passed to EmitCaseConstructHandler() /// by EmitEdgeClass(). -void IncDecWeight (const Init* i, const char* IndentLevel, +void IncDecWeight (const Init* i, unsigned IndentLevel, raw_ostream& O) { const DagInit& d = InitPtrToDag(i); const std::string& OpName = d.getOperator()->getAsString(); if (OpName == "inc_weight") { - O << IndentLevel << "ret += "; + O.indent(IndentLevel) << "ret += "; } else if (OpName == "dec_weight") { - O << IndentLevel << "ret -= "; + O.indent(IndentLevel) << "ret -= "; } else if (OpName == "error") { - O << IndentLevel << "throw std::runtime_error(\"" << - (d.getNumArgs() >= 1 ? InitPtrToString(d.getArg(0)) - : "Unknown error!") + O.indent(IndentLevel) + << "throw std::runtime_error(\"" << + (d.getNumArgs() >= 1 ? InitPtrToString(d.getArg(0)) + : "Unknown error!") << "\");\n"; return; } @@ -1852,19 +1869,20 @@ // Class constructor. O << "class Edge" << N << ": public Edge {\n" - << "public:\n" - << Indent1 << "Edge" << N << "() : Edge(\"" << Target - << "\") {}\n\n" + << "public:\n"; + O.indent(Indent1) << "Edge" << N << "() : Edge(\"" << Target + << "\") {}\n\n"; // Function Weight(). - << Indent1 << "unsigned Weight(const InputLanguagesSet& InLangs) const {\n" - << Indent2 << "unsigned ret = 0;\n"; + O.indent(Indent1) + << "unsigned Weight(const InputLanguagesSet& InLangs) const {\n"; + O.indent(Indent2) << "unsigned ret = 0;\n"; // Handle the 'case' construct. EmitCaseConstructHandler(Case, Indent2, IncDecWeight, false, OptDescs, O); - O << Indent2 << "return ret;\n" - << Indent1 << "};\n\n};\n\n"; + O.indent(Indent2) << "return ret;\n"; + O.indent(Indent1) << "};\n\n};\n\n"; } /// EmitEdgeClasses - Emit Edge* classes that represent graph edges. @@ -1894,7 +1912,7 @@ for (ToolDescriptions::const_iterator B = ToolDescs.begin(), E = ToolDescs.end(); B != E; ++B) - O << Indent1 << "G.insertNode(new " << (*B)->Name << "());\n"; + O.indent(Indent1) << "G.insertNode(new " << (*B)->Name << "());\n"; O << '\n'; @@ -1908,7 +1926,7 @@ const std::string& NodeB = Edge->getValueAsString("b"); DagInit* Weight = Edge->getValueAsDag("weight"); - O << Indent1 << "G.insertEdge(\"" << NodeA << "\", "; + O.indent(Indent1) << "G.insertEdge(\"" << NodeA << "\", "; if (isDagEmpty(Weight)) O << "new SimpleEdge(\"" << NodeB << "\")"; @@ -1997,7 +2015,7 @@ O << "namespace hooks {\n"; for (StringMap::const_iterator B = HookNames.begin(), E = HookNames.end(); B != E; ++B) { - O << Indent1 << "std::string " << B->first() << "("; + O.indent(Indent1) << "std::string " << B->first() << "("; for (unsigned i = 0, j = B->second; i < j; ++i) { O << "const char* Arg" << i << (i+1 == j ? "" : ", "); @@ -2010,16 +2028,16 @@ /// EmitRegisterPlugin - Emit code to register this plugin. void EmitRegisterPlugin(int Priority, raw_ostream& O) { - O << "struct Plugin : public llvmc::BasePlugin {\n\n" - << Indent1 << "int Priority() const { return " << Priority << "; }\n\n" - << Indent1 << "void PopulateLanguageMap(LanguageMap& langMap) const\n" - << Indent1 << "{ PopulateLanguageMapLocal(langMap); }\n\n" - << Indent1 - << "void PopulateCompilationGraph(CompilationGraph& graph) const\n" - << Indent1 << "{ PopulateCompilationGraphLocal(graph); }\n" - << "};\n\n" - - << "static llvmc::RegisterPlugin RP;\n\n"; + O << "struct Plugin : public llvmc::BasePlugin {\n\n"; + O.indent(Indent1) << "int Priority() const { return " + << Priority << "; }\n\n"; + O.indent(Indent1) << "void PopulateLanguageMap(LanguageMap& langMap) const\n"; + O.indent(Indent1) << "{ PopulateLanguageMapLocal(langMap); }\n\n"; + O.indent(Indent1) + << "void PopulateCompilationGraph(CompilationGraph& graph) const\n"; + O.indent(Indent1) << "{ PopulateCompilationGraphLocal(graph); }\n" + << "};\n\n" + << "static llvmc::RegisterPlugin RP;\n\n"; } /// EmitIncludes - Emit necessary #include directives and some From ssen at apple.com Mon Sep 21 11:15:19 2009 From: ssen at apple.com (Shantonu Sen) Date: Mon, 21 Sep 2009 09:15:19 -0700 Subject: [llvm-commits] [PATCH] BlocksRuntime updates for Linux References: <74663C84-9383-4D23-A844-7E8C16AA0D5E@apple.com> Message-ID: <3210EDA4-C758-41FA-B391-70759C11FB07@apple.com> [forwarding to llvm-commits, which is where i meant to send it the first time] Ping? Shantonu Sen ssen at apple.com Sent from my Mac Pro Begin forwarded message: > From: Shantonu Sen > Date: September 18, 2009 11:14:13 AM PDT > To: LLVM Developers Mailing List > Subject: [LLVMdev] [PATCH] BlocksRuntime updates for Linux > > The attached diff cleans up the BlocksRuntime/ directory of compiler- > rt for better portability, eliminates compiler warnings, and adds > support to the cmake build to install the results. > > More specifically, the changes: > 1) Remove cmake-specific #define usage from the exported Block.h/ > Block_private.h headers, since clients won't know what to set. These > are moved into runtime.c as appropriate > 2) Use cmake checks for CAS builtins, instead of guessing based on > GCC #defines (which aren't set by clang and llvm-gcc anyway) > 3) "#pragma mark" isn't supported by FSF gcc, so "#if 0" it out. It > should still show up in IDEs that support it > 4) Fix some compiler warnings. GCC 4.3.3 seems super strict about > %p. function pointers can't be cast to void * either. > 5) Avoid a warning for apple_versioning.c that "ISO C does not allow > empty files" > > Tested on Ubuntu Linux 9.04 with clang and llvm-gcc and -fblocks to > define and copy some blocks (and invoke them, obviously). Also > tested on Mac OS X 10.6 and linking against -lBlocksRuntime ahead of > -lSystem. > > > Shantonu Sen > ssen at apple.com > > Sent from my Mac Pro > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090921/35908a29/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: blocks-linux.diff Type: application/octet-stream Size: 10483 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090921/35908a29/attachment.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090921/35908a29/attachment-0001.html From baldrick at free.fr Mon Sep 21 11:26:19 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 16:26:19 -0000 Subject: [llvm-commits] [gcc-plugin] r82457 - /gcc-plugin/trunk/Makefile Message-ID: <200909211626.n8LGQJDL022513@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 11:26:19 2009 New Revision: 82457 URL: http://llvm.org/viewvc/llvm-project?rev=82457&view=rev Log: Make the Makefile -j safe. Modified: gcc-plugin/trunk/Makefile Modified: gcc-plugin/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=82457&r1=82456&r2=82457&view=diff ============================================================================== --- gcc-plugin/trunk/Makefile (original) +++ gcc-plugin/trunk/Makefile Mon Sep 21 11:26:19 2009 @@ -44,13 +44,13 @@ $(TARGET_UTIL): $(TARGET_UTIL_OBJECTS) $(CXX) $^ -o $@ $(CXXFLAGS) $(LDFLAGS) -$(PLUGIN_C_OBJECTS): %.o : %.c +$(PLUGIN_C_OBJECTS): %.o : %.c $(TARGET_UTIL) $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PLUGIN_CFLAGS) $< -$(PLUGIN_CPP_OBJECTS): %.o : %.cpp +$(PLUGIN_CPP_OBJECTS): %.o : %.cpp $(TARGET_UTIL) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) $< -$(TARGET_OBJECT): +$(TARGET_OBJECT): $(TARGET_UTIL) $(CXX) -c $(TARGET_CPP) -o $@ $(CPPFLAGS) $(CXXFLAGS) $(PLUGIN_CXXFLAGS) -I. $(PLUGIN): $(TARGET_UTIL) $(PLUGIN_OBJECTS) $(TARGET_OBJECT) From baldrick at free.fr Mon Sep 21 11:30:13 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 16:30:13 -0000 Subject: [llvm-commits] [gcc-plugin] r82458 - in /gcc-plugin/trunk/gcc-patches: gc_caches.diff i386_static.diff Message-ID: <200909211630.n8LGUD4T022982@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 11:30:12 2009 New Revision: 82458 URL: http://llvm.org/viewvc/llvm-project?rev=82458&view=rev Log: Refresh these patches against GCC top-of-tree. Modified: gcc-plugin/trunk/gcc-patches/gc_caches.diff gcc-plugin/trunk/gcc-patches/i386_static.diff Modified: gcc-plugin/trunk/gcc-patches/gc_caches.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/gc_caches.diff?rev=82458&r1=82457&r2=82458&view=diff ============================================================================== --- gcc-plugin/trunk/gcc-patches/gc_caches.diff (original) +++ gcc-plugin/trunk/gcc-patches/gc_caches.diff Mon Sep 21 11:30:12 2009 @@ -1,7 +1,7 @@ -Index: lto/gcc/doc/plugins.texi +Index: mainline/gcc/doc/plugins.texi =================================================================== ---- lto.orig/gcc/doc/plugins.texi 2009-09-03 21:50:47.460087851 +0200 -+++ lto/gcc/doc/plugins.texi 2009-09-03 22:17:19.831140355 +0200 +--- mainline.orig/gcc/doc/plugins.texi 2009-09-21 18:26:44.088984496 +0200 ++++ mainline/gcc/doc/plugins.texi 2009-09-21 18:28:51.279983189 +0200 @@ -133,6 +133,7 @@ PLUGIN_GGC_MARKING, /* Extend the GGC marking. */ PLUGIN_GGC_END, /* Called at end of GGC. */ @@ -21,7 +21,7 @@ null, and the @code{user_data} is specific. @section Interacting with the pass manager -@@ -222,18 +223,20 @@ +@@ -222,16 +223,19 @@ (and conversely, these routines should usually not be used in plugins outside of the @code{PLUGIN_GGC_MARKING} event). @@ -32,27 +32,26 @@ +Some plugins may need to add extra GGC root tables, e.g. to handle their own + at code{GTY}-ed data. This can be done with the @code{PLUGIN_REGISTER_GGC_ROOTS} +pseudo-event with a null callback and the extra root table as @code{user_data}. -+Plugins that need to add extra GGC cache tables can likewise use the ++Plugins that want to use the @code{if_marked} hash table option can add the ++extra GGC cache tables generated by @code{gengtype} using the + at code{PLUGIN_REGISTER_GGC_CACHES} pseudo-event with a null callback and the -+extra cache table as @code{user_data}. Running the @code{gengtype - -P @file{gt-plugin.h} @var{source-dir} @var{file-list} @var{plugin*.c} --...} utility generates this extra root table, with the PCH related -+...} utility generates these extra tables, with the PCH related - generated code kept wrapped with the @code{#ifdef - GCC_PLUGIN_HAVE_PCH}, so disabled by default. ++extra cache table as @code{user_data}. Running the @code{gengtype + -p @var{source-dir} @var{file-list} @var{plugin*.c} ...} utility +-generates this extra root table. ++generates these extra root tables. You should understand the details of memory management inside GCC -before using @code{PLUGIN_GGC_MARKING} or -- at code{PLUGIN_REGISTER_GGC_ROOTS}. Notice that using plugins which -+before using @code{PLUGIN_GGC_MARKING}, @code{PLUGIN_REGISTER_GGC_ROOTS} or -+ at code{PLUGIN_REGISTER_GGC_CACHES}. Notice that using plugins which - need these features may break the generation of precompiled headers - [PCH], unless these plugins take specific measures. +- at code{PLUGIN_REGISTER_GGC_ROOTS}. ++before using @code{PLUGIN_GGC_MARKING}, @code{PLUGIN_REGISTER_GGC_ROOTS} ++or @code{PLUGIN_REGISTER_GGC_CACHES}. -Index: lto/gcc/gcc-plugin.h + + @section Giving information about a plugin +Index: mainline/gcc/gcc-plugin.h =================================================================== ---- lto.orig/gcc/gcc-plugin.h 2009-09-03 21:50:28.832084778 +0200 -+++ lto/gcc/gcc-plugin.h 2009-09-03 22:17:19.831140355 +0200 +--- mainline.orig/gcc/gcc-plugin.h 2009-09-21 18:26:44.084984608 +0200 ++++ mainline/gcc/gcc-plugin.h 2009-09-21 18:28:51.279983189 +0200 @@ -40,6 +40,7 @@ PLUGIN_GGC_MARKING, /* Extend the GGC marking. */ PLUGIN_GGC_END, /* Called at end of GGC. */ @@ -72,14 +71,27 @@ */ extern void register_callback (const char *plugin_name, -Index: lto/gcc/ggc-common.c +Index: mainline/gcc/ggc-common.c =================================================================== ---- lto.orig/gcc/ggc-common.c 2009-09-03 21:52:50.831086272 +0200 -+++ lto/gcc/ggc-common.c 2009-09-04 13:48:16.077072772 +0200 -@@ -116,6 +116,33 @@ - } - - +--- mainline.orig/gcc/ggc-common.c 2009-09-21 18:26:44.049022422 +0200 ++++ mainline/gcc/ggc-common.c 2009-09-21 18:28:51.279983189 +0200 +@@ -105,14 +105,29 @@ + void + ggc_register_root_tab (const struct ggc_root_tab* rt) + { +- if (!rt) +- return; +- if (!extra_root_vec) +- { +- int vlen = 32; +- extra_root_vec = VEC_alloc (const_ggc_root_tab_t, heap, vlen); +- } +- VEC_safe_push (const_ggc_root_tab_t, heap, extra_root_vec, rt); ++ if (rt) ++ VEC_safe_push (const_ggc_root_tab_t, heap, extra_root_vec, rt); ++} ++ ++ +/* This extra vector of dynamically registered cache_tab-s is used by + ggc_mark_roots and gives the ability to dynamically add new GGC cache + tables, for instance from some plugins; this vector is a heap one @@ -96,50 +108,68 @@ +void +ggc_register_cache_tab (const struct ggc_cache_tab* ct) +{ -+ if (!ct) -+ return; -+ if (!extra_cache_vec) -+ { -+ int vlen = 32; -+ extra_cache_vec = VEC_alloc (const_ggc_cache_tab_t, heap, vlen); -+ } -+ VEC_safe_push (const_ggc_cache_tab_t, heap, extra_cache_vec, ct); -+} -+ -+ - /* Iterate through all registered roots and mark each element. */ ++ if (ct) ++ VEC_safe_push (const_ggc_cache_tab_t, heap, extra_cache_vec, ct); + } + - void -@@ -165,6 +192,25 @@ +@@ -123,8 +138,10 @@ + { + const struct ggc_root_tab *const *rt; + const struct ggc_root_tab *rti; ++ const_ggc_root_tab_t rtp; + const struct ggc_cache_tab *const *ct; + const struct ggc_cache_tab *cti; ++ const_ggc_cache_tab_t ctp; + size_t i; + + for (rt = gt_ggc_deletable_rtab; *rt; rt++) +@@ -136,18 +153,11 @@ + for (i = 0; i < rti->nelt; i++) + (*rti->cb) (*(void **)((char *)rti->base + rti->stride * i)); + +- if (extra_root_vec +- && VEC_length(const_ggc_root_tab_t,extra_root_vec) > 0) ++ for (i = 0; VEC_iterate(const_ggc_root_tab_t, extra_root_vec, i, rtp); i++) + { +- const_ggc_root_tab_t rtp = NULL; +- for (i=0; +- VEC_iterate(const_ggc_root_tab_t, extra_root_vec, i, rtp); +- i++) +- { +- for (rti = rtp; rti->base != NULL; rti++) +- for (i = 0; i < rti->nelt; i++) +- (*rti->cb) (*(void **) ((char *)rti->base + rti->stride * i)); +- } ++ for (rti = rtp; rti->base != NULL; rti++) ++ for (i = 0; i < rti->nelt; i++) ++ (*rti->cb) (*(void **) ((char *)rti->base + rti->stride * i)); + } + + if (ggc_protect_identifiers) +@@ -165,6 +175,18 @@ ggc_set_mark ((*cti->base)->entries); } -+ if (extra_cache_vec -+ && VEC_length(const_ggc_cache_tab_t,extra_cache_vec) > 0) ++ for (i = 0; VEC_iterate(const_ggc_cache_tab_t, extra_cache_vec, i, ctp); i++) + { -+ const_ggc_cache_tab_t ctp = NULL; -+ for (i=0; -+ VEC_iterate(const_ggc_cache_tab_t, extra_cache_vec, i, ctp); -+ i++) -+ { -+ for (cti = ctp; cti->base != NULL; cti++) -+ if (*cti->base) -+ { -+ ggc_set_mark (*cti->base); -+ htab_traverse_noresize (*cti->base, ggc_htab_delete, -+ CONST_CAST (void *, (const void *)cti)); -+ ggc_set_mark ((*cti->base)->entries); -+ } -+ } ++ for (cti = ctp; cti->base != NULL; cti++) ++ if (*cti->base) ++ { ++ ggc_set_mark (*cti->base); ++ htab_traverse_noresize (*cti->base, ggc_htab_delete, ++ CONST_CAST (void *, (const void *)cti)); ++ ggc_set_mark ((*cti->base)->entries); ++ } + } + if (! ggc_protect_identifiers) ggc_purge_stringpool (); -Index: lto/gcc/ggc.h +Index: mainline/gcc/ggc.h =================================================================== ---- lto.orig/gcc/ggc.h 2009-09-03 21:52:23.632087782 +0200 -+++ lto/gcc/ggc.h 2009-09-03 22:17:19.831140355 +0200 +--- mainline.orig/gcc/ggc.h 2009-09-21 18:26:44.077006832 +0200 ++++ mainline/gcc/ggc.h 2009-09-21 18:28:51.279983189 +0200 @@ -275,6 +275,10 @@ plugins. Does nothing if the passed pointer is null. */ extern void ggc_register_root_tab (const struct ggc_root_tab *); @@ -151,10 +181,10 @@ /* Return the number of bytes allocated at the indicated address. */ extern size_t ggc_get_size (const void *); -Index: lto/gcc/plugin.c +Index: mainline/gcc/plugin.c =================================================================== ---- lto.orig/gcc/plugin.c 2009-09-03 21:51:11.624084490 +0200 -+++ lto/gcc/plugin.c 2009-09-03 22:17:19.831140355 +0200 +--- mainline.orig/gcc/plugin.c 2009-09-21 18:26:44.092984594 +0200 ++++ mainline/gcc/plugin.c 2009-09-21 18:28:51.279983189 +0200 @@ -57,6 +57,7 @@ "PLUGIN_GGC_MARKING", "PLUGIN_GGC_END", @@ -163,7 +193,7 @@ "PLUGIN_START_UNIT", "PLUGIN_EVENT_LAST" }; -@@ -501,6 +502,10 @@ +@@ -499,6 +500,10 @@ gcc_assert (!callback); ggc_register_root_tab ((const struct ggc_root_tab*) user_data); break; @@ -174,7 +204,7 @@ case PLUGIN_FINISH_TYPE: case PLUGIN_START_UNIT: case PLUGIN_FINISH_UNIT: -@@ -568,6 +573,7 @@ +@@ -566,6 +571,7 @@ case PLUGIN_PASS_MANAGER_SETUP: case PLUGIN_EVENT_LAST: case PLUGIN_REGISTER_GGC_ROOTS: @@ -182,3 +212,79 @@ default: gcc_assert (false); } +Index: mainline/gcc/testsuite/gcc.dg/plugin/ggc_caches-test-1.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ mainline/gcc/testsuite/gcc.dg/plugin/ggc_caches-test-1.c 2009-09-21 18:28:51.283987006 +0200 +@@ -0,0 +1,2 @@ ++/* Test the ggc_caches plugin. */ ++/* { dg-do compile } */ +Index: mainline/gcc/testsuite/gcc.dg/plugin/ggc_caches_plugin.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ mainline/gcc/testsuite/gcc.dg/plugin/ggc_caches_plugin.c 2009-09-21 18:28:51.283987006 +0200 +@@ -0,0 +1,52 @@ ++/* This plugin tests the registering of GGC cache tables. */ ++/* { dg-options "-O" } */ ++ ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "toplev.h" ++#include "basic-block.h" ++#include "gimple.h" ++#include "tree.h" ++#include "tree-pass.h" ++#include "intl.h" ++#include "gcc-plugin.h" ++ ++int plugin_is_GPL_compatible; ++ ++static GTY ((if_marked ("tree_map_base_marked_p"), ++ param_is(struct tree_map_base))) ++ htab_t cache; ++ ++/* Extra GGC cache table with one entry. */ ++static const struct ggc_cache_tab our_xtratab[] = { ++ { ++ &cache, ++ 1, ++ sizeof (cache), ++ >_ggc_mx_tree_map_base, ++ >_pch_nx_tree_map_base, ++ &tree_map_base_marked_p ++ }, ++ LAST_GGC_CACHE_TAB ++}; ++ ++/* The initialization routine exposed to and called by GCC. The spec of this ++ function is defined in gcc/gcc-plugin.h. ++ ++ Note that this function needs to be named exactly "plugin_init". */ ++int ++plugin_init (struct plugin_name_args *plugin_info, ++ struct plugin_gcc_version *version) ++{ ++ const char *plugin_name = plugin_info->base_name; ++ if (!plugin_default_version_check (version, version)) ++ return 1; ++ ++ register_callback (plugin_name, PLUGIN_REGISTER_GGC_CACHES, NULL, ++ (void *) our_xtratab); ++ ++ /* plugin initialization succeeded */ ++ return 0; ++} +Index: mainline/gcc/testsuite/gcc.dg/plugin/plugin.exp +=================================================================== +--- mainline.orig/gcc/testsuite/gcc.dg/plugin/plugin.exp 2009-09-21 18:26:44.109009082 +0200 ++++ mainline/gcc/testsuite/gcc.dg/plugin/plugin.exp 2009-09-21 18:28:51.283987006 +0200 +@@ -49,6 +49,7 @@ + set plugin_test_list [list \ + { selfassign.c self-assign-test-1.c self-assign-test-2.c } \ + { ggcplug.c ggcplug-test-1.c } \ ++ { ggc_caches_plugin.c ggc_caches-test-1.c } \ + { one_time_plugin.c one_time-test-1.c } \ + { start_unit_plugin.c start_unit-test-1.c } \ + { finish_unit_plugin.c finish_unit-test-1.c } \ Modified: gcc-plugin/trunk/gcc-patches/i386_static.diff URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/gcc-patches/i386_static.diff?rev=82458&r1=82457&r2=82458&view=diff ============================================================================== --- gcc-plugin/trunk/gcc-patches/i386_static.diff (original) +++ gcc-plugin/trunk/gcc-patches/i386_static.diff Mon Sep 21 11:30:12 2009 @@ -1,8 +1,8 @@ -Index: lto/gcc/config/i386/i386.c +Index: mainline/gcc/config/i386/i386.c =================================================================== ---- lto.orig/gcc/config/i386/i386.c 2009-08-31 10:47:18.103197067 +0200 -+++ lto/gcc/config/i386/i386.c 2009-08-31 10:49:23.167200047 +0200 -@@ -4927,7 +4927,7 @@ +--- mainline.orig/gcc/config/i386/i386.c 2009-09-21 18:27:48.232986747 +0200 ++++ mainline/gcc/config/i386/i386.c 2009-09-21 18:28:56.616984269 +0200 +@@ -4917,7 +4917,7 @@ case, we return the original mode and warn ABI change if CUM isn't NULL. */ @@ -11,7 +11,7 @@ type_natural_mode (const_tree type, CUMULATIVE_ARGS *cum) { enum machine_mode mode = TYPE_MODE (type); -@@ -5058,7 +5058,7 @@ +@@ -5048,7 +5048,7 @@ See the x86-64 PS ABI for details. */ @@ -20,7 +20,7 @@ classify_argument (enum machine_mode mode, const_tree type, enum x86_64_reg_class classes[MAX_CLASSES], int bit_offset) { -@@ -5438,7 +5438,7 @@ +@@ -5428,7 +5428,7 @@ /* Examine the argument and return set number of register required in each class. Return 0 iff parameter should be passed in memory. */ @@ -29,7 +29,7 @@ examine_argument (enum machine_mode mode, const_tree type, int in_return, int *int_nregs, int *sse_nregs) { -@@ -6118,7 +6118,7 @@ +@@ -6108,7 +6108,7 @@ /* Return true when TYPE should be 128bit aligned for 32bit argument passing ABI. */ From evan.cheng at apple.com Mon Sep 21 11:30:56 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 09:30:56 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> Message-ID: <1EC41638-6AA6-448D-9D4D-9A21F07ECB56@apple.com> 483_xalancbmk is still failing as far as I can tell. The rest are fixed. Evan On Sep 19, 2009, at 10:12 AM, Daniel Dunbar wrote: > Hi All, > > There were a large number of regressions on the nightly tests last > night. I'd appreciate some help in tracking down the failures. > > This is a summary of the important new failures: > > This is failing in many places: > SingleSource/Regression/C++/EH/exception_spec_test [LLC, LLC-BETA, > LLC compile, LLC_BETA compile] > and these are failing in some places: > SingleSource/Benchmarks/Shootout-C++/except [LLC, LLC-BETA, LLC > compile, LLC_BETA compile] > SingleSource/Regression/C++/EH/ctor_dtor_count-2 [LLC, LLC-BETA, LLC > compile, LLC_BETA compile] > SingleSource/Regression/C++/EH/throw_rethrow_test [LLC, LLC-BETA, > LLC compile, LLC_BETA compile] > and this is failing when built with clang: > SingleSource/UnitTests/ObjC/exceptions [LLC, LLC-BETA, LLC compile, > LLC_BETA compile] > > Bill, Chris, Eric, Duncan: Can you guys sort out someone to look at > it? > > This is failing in a number of places: > Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT > codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA compile] > Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT > codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA compile] > and these are failing in at least one place: > Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC > compile, LLC_BETA compile] > Externals/SPEC/CINT2000/252_eon/252_eon [JIT codegen] > > Evan or Dan, can you guys point a finger or take a look? > > Thanks, > - Daniel From dpatel at apple.com Mon Sep 21 12:18:13 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Sep 2009 10:18:13 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r81586 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h In-Reply-To: <6a8523d60909191232q23290c36lc2e85ced7ab3476a@mail.gmail.com> References: <200909112357.n8BNvRxX013435@zion.cs.uiuc.edu> <6a8523d60909191232q23290c36lc2e85ced7ab3476a@mail.gmail.com> Message-ID: <5AA4AF63-4540-421E-8161-F2622C473C0E@apple.com> Hi Daniel, On Sep 19, 2009, at 12:32 PM, Daniel Dunbar wrote: > > Can you explain this line below? Its reconstructing a type in the case > when something deleted the metadata which was in the type cache. > Should that ever happen? Yes. It is possible that the MDNode describing type disappear. > Can we not maintain enough invariants to > allow us to use an AssertingVH instead? It is not an error if the MDNode disappears. > > I went ahead and moved clang over to an AssertingVH in r8232{0,1}, so > that we will at least get asserts if we try something funny (which > does, indeed, assert for PR4894). > >> + if (Value *M = I->second) >> + return DIType(cast(M)); > > - Daniel - Devang From sabre at nondot.org Mon Sep 21 12:24:04 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 17:24:04 -0000 Subject: [llvm-commits] [llvm] r82460 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/rle.ll Message-ID: <200909211724.n8LHO5KA030220@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 12:24:04 2009 New Revision: 82460 URL: http://llvm.org/viewvc/llvm-project?rev=82460&view=rev Log: fix PR5016, a crash I introduced in GVN handing first class arrays and structs, which cannot be bitcast to integers. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/test/Transforms/GVN/rle.ll Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82460&r1=82459&r2=82460&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 12:24:04 2009 @@ -940,6 +940,27 @@ } +/// CanCoerceMustAliasedValueToLoad - Return true if +/// CoerceAvailableValueToLoadType will succeed. +static bool CanCoerceMustAliasedValueToLoad(Value *StoredVal, + const Type *LoadTy, + const TargetData &TD) { + // If the loaded or stored value is an first class array or struct, don't try + // to transform them. We need to be able to bitcast to integer. + if (isa(LoadTy) || isa(LoadTy) || + isa(StoredVal->getType()) || + isa(StoredVal->getType())) + return false; + + // The store has to be at least as big as the load. + if (TD.getTypeSizeInBits(StoredVal->getType()) < + TD.getTypeSizeInBits(LoadTy)) + return false; + + return true; +} + + /// CoerceAvailableValueToLoadType - If we saw a store of a value to memory, and /// then a load from a must-aliased pointer of a different type, try to coerce /// the stored value. LoadedTy is the type of the load we want to replace and @@ -950,6 +971,9 @@ const Type *LoadedTy, Instruction *InsertPt, const TargetData &TD) { + if (!CanCoerceMustAliasedValueToLoad(StoredVal, LoadedTy, TD)) + return 0; + const Type *StoredValTy = StoredVal->getType(); uint64_t StoreSize = TD.getTypeSizeInBits(StoredValTy); @@ -985,8 +1009,7 @@ // If the loaded value is smaller than the available value, then we can // extract out a piece from it. If the available value is too small, then we // can't do anything. - if (StoreSize < LoadSize) - return 0; + assert(StoreSize >= LoadSize && "CanCoerceMustAliasedValueToLoad fail"); // Convert source pointers to integers, which can be manipulated. if (isa(StoredValTy)) { @@ -1072,6 +1095,13 @@ /// load. static int AnalyzeLoadFromClobberingStore(LoadInst *L, StoreInst *DepSI, const TargetData &TD) { + // If the loaded or stored value is an first class array or struct, don't try + // to transform them. We need to be able to bitcast to integer. + if (isa(L->getType()) || isa(L->getType()) || + isa(DepSI->getOperand(0)->getType()) || + isa(DepSI->getOperand(0)->getType())) + return -1; + int64_t StoreOffset = 0, LoadOffset = 0; Value *StoreBase = GetBaseWithConstantOffset(DepSI->getPointerOperand(), StoreOffset, TD); @@ -1323,9 +1353,8 @@ // If the stored value is larger or equal to the loaded value, we can // reuse it. - if (TD == 0 || - TD->getTypeSizeInBits(S->getOperand(0)->getType()) < - TD->getTypeSizeInBits(LI->getType())) { + if (TD == 0 || !CanCoerceMustAliasedValueToLoad(S->getOperand(0), + LI->getType(), *TD)) { UnavailableBlocks.push_back(DepBB); continue; } @@ -1344,9 +1373,7 @@ // If the stored value is larger or equal to the loaded value, we can // reuse it. - if (TD == 0 || - TD->getTypeSizeInBits(LD->getType()) < - TD->getTypeSizeInBits(LI->getType())) { + if (TD == 0 || !CanCoerceMustAliasedValueToLoad(LD, LI->getType(),*TD)){ UnavailableBlocks.push_back(DepBB); continue; } @@ -1627,7 +1654,8 @@ const TargetData *TD = 0; if (StoredVal->getType() != L->getType() && (TD = getAnalysisIfAvailable())) { - StoredVal = CoerceAvailableValueToLoadType(StoredVal, L->getType(), L, *TD); + StoredVal = CoerceAvailableValueToLoadType(StoredVal, L->getType(), + L, *TD); if (StoredVal == 0) return false; @@ -1653,7 +1681,7 @@ const TargetData *TD = 0; if (DepLI->getType() != L->getType() && (TD = getAnalysisIfAvailable())) { - AvailableVal = CoerceAvailableValueToLoadType(DepLI, L->getType(), L, *TD); + AvailableVal = CoerceAvailableValueToLoadType(DepLI, L->getType(), L,*TD); if (AvailableVal == 0) return false; Modified: llvm/trunk/test/Transforms/GVN/rle.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/rle.ll?rev=82460&r1=82459&r2=82460&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GVN/rle.ll (original) +++ llvm/trunk/test/Transforms/GVN/rle.ll Mon Sep 21 12:24:04 2009 @@ -13,6 +13,20 @@ ; CHECK: ret i32 %V } + +;;===----------------------------------------------------------------------===;; +;; Tests for crashers +;;===----------------------------------------------------------------------===;; + +;; PR5016 +define i8 @crash0({i32, i32} %A, {i32, i32}* %P) { + store {i32, i32} %A, {i32, i32}* %P + %X = bitcast {i32, i32}* %P to i8* + %Y = load i8* %X + ret i8 %Y +} + + ;;===----------------------------------------------------------------------===;; ;; Store -> Load and Load -> Load forwarding where src and dst are different ;; types, but where the base pointer is a must alias. From dpatel at apple.com Mon Sep 21 12:24:42 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Sep 2009 10:24:42 -0700 Subject: [llvm-commits] [PATCH] TrackingVH and DebugInfo changes In-Reply-To: <6a8523d60909192237u182ad2b2h1352e17bf5c1206@mail.gmail.com> References: <6a8523d60909192237u182ad2b2h1352e17bf5c1206@mail.gmail.com> Message-ID: <972DB0A0-E559-4011-8343-380DFD976265@apple.com> On Sep 19, 2009, at 10:37 PM, Daniel Dunbar wrote: > Hi, > > The attached patches add a TrackingVH and changes DebugInfo to use it > *everywhere*. > > The immediate motivation for this change is PR4984: > http://llvm.org/bugs/show_bug.cgi?id=4894 > but they are also motivated by the general complexity of using > something which is represented by an MDNode. > > The issue is that metadata nodes are uniqued, sometimes surprisingly. :) > This patch essentially trades some runtime performance for safety by > making sure that DebugInfo objects never have dangling pointers. > > It isn't without warts, see the comments on TrackingVH. I also decided > to change DIDerivedType to allow its version of replaceAllUsesWith() > on a value with itself. ok. > The issue here is that a DIDerivedType wraps > an MDNode internally, so it may be very reasonable for a client to do > something like: > -- > DIDerivedType A = ...; > ... do some work, for example code which may build a recursive > reference to A ... > DIDerivedType B = ... create the real object ...; > B.replaceAllUsesWith(B); > -- > but due to MDNode uniquing, its possible that A and B will end up > pointing to the same underlying node. It seems mean to require clients > to remember this, but it does go against the RAUW convention. > > Overall I think this is an net positive change, and it will simplify > some subtle code in clang and llvm-gcc (and PR4984), but I'm open to > alternate approaches. > > Comments? looks good. > > - Daniel > <0001-Add-a-TrackingVH-value-handle.patch><0002-Switch-DIDescriptor- > to-use-a-TrackingVH.patch> - Devang From baldrick at free.fr Mon Sep 21 12:25:49 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 17:25:49 -0000 Subject: [llvm-commits] [gcc-plugin] r82461 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909211725.n8LHPnbD030499@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 12:25:49 2009 New Revision: 82461 URL: http://llvm.org/viewvc/llvm-project?rev=82461&view=rev Log: Fix a thinko introduced during CALL_EXPR -> GIMPLE_CALL conversion. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82461&r1=82460&r2=82461&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Mon Sep 21 12:25:49 2009 @@ -2750,7 +2750,7 @@ // Handle the result, including struct returns. ABIConverter.HandleReturnType(gimple_call_return_type(stmt), - fndecl ? fndecl : gimple_call_return_type(stmt), + fndecl ? fndecl : fntype, fndecl ? DECL_BUILT_IN(fndecl) : false); // Pass the static chain, if any, as the first parameter. From gohman at apple.com Mon Sep 21 12:53:35 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 17:53:35 -0000 Subject: [llvm-commits] [llvm] r82462 - /llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp Message-ID: <200909211753.n8LHrZV1001771@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 12:53:35 2009 New Revision: 82462 URL: http://llvm.org/viewvc/llvm-project?rev=82462&view=rev Log: Remove the special-case for constants in PHI nodes; it's not really helpful, and it didn't correctly handle the case of constants input to PHIs for backedges. Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp?rev=82462&r1=82461&r2=82462&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp Mon Sep 21 12:53:35 2009 @@ -60,9 +60,6 @@ for (BasicBlock::iterator BBI = BB->begin(), BBE = BB->end(); BBI != BBE; ++BBI) { Instruction *I = BBI; - // Don't bother hoisting constants out of loop-header phi nodes. - if (BB == L->getHeader() && isa(I)) - continue; // TODO: For now, skip all intrinsic instructions, because some of them // can require their operands to be constants, and we don't want to // break that. From gohman at apple.com Mon Sep 21 12:54:42 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 17:54:42 -0000 Subject: [llvm-commits] [llvm] r82463 - /llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp Message-ID: <200909211754.n8LHsgUS001914@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 12:54:42 2009 New Revision: 82463 URL: http://llvm.org/viewvc/llvm-project?rev=82463&view=rev Log: Nick pointed out that DominanceFrontier and DominanceTree are preserved by setPreservesCFG(). Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp?rev=82463&r1=82462&r2=82463&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenLICM.cpp Mon Sep 21 12:54:42 2009 @@ -104,8 +104,6 @@ AU.addPreservedID(LoopSimplifyID); AU.addPreserved(); AU.addPreserved(); - AU.addPreserved(); - AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); From sabre at nondot.org Mon Sep 21 12:55:48 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 17:55:48 -0000 Subject: [llvm-commits] [llvm] r82464 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200909211755.n8LHtmch002057@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 12:55:47 2009 New Revision: 82464 URL: http://llvm.org/viewvc/llvm-project?rev=82464&view=rev Log: big endian systems shift by bits too, hopefully this will fix the ppc bootstrap problems. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=82464&r1=82463&r2=82464&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 21 12:55:47 2009 @@ -1202,7 +1202,7 @@ if (TD.isLittleEndian()) { ShiftAmt = Offset*8; } else { - ShiftAmt = StoreSize-LoadSize-Offset; + ShiftAmt = (StoreSize-LoadSize-Offset)*8; } if (ShiftAmt) From gohman at apple.com Mon Sep 21 12:58:09 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 17:58:09 -0000 Subject: [llvm-commits] [llvm] r82465 - in /llvm/trunk/lib/Target: SystemZ/SystemZInstrBuilder.h X86/X86InstrBuilder.h Message-ID: <200909211758.n8LHwAUk002349@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 12:58:09 2009 New Revision: 82465 URL: http://llvm.org/viewvc/llvm-project?rev=82465&view=rev Log: Fix the offset values for these memoperands. For frame objects, the PseudoSourceValue already effectively represents the offset from the frame base, so the actual offset should not be added to it. Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h llvm/trunk/lib/Target/X86/X86InstrBuilder.h Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h?rev=82465&r1=82464&r2=82465&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h Mon Sep 21 12:58:09 2009 @@ -115,7 +115,7 @@ Flags |= MachineMemOperand::MOStore; MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FI), Flags, - MFI.getObjectOffset(FI) + Offset, + Offset, MFI.getObjectSize(FI), MFI.getObjectAlignment(FI)); return addOffset(MIB.addFrameIndex(FI), Offset) Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=82465&r1=82464&r2=82465&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Mon Sep 21 12:58:09 2009 @@ -144,7 +144,7 @@ Flags |= MachineMemOperand::MOStore; MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FI), Flags, - MFI.getObjectOffset(FI) + Offset, + Offset, MFI.getObjectSize(FI), MFI.getObjectAlignment(FI)); return addOffset(MIB.addFrameIndex(FI), Offset) From gohman at apple.com Mon Sep 21 13:03:22 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 18:03:22 -0000 Subject: [llvm-commits] [llvm] r82466 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/scalar-min-max-fill-operand.ll test/CodeGen/X86/sse-minmax.ll Message-ID: <200909211803.n8LI3N7P003019@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 13:03:22 2009 New Revision: 82466 URL: http://llvm.org/viewvc/llvm-project?rev=82466&view=rev Log: Recognize SSE min and max opportunities in even more cases. And fix a bug with the behavior of min/max instructions formed from fcmp uge comparisons. Also, use FiniteOnlyFPMath() for this code instead of UnsafeFPMath, as it is more specific. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/scalar-min-max-fill-operand.ll llvm/trunk/test/CodeGen/X86/sse-minmax.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=82466&r1=82465&r2=82466&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Sep 21 13:03:22 2009 @@ -8256,76 +8256,158 @@ SDValue LHS = N->getOperand(1); SDValue RHS = N->getOperand(2); - // If we have SSE[12] support, try to form min/max nodes. + // If we have SSE[12] support, try to form min/max nodes. SSE min/max + // instructions have the peculiarity that if either operand is a NaN, + // they chose what we call the RHS operand (and as such are not symmetric). + // It happens that this matches the semantics of the common C idiom + // xhasSSE2() && (LHS.getValueType() == MVT::f32 || LHS.getValueType() == MVT::f64) && Cond.getOpcode() == ISD::SETCC) { ISD::CondCode CC = cast(Cond.getOperand(2))->get(); unsigned Opcode = 0; + // Check for x CC y ? x : y. if (LHS == Cond.getOperand(0) && RHS == Cond.getOperand(1)) { switch (CC) { default: break; - case ISD::SETOLE: // (X <= Y) ? X : Y -> min + case ISD::SETULT: + // This can be a min if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(RHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(LHS)) + break; + } + Opcode = X86ISD::FMIN; + break; + case ISD::SETOLE: + // This can be a min if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(LHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(RHS)) + break; + } + Opcode = X86ISD::FMIN; + break; case ISD::SETULE: - case ISD::SETLE: - if (!UnsafeFPMath) break; - // FALL THROUGH. - case ISD::SETOLT: // (X olt/lt Y) ? X : Y -> min + // This can be a min, but if either operand is a NaN we need it to + // preserve the original LHS. + std::swap(LHS, RHS); + case ISD::SETOLT: case ISD::SETLT: + case ISD::SETLE: Opcode = X86ISD::FMIN; break; - case ISD::SETOGT: // (X > Y) ? X : Y -> max + case ISD::SETOGE: + // This can be a max if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(LHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(RHS)) + break; + } + Opcode = X86ISD::FMAX; + break; case ISD::SETUGT: + // This can be a max if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(RHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(LHS)) + break; + } + Opcode = X86ISD::FMAX; + break; + case ISD::SETUGE: + // This can be a max, but if either operand is a NaN we need it to + // preserve the original LHS. + std::swap(LHS, RHS); + case ISD::SETOGT: case ISD::SETGT: - if (!UnsafeFPMath) break; - // FALL THROUGH. - case ISD::SETUGE: // (X uge/ge Y) ? X : Y -> max case ISD::SETGE: Opcode = X86ISD::FMAX; break; } + // Check for x CC y ? y : x -- a min/max with reversed arms. } else if (LHS == Cond.getOperand(1) && RHS == Cond.getOperand(0)) { switch (CC) { default: break; - case ISD::SETOGT: - // This can use a min only if the LHS isn't NaN. - if (DAG.isKnownNeverNaN(LHS)) - Opcode = X86ISD::FMIN; - else if (DAG.isKnownNeverNaN(RHS)) { - Opcode = X86ISD::FMIN; - // Put the potential NaN in the RHS so that SSE will preserve it. - std::swap(LHS, RHS); + case ISD::SETOGE: + // This can be a min if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(RHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(LHS)) + break; } + Opcode = X86ISD::FMIN; break; - - case ISD::SETUGT: // (X > Y) ? Y : X -> min + case ISD::SETUGT: + // This can be a min if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(LHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(RHS)) + break; + } + Opcode = X86ISD::FMIN; + break; + case ISD::SETUGE: + // This can be a min, but if either operand is a NaN we need it to + // preserve the original LHS. + std::swap(LHS, RHS); + case ISD::SETOGT: case ISD::SETGT: - if (!UnsafeFPMath) break; - // FALL THROUGH. - case ISD::SETUGE: // (X uge/ge Y) ? Y : X -> min case ISD::SETGE: Opcode = X86ISD::FMIN; break; - case ISD::SETULE: - // This can use a max only if the LHS isn't NaN. - if (DAG.isKnownNeverNaN(LHS)) - Opcode = X86ISD::FMAX; - else if (DAG.isKnownNeverNaN(RHS)) { - Opcode = X86ISD::FMAX; - // Put the potential NaN in the RHS so that SSE will preserve it. - std::swap(LHS, RHS); + case ISD::SETULT: + // This can be a max if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(LHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(RHS)) + break; } + Opcode = X86ISD::FMAX; break; - - case ISD::SETOLE: // (X <= Y) ? Y : X -> max - case ISD::SETLE: - if (!UnsafeFPMath) break; - // FALL THROUGH. - case ISD::SETOLT: // (X olt/lt Y) ? Y : X -> max + case ISD::SETOLE: + // This can be a max if we can prove that at least one of the operands + // is not a nan. + if (!FiniteOnlyFPMath()) { + if (DAG.isKnownNeverNaN(RHS)) { + // Put the potential NaN in the RHS so that SSE will preserve it. + std::swap(LHS, RHS); + } else if (!DAG.isKnownNeverNaN(LHS)) + break; + } + Opcode = X86ISD::FMAX; + break; + case ISD::SETULE: + // This can be a max, but if either operand is a NaN we need it to + // preserve the original LHS. + std::swap(LHS, RHS); + case ISD::SETOLT: case ISD::SETLT: + case ISD::SETLE: Opcode = X86ISD::FMAX; break; } Modified: llvm/trunk/test/CodeGen/X86/scalar-min-max-fill-operand.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/scalar-min-max-fill-operand.ll?rev=82466&r1=82465&r2=82466&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/scalar-min-max-fill-operand.ll (original) +++ llvm/trunk/test/CodeGen/X86/scalar-min-max-fill-operand.ll Mon Sep 21 13:03:22 2009 @@ -4,17 +4,17 @@ declare float @bar() -define float @foo(float %a) +define float @foo(float %a) nounwind { %s = call float @bar() %t = fcmp olt float %s, %a %u = select i1 %t, float %s, float %a ret float %u } -define float @hem(float %a) +define float @hem(float %a) nounwind { %s = call float @bar() - %t = fcmp uge float %s, %a + %t = fcmp ogt float %s, %a %u = select i1 %t, float %s, float %a ret float %u } Modified: llvm/trunk/test/CodeGen/X86/sse-minmax.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse-minmax.ll?rev=82466&r1=82465&r2=82466&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/sse-minmax.ll (original) +++ llvm/trunk/test/CodeGen/X86/sse-minmax.ll Mon Sep 21 13:03:22 2009 @@ -1,4 +1,323 @@ -; RUN: llc < %s -march=x86-64 | FileCheck %s +; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s + +; Some of these patterns can be matched as SSE min or max. Some of +; then can be matched provided that the operands are swapped. +; Some of them can't be matched at all and require a comparison +; and a conditional branch. + +; The naming convention is {,x_}{o,u}{gt,lt,ge,le}{,_inverse} +; x_ : use 0.0 instead of %y +; _inverse : swap the arms of the select. + +; CHECK: ogt: +; CHECK-NEXT: maxsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @ogt(double %x, double %y) nounwind { + %c = fcmp ogt double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: olt: +; CHECK-NEXT: minsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @olt(double %x, double %y) nounwind { + %c = fcmp olt double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: ogt_inverse: +; CHECK-NEXT: minsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @ogt_inverse(double %x, double %y) nounwind { + %c = fcmp ogt double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: olt_inverse: +; CHECK-NEXT: maxsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @olt_inverse(double %x, double %y) nounwind { + %c = fcmp olt double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: oge: +; CHECK-NEXT: ucomisd %xmm1, %xmm0 +define double @oge(double %x, double %y) nounwind { + %c = fcmp oge double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: ole: +; CHECK-NEXT: ucomisd %xmm0, %xmm1 +define double @ole(double %x, double %y) nounwind { + %c = fcmp ole double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: oge_inverse: +; CHECK-NEXT: ucomisd %xmm1, %xmm0 +define double @oge_inverse(double %x, double %y) nounwind { + %c = fcmp oge double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: ole_inverse: +; CHECK-NEXT: ucomisd %xmm0, %xmm1 +define double @ole_inverse(double %x, double %y) nounwind { + %c = fcmp ole double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: x_ogt: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ogt(double %x) nounwind { + %c = fcmp ogt double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_olt: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_olt(double %x) nounwind { + %c = fcmp olt double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_ogt_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ogt_inverse(double %x) nounwind { + %c = fcmp ogt double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: x_olt_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_olt_inverse(double %x) nounwind { + %c = fcmp olt double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: x_oge: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_oge(double %x) nounwind { + %c = fcmp oge double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_ole: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ole(double %x) nounwind { + %c = fcmp ole double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_oge_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_oge_inverse(double %x) nounwind { + %c = fcmp oge double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: x_ole_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ole_inverse(double %x) nounwind { + %c = fcmp ole double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: ugt: +; CHECK-NEXT: ucomisd %xmm0, %xmm1 +define double @ugt(double %x, double %y) nounwind { + %c = fcmp ugt double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: ult: +; CHECK-NEXT: ucomisd %xmm1, %xmm0 +define double @ult(double %x, double %y) nounwind { + %c = fcmp ult double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: ugt_inverse: +; CHECK-NEXT: ucomisd %xmm0, %xmm1 +define double @ugt_inverse(double %x, double %y) nounwind { + %c = fcmp ugt double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: ult_inverse: +; CHECK-NEXT: ucomisd %xmm1, %xmm0 +define double @ult_inverse(double %x, double %y) nounwind { + %c = fcmp ult double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: uge: +; CHECK-NEXT: maxsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @uge(double %x, double %y) nounwind { + %c = fcmp uge double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: ule: +; CHECK-NEXT: minsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @ule(double %x, double %y) nounwind { + %c = fcmp ule double %x, %y + %d = select i1 %c, double %x, double %y + ret double %d +} + +; CHECK: uge_inverse: +; CHECK-NEXT: minsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @uge_inverse(double %x, double %y) nounwind { + %c = fcmp uge double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: ule_inverse: +; CHECK-NEXT: maxsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @ule_inverse(double %x, double %y) nounwind { + %c = fcmp ule double %x, %y + %d = select i1 %c, double %y, double %x + ret double %d +} + +; CHECK: x_ugt: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ugt(double %x) nounwind { + %c = fcmp ugt double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_ult: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ult(double %x) nounwind { + %c = fcmp ult double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_ugt_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ugt_inverse(double %x) nounwind { + %c = fcmp ugt double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: x_ult_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ult_inverse(double %x) nounwind { + %c = fcmp ult double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: x_uge: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_uge(double %x) nounwind { + %c = fcmp uge double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_ule: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm0, %xmm1 +; CHECK-NEXT: movapd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ule(double %x) nounwind { + %c = fcmp ule double %x, 0.000000e+00 + %d = select i1 %c, double %x, double 0.000000e+00 + ret double %d +} + +; CHECK: x_uge_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: minsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_uge_inverse(double %x) nounwind { + %c = fcmp uge double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; CHECK: x_ule_inverse: +; CHECK-NEXT: pxor %xmm1, %xmm1 +; CHECK-NEXT: maxsd %xmm1, %xmm0 +; CHECK-NEXT: ret +define double @x_ule_inverse(double %x) nounwind { + %c = fcmp ule double %x, 0.000000e+00 + %d = select i1 %c, double 0.000000e+00, double %x + ret double %d +} + +; Test a few more misc. cases. ; CHECK: clampTo3k_a: ; CHECK: minsd From wendling at apple.com Mon Sep 21 13:11:11 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 21 Sep 2009 11:11:11 -0700 Subject: [llvm-commits] [gcc-plugin] r82450 - in /gcc-plugin/trunk/utils: ./ target.cpp In-Reply-To: <200909210940.n8L9e9vi002094@zion.cs.uiuc.edu> References: <200909210940.n8L9e9vi002094@zion.cs.uiuc.edu> Message-ID: On Sep 21, 2009, at 2:40 AM, Duncan Sands wrote: > Author: baldrick > Date: Mon Sep 21 04:40:06 2009 > New Revision: 82450 > > URL: http://llvm.org/viewvc/llvm-project?rev=82450&view=rev > Log: > Add a helper for printing info extracted from the > target triple. > > Added: > gcc-plugin/trunk/utils/ > gcc-plugin/trunk/utils/target.cpp > > Added: gcc-plugin/trunk/utils/target.cpp > URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/utils/target.cpp?rev=82450&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- gcc-plugin/trunk/utils/target.cpp (added) > +++ gcc-plugin/trunk/utils/target.cpp Mon Sep 21 04:40:06 2009 > @@ -0,0 +1,68 @@ > +#include > +#include > + Are you sure you wouldn't rather use the raw_ostream instead? :-) -bw From wendling at apple.com Mon Sep 21 13:17:47 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 21 Sep 2009 11:17:47 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: <1EC41638-6AA6-448D-9D4D-9A21F07ECB56@apple.com> References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1EC41638-6AA6-448D-9D4D-9A21F07ECB56@apple.com> Message-ID: All of my EH changes were reverted, so it's something else. -bw On Sep 21, 2009, at 9:30 AM, Evan Cheng wrote: > 483_xalancbmk is still failing as far as I can tell. The rest are > fixed. > > Evan > > On Sep 19, 2009, at 10:12 AM, Daniel Dunbar wrote: > >> Hi All, >> >> There were a large number of regressions on the nightly tests last >> night. I'd appreciate some help in tracking down the failures. >> >> This is a summary of the important new failures: >> >> This is failing in many places: >> SingleSource/Regression/C++/EH/exception_spec_test [LLC, LLC-BETA, >> LLC compile, LLC_BETA compile] >> and these are failing in some places: >> SingleSource/Benchmarks/Shootout-C++/except [LLC, LLC-BETA, LLC >> compile, LLC_BETA compile] >> SingleSource/Regression/C++/EH/ctor_dtor_count-2 [LLC, LLC-BETA, LLC >> compile, LLC_BETA compile] >> SingleSource/Regression/C++/EH/throw_rethrow_test [LLC, LLC-BETA, >> LLC compile, LLC_BETA compile] >> and this is failing when built with clang: >> SingleSource/UnitTests/ObjC/exceptions [LLC, LLC-BETA, LLC compile, >> LLC_BETA compile] >> >> Bill, Chris, Eric, Duncan: Can you guys sort out someone to look at >> it? >> >> This is failing in a number of places: >> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT >> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >> compile] >> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT >> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >> compile] >> and these are failing in at least one place: >> Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC >> compile, LLC_BETA compile] >> Externals/SPEC/CINT2000/252_eon/252_eon [JIT codegen] >> >> Evan or Dan, can you guys point a finger or take a look? >> >> Thanks, >> - Daniel > From baldrick at free.fr Mon Sep 21 13:26:35 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 18:26:35 -0000 Subject: [llvm-commits] [gcc-plugin] r82468 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909211826.n8LIQZ7g006103@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 13:26:34 2009 New Revision: 82468 URL: http://llvm.org/viewvc/llvm-project?rev=82468&view=rev Log: Ignore gimple debug info for the moment rather than crashing. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82468&r1=82467&r2=82468&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Mon Sep 21 13:26:34 2009 @@ -962,6 +962,10 @@ RenderGIMPLE_COND(gimple_stmt); break; + case GIMPLE_DEBUG: + // TODO: Output debug info rather than just discarding it. + break; + case GIMPLE_GOTO: RenderGIMPLE_GOTO(gimple_stmt); break; From baldrick at free.fr Mon Sep 21 13:28:02 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 18:28:02 -0000 Subject: [llvm-commits] [gcc-plugin] r82469 - /gcc-plugin/trunk/utils/target.cpp Message-ID: <200909211828.n8LIS2Lg006291@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 21 13:28:02 2009 New Revision: 82469 URL: http://llvm.org/viewvc/llvm-project?rev=82469&view=rev Log: Print "darwin" rather than "darwin9.8.0" or whatever when using the -o option. Modified: gcc-plugin/trunk/utils/target.cpp Modified: gcc-plugin/trunk/utils/target.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/utils/target.cpp?rev=82469&r1=82468&r2=82469&view=diff ============================================================================== --- gcc-plugin/trunk/utils/target.cpp (original) +++ gcc-plugin/trunk/utils/target.cpp Mon Sep 21 13:28:02 2009 @@ -14,8 +14,8 @@ static void PrintVendorName(Triple &T) { std::cout << T.getVendorName().str() << "\n"; } -static void PrintOSName(Triple &T) { - std::cout << T.getOSName().str() << "\n"; +static void PrintOSTypeName(Triple &T) { + std::cout << T.getOSTypeName(T.getOS()) << "\n"; } static void PrintEnvironmentName(Triple &T) { std::cout << T.getEnvironmentName().str() << "\n"; @@ -36,7 +36,7 @@ { "-t", PrintTriple }, { "-a", PrintArchName }, { "-v", PrintVendorName }, - { "-o", PrintOSName }, + { "-o", PrintOSTypeName }, { "-e", PrintEnvironmentName }, { "-oe", PrintOSAndEnvironmentName }, { "-p", PrintArchTypePrefix }, From gohman at apple.com Mon Sep 21 13:30:38 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 18:30:38 -0000 Subject: [llvm-commits] [llvm] r82470 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/remat-scalar-zero.ll Message-ID: <200909211830.n8LIUcg8006623@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 13:30:38 2009 New Revision: 82470 URL: http://llvm.org/viewvc/llvm-project?rev=82470&view=rev Log: Add support for rematerializing FsFLD0SS and FsFLD0SD as constant-pool loads in order to reduce register pressure. Added: llvm/trunk/test/CodeGen/X86/remat-scalar-zero.ll Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=82470&r1=82469&r2=82470&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Sep 21 13:30:38 2009 @@ -2297,9 +2297,21 @@ unsigned Alignment = 0; if (LoadMI->hasOneMemOperand()) Alignment = LoadMI->memoperands_begin()->getAlignment(); - else if (LoadMI->getOpcode() == X86::V_SET0 || - LoadMI->getOpcode() == X86::V_SETALLONES) - Alignment = 16; + else + switch (LoadMI->getOpcode()) { + case X86::V_SET0: + case X86::V_SETALLONES: + Alignment = 16; + break; + case X86::FsFLD0SD: + Alignment = 8; + break; + case X86::FsFLD0SS: + Alignment = 4; + break; + default: + llvm_unreachable("Don't know how to fold this instruction!"); + } if (Ops.size() == 2 && Ops[0] == 0 && Ops[1] == 1) { unsigned NewOpc = 0; switch (MI->getOpcode()) { @@ -2316,8 +2328,11 @@ return NULL; SmallVector MOs; - if (LoadMI->getOpcode() == X86::V_SET0 || - LoadMI->getOpcode() == X86::V_SETALLONES) { + switch (LoadMI->getOpcode()) { + case X86::V_SET0: + case X86::V_SETALLONES: + case X86::FsFLD0SD: + case X86::FsFLD0SS: { // Folding a V_SET0 or V_SETALLONES as a load, to ease register pressure. // Create a constant-pool entry and operands to load from it. @@ -2331,17 +2346,22 @@ // This doesn't work for several reasons. // 1. GlobalBaseReg may have been spilled. // 2. It may not be live at MI. - return false; + return NULL; } - // Create a v4i32 constant-pool entry. + // Create a constant-pool entry. MachineConstantPool &MCP = *MF.getConstantPool(); - const VectorType *Ty = - VectorType::get(Type::getInt32Ty(MF.getFunction()->getContext()), 4); - Constant *C = LoadMI->getOpcode() == X86::V_SET0 ? - Constant::getNullValue(Ty) : - Constant::getAllOnesValue(Ty); - unsigned CPI = MCP.getConstantPoolIndex(C, 16); + const Type *Ty; + if (LoadMI->getOpcode() == X86::FsFLD0SS) + Ty = Type::getFloatTy(MF.getFunction()->getContext()); + else if (LoadMI->getOpcode() == X86::FsFLD0SD) + Ty = Type::getDoubleTy(MF.getFunction()->getContext()); + else + Ty = VectorType::get(Type::getInt32Ty(MF.getFunction()->getContext()), 4); + Constant *C = LoadMI->getOpcode() == X86::V_SETALLONES ? + Constant::getAllOnesValue(Ty) : + Constant::getNullValue(Ty); + unsigned CPI = MCP.getConstantPoolIndex(C, Alignment); // Create operands to load from the constant pool entry. MOs.push_back(MachineOperand::CreateReg(PICBase, false)); @@ -2349,11 +2369,15 @@ MOs.push_back(MachineOperand::CreateReg(0, false)); MOs.push_back(MachineOperand::CreateCPI(CPI, 0)); MOs.push_back(MachineOperand::CreateReg(0, false)); - } else { + break; + } + default: { // Folding a normal load. Just copy the load's address operands. unsigned NumOps = LoadMI->getDesc().getNumOperands(); for (unsigned i = NumOps - X86AddrNumOperands; i != NumOps; ++i) MOs.push_back(LoadMI->getOperand(i)); + break; + } } return foldMemoryOperandImpl(MF, MI, Ops[0], MOs, 0, Alignment); } Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=82470&r1=82469&r2=82470&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Sep 21 13:30:38 2009 @@ -472,7 +472,8 @@ // that start with 'Fs'. // Alias instructions that map fld0 to pxor for sse. -let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1 in +let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, + canFoldAsLoad = 1 in def FsFLD0SS : I<0xEF, MRMInitReg, (outs FR32:$dst), (ins), "pxor\t$dst, $dst", [(set FR32:$dst, fp32imm0)]>, Requires<[HasSSE1]>, TB, OpSize; @@ -1230,7 +1231,8 @@ // that start with 'Fs'. // Alias instructions that map fld0 to pxor for sse. -let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1 in +let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, + canFoldAsLoad = 1 in def FsFLD0SD : I<0xEF, MRMInitReg, (outs FR64:$dst), (ins), "pxor\t$dst, $dst", [(set FR64:$dst, fpimm0)]>, Requires<[HasSSE2]>, TB, OpSize; Added: llvm/trunk/test/CodeGen/X86/remat-scalar-zero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/remat-scalar-zero.ll?rev=82470&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/remat-scalar-zero.ll (added) +++ llvm/trunk/test/CodeGen/X86/remat-scalar-zero.ll Mon Sep 21 13:30:38 2009 @@ -0,0 +1,95 @@ +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu > %t +; RUN: not grep xor %t +; RUN: not grep movap %t +; RUN: grep {\\.zero} %t + +; Remat should be able to fold the zero constant into the div instructions +; as a constant-pool load. + +define void @foo(double* nocapture %x, double* nocapture %y) nounwind { +entry: + %tmp1 = load double* %x ; [#uses=1] + %arrayidx4 = getelementptr inbounds double* %x, i64 1 ; [#uses=1] + %tmp5 = load double* %arrayidx4 ; [#uses=1] + %arrayidx8 = getelementptr inbounds double* %x, i64 2 ; [#uses=1] + %tmp9 = load double* %arrayidx8 ; [#uses=1] + %arrayidx12 = getelementptr inbounds double* %x, i64 3 ; [#uses=1] + %tmp13 = load double* %arrayidx12 ; [#uses=1] + %arrayidx16 = getelementptr inbounds double* %x, i64 4 ; [#uses=1] + %tmp17 = load double* %arrayidx16 ; [#uses=1] + %arrayidx20 = getelementptr inbounds double* %x, i64 5 ; [#uses=1] + %tmp21 = load double* %arrayidx20 ; [#uses=1] + %arrayidx24 = getelementptr inbounds double* %x, i64 6 ; [#uses=1] + %tmp25 = load double* %arrayidx24 ; [#uses=1] + %arrayidx28 = getelementptr inbounds double* %x, i64 7 ; [#uses=1] + %tmp29 = load double* %arrayidx28 ; [#uses=1] + %arrayidx32 = getelementptr inbounds double* %x, i64 8 ; [#uses=1] + %tmp33 = load double* %arrayidx32 ; [#uses=1] + %arrayidx36 = getelementptr inbounds double* %x, i64 9 ; [#uses=1] + %tmp37 = load double* %arrayidx36 ; [#uses=1] + %arrayidx40 = getelementptr inbounds double* %x, i64 10 ; [#uses=1] + %tmp41 = load double* %arrayidx40 ; [#uses=1] + %arrayidx44 = getelementptr inbounds double* %x, i64 11 ; [#uses=1] + %tmp45 = load double* %arrayidx44 ; [#uses=1] + %arrayidx48 = getelementptr inbounds double* %x, i64 12 ; [#uses=1] + %tmp49 = load double* %arrayidx48 ; [#uses=1] + %arrayidx52 = getelementptr inbounds double* %x, i64 13 ; [#uses=1] + %tmp53 = load double* %arrayidx52 ; [#uses=1] + %arrayidx56 = getelementptr inbounds double* %x, i64 14 ; [#uses=1] + %tmp57 = load double* %arrayidx56 ; [#uses=1] + %arrayidx60 = getelementptr inbounds double* %x, i64 15 ; [#uses=1] + %tmp61 = load double* %arrayidx60 ; [#uses=1] + %arrayidx64 = getelementptr inbounds double* %x, i64 16 ; [#uses=1] + %tmp65 = load double* %arrayidx64 ; [#uses=1] + %div = fdiv double %tmp1, 0.000000e+00 ; [#uses=1] + store double %div, double* %y + %div70 = fdiv double %tmp5, 2.000000e-01 ; [#uses=1] + %arrayidx72 = getelementptr inbounds double* %y, i64 1 ; [#uses=1] + store double %div70, double* %arrayidx72 + %div74 = fdiv double %tmp9, 2.000000e-01 ; [#uses=1] + %arrayidx76 = getelementptr inbounds double* %y, i64 2 ; [#uses=1] + store double %div74, double* %arrayidx76 + %div78 = fdiv double %tmp13, 2.000000e-01 ; [#uses=1] + %arrayidx80 = getelementptr inbounds double* %y, i64 3 ; [#uses=1] + store double %div78, double* %arrayidx80 + %div82 = fdiv double %tmp17, 2.000000e-01 ; [#uses=1] + %arrayidx84 = getelementptr inbounds double* %y, i64 4 ; [#uses=1] + store double %div82, double* %arrayidx84 + %div86 = fdiv double %tmp21, 2.000000e-01 ; [#uses=1] + %arrayidx88 = getelementptr inbounds double* %y, i64 5 ; [#uses=1] + store double %div86, double* %arrayidx88 + %div90 = fdiv double %tmp25, 2.000000e-01 ; [#uses=1] + %arrayidx92 = getelementptr inbounds double* %y, i64 6 ; [#uses=1] + store double %div90, double* %arrayidx92 + %div94 = fdiv double %tmp29, 2.000000e-01 ; [#uses=1] + %arrayidx96 = getelementptr inbounds double* %y, i64 7 ; [#uses=1] + store double %div94, double* %arrayidx96 + %div98 = fdiv double %tmp33, 2.000000e-01 ; [#uses=1] + %arrayidx100 = getelementptr inbounds double* %y, i64 8 ; [#uses=1] + store double %div98, double* %arrayidx100 + %div102 = fdiv double %tmp37, 2.000000e-01 ; [#uses=1] + %arrayidx104 = getelementptr inbounds double* %y, i64 9 ; [#uses=1] + store double %div102, double* %arrayidx104 + %div106 = fdiv double %tmp41, 2.000000e-01 ; [#uses=1] + %arrayidx108 = getelementptr inbounds double* %y, i64 10 ; [#uses=1] + store double %div106, double* %arrayidx108 + %div110 = fdiv double %tmp45, 2.000000e-01 ; [#uses=1] + %arrayidx112 = getelementptr inbounds double* %y, i64 11 ; [#uses=1] + store double %div110, double* %arrayidx112 + %div114 = fdiv double %tmp49, 2.000000e-01 ; [#uses=1] + %arrayidx116 = getelementptr inbounds double* %y, i64 12 ; [#uses=1] + store double %div114, double* %arrayidx116 + %div118 = fdiv double %tmp53, 2.000000e-01 ; [#uses=1] + %arrayidx120 = getelementptr inbounds double* %y, i64 13 ; [#uses=1] + store double %div118, double* %arrayidx120 + %div122 = fdiv double %tmp57, 2.000000e-01 ; [#uses=1] + %arrayidx124 = getelementptr inbounds double* %y, i64 14 ; [#uses=1] + store double %div122, double* %arrayidx124 + %div126 = fdiv double %tmp61, 2.000000e-01 ; [#uses=1] + %arrayidx128 = getelementptr inbounds double* %y, i64 15 ; [#uses=1] + store double %div126, double* %arrayidx128 + %div130 = fdiv double %tmp65, 0.000000e+00 ; [#uses=1] + %arrayidx132 = getelementptr inbounds double* %y, i64 16 ; [#uses=1] + store double %div130, double* %arrayidx132 + ret void +} From gohman at apple.com Mon Sep 21 13:32:20 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 18:32:20 -0000 Subject: [llvm-commits] [llvm] r82471 - /llvm/trunk/test/CodeGen/X86/peep-test-3.ll Message-ID: <200909211832.n8LIWKrs006860@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 13:32:20 2009 New Revision: 82471 URL: http://llvm.org/viewvc/llvm-project?rev=82471&view=rev Log: Add a comment mentioning the rdar number associated with this test. Modified: llvm/trunk/test/CodeGen/X86/peep-test-3.ll Modified: llvm/trunk/test/CodeGen/X86/peep-test-3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/peep-test-3.ll?rev=82471&r1=82470&r2=82471&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/peep-test-3.ll (original) +++ llvm/trunk/test/CodeGen/X86/peep-test-3.ll Mon Sep 21 13:32:20 2009 @@ -1,4 +1,5 @@ ; RUN: llc < %s -march=x86 | FileCheck %s +; rdar://7226797 ; LLVM should omit the testl and use the flags result from the orl. From gohman at apple.com Mon Sep 21 13:37:02 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 11:37:02 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1EC41638-6AA6-448D-9D4D-9A21F07ECB56@apple.com> Message-ID: <761FE368-C749-4C41-AB7D-73DC2C3EBAE0@apple.com> When I run 483.xalancbmk, it gets an opt verifier error: "Invoke result does not dominate all uses!" Anyone have any guesses as to what triggered that? Dan On Sep 21, 2009, at 11:17 AM, Bill Wendling wrote: > All of my EH changes were reverted, so it's something else. > > -bw > > On Sep 21, 2009, at 9:30 AM, Evan Cheng wrote: > >> 483_xalancbmk is still failing as far as I can tell. The rest are >> fixed. >> >> Evan >> >> On Sep 19, 2009, at 10:12 AM, Daniel Dunbar wrote: >> >>> Hi All, >>> >>> There were a large number of regressions on the nightly tests last >>> night. I'd appreciate some help in tracking down the failures. >>> >>> This is a summary of the important new failures: >>> >>> This is failing in many places: >>> SingleSource/Regression/C++/EH/exception_spec_test [LLC, LLC-BETA, >>> LLC compile, LLC_BETA compile] >>> and these are failing in some places: >>> SingleSource/Benchmarks/Shootout-C++/except [LLC, LLC-BETA, LLC >>> compile, LLC_BETA compile] >>> SingleSource/Regression/C++/EH/ctor_dtor_count-2 [LLC, LLC-BETA, LLC >>> compile, LLC_BETA compile] >>> SingleSource/Regression/C++/EH/throw_rethrow_test [LLC, LLC-BETA, >>> LLC compile, LLC_BETA compile] >>> and this is failing when built with clang: >>> SingleSource/UnitTests/ObjC/exceptions [LLC, LLC-BETA, LLC compile, >>> LLC_BETA compile] >>> >>> Bill, Chris, Eric, Duncan: Can you guys sort out someone to look >>> at it? >>> >>> This is failing in a number of places: >>> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, JIT >>> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >>> compile] >>> Externals/SPEC/CINT2006/483_xalancbmk/483_xalancbmk [JIT, CBE, JIT >>> codegen, LLC, LLC-BETA, LLC compile, Bitcode, GCCAS, LLC_BETA >>> compile] >>> and these are failing in at least one place: >>> Externals/SPEC/CINT2006/471_omnetpp/471_omnetpp [LLC, LLC-BETA, LLC >>> compile, LLC_BETA compile] >>> Externals/SPEC/CINT2000/252_eon/252_eon [JIT codegen] >>> >>> Evan or Dan, can you guys point a finger or take a look? >>> >>> Thanks, >>> - Daniel >> > From deeppatel1987 at gmail.com Mon Sep 21 13:38:33 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Mon, 21 Sep 2009 18:38:33 +0000 Subject: [llvm-commits] [gcc-plugin] r82450 - in /gcc-plugin/trunk/utils: ./ target.cpp In-Reply-To: <200909210940.n8L9e9vi002094@zion.cs.uiuc.edu> References: <200909210940.n8L9e9vi002094@zion.cs.uiuc.edu> Message-ID: <305d6f60909211138v6148c9ddua9acee9c6a8e4dc6@mail.gmail.com> Would it make sense to use command line options that resemble those used with uname? deep On Mon, Sep 21, 2009 at 9:40 AM, Duncan Sands wrote: > Author: baldrick > Date: Mon Sep 21 04:40:06 2009 > New Revision: 82450 > > URL: http://llvm.org/viewvc/llvm-project?rev=82450&view=rev > Log: > Add a helper for printing info extracted from the > target triple. > > Added: > ? ?gcc-plugin/trunk/utils/ > ? ?gcc-plugin/trunk/utils/target.cpp > > Added: gcc-plugin/trunk/utils/target.cpp > URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/utils/target.cpp?rev=82450&view=auto > > ============================================================================== > --- gcc-plugin/trunk/utils/target.cpp (added) > +++ gcc-plugin/trunk/utils/target.cpp Mon Sep 21 04:40:06 2009 > @@ -0,0 +1,68 @@ > +#include > +#include > + > +#include > + > +using namespace llvm; > + > +static void PrintTriple(Triple &T) { > + ?std::cout << T.getTriple() << "\n"; > +} > +static void PrintArchName(Triple &T) { > + ?std::cout << T.getArchName().str() << "\n"; > +} > +static void PrintVendorName(Triple &T) { > + ?std::cout << T.getVendorName().str() << "\n"; > +} > +static void PrintOSName(Triple &T) { > + ?std::cout << T.getOSName().str() << "\n"; > +} > +static void PrintEnvironmentName(Triple &T) { > + ?std::cout << T.getEnvironmentName().str() << "\n"; > +} > +static void PrintOSAndEnvironmentName(Triple &T) { > + ?std::cout << T.getOSAndEnvironmentName().str() << "\n"; > +} > +static void PrintArchTypePrefix(Triple &T) { > + ?std::cout << T.getArchTypePrefix(T.getArch()) << "\n"; > +} > + > +struct Option { > + ?const char *Name; > + ?void (*Action)(Triple &); > +}; > + > +static Option Options[] = { > + ?{ "-t", PrintTriple }, > + ?{ "-a", PrintArchName }, > + ?{ "-v", PrintVendorName }, > + ?{ "-o", PrintOSName }, > + ?{ "-e", PrintEnvironmentName }, > + ?{ "-oe", PrintOSAndEnvironmentName }, > + ?{ "-p", PrintArchTypePrefix }, > + ?{ NULL, NULL } > +}; > + > +int main(int argc, char **argv) { > + ?Triple T(TARGET_NAME); > + > + ?for (int i = 1; i < argc; ++i) { > + ? ?bool Found = false; > + ? ?for (Option *O = Options; O->Name; ++O) > + ? ? ?if (!strcmp(argv[i], O->Name)) { > + ? ? ? ?Found = true; > + ? ? ? ?O->Action(T); > + ? ? ? ?break; > + ? ? ?} > + ? ?if (!Found) { > + ? ? ?std::cerr << "Unknown option \"" << argv[i] << "\"\n"; > + ? ? ?std::cerr << "Usage: " << argv[0]; > + ? ? ?for (Option *O = Options; O->Name; ++O) > + ? ? ? ?std::cerr << " " << O->Name; > + ? ? ?std::cerr << "\n"; > + ? ? ?return 1; > + ? ?} > + ?} > + > + ?return 0; > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From baldrick at free.fr Mon Sep 21 13:59:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Sep 2009 20:59:21 +0200 Subject: [llvm-commits] [gcc-plugin] r82450 - in /gcc-plugin/trunk/utils: ./ target.cpp In-Reply-To: References: <200909210940.n8L9e9vi002094@zion.cs.uiuc.edu> Message-ID: <4AB7CD09.3030109@free.fr> Hi Bill, > Are you sure you wouldn't rather use the raw_ostream instead? :-) this is a helper tool run during the build - speed doesn't matter. So while all my love goes to raw_ostream, here iostream will do. Thanks for pointing it out though! Ciao, Duncan. From gohman at apple.com Mon Sep 21 14:47:05 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 19:47:05 -0000 Subject: [llvm-commits] [llvm] r82473 - in /llvm/trunk: include/llvm/CodeGen/MachineMemOperand.h lib/CodeGen/MachineInstr.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/StackSlotColoring.cpp lib/CodeGen/TargetInstrInfoImpl.cpp Message-ID: <200909211947.n8LJl5jj016806@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 21 14:47:04 2009 New Revision: 82473 URL: http://llvm.org/viewvc/llvm-project?rev=82473&view=rev Log: Change MachineMemOperand's alignment value to be the alignment of the base pointer, without the offset. This matches MemSDNode's new alignment behavior, and holds more interesting information. Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/StackSlotColoring.cpp llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=82473&r1=82472&r2=82473&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Mon Sep 21 14:47:04 2009 @@ -16,6 +16,8 @@ #ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H #define LLVM_CODEGEN_MACHINEMEMOPERAND_H +#include "llvm/Support/MathExtras.h" + namespace llvm { class Value; @@ -47,9 +49,9 @@ }; /// MachineMemOperand - Construct an MachineMemOperand object with the - /// specified address Value, flags, offset, size, and alignment. + /// specified address Value, flags, offset, size, and base alignment. MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, - unsigned int a); + unsigned int base_alignment); /// getValue - Return the base address of the memory access. This may either /// be a normal LLVM IR Value, or one of the special values used in CodeGen. @@ -72,8 +74,14 @@ uint64_t getSize() const { return Size; } /// getAlignment - Return the minimum known alignment in bytes of the - /// memory reference. - unsigned int getAlignment() const { return (1u << (Flags >> 3)) >> 1; } + /// actual memory reference. + uint64_t getAlignment() const { + return MinAlign(getBaseAlignment(), getOffset()); + } + + /// getBaseAlignment - Return the minimum known alignment in bytes of the + /// base address, without the offset. + uint64_t getBaseAlignment() const { return (1u << (Flags >> 3)) >> 1; } bool isLoad() const { return Flags & MOLoad; } bool isStore() const { return Flags & MOStore; } Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=82473&r1=82472&r2=82473&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Mon Sep 21 14:47:04 2009 @@ -284,7 +284,7 @@ int64_t o, uint64_t s, unsigned int a) : Offset(o), Size(s), V(v), Flags((f & 7) | ((Log2_32(a) + 1) << 3)) { - assert(isPowerOf2_32(a) && "Alignment is not a power of 2!"); + assert(getBaseAlignment() == a && "Alignment is not a power of 2!"); assert((isLoad() || isStore()) && "Not a load/store!"); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=82473&r1=82472&r2=82473&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 21 14:47:04 2009 @@ -5015,10 +5015,10 @@ dyn_cast(getBasePtr().getNode()); if (!getSrcValue() && FI) return MachineMemOperand(PseudoSourceValue::getFixedStack(FI->getIndex()), - Flags, 0, Size, getAlignment()); + Flags, 0, Size, getOriginalAlignment()); else return MachineMemOperand(getSrcValue(), Flags, getSrcValueOffset(), - Size, getAlignment()); + Size, getOriginalAlignment()); } /// Profile - Gather unique data for the node. Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=82473&r1=82472&r2=82473&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Mon Sep 21 14:47:04 2009 @@ -473,7 +473,7 @@ else { MachineMemOperand MMO(PseudoSourceValue::getFixedStack(NewFI), MMOs[i].getFlags(), MMOs[i].getOffset(), - MMOs[i].getSize(), MMOs[i].getAlignment()); + MMOs[i].getSize(), MMOs[i].getBaseAlignment()); MI->addMemOperand(MF, MMO); } } Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=82473&r1=82472&r2=82473&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Mon Sep 21 14:47:04 2009 @@ -205,7 +205,7 @@ assert(MFI.getObjectOffset(FrameIndex) != -1); MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FrameIndex), Flags, - MFI.getObjectOffset(FrameIndex), + /*Offset=*/0, MFI.getObjectSize(FrameIndex), MFI.getObjectAlignment(FrameIndex)); NewMI->addMemOperand(MF, MMO); From isanbard at gmail.com Mon Sep 21 15:18:00 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Sep 2009 20:18:00 -0000 Subject: [llvm-commits] [llvm] r82479 - /llvm/tags/Apple/llvmCore-2208.2/ Message-ID: <200909212018.n8LKI02p021100@zion.cs.uiuc.edu> Author: void Date: Mon Sep 21 15:18:00 2009 New Revision: 82479 URL: http://llvm.org/viewvc/llvm-project?rev=82479&view=rev Log: Creating llvmCore-2208.2 from Bender-SWB. Added: llvm/tags/Apple/llvmCore-2208.2/ - copied from r82478, llvm/branches/Apple/Bender-SWB/ From isanbard at gmail.com Mon Sep 21 15:18:10 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Sep 2009 20:18:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82480 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ Message-ID: <200909212018.n8LKIAfk021142@zion.cs.uiuc.edu> Author: void Date: Mon Sep 21 15:18:09 2009 New Revision: 82480 URL: http://llvm.org/viewvc/llvm-project?rev=82480&view=rev Log: Creating llvmgcc42-2208.2 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ - copied from r82479, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From david_goodwin at apple.com Mon Sep 21 15:52:18 2009 From: david_goodwin at apple.com (David Goodwin) Date: Mon, 21 Sep 2009 20:52:18 -0000 Subject: [llvm-commits] [llvm] r82483 - in /llvm/trunk/lib/Target/ARM: ARMInstrVFP.td ARMSchedule.td ARMScheduleV6.td ARMScheduleV7.td Message-ID: <200909212052.n8LKqJ86025657@zion.cs.uiuc.edu> Author: david_goodwin Date: Mon Sep 21 15:52:17 2009 New Revision: 82483 URL: http://llvm.org/viewvc/llvm-project?rev=82483&view=rev Log: Add Cortex-A8 VFP model. Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td llvm/trunk/lib/Target/ARM/ARMSchedule.td llvm/trunk/lib/Target/ARM/ARMScheduleV6.td llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=82483&r1=82482&r2=82483&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Mon Sep 21 15:52:17 2009 @@ -36,20 +36,20 @@ let canFoldAsLoad = 1 in { def FLDD : ADI5<0b1101, 0b01, (outs DPR:$dst), (ins addrmode5:$addr), - IIC_fpLoad, "fldd", " $dst, $addr", + IIC_fpLoad64, "fldd", " $dst, $addr", [(set DPR:$dst, (load addrmode5:$addr))]>; def FLDS : ASI5<0b1101, 0b01, (outs SPR:$dst), (ins addrmode5:$addr), - IIC_fpLoad, "flds", " $dst, $addr", + IIC_fpLoad32, "flds", " $dst, $addr", [(set SPR:$dst, (load addrmode5:$addr))]>; } // canFoldAsLoad def FSTD : ADI5<0b1101, 0b00, (outs), (ins DPR:$src, addrmode5:$addr), - IIC_fpStore, "fstd", " $src, $addr", + IIC_fpStore64, "fstd", " $src, $addr", [(store DPR:$src, addrmode5:$addr)]>; def FSTS : ASI5<0b1101, 0b00, (outs), (ins SPR:$src, addrmode5:$addr), - IIC_fpStore, "fsts", " $src, $addr", + IIC_fpStore32, "fsts", " $src, $addr", [(store SPR:$src, addrmode5:$addr)]>; //===----------------------------------------------------------------------===// @@ -58,14 +58,14 @@ let mayLoad = 1 in { def FLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dst1, - variable_ops), IIC_fpLoad, + variable_ops), IIC_fpLoadm, "fldm${addr:submode}d${p} ${addr:base}, $dst1", []> { let Inst{20} = 1; } def FLDMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dst1, - variable_ops), IIC_fpLoad, + variable_ops), IIC_fpLoadm, "fldm${addr:submode}s${p} ${addr:base}, $dst1", []> { let Inst{20} = 1; @@ -74,14 +74,14 @@ let mayStore = 1 in { def FSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$src1, - variable_ops), IIC_fpStore, + variable_ops), IIC_fpStorem, "fstm${addr:submode}d${p} ${addr:base}, $src1", []> { let Inst{20} = 0; } def FSTMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$src1, - variable_ops), IIC_fpStore, + variable_ops), IIC_fpStorem, "fstm${addr:submode}s${p} ${addr:base}, $src1", []> { let Inst{20} = 0; @@ -95,48 +95,48 @@ // def FADDD : ADbI<0b11100011, (outs DPR:$dst), (ins DPR:$a, DPR:$b), - IIC_fpALU, "faddd", " $dst, $a, $b", + IIC_fpALU64, "faddd", " $dst, $a, $b", [(set DPR:$dst, (fadd DPR:$a, DPR:$b))]>; def FADDS : ASbIn<0b11100011, (outs SPR:$dst), (ins SPR:$a, SPR:$b), - IIC_fpALU, "fadds", " $dst, $a, $b", + IIC_fpALU32, "fadds", " $dst, $a, $b", [(set SPR:$dst, (fadd SPR:$a, SPR:$b))]>; // These are encoded as unary instructions. let Defs = [FPSCR] in { def FCMPED : ADuI<0b11101011, 0b0100, 0b1100, (outs), (ins DPR:$a, DPR:$b), - IIC_fpALU, "fcmped", " $a, $b", + IIC_fpCMP64, "fcmped", " $a, $b", [(arm_cmpfp DPR:$a, DPR:$b)]>; def FCMPES : ASuI<0b11101011, 0b0100, 0b1100, (outs), (ins SPR:$a, SPR:$b), - IIC_fpALU, "fcmpes", " $a, $b", + IIC_fpCMP32, "fcmpes", " $a, $b", [(arm_cmpfp SPR:$a, SPR:$b)]>; } def FDIVD : ADbI<0b11101000, (outs DPR:$dst), (ins DPR:$a, DPR:$b), - IIC_fpALU, "fdivd", " $dst, $a, $b", + IIC_fpDIV64, "fdivd", " $dst, $a, $b", [(set DPR:$dst, (fdiv DPR:$a, DPR:$b))]>; def FDIVS : ASbI<0b11101000, (outs SPR:$dst), (ins SPR:$a, SPR:$b), - IIC_fpALU, "fdivs", " $dst, $a, $b", + IIC_fpDIV32, "fdivs", " $dst, $a, $b", [(set SPR:$dst, (fdiv SPR:$a, SPR:$b))]>; def FMULD : ADbI<0b11100010, (outs DPR:$dst), (ins DPR:$a, DPR:$b), - IIC_fpALU, "fmuld", " $dst, $a, $b", + IIC_fpMUL64, "fmuld", " $dst, $a, $b", [(set DPR:$dst, (fmul DPR:$a, DPR:$b))]>; def FMULS : ASbIn<0b11100010, (outs SPR:$dst), (ins SPR:$a, SPR:$b), - IIC_fpALU, "fmuls", " $dst, $a, $b", + IIC_fpMUL32, "fmuls", " $dst, $a, $b", [(set SPR:$dst, (fmul SPR:$a, SPR:$b))]>; def FNMULD : ADbI<0b11100010, (outs DPR:$dst), (ins DPR:$a, DPR:$b), - IIC_fpALU, "fnmuld", " $dst, $a, $b", + IIC_fpMUL64, "fnmuld", " $dst, $a, $b", [(set DPR:$dst, (fneg (fmul DPR:$a, DPR:$b)))]> { let Inst{6} = 1; } def FNMULS : ASbI<0b11100010, (outs SPR:$dst), (ins SPR:$a, SPR:$b), - IIC_fpALU, "fnmuls", " $dst, $a, $b", + IIC_fpMUL32, "fnmuls", " $dst, $a, $b", [(set SPR:$dst, (fneg (fmul SPR:$a, SPR:$b)))]> { let Inst{6} = 1; } @@ -149,13 +149,13 @@ def FSUBD : ADbI<0b11100011, (outs DPR:$dst), (ins DPR:$a, DPR:$b), - IIC_fpALU, "fsubd", " $dst, $a, $b", + IIC_fpALU64, "fsubd", " $dst, $a, $b", [(set DPR:$dst, (fsub DPR:$a, DPR:$b))]> { let Inst{6} = 1; } def FSUBS : ASbIn<0b11100011, (outs SPR:$dst), (ins SPR:$a, SPR:$b), - IIC_fpALU, "fsubs", " $dst, $a, $b", + IIC_fpALU32, "fsubs", " $dst, $a, $b", [(set SPR:$dst, (fsub SPR:$a, SPR:$b))]> { let Inst{6} = 1; } @@ -165,30 +165,30 @@ // def FABSD : ADuI<0b11101011, 0b0000, 0b1100, (outs DPR:$dst), (ins DPR:$a), - IIC_fpALU, "fabsd", " $dst, $a", + IIC_fpUNA64, "fabsd", " $dst, $a", [(set DPR:$dst, (fabs DPR:$a))]>; def FABSS : ASuIn<0b11101011, 0b0000, 0b1100, (outs SPR:$dst), (ins SPR:$a), - IIC_fpALU, "fabss", " $dst, $a", + IIC_fpUNA32, "fabss", " $dst, $a", [(set SPR:$dst, (fabs SPR:$a))]>; let Defs = [FPSCR] in { def FCMPEZD : ADuI<0b11101011, 0b0101, 0b1100, (outs), (ins DPR:$a), - IIC_fpALU, "fcmpezd", " $a", + IIC_fpCMP64, "fcmpezd", " $a", [(arm_cmpfp0 DPR:$a)]>; def FCMPEZS : ASuI<0b11101011, 0b0101, 0b1100, (outs), (ins SPR:$a), - IIC_fpALU, "fcmpezs", " $a", + IIC_fpCMP32, "fcmpezs", " $a", [(arm_cmpfp0 SPR:$a)]>; } def FCVTDS : ASuI<0b11101011, 0b0111, 0b1100, (outs DPR:$dst), (ins SPR:$a), - IIC_fpALU, "fcvtds", " $dst, $a", + IIC_fpCVTDS, "fcvtds", " $dst, $a", [(set DPR:$dst, (fextend SPR:$a))]>; // Special case encoding: bits 11-8 is 0b1011. def FCVTSD : VFPAI<(outs SPR:$dst), (ins DPR:$a), VFPUnaryFrm, - IIC_fpALU, "fcvtsd", " $dst, $a", + IIC_fpCVTSD, "fcvtsd", " $dst, $a", [(set SPR:$dst, (fround DPR:$a))]> { let Inst{27-23} = 0b11101; let Inst{21-16} = 0b110111; @@ -198,26 +198,26 @@ let neverHasSideEffects = 1 in { def FCPYD : ADuI<0b11101011, 0b0000, 0b0100, (outs DPR:$dst), (ins DPR:$a), - IIC_fpALU, "fcpyd", " $dst, $a", []>; + IIC_fpUNA64, "fcpyd", " $dst, $a", []>; def FCPYS : ASuI<0b11101011, 0b0000, 0b0100, (outs SPR:$dst), (ins SPR:$a), - IIC_fpALU, "fcpys", " $dst, $a", []>; + IIC_fpUNA32, "fcpys", " $dst, $a", []>; } // neverHasSideEffects def FNEGD : ADuI<0b11101011, 0b0001, 0b0100, (outs DPR:$dst), (ins DPR:$a), - IIC_fpALU, "fnegd", " $dst, $a", + IIC_fpUNA64, "fnegd", " $dst, $a", [(set DPR:$dst, (fneg DPR:$a))]>; def FNEGS : ASuIn<0b11101011, 0b0001, 0b0100, (outs SPR:$dst), (ins SPR:$a), - IIC_fpALU, "fnegs", " $dst, $a", + IIC_fpUNA32, "fnegs", " $dst, $a", [(set SPR:$dst, (fneg SPR:$a))]>; def FSQRTD : ADuI<0b11101011, 0b0001, 0b1100, (outs DPR:$dst), (ins DPR:$a), - IIC_fpALU, "fsqrtd", " $dst, $a", + IIC_fpSQRT64, "fsqrtd", " $dst, $a", [(set DPR:$dst, (fsqrt DPR:$a))]>; def FSQRTS : ASuI<0b11101011, 0b0001, 0b1100, (outs SPR:$dst), (ins SPR:$a), - IIC_fpALU, "fsqrts", " $dst, $a", + IIC_fpSQRT32, "fsqrts", " $dst, $a", [(set SPR:$dst, (fsqrt SPR:$a))]>; //===----------------------------------------------------------------------===// @@ -225,16 +225,16 @@ // def FMRS : AVConv2I<0b11100001, 0b1010, (outs GPR:$dst), (ins SPR:$src), - IIC_fpALU, "fmrs", " $dst, $src", + IIC_fpMOVSI, "fmrs", " $dst, $src", [(set GPR:$dst, (bitconvert SPR:$src))]>; def FMSR : AVConv4I<0b11100000, 0b1010, (outs SPR:$dst), (ins GPR:$src), - IIC_fpALU, "fmsr", " $dst, $src", + IIC_fpMOVIS, "fmsr", " $dst, $src", [(set SPR:$dst, (bitconvert GPR:$src))]>; def FMRRD : AVConv3I<0b11000101, 0b1011, (outs GPR:$dst1, GPR:$dst2), (ins DPR:$src), - IIC_fpALU, "fmrrd", " $dst1, $dst2, $src", + IIC_fpMOVDI, "fmrrd", " $dst1, $dst2, $src", [/* FIXME: Can't write pattern for multiple result instr*/]>; // FMDHR: GPR -> SPR @@ -242,7 +242,7 @@ def FMDRR : AVConv5I<0b11000100, 0b1011, (outs DPR:$dst), (ins GPR:$src1, GPR:$src2), - IIC_fpALU, "fmdrr", " $dst, $src1, $src2", + IIC_fpMOVID, "fmdrr", " $dst, $src1, $src2", [(set DPR:$dst, (arm_fmdrr GPR:$src1, GPR:$src2))]>; // FMRDH: SPR -> GPR @@ -258,23 +258,23 @@ // Int to FP: def FSITOD : AVConv1I<0b11101011, 0b1000, 0b1011, (outs DPR:$dst), (ins SPR:$a), - IIC_fpALU, "fsitod", " $dst, $a", + IIC_fpCVTID, "fsitod", " $dst, $a", [(set DPR:$dst, (arm_sitof SPR:$a))]> { let Inst{7} = 1; } def FSITOS : AVConv1In<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),(ins SPR:$a), - IIC_fpALU, "fsitos", " $dst, $a", + IIC_fpCVTIS, "fsitos", " $dst, $a", [(set SPR:$dst, (arm_sitof SPR:$a))]> { let Inst{7} = 1; } def FUITOD : AVConv1I<0b11101011, 0b1000, 0b1011, (outs DPR:$dst), (ins SPR:$a), - IIC_fpALU, "fuitod", " $dst, $a", + IIC_fpCVTID, "fuitod", " $dst, $a", [(set DPR:$dst, (arm_uitof SPR:$a))]>; def FUITOS : AVConv1In<0b11101011, 0b1000, 0b1010, (outs SPR:$dst),(ins SPR:$a), - IIC_fpALU, "fuitos", " $dst, $a", + IIC_fpCVTIS, "fuitos", " $dst, $a", [(set SPR:$dst, (arm_uitof SPR:$a))]>; // FP to Int: @@ -282,28 +282,28 @@ def FTOSIZD : AVConv1I<0b11101011, 0b1101, 0b1011, (outs SPR:$dst), (ins DPR:$a), - IIC_fpALU, "ftosizd", " $dst, $a", + IIC_fpCVTDI, "ftosizd", " $dst, $a", [(set SPR:$dst, (arm_ftosi DPR:$a))]> { let Inst{7} = 1; // Z bit } def FTOSIZS : AVConv1In<0b11101011, 0b1101, 0b1010, (outs SPR:$dst), (ins SPR:$a), - IIC_fpALU, "ftosizs", " $dst, $a", + IIC_fpCVTSI, "ftosizs", " $dst, $a", [(set SPR:$dst, (arm_ftosi SPR:$a))]> { let Inst{7} = 1; // Z bit } def FTOUIZD : AVConv1I<0b11101011, 0b1100, 0b1011, (outs SPR:$dst), (ins DPR:$a), - IIC_fpALU, "ftouizd", " $dst, $a", + IIC_fpCVTDI, "ftouizd", " $dst, $a", [(set SPR:$dst, (arm_ftoui DPR:$a))]> { let Inst{7} = 1; // Z bit } def FTOUIZS : AVConv1In<0b11101011, 0b1100, 0b1010, (outs SPR:$dst), (ins SPR:$a), - IIC_fpALU, "ftouizs", " $dst, $a", + IIC_fpCVTSI, "ftouizs", " $dst, $a", [(set SPR:$dst, (arm_ftoui SPR:$a))]> { let Inst{7} = 1; // Z bit } @@ -313,34 +313,34 @@ // def FMACD : ADbI<0b11100000, (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), - IIC_fpALU, "fmacd", " $dst, $a, $b", + IIC_fpMAC64, "fmacd", " $dst, $a, $b", [(set DPR:$dst, (fadd (fmul DPR:$a, DPR:$b), DPR:$dstin))]>, RegConstraint<"$dstin = $dst">; def FMACS : ASbIn<0b11100000, (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), - IIC_fpALU, "fmacs", " $dst, $a, $b", + IIC_fpMAC32, "fmacs", " $dst, $a, $b", [(set SPR:$dst, (fadd (fmul SPR:$a, SPR:$b), SPR:$dstin))]>, RegConstraint<"$dstin = $dst">; def FMSCD : ADbI<0b11100001, (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), - IIC_fpALU, "fmscd", " $dst, $a, $b", + IIC_fpMAC64, "fmscd", " $dst, $a, $b", [(set DPR:$dst, (fsub (fmul DPR:$a, DPR:$b), DPR:$dstin))]>, RegConstraint<"$dstin = $dst">; def FMSCS : ASbI<0b11100001, (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), - IIC_fpALU, "fmscs", " $dst, $a, $b", + IIC_fpMAC32, "fmscs", " $dst, $a, $b", [(set SPR:$dst, (fsub (fmul SPR:$a, SPR:$b), SPR:$dstin))]>, RegConstraint<"$dstin = $dst">; def FNMACD : ADbI<0b11100000, (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), - IIC_fpALU, "fnmacd", " $dst, $a, $b", + IIC_fpMAC64, "fnmacd", " $dst, $a, $b", [(set DPR:$dst, (fadd (fneg (fmul DPR:$a, DPR:$b)), DPR:$dstin))]>, RegConstraint<"$dstin = $dst"> { let Inst{6} = 1; } def FNMACS : ASbIn<0b11100000, (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), - IIC_fpALU, "fnmacs", " $dst, $a, $b", + IIC_fpMAC32, "fnmacs", " $dst, $a, $b", [(set SPR:$dst, (fadd (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>, RegConstraint<"$dstin = $dst"> { let Inst{6} = 1; @@ -352,14 +352,14 @@ (FNMACS SPR:$dstin, SPR:$a, SPR:$b)>, Requires<[DontUseNEONForFP]>; def FNMSCD : ADbI<0b11100001, (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), - IIC_fpALU, "fnmscd", " $dst, $a, $b", + IIC_fpMAC64, "fnmscd", " $dst, $a, $b", [(set DPR:$dst, (fsub (fneg (fmul DPR:$a, DPR:$b)), DPR:$dstin))]>, RegConstraint<"$dstin = $dst"> { let Inst{6} = 1; } def FNMSCS : ASbI<0b11100001, (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), - IIC_fpALU, "fnmscs", " $dst, $a, $b", + IIC_fpMAC32, "fnmscs", " $dst, $a, $b", [(set SPR:$dst, (fsub (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>, RegConstraint<"$dstin = $dst"> { let Inst{6} = 1; @@ -371,25 +371,25 @@ def FCPYDcc : ADuI<0b11101011, 0b0000, 0b0100, (outs DPR:$dst), (ins DPR:$false, DPR:$true), - IIC_fpALU, "fcpyd", " $dst, $true", + IIC_fpUNA64, "fcpyd", " $dst, $true", [/*(set DPR:$dst, (ARMcmov DPR:$false, DPR:$true, imm:$cc))*/]>, RegConstraint<"$false = $dst">; def FCPYScc : ASuI<0b11101011, 0b0000, 0b0100, (outs SPR:$dst), (ins SPR:$false, SPR:$true), - IIC_fpALU, "fcpys", " $dst, $true", + IIC_fpUNA32, "fcpys", " $dst, $true", [/*(set SPR:$dst, (ARMcmov SPR:$false, SPR:$true, imm:$cc))*/]>, RegConstraint<"$false = $dst">; def FNEGDcc : ADuI<0b11101011, 0b0001, 0b0100, (outs DPR:$dst), (ins DPR:$false, DPR:$true), - IIC_fpALU, "fnegd", " $dst, $true", + IIC_fpUNA64, "fnegd", " $dst, $true", [/*(set DPR:$dst, (ARMcneg DPR:$false, DPR:$true, imm:$cc))*/]>, RegConstraint<"$false = $dst">; def FNEGScc : ASuI<0b11101011, 0b0001, 0b0100, (outs SPR:$dst), (ins SPR:$false, SPR:$true), - IIC_fpALU, "fnegs", " $dst, $true", + IIC_fpUNA32, "fnegs", " $dst, $true", [/*(set SPR:$dst, (ARMcneg SPR:$false, SPR:$true, imm:$cc))*/]>, RegConstraint<"$false = $dst">; @@ -399,7 +399,7 @@ // let Defs = [CPSR], Uses = [FPSCR] in -def FMSTAT : VFPAI<(outs), (ins), VFPMiscFrm, IIC_fpALU, "fmstat", "", [(arm_fmstat)]> { +def FMSTAT : VFPAI<(outs), (ins), VFPMiscFrm, IIC_fpSTAT, "fmstat", "", [(arm_fmstat)]> { let Inst{27-20} = 0b11101111; let Inst{19-16} = 0b0001; let Inst{15-12} = 0b1111; Modified: llvm/trunk/lib/Target/ARM/ARMSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSchedule.td?rev=82483&r1=82482&r2=82483&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSchedule.td (original) +++ llvm/trunk/lib/Target/ARM/ARMSchedule.td Mon Sep 21 15:52:17 2009 @@ -15,6 +15,8 @@ def FU_Pipe1 : FuncUnit; // pipeline 1 def FU_LdSt0 : FuncUnit; // pipeline 0 load/store def FU_LdSt1 : FuncUnit; // pipeline 1 load/store +def FU_NPipe : FuncUnit; // NEON ALU/MUL pipe +def FU_NLSPipe : FuncUnit; // NEON LS pipe //===----------------------------------------------------------------------===// // Instruction Itinerary classes used for ARM @@ -59,10 +61,37 @@ def IIC_iStoreru : InstrItinClass; def IIC_iStoresiu : InstrItinClass; def IIC_iStorem : InstrItinClass; -def IIC_fpALU : InstrItinClass; -def IIC_fpMPY : InstrItinClass; -def IIC_fpLoad : InstrItinClass; -def IIC_fpStore : InstrItinClass; +def IIC_fpSTAT : InstrItinClass; +def IIC_fpMOVIS : InstrItinClass; +def IIC_fpMOVID : InstrItinClass; +def IIC_fpMOVSI : InstrItinClass; +def IIC_fpMOVDI : InstrItinClass; +def IIC_fpUNA32 : InstrItinClass; +def IIC_fpUNA64 : InstrItinClass; +def IIC_fpCMP32 : InstrItinClass; +def IIC_fpCMP64 : InstrItinClass; +def IIC_fpCVTSD : InstrItinClass; +def IIC_fpCVTDS : InstrItinClass; +def IIC_fpCVTIS : InstrItinClass; +def IIC_fpCVTID : InstrItinClass; +def IIC_fpCVTSI : InstrItinClass; +def IIC_fpCVTDI : InstrItinClass; +def IIC_fpALU32 : InstrItinClass; +def IIC_fpALU64 : InstrItinClass; +def IIC_fpMUL32 : InstrItinClass; +def IIC_fpMUL64 : InstrItinClass; +def IIC_fpMAC32 : InstrItinClass; +def IIC_fpMAC64 : InstrItinClass; +def IIC_fpDIV32 : InstrItinClass; +def IIC_fpDIV64 : InstrItinClass; +def IIC_fpSQRT32 : InstrItinClass; +def IIC_fpSQRT64 : InstrItinClass; +def IIC_fpLoad32 : InstrItinClass; +def IIC_fpLoad64 : InstrItinClass; +def IIC_fpLoadm : InstrItinClass; +def IIC_fpStore32 : InstrItinClass; +def IIC_fpStore64 : InstrItinClass; +def IIC_fpStorem : InstrItinClass; def IIC_Br : InstrItinClass; //===----------------------------------------------------------------------===// @@ -116,12 +145,41 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]> + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]> ]>; Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV6.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV6.td?rev=82483&r1=82482&r2=82483&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV6.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV6.td Mon Sep 21 15:52:17 2009 @@ -61,10 +61,39 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]> + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]> ]>; Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV7.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV7.td?rev=82483&r1=82482&r2=82483&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV7.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Mon Sep 21 15:52:17 2009 @@ -14,7 +14,7 @@ // // Scheduling information derived from "Cortex-A8 Technical Reference Manual". // -// Dual issue pipeline so every itinerary starts with FU_Pipe0 | FU_Pipe1 +// Dual issue pipeline represented by FU_Pipe0 | FU_Pipe1 // def CortexA8Itineraries : ProcessorItineraries<[ @@ -86,7 +86,7 @@ // Scaled register offset, issues over 2 cycles InstrItinData, InstrStage<1, [FU_Pipe0], 0>, - InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0]>], [4, 1, 1]>, // @@ -103,14 +103,14 @@ // Scaled register offset with update, issues over 2 cycles InstrItinData, InstrStage<1, [FU_Pipe0], 0>, - InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0]>], [4, 3, 1, 1]>, // // Load multiple InstrItinData, InstrStage<2, [FU_Pipe0], 0>, - InstrStage<2, [FU_Pipe1], 0>, + InstrStage<2, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0]>]>, @@ -120,16 +120,18 @@ // // Immediate offset InstrItinData, - InstrStage<1, [FU_Pipe0, FU_Pipe1]>], [3, 1]>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 1]>, // // Register offset InstrItinData, - InstrStage<1, [FU_Pipe0, FU_Pipe1]>], [3, 1, 1]>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0]>], [3, 1, 1]>, // // Scaled register offset, issues over 2 cycles InstrItinData, InstrStage<1, [FU_Pipe0], 0>, - InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0]>], [3, 1, 1]>, // @@ -146,14 +148,14 @@ // Scaled register offset with update, issues over 2 cycles InstrItinData, InstrStage<1, [FU_Pipe0], 0>, - InstrStage<1, [FU_Pipe1], 0>, + InstrStage<1, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0]>], [3, 3, 1, 1]>, // // Store multiple InstrItinData, InstrStage<2, [FU_Pipe0], 0>, - InstrStage<2, [FU_Pipe1], 0>, + InstrStage<2, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0]>]>, @@ -162,20 +164,173 @@ // no delay slots, so the latency of a branch is unimportant InstrItinData]>, - // NFP ALU is not pipelined so stall all issues - InstrItinData, - InstrStage<7, [FU_Pipe1], 0>]>, - // VFP MPY is not pipelined so stall all issues - InstrItinData, - InstrStage<7, [FU_Pipe1], 0>]>, - // loads have an extra cycle of latency, but are fully pipelined + // VFP + // Issue through integer pipeline, and execute in NEON unit. We assume + // RunFast mode so that NFP pipeline is used for single-precision when + // possible. + // + // FP Special Register to Integer Register File Move + InstrItinData, + InstrStage<1, [FU_NLSPipe], 1>]>, + // + // Integer to Single-Precision FP Register File Move + InstrItinData, + InstrStage<1, [FU_NLSPipe], 1>]>, + // + // Integer to Double-Precision FP Register File Move + InstrItinData, + InstrStage<1, [FU_NLSPipe], 1>]>, + // + // Single-Precision FP to Integer Register File Move + InstrItinData, + InstrStage<1, [FU_NLSPipe], 1>], [20, 1]>, + // + // Double-Precision FP to Integer Register File Move + InstrItinData, + InstrStage<1, [FU_NLSPipe], 1>], [20, 20, 1]>, + // + // Single-precision FP Unary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Double-precision FP Unary + InstrItinData, + InstrStage<4, [FU_NPipe], 0>, + InstrStage<4, [FU_NLSPipe]>]>, + // + // Single-precision FP Compare + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Double-precision FP Compare + InstrItinData, + InstrStage<4, [FU_NPipe], 0>, + InstrStage<4, [FU_NLSPipe]>]>, + // + // Single to Double FP Convert + InstrItinData, + InstrStage<7, [FU_NPipe], 0>, + InstrStage<7, [FU_NLSPipe]>]>, + // + // Double to Single FP Convert + InstrItinData, + InstrStage<5, [FU_NPipe], 0>, + InstrStage<5, [FU_NLSPipe]>]>, + // + // Single-Precision FP to Integer Convert + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Double-Precision FP to Integer Convert + InstrItinData, + InstrStage<8, [FU_NPipe], 0>, + InstrStage<8, [FU_NLSPipe]>]>, + // + // Integer to Single-Precision FP Convert + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Integer to Double-Precision FP Convert + InstrItinData, + InstrStage<8, [FU_NPipe], 0>, + InstrStage<8, [FU_NLSPipe]>]>, + // + // Single-precision FP ALU + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Double-precision FP ALU + InstrItinData, + InstrStage<9, [FU_NPipe], 0>, + InstrStage<9, [FU_NLSPipe]>]>, + // + // Single-precision FP Multiply + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Double-precision FP Multiply + InstrItinData, + InstrStage<11, [FU_NPipe], 0>, + InstrStage<11, [FU_NLSPipe]>]>, + // + // Single-precision FP MAC + InstrItinData, + InstrStage<1, [FU_NPipe]>], [7, 1]>, + // + // Double-precision FP MAC + InstrItinData, + InstrStage<19, [FU_NPipe], 0>, + InstrStage<19, [FU_NLSPipe]>]>, + // + // Single-precision FP DIV + InstrItinData, + InstrStage<20, [FU_NPipe], 0>, + InstrStage<20, [FU_NLSPipe]>]>, + // + // Double-precision FP DIV + InstrItinData, + InstrStage<29, [FU_NPipe], 0>, + InstrStage<29, [FU_NLSPipe]>]>, + // + // Single-precision FP SQRT + InstrItinData, + InstrStage<19, [FU_NPipe], 0>, + InstrStage<19, [FU_NLSPipe]>]>, + // + // Double-precision FP SQRT + InstrItinData, + InstrStage<29, [FU_NPipe], 0>, + InstrStage<29, [FU_NLSPipe]>]>, + // + // Single-precision FP Load // use FU_Issue to enforce the 1 load/store per cycle limit - InstrItinData, + InstrItinData, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, - InstrStage<1, [FU_LdSt0]>]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // Double-precision FP Load + // use FU_Issue to enforce the 1 load/store per cycle limit + InstrItinData, + InstrStage<1, [FU_Pipe0], 0>, + InstrStage<1, [FU_Pipe1]>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // FP Load Multiple // use FU_Issue to enforce the 1 load/store per cycle limit - InstrItinData, - InstrStage<1, [FU_Pipe0, FU_Pipe1]>]> + InstrItinData, + InstrStage<2, [FU_Pipe0], 0>, + InstrStage<2, [FU_Pipe1]>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // Single-precision FP Store + // use FU_Issue to enforce the 1 load/store per cycle limit + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // Double-precision FP Store + // use FU_Issue to enforce the 1 load/store per cycle limit + InstrItinData, + InstrStage<1, [FU_Pipe0], 0>, + InstrStage<1, [FU_Pipe1]>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // FP Store Multiple + // use FU_Issue to enforce the 1 load/store per cycle limit + InstrItinData, + InstrStage<2, [FU_Pipe0], 0>, + InstrStage<2, [FU_Pipe1]>, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]> ]>; // FIXME @@ -227,10 +382,39 @@ InstrItinData]>, InstrItinData]>, InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]> + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData, + InstrStage<1, [FU_LdSt0]>]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]> ]>; From jlerouge at apple.com Mon Sep 21 15:54:50 2009 From: jlerouge at apple.com (Julien Lerouge) Date: Mon, 21 Sep 2009 13:54:50 -0700 Subject: [llvm-commits] [llvm] r81719 - in /llvm/trunk: unittests/Makefile unittests/TestMain.cpp utils/unittest/Makefile utils/unittest/UnitTestMain/ utils/unittest/UnitTestMain/Makefile utils/unittest/UnitTestMain/TestMain.cpp In-Reply-To: <6a8523d60909192317j699fdb8do585e6f6b74f73749@mail.gmail.com> References: <200909132131.n8DLVLIl028742@zion.cs.uiuc.edu> <20090918161136.GB59666@pom.apple.com> <6a8523d60909192317j699fdb8do585e6f6b74f73749@mail.gmail.com> Message-ID: <20090921205450.GA69558@pom.apple.com> On Sat, Sep 19, 2009 at 11:17:40PM -0700, Daniel Dunbar wrote: > Ok, this was a preexisting problem with the unit test build but it > would be nice to fix. I don't think your patch is correct though, it > changes the flags in the utils/unittest but this isn't how recursive > make works, the builds in the subdirs just ignore those options which > means the build gets new warnings. I'll just duplicated the logic into > UnitTestMain for now, although it probably would be better to suck it > into the top level Makefile. r82373. > > - Daniel Right, sorry for the bad patch, and thanks for the fix! Julien -- Julien Lerouge PGP Key Id: 0xB1964A62 PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62 PGP Public Key from: keyserver.pgp.com From gohman at apple.com Mon Sep 21 16:12:18 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 14:12:18 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: <761FE368-C749-4C41-AB7D-73DC2C3EBAE0@apple.com> References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1EC41638-6AA6-448D-9D4D-9A21F07ECB56@apple.com> <761FE368-C749-4C41-AB7D-73DC2C3EBAE0@apple.com> Message-ID: Bugpoint found the -scalarrepl pass to expose the problem. I captured what I know and included the bugpoint-reduced testcase in PR5023. Dan On Sep 21, 2009, at 11:37 AM, Dan Gohman wrote: > When I run 483.xalancbmk, it gets an opt verifier error: > "Invoke result does not dominate all uses!" Anyone have any > guesses as to what triggered that? > > Dan From evan.cheng at apple.com Mon Sep 21 16:12:25 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 21:12:25 -0000 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll Message-ID: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 21 16:12:25 2009 New Revision: 82485 URL: http://llvm.org/viewvc/llvm-project?rev=82485&view=rev Log: Clean up spill weight computation. Also some changes to give loop induction variable increment / decrement slighter high priority. This has major impact on some micro-benchmarks. On MultiSource/Applications and spec tests, it's a minor win. It also reduce 256.bzip instruction count by 8%, 55 on 164.gzip on i386 / Darwin. Added: llvm/trunk/test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll llvm/trunk/test/CodeGen/ARM/remat.ll llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll llvm/trunk/test/CodeGen/X86/2009-04-20-LinearScanOpt.ll llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Sep 21 16:12:25 2009 @@ -2535,7 +2535,8 @@ ReMatDefs.clear(); } -bool SimpleRegisterCoalescing::isZeroLengthInterval(LiveInterval *li) const { +/// Returns true if the given live interval is zero length. +static bool isZeroLengthInterval(LiveInterval *li, LiveIntervals *li_) { for (LiveInterval::Ranges::const_iterator i = li->ranges.begin(), e = li->ranges.end(); i != e; ++i) if (li_->getPrevIndex(i->end) > i->start) @@ -2543,6 +2544,97 @@ return true; } +void SimpleRegisterCoalescing::CalculateSpillWeights() { + SmallSet Processed; + for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end(); + mbbi != mbbe; ++mbbi) { + MachineBasicBlock* MBB = mbbi; + MachineInstrIndex MBBEnd = li_->getMBBEndIdx(MBB); + MachineLoop* loop = loopInfo->getLoopFor(MBB); + unsigned loopDepth = loop ? loop->getLoopDepth() : 0; + bool isExit = loop ? loop->isLoopExit(MBB) : false; + + for (MachineBasicBlock::iterator mii = MBB->begin(), mie = MBB->end(); + mii != mie; ++mii) { + MachineInstr *MI = mii; + + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &mopi = MI->getOperand(i); + if (!mopi.isReg() || mopi.getReg() == 0) + continue; + unsigned Reg = mopi.getReg(); + if (!TargetRegisterInfo::isVirtualRegister(mopi.getReg())) + continue; + // Multiple uses of reg by the same instruction. It should not + // contribute to spill weight again. + if (!Processed.insert(Reg)) + continue; + + bool HasDef = mopi.isDef(); + bool HasUse = mopi.isUse(); + for (unsigned j = i+1; j != e; ++j) { + const MachineOperand &mopj = MI->getOperand(j); + if (!mopj.isReg() || mopj.getReg() != Reg) + continue; + HasDef |= mopj.isDef(); + HasUse |= mopj.isUse(); + } + + LiveInterval &RegInt = li_->getInterval(Reg); + float Weight = li_->getSpillWeight(HasDef, HasUse, loopDepth+1); + if (HasDef && isExit) { + // Looks like this is a loop count variable update. + MachineInstrIndex DefIdx = + li_->getDefIndex(li_->getInstructionIndex(MI)); + const LiveRange *DLR = + li_->getInterval(Reg).getLiveRangeContaining(DefIdx); + if (DLR->end > MBBEnd) + Weight *= 3.0F; + } + RegInt.weight += Weight; + } + Processed.clear(); + } + } + + for (LiveIntervals::iterator I = li_->begin(), E = li_->end(); I != E; ++I) { + LiveInterval &LI = *I->second; + if (TargetRegisterInfo::isVirtualRegister(LI.reg)) { + // If the live interval length is essentially zero, i.e. in every live + // range the use follows def immediately, it doesn't make sense to spill + // it and hope it will be easier to allocate for this li. + if (isZeroLengthInterval(&LI, li_)) { + LI.weight = HUGE_VALF; + continue; + } + + bool isLoad = false; + SmallVector SpillIs; + if (li_->isReMaterializable(LI, SpillIs, isLoad)) { + // If all of the definitions of the interval are re-materializable, + // it is a preferred candidate for spilling. If non of the defs are + // loads, then it's potentially very cheap to re-materialize. + // FIXME: this gets much more complicated once we support non-trivial + // re-materialization. + if (isLoad) + LI.weight *= 0.9F; + else + LI.weight *= 0.5F; + } + + // Slightly prefer live interval that has been assigned a preferred reg. + std::pair Hint = mri_->getRegAllocationHint(LI.reg); + if (Hint.first || Hint.second) + LI.weight *= 1.01F; + + // Divide 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. + LI.weight /= li_->getApproximateInstructionCount(LI) * InstrSlots::NUM; + } + } +} + bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) { mf_ = &fn; @@ -2581,8 +2673,6 @@ for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end(); mbbi != mbbe; ++mbbi) { MachineBasicBlock* mbb = mbbi; - unsigned loopDepth = loopInfo->getLoopDepth(mbb); - for (MachineBasicBlock::iterator mii = mbb->begin(), mie = mbb->end(); mii != mie; ) { MachineInstr *MI = mii; @@ -2656,62 +2746,12 @@ mii = mbbi->erase(mii); ++numPeep; } else { - SmallSet UniqueUses; - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - const MachineOperand &mop = MI->getOperand(i); - if (mop.isReg() && mop.getReg() && - TargetRegisterInfo::isVirtualRegister(mop.getReg())) { - unsigned reg = mop.getReg(); - // Multiple uses of reg by the same instruction. It should not - // contribute to spill weight again. - if (UniqueUses.count(reg) != 0) - continue; - LiveInterval &RegInt = li_->getInterval(reg); - RegInt.weight += - li_->getSpillWeight(mop.isDef(), mop.isUse(), loopDepth); - UniqueUses.insert(reg); - } - } ++mii; } } } - for (LiveIntervals::iterator I = li_->begin(), E = li_->end(); I != E; ++I) { - LiveInterval &LI = *I->second; - if (TargetRegisterInfo::isVirtualRegister(LI.reg)) { - // If the live interval length is essentially zero, i.e. in every live - // range the use follows def immediately, it doesn't make sense to spill - // it and hope it will be easier to allocate for this li. - if (isZeroLengthInterval(&LI)) - LI.weight = HUGE_VALF; - else { - bool isLoad = false; - SmallVector SpillIs; - if (li_->isReMaterializable(LI, SpillIs, isLoad)) { - // If all of the definitions of the interval are re-materializable, - // it is a preferred candidate for spilling. If non of the defs are - // loads, then it's potentially very cheap to re-materialize. - // FIXME: this gets much more complicated once we support non-trivial - // re-materialization. - if (isLoad) - LI.weight *= 0.9F; - else - LI.weight *= 0.5F; - } - } - - // Slightly prefer live interval that has been assigned a preferred reg. - std::pair Hint = mri_->getRegAllocationHint(LI.reg); - if (Hint.first || Hint.second) - LI.weight *= 1.01F; - - // Divide 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. - LI.weight /= li_->getApproximateInstructionCount(LI) * InstrSlots::NUM; - } - } + CalculateSpillWeights(); DEBUG(dump()); return true; Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Mon Sep 21 16:12:25 2009 @@ -123,7 +123,6 @@ /// classes. The registers may be either phys or virt regs. bool differingRegisterClasses(unsigned RegA, unsigned RegB) const; - /// AdjustCopiesBackFrom - We found a non-trivially-coalescable copy. If /// the source value number is defined by a copy from the destination reg /// see if we can merge these two destination reg valno# into a single @@ -235,13 +234,15 @@ /// lastRegisterUse - Returns the last use of the specific register between /// cycles Start and End or NULL if there are no uses. - MachineOperand *lastRegisterUse(MachineInstrIndex Start, MachineInstrIndex End, - unsigned Reg, MachineInstrIndex &LastUseIdx) const; + MachineOperand *lastRegisterUse(MachineInstrIndex Start, + MachineInstrIndex End, unsigned Reg, + MachineInstrIndex &LastUseIdx) const; + + /// CalculateSpillWeights - Compute spill weights for all virtual register + /// live intervals. + void CalculateSpillWeights(); void printRegName(unsigned reg) const; - - /// Returns true if the given live interval is zero length. - bool isZeroLengthInterval(LiveInterval *li) const; }; } // End llvm namespace Modified: llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll Mon Sep 21 16:12:25 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 164 +; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 161 %"struct.Adv5::Ekin<3>" = type <{ i8 }> %"struct.Adv5::X::Energyflux<3>" = type { double } Modified: llvm/trunk/test/CodeGen/ARM/remat.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/remat.ll?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/remat.ll (original) +++ llvm/trunk/test/CodeGen/ARM/remat.ll Mon Sep 21 16:12:25 2009 @@ -1,5 +1,5 @@ ; RUN: llc < %s -mtriple=arm-apple-darwin -; RUN: llc < %s -mtriple=arm-apple-darwin -stats -info-output-file - | grep "Number of re-materialization" | grep 2 +; RUN: llc < %s -mtriple=arm-apple-darwin -stats -info-output-file - | grep "Number of re-materialization" | grep 5 %struct.CONTENTBOX = type { i32, i32, i32, i32, i32 } %struct.LOCBOX = type { i32, i32, i32, i32 } Modified: llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll Mon Sep 21 16:12:25 2009 @@ -1,5 +1,4 @@ -; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 3 -; RUN: llc < %s -march=x86 -stats |& grep {Number of dead spill slots removed} +; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 2 ; rdar://5761454 %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* } Modified: llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-07-11-SpillerBug.ll Mon Sep 21 16:12:25 2009 @@ -2,8 +2,9 @@ ; PR2536 -; CHECK: movw %ax +; CHECK: movw %cx ; CHECK-NEXT: andl $65534, % +; CHECK-NEXT: movl % ; CHECK-NEXT: movl $17 @g_5 = external global i16 ; [#uses=2] Modified: llvm/trunk/test/CodeGen/X86/2009-04-20-LinearScanOpt.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-04-20-LinearScanOpt.ll?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-04-20-LinearScanOpt.ll (original) +++ llvm/trunk/test/CodeGen/X86/2009-04-20-LinearScanOpt.ll Mon Sep 21 16:12:25 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=x86_64-apple-darwin10.0 -relocation-model=pic -disable-fp-elim -stats |& grep {Number of registers downgraded} +; RUN: llc < %s -mtriple=x86_64-apple-darwin10.0 -relocation-model=pic -disable-fp-elim -stats |& grep asm-printer | grep 84 ; rdar://6802189 ; Test if linearscan is unfavoring registers for allocation to allow more reuse Added: llvm/trunk/test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll?rev=82485&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll Mon Sep 21 16:12:25 2009 @@ -0,0 +1,36 @@ +; RUN: llc < %s -mtriple=i386-apple-darwin10.0 -relocation-model=pic | FileCheck %s + +define void @dot(i16* nocapture %A, i32 %As, i16* nocapture %B, i32 %Bs, i16* nocapture %C, i32 %N) nounwind ssp { +; CHECK: dot: +; CHECK: decl % +; CHECK-NEXT: jne +entry: + %0 = icmp sgt i32 %N, 0 ; [#uses=1] + br i1 %0, label %bb, label %bb2 + +bb: ; preds = %bb, %entry + %i.03 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=3] + %sum.04 = phi i32 [ 0, %entry ], [ %10, %bb ] ; [#uses=1] + %1 = mul i32 %i.03, %As ; [#uses=1] + %2 = getelementptr i16* %A, i32 %1 ; [#uses=1] + %3 = load i16* %2, align 2 ; [#uses=1] + %4 = sext i16 %3 to i32 ; [#uses=1] + %5 = mul i32 %i.03, %Bs ; [#uses=1] + %6 = getelementptr i16* %B, i32 %5 ; [#uses=1] + %7 = load i16* %6, align 2 ; [#uses=1] + %8 = sext i16 %7 to i32 ; [#uses=1] + %9 = mul i32 %8, %4 ; [#uses=1] + %10 = add i32 %9, %sum.04 ; [#uses=2] + %indvar.next = add i32 %i.03, 1 ; [#uses=2] + %exitcond = icmp eq i32 %indvar.next, %N ; [#uses=1] + br i1 %exitcond, label %bb1.bb2_crit_edge, label %bb + +bb1.bb2_crit_edge: ; preds = %bb + %phitmp = trunc i32 %10 to i16 ; [#uses=1] + br label %bb2 + +bb2: ; preds = %entry, %bb1.bb2_crit_edge + %sum.0.lcssa = phi i16 [ %phitmp, %bb1.bb2_crit_edge ], [ 0, %entry ] ; [#uses=1] + store i16 %sum.0.lcssa, i16* %C, align 2 + ret void +} Modified: llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll?rev=82485&r1=82484&r2=82485&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll (original) +++ llvm/trunk/test/CodeGen/X86/stack-color-with-reg.ll Mon Sep 21 16:12:25 2009 @@ -1,6 +1,6 @@ ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -relocation-model=pic -disable-fp-elim -color-ss-with-regs -stats -info-output-file - > %t -; RUN: grep stackcoloring %t | grep "stack slot refs replaced with reg refs" | grep 8 -; RUN: grep asm-printer %t | grep 182 +; RUN: grep stackcoloring %t | grep "stack slot refs replaced with reg refs" | grep 5 +; RUN: grep asm-printer %t | grep 179 type { [62 x %struct.Bitvec*] } ; type %0 type { i8* } ; type %1 From wendling at apple.com Mon Sep 21 16:19:22 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 21 Sep 2009 14:19:22 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> Message-ID: <3CF11BD7-7827-4EE5-854A-CF59BA12AC8C@apple.com> On Sep 21, 2009, at 2:12 PM, Evan Cheng wrote: > --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) > +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Sep 21 > 16:12:25 2009 > @@ -2535,7 +2535,8 @@ > ReMatDefs.clear(); > } > > -bool SimpleRegisterCoalescing::isZeroLengthInterval(LiveInterval > *li) const { > +/// Returns true if the given live interval is zero length. > +static bool isZeroLengthInterval(LiveInterval *li, LiveIntervals > *li_) { > for (LiveInterval::Ranges::const_iterator > i = li->ranges.begin(), e = li->ranges.end(); i != e; ++i) > if (li_->getPrevIndex(i->end) > i->start) > @@ -2543,6 +2544,97 @@ > return true; > } > > +void SimpleRegisterCoalescing::CalculateSpillWeights() { > + SmallSet Processed; > + for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_- > >end(); > + mbbi != mbbe; ++mbbi) { > + MachineBasicBlock* MBB = mbbi; > + MachineInstrIndex MBBEnd = li_->getMBBEndIdx(MBB); > + MachineLoop* loop = loopInfo->getLoopFor(MBB); > + unsigned loopDepth = loop ? loop->getLoopDepth() : 0; > + bool isExit = loop ? loop->isLoopExit(MBB) : false; > + > + for (MachineBasicBlock::iterator mii = MBB->begin(), mie = MBB- > >end(); > + mii != mie; ++mii) { > + MachineInstr *MI = mii; > + > + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { > + const MachineOperand &mopi = MI->getOperand(i); > + if (!mopi.isReg() || mopi.getReg() == 0) > + continue; > + unsigned Reg = mopi.getReg(); > + if (!TargetRegisterInfo::isVirtualRegister(mopi.getReg())) > + continue; > + // Multiple uses of reg by the same instruction. It should > not > + // contribute to spill weight again. > + if (!Processed.insert(Reg)) > + continue; > + > + bool HasDef = mopi.isDef(); > + bool HasUse = mopi.isUse(); > + for (unsigned j = i+1; j != e; ++j) { > + const MachineOperand &mopj = MI->getOperand(j); > + if (!mopj.isReg() || mopj.getReg() != Reg) > + continue; > + HasDef |= mopj.isDef(); > + HasUse |= mopj.isUse(); > + } > + This loop is dead is "HasDef" and "HasUse" are both true. :-) -bw From evan.cheng at apple.com Mon Sep 21 16:39:15 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 14:39:15 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: <3CF11BD7-7827-4EE5-854A-CF59BA12AC8C@apple.com> References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> <3CF11BD7-7827-4EE5-854A-CF59BA12AC8C@apple.com> Message-ID: On Sep 21, 2009, at 2:19 PM, Bill Wendling wrote: >> > This loop is dead is "HasDef" and "HasUse" are both true. :-) That's not possible. isDef() the opposite of isUse(). Evan > > -bw > From bob.wilson at apple.com Mon Sep 21 17:08:08 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 21 Sep 2009 22:08:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82486 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200909212208.n8LM884Y003865@zion.cs.uiuc.edu> Author: bwilson Date: Mon Sep 21 17:08:07 2009 New Revision: 82486 URL: http://llvm.org/viewvc/llvm-project?rev=82486&view=rev Log: Fix an apparent copy/paste mistake: the addTypeName call at the beginning of ConvertUNION for forward declarations uses "union" but this call for completed union types uses "struct". 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=82486&r1=82485&r2=82486&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Sep 21 17:08:07 2009 @@ -2392,7 +2392,7 @@ const_cast(OldTy)->refineAbstractTypeTo(ResultTy); // Finally, set the name for the type. - TheModule->addTypeName(GetTypeName("struct.", orig_type), + TheModule->addTypeName(GetTypeName("union.", orig_type), GET_TYPE_LLVM(type)); // We have finished converting this union. See if the is the outer-most From bob.wilson at apple.com Mon Sep 21 17:11:00 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 21 Sep 2009 22:11:00 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82487 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200909212211.n8LMB0er004253@zion.cs.uiuc.edu> Author: bwilson Date: Mon Sep 21 17:10:59 2009 New Revision: 82487 URL: http://llvm.org/viewvc/llvm-project?rev=82487&view=rev Log: Fix some comment typos. 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=82487&r1=82486&r2=82487&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Sep 21 17:10:59 2009 @@ -1597,7 +1597,7 @@ void dump() const; }; -// Add new element which is a bit field. Size is not the size of bit filed, +// Add new element which is a bit field. Size is not the size of bit field, // but size of bits required to determine type of new Field which will be // used to access this bit field. void StructTypeConversionInfo::addNewBitField(uint64_t Size, @@ -2259,7 +2259,7 @@ // Find the type with the largest aligment, and if we have multiple types with // the same alignment, select one with largest size. If type with max. align - // is smaller then other types then we will add padding later on anyway to + // is smaller than other types, then we will add padding later on anyway to // match union size. const TargetData &TD = getTargetData(); const Type *UnionTy = 0; From sabre at nondot.org Mon Sep 21 17:26:02 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 22:26:02 -0000 Subject: [llvm-commits] [llvm] r82488 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Message-ID: <200909212226.n8LMQ2eP006360@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 17:26:02 2009 New Revision: 82488 URL: http://llvm.org/viewvc/llvm-project?rev=82488&view=rev Log: tidy up Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=82488&r1=82487&r2=82488&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Sep 21 17:26:02 2009 @@ -41,7 +41,6 @@ STATISTIC(NumDeadAlloca, "Number of dead alloca's removed"); STATISTIC(NumPHIInsert, "Number of PHI nodes inserted"); -// Provide DenseMapInfo for all pointers. namespace llvm { template<> struct DenseMapInfo > { @@ -294,10 +293,9 @@ // As we scan the uses of the alloca instruction, keep track of stores, // and decide whether all of the loads and stores to the alloca are within // the same basic block. - for (Value::use_iterator U = AI->use_begin(), E = AI->use_end(); - U != E;) { - Instruction *User = cast(*U); - ++U; + for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); + UI != E;) { + Instruction *User = cast(*UI++); if (BitCastInst *BC = dyn_cast(User)) { // Remove any uses of this alloca in DbgInfoInstrinsics. assert(BC->hasOneUse() && "Unexpected alloca uses!"); @@ -306,7 +304,8 @@ BC->eraseFromParent(); continue; } - else if (StoreInst *SI = dyn_cast(User)) { + + if (StoreInst *SI = dyn_cast(User)) { // Remember the basic blocks which define new values for the alloca DefiningBlocks.push_back(SI->getParent()); AllocaPointerVal = SI->getOperand(0); @@ -603,7 +602,9 @@ LiveInBlockWorklist.pop_back(); --i, --e; break; - } else if (LoadInst *LI = dyn_cast(I)) { + } + + if (LoadInst *LI = dyn_cast(I)) { if (LI->getOperand(0) != AI) continue; // Okay, we found a load before a store to the alloca. It is actually From sabre at nondot.org Mon Sep 21 17:27:34 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 22:27:34 -0000 Subject: [llvm-commits] [llvm] r82489 - /llvm/trunk/lib/VMCore/Instructions.cpp Message-ID: <200909212227.n8LMRYno006595@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 17:27:34 2009 New Revision: 82489 URL: http://llvm.org/viewvc/llvm-project?rev=82489&view=rev Log: tidy up Modified: llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82489&r1=82488&r2=82489&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Sep 21 17:27:34 2009 @@ -234,12 +234,11 @@ /// otherwise use DT to test for dominance. /// Value *PHINode::hasConstantValue(DominatorTree *DT) const { - // If the PHI node only has one incoming value, eliminate the PHI node... + // If the PHI node only has one incoming value, eliminate the PHI node. if (getNumIncomingValues() == 1) { if (getIncomingValue(0) != this) // not X = phi X return getIncomingValue(0); - else - return UndefValue::get(getType()); // Self cycle is dead. + return UndefValue::get(getType()); // Self cycle is dead. } // Otherwise if all of the incoming values are the same for the PHI, replace @@ -253,8 +252,7 @@ } else if (getIncomingValue(i) != this) { // Not the PHI node itself... if (InVal && getIncomingValue(i) != InVal) return 0; // Not the same, bail out. - else - InVal = getIncomingValue(i); + InVal = getIncomingValue(i); } // The only case that could cause InVal to be null is if we have a PHI node @@ -267,19 +265,20 @@ // instruction, we cannot always return X as the result of the PHI node. Only // do this if X is not an instruction (thus it must dominate the PHI block), // or if the client is prepared to deal with this possibility. - if (HasUndefInput) - if (Instruction *IV = dyn_cast(InVal)) { - if (DT) { - // We have a DominatorTree. Do a precise test. - if (!DT->dominates(IV, this)) - return 0; - } else { - // If it's in the entry block, it dominates everything. - if (IV->getParent() != &IV->getParent()->getParent()->getEntryBlock() || - isa(IV)) - return 0; // Cannot guarantee that InVal dominates this PHINode. - } - } + if (!HasUndefInput || !isa(InVal)) + return InVal; + + Instruction *IV = cast(InVal); + if (DT) { + // We have a DominatorTree. Do a precise test. + if (!DT->dominates(IV, this)) + return 0; + } else { + // If it is in the entry block, it obviously dominates everything. + if (IV->getParent() != &IV->getParent()->getParent()->getEntryBlock() || + isa(IV)) + return 0; // Cannot guarantee that InVal dominates this PHINode. + } // All of the incoming values are the same, return the value now. return InVal; From sabre at nondot.org Mon Sep 21 17:30:50 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 22:30:50 -0000 Subject: [llvm-commits] [llvm] r82490 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/VMCore/Dominators.cpp Message-ID: <200909212230.n8LMUoCV007009@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 17:30:50 2009 New Revision: 82490 URL: http://llvm.org/viewvc/llvm-project?rev=82490&view=rev Log: move DominatorTree::dominates for instructions out of line, no functionality change. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=82490&r1=82489&r2=82490&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Sep 21 17:30:50 2009 @@ -748,34 +748,13 @@ // dominates - Return true if A dominates B. This performs the // special checks necessary if A and B are in the same basic block. - bool dominates(const Instruction *A, const Instruction *B) const { - const BasicBlock *BBA = A->getParent(), *BBB = B->getParent(); - if (BBA != BBB) return dominates(BBA, BBB); - - // It is not possible to determine dominance between two PHI nodes - // based on their ordering. - if (isa(A) && isa(B)) - return false; - - // Loop through the basic block until we find A or B. - BasicBlock::const_iterator I = BBA->begin(); - for (; &*I != A && &*I != B; ++I) /*empty*/; - - //if(!DT.IsPostDominators) { - // A dominates B if it is found first in the basic block. - return &*I == A; - //} else { - // // A post-dominates B if B is found first in the basic block. - // return &*I == B; - //} - } + bool dominates(const Instruction *A, const Instruction *B) const; - inline bool properlyDominates(const DomTreeNode* A, - const DomTreeNode* B) const { + bool properlyDominates(const DomTreeNode *A, const DomTreeNode *B) const { return DT->properlyDominates(A, B); } - inline bool properlyDominates(BasicBlock* A, BasicBlock* B) const { + bool properlyDominates(BasicBlock *A, BasicBlock *B) const { return DT->properlyDominates(A, B); } Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=82490&r1=82489&r2=82490&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Sep 21 17:30:50 2009 @@ -52,6 +52,25 @@ DT->print(OS); } +// dominates - Return true if A dominates B. This performs the +// special checks necessary if A and B are in the same basic block. +bool DominatorTree::dominates(const Instruction *A, const Instruction *B) const{ + const BasicBlock *BBA = A->getParent(), *BBB = B->getParent(); + if (BBA != BBB) return dominates(BBA, BBB); + + // It is not possible to determine dominance between two PHI nodes + // based on their ordering. + if (isa(A) && isa(B)) + return false; + + // Loop through the basic block until we find A or B. + BasicBlock::const_iterator I = BBA->begin(); + for (; &*I != A && &*I != B; ++I) + /*empty*/; + + return &*I == A; +} + //===----------------------------------------------------------------------===// From wendling at apple.com Mon Sep 21 17:34:17 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 21 Sep 2009 15:34:17 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> <3CF11BD7-7827-4EE5-854A-CF59BA12AC8C@apple.com> Message-ID: <83B23E8A-0862-400A-866F-162B355FEA10@apple.com> On Sep 21, 2009, at 2:39 PM, Evan Cheng wrote: > > On Sep 21, 2009, at 2:19 PM, Bill Wendling wrote: > >>> >> This loop is dead is "HasDef" and "HasUse" are both true. :-) > > That's not possible. isDef() the opposite of isUse(). > Yes, but the only affect of the "|=" operator on a boolean is to turn it from a "false" to a "true". If HasDef and HasUse are already true after their initializations, then the loop will can't turn them "false". :-) -bw bool HasDef = mopi.isDef(); bool HasUse = mopi.isUse(); for (unsigned j = i+1; j != e; ++j) { const MachineOperand &mopj = MI->getOperand(j); if (!mopj.isReg() || mopj.getReg() != Reg) continue; HasDef |= mopj.isDef(); HasUse |= mopj.isUse(); } From sabre at nondot.org Mon Sep 21 17:39:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 21 Sep 2009 22:39:35 -0000 Subject: [llvm-commits] [llvm] r82491 - in /llvm/trunk: lib/VMCore/Dominators.cpp test/Transforms/Mem2Reg/crash.ll Message-ID: <200909212239.n8LMdZtf008226@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 21 17:39:35 2009 New Revision: 82491 URL: http://llvm.org/viewvc/llvm-project?rev=82491&view=rev Log: Fix PR5023: The instruction form of DominatorTree::dominates did not take into consideration that the result of an invoke is only valid in the normal dest, not the unwind dest. This caused 'PHINode::hasConstantValue' to return true in an invalid situation, causing mem2reg to delete a phi that was actually needed. This caused a crash building 483.xalancbmk. Added: llvm/trunk/test/Transforms/Mem2Reg/crash.ll Modified: llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=82491&r1=82490&r2=82491&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Sep 21 17:39:35 2009 @@ -52,10 +52,16 @@ DT->print(OS); } -// dominates - Return true if A dominates B. This performs the +// dominates - Return true if A dominates a use in B. This performs the // special checks necessary if A and B are in the same basic block. bool DominatorTree::dominates(const Instruction *A, const Instruction *B) const{ const BasicBlock *BBA = A->getParent(), *BBB = B->getParent(); + + // If A is an invoke instruction, its value is only available in this normal + // successor block. + if (const InvokeInst *II = dyn_cast(A)) + BBA = II->getNormalDest(); + if (BBA != BBB) return dominates(BBA, BBB); // It is not possible to determine dominance between two PHI nodes Added: llvm/trunk/test/Transforms/Mem2Reg/crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Mem2Reg/crash.ll?rev=82491&view=auto ============================================================================== --- llvm/trunk/test/Transforms/Mem2Reg/crash.ll (added) +++ llvm/trunk/test/Transforms/Mem2Reg/crash.ll Mon Sep 21 17:39:35 2009 @@ -0,0 +1,24 @@ +; RUN: opt < %s -mem2reg -S +; PR5023 + +declare i32 @bar() + +define i32 @foo() { +entry: + %whichFlag = alloca i32 + %A = invoke i32 @bar() + to label %invcont2 unwind label %lpad86 + +invcont2: + store i32 %A, i32* %whichFlag + br label %bb15 + +bb15: + %B = load i32* %whichFlag + ret i32 %B + +lpad86: + br label %bb15 + +} + From clattner at apple.com Mon Sep 21 17:40:28 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Sep 2009 15:40:28 -0700 Subject: [llvm-commits] Nightly Test Regressions In-Reply-To: References: <6a8523d60909191012y6fb7f512i8b1a02d9c5190f1b@mail.gmail.com> <1EC41638-6AA6-448D-9D4D-9A21F07ECB56@apple.com> <761FE368-C749-4C41-AB7D-73DC2C3EBAE0@apple.com> Message-ID: <730AFAA6-71DD-41F4-BB7F-D8BEF465D624@apple.com> On Sep 21, 2009, at 2:12 PM, Dan Gohman wrote: > Bugpoint found the -scalarrepl pass to expose the problem. I captured > what I know and included the bugpoint-reduced testcase in PR5023. Fixed in r82491, I didn't verify that 483.xalancbmk builds though. -Chris > > Dan > > On Sep 21, 2009, at 11:37 AM, Dan Gohman wrote: > >> When I run 483.xalancbmk, it gets an opt verifier error: >> "Invoke result does not dominate all uses!" Anyone have any >> guesses as to what triggered that? >> >> Dan From bob.wilson at apple.com Mon Sep 21 18:20:01 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 21 Sep 2009 23:20:01 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82494 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200909212320.n8LNK1Xo013469@zion.cs.uiuc.edu> Author: bwilson Date: Mon Sep 21 18:20:01 2009 New Revision: 82494 URL: http://llvm.org/viewvc/llvm-project?rev=82494&view=rev Log: Fix another comment typo. 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=82494&r1=82493&r2=82494&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Sep 21 18:20:01 2009 @@ -1849,7 +1849,7 @@ /// DecodeStructFields - This method decodes the specified field, if it is a /// FIELD_DECL, adding or updating the specified StructTypeConversionInfo to -/// reflect it. Return tree if field is decoded correctly. Otherwise return +/// reflect it. Return true if field is decoded correctly. Otherwise return /// false. bool TypeConverter::DecodeStructFields(tree Field, StructTypeConversionInfo &Info) { From gohman at apple.com Mon Sep 21 18:21:04 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 16:21:04 -0700 Subject: [llvm-commits] [llvm] r82434 - /llvm/trunk/include/llvm/Support/FormattedStream.h In-Reply-To: <200909210356.n8L3u3is009480@zion.cs.uiuc.edu> References: <200909210356.n8L3u3is009480@zion.cs.uiuc.edu> Message-ID: <0DCBD0E8-72AA-4179-9966-A76E2985B73B@apple.com> Hi Daniel, With this change, errs() is now becoming buffered, which is very inconvenient. Dan On Sep 20, 2009, at 8:56 PM, Daniel Dunbar wrote: > Author: ddunbar > Date: Sun Sep 20 22:56:00 2009 > New Revision: 82434 > > URL: http://llvm.org/viewvc/llvm-project?rev=82434&view=rev > Log: > Don't allow formatted_ostream to be unbuffered, even if its > underlying buffer > is. > - The problem is that formatted_ostream forces its underlying buffer > to be > unbuffered, so if some client happens to wrap a formatted_ostream > around > something, but still use the underlying stream, then we can end up > writing on > a fully unbuffered output (which was never intended to be > unbuffered). > > - This makes clang (and presumably llvm-gcc) -emit-llvm -S a mere > 10x faster. > > Modified: > llvm/trunk/include/llvm/Support/FormattedStream.h > > Modified: llvm/trunk/include/llvm/Support/FormattedStream.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=82434&r1=82433&r2=82434&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) > +++ llvm/trunk/include/llvm/Support/FormattedStream.h Sun Sep 20 > 22:56:00 2009 > @@ -105,10 +105,15 @@ > // own buffering, and it doesn't need or want TheStream to do > another > // layer of buffering underneath. Resize the buffer to what > TheStream > // had been using, and tell TheStream not to do its own > buffering. > + // > + // If the underlying stream is unbuffered, just use its > preferred buffer > + // size. We can't treat this as an honest wish for unbuffered > output, > + // because it could very well be a stream we previously > forced to be > + // unbuffered. > if (size_t BufferSize = TheStream->GetBufferSize()) > SetBufferSize(BufferSize); > else > - SetUnbuffered(); > + SetBuffered(); > TheStream->SetUnbuffered(); > > Scanned = 0; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From kremenek at apple.com Mon Sep 21 18:30:23 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 21 Sep 2009 23:30:23 -0000 Subject: [llvm-commits] [llvm] r82497 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909212330.n8LNUN4D014799@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 21 18:30:23 2009 New Revision: 82497 URL: http://llvm.org/viewvc/llvm-project?rev=82497&view=rev Log: Removing checker-0.220. Removed: llvm/tags/checker/checker-0.220/ From kremenek at apple.com Mon Sep 21 18:30:40 2009 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 21 Sep 2009 23:30:40 -0000 Subject: [llvm-commits] [llvm] r82499 - /llvm/tags/checker/checker-0.220/ Message-ID: <200909212330.n8LNUeHF014859@zion.cs.uiuc.edu> Author: kremenek Date: Mon Sep 21 18:30:40 2009 New Revision: 82499 URL: http://llvm.org/viewvc/llvm-project?rev=82499&view=rev Log: Tagging checker-0.220. Added: llvm/tags/checker/checker-0.220/ - copied from r82498, llvm/trunk/ From gohman at apple.com Mon Sep 21 19:05:44 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 17:05:44 -0700 Subject: [llvm-commits] Static Profile Patch In-Reply-To: References: <030E9AA3-1AF1-433F-8807-9628E7155939@apple.com> Message-ID: <98736D45-B8BE-4616-82EC-EECE7A25AE40@apple.com> On Sep 20, 2009, at 8:35 AM, Andrei Alvares wrote: > The passes should override the Pass::releaseMemory virtual function. > Some currently have a Clear member function; they should implement > releaseMemory and have it call Clear, or perhaps Clear should be > renamed releaseMemory, depending on how it's used. > > > Done. But I would like to know more about this functionality. > Consider the BranchPreditionPass class. I need to maintain edge > predictions for subsequent passes (like BlockEdgeFrequencyPass that > will consume it). If the pass manager calls the > BranchPredictionPass::releaseMemory, should I free those edge > predictions too? The attached patch is freeing it when releaseMemory > is called. The pass manager won't call releaseMemory until all passes that depend on the pass have been run, so releaseMemory should release everything. > > BranchHeuristicsInfo::MatchCallHeuristic and some of the others > don't test whether the terminator is a BranchInst. It looks like > there's nothing preventing them from analyzing a block with an > InvokeInst as its terminator. Is that intended by the heuristics? > > All the functions that process heuristics (Match{Some Heuristic} > Heuristic) have a private visibility. The MatchHeuristic is a > wrapper for those functions. There is a comment in the > MatchHeuristic header claiming that it expects a BasicBlock with > exactly two successors. The heuristics are only capable to handle > blocks with two successors. > > I haven't add a check inside MatchHeuristic because I'm already > ensuring this condition before it is called (on > BranchPredictionPass). I was trying to avoid redundant checks. Do > you believe that it should have the test anyway (inside > BranchHeuristic)? No, don't insert redundant checks. An assertion might be useful though. > > BranchHeuristicsInfo::postDominates calls > PostDominatorTree::properlyDominates. Since the distinction between > domination and proper domination is often both subtle and critical > for algorithm correctness, please either rename this function or add > comments or both. > > > The algorithm requires post domination rather than properly post > dominates. Take the call heuristic for example. If a block contains > a call and a loop to itself, the heuristic should match. Properly > post domination miss this and other cases. > > DominatorTree have "dominates" and "properlyDominates" functions. > How come PostDominatorTree implemented only properlyDominates? > That's way I felt the need to created my own. I believe this is just because no one has needed it. Feel free to add it. It should be straight-forward; see DominatorTree's dominates function for example. The main work is done by the DominatorTreeBase class. > > BranchPredictionInfo::FindBackEdges does a DominatorTree query for > every edge in the function. It would be possible to get a close > approximation of this using LoopInfo. That would miss unnatural > loops and spaghetti code though; is that the reason for doing the > full traversal? Please add a comment about this. > > > That's an interesting question. At first I thought that it would be > possible, but after I've implemented the back edges considering only > LoopInfo, the profiler shown a very low hit rate (20% worst in > average). I've maintained the back edge calculation with domination > tree. That's surprising. It would be worth documenting this somewhere, perhaps in a comment. > > BranchPredictionInfo::FindExitEdges seems to be redundant with > Loop::getExitEdges. > > > Thanks for the tip. Unfortunately, I've tried to use the > LoopInfo::getExitEdge in the branch prediction pass, but it is > crashing. I can't tell for sure the root cause of the problem, but I > believe that this function required that the loops are in simplified > form, which is not what happens in some situations. Hmm. A comment about this would be appropriate as well. > In its current form, BranchPredictionPass won't be usable in LLVM's > default optimization pipeline because it requires post-dominator tree > construction. None of LLVM's current default optimization passes > require post-dominator trees, so constructing it just for this pass > will likely be too slow. It could possibly be justified for -O3, > if there are sufficient benefits to oughtweigh the costs. There are > many LLVM users that don't use the standard -O2 or -O3 passes > also, of course. > > > Unfortunately, four of the nine implemented heuristics require post > dominate tree information. The profiler would be very imprecise if > those heuristics were lacking. Maybe when LLVM have more profile- > guided passes, the benefits will out weight its costs. Ok. Dan From evan.cheng at apple.com Mon Sep 21 19:07:23 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 17:07:23 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: <83B23E8A-0862-400A-866F-162B355FEA10@apple.com> References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> <3CF11BD7-7827-4EE5-854A-CF59BA12AC8C@apple.com> <83B23E8A-0862-400A-866F-162B355FEA10@apple.com> Message-ID: <87F4FA26-7C69-4754-B239-6163E377EFBE@apple.com> On Sep 21, 2009, at 3:34 PM, Bill Wendling wrote: > On Sep 21, 2009, at 2:39 PM, Evan Cheng wrote: > >> >> On Sep 21, 2009, at 2:19 PM, Bill Wendling wrote: >> >>>> >>> This loop is dead is "HasDef" and "HasUse" are both true. :-) >> >> That's not possible. isDef() the opposite of isUse(). >> > Yes, but the only affect of the "|=" operator on a boolean is to > turn it from a "false" to a "true". If HasDef and HasUse are already > true after their initializations, then the loop will can't turn them > "false". :-) I don't understand your point. Before the loop, HasDef and HasUse cannot both be true. The only possible simplification here is an early exit out of the loop if both HasDef and HasUse have become true. Evan > > -bw > > bool HasDef = mopi.isDef(); > bool HasUse = mopi.isUse(); > for (unsigned j = i+1; j != e; ++j) { > const MachineOperand &mopj = MI->getOperand(j); > if (!mopj.isReg() || mopj.getReg() != Reg) > continue; > HasDef |= mopj.isDef(); > HasUse |= mopj.isUse(); > } > > From evan.cheng at apple.com Mon Sep 21 19:29:41 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Sep 2009 00:29:41 -0000 Subject: [llvm-commits] [llvm] r82503 - /llvm/trunk/lib/CodeGen/LowerSubregs.cpp Message-ID: <200909220029.n8M0TfoX022615@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 21 19:29:40 2009 New Revision: 82503 URL: http://llvm.org/viewvc/llvm-project?rev=82503&view=rev Log: Minor bug fix. LowerSubregs should translate %S0 = EXTRACT_SUBREG %Q0, 1 to %S0 = IMPLICIT_DEF %Q0 Implicit_def does not *read* any register so the operand should be marked "implicit". The missing "implicit" marker on the operand is wrong, but it doesn't actually break anything. Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LowerSubregs.cpp?rev=82503&r1=82502&r2=82503&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LowerSubregs.cpp (original) +++ llvm/trunk/lib/CodeGen/LowerSubregs.cpp Mon Sep 21 19:29:40 2009 @@ -130,6 +130,7 @@ // instruction with IMPLICIT_DEF. MI->setDesc(TII.get(TargetInstrInfo::IMPLICIT_DEF)); MI->RemoveOperand(2); // SubIdx + MI->getOperand(1).setImplicit(true); DEBUG(errs() << "subreg: replace by: " << *MI); return true; } From clattner at apple.com Mon Sep 21 19:44:40 2009 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Sep 2009 17:44:40 -0700 Subject: [llvm-commits] [PATCH] BlocksRuntime updates for Linux In-Reply-To: <3210EDA4-C758-41FA-B391-70759C11FB07@apple.com> References: <74663C84-9383-4D23-A844-7E8C16AA0D5E@apple.com> <3210EDA4-C758-41FA-B391-70759C11FB07@apple.com> Message-ID: <9CDCB68B-4FC3-49FD-B398-FF6EA3F4AC77@apple.com> On Sep 21, 2009, at 9:15 AM, Shantonu Sen wrote: > [forwarding to llvm-commits, which is where i meant to send it the > first time] The source changes seem fine to me, and I don't have an opinion about the build system changes - I suggest committing them and seeing if anyone screams :) Thanks Shantonu, -Chris > > Ping? > > Shantonu Sen > ssen at apple.com > > Sent from my Mac Pro > > Begin forwarded message: > >> From: Shantonu Sen >> Date: September 18, 2009 11:14:13 AM PDT >> To: LLVM Developers Mailing List >> Subject: [LLVMdev] [PATCH] BlocksRuntime updates for Linux >> >> The attached diff cleans up the BlocksRuntime/ directory of >> compiler-rt for better portability, eliminates compiler warnings, >> and adds support to the cmake build to install the results. >> >> More specifically, the changes: >> 1) Remove cmake-specific #define usage from the exported Block.h/ >> Block_private.h headers, since clients won't know what to set. >> These are moved into runtime.c as appropriate >> 2) Use cmake checks for CAS builtins, instead of guessing based on >> GCC #defines (which aren't set by clang and llvm-gcc anyway) >> 3) "#pragma mark" isn't supported by FSF gcc, so "#if 0" it out. It >> should still show up in IDEs that support it >> 4) Fix some compiler warnings. GCC 4.3.3 seems super strict about >> %p. function pointers can't be cast to void * either. >> 5) Avoid a warning for apple_versioning.c that "ISO C does not >> allow empty files" >> >> Tested on Ubuntu Linux 9.04 with clang and llvm-gcc and -fblocks to >> define and copy some blocks (and invoke them, obviously). Also >> tested on Mac OS X 10.6 and linking against -lBlocksRuntime ahead >> of -lSystem. >> > >> >> Shantonu Sen >> ssen at apple.com >> >> Sent from my Mac Pro >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > 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/20090921/81b8189e/attachment.html From wendling at apple.com Mon Sep 21 19:47:55 2009 From: wendling at apple.com (Bill Wendling) Date: Mon, 21 Sep 2009 17:47:55 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: <87F4FA26-7C69-4754-B239-6163E377EFBE@apple.com> References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> <3CF11BD7-7827-4EE5-854A-CF59BA12AC8C@apple.com> <83B23E8A-0862-400A-866F-162B355FEA10@apple.com> <87F4FA26-7C69-4754-B239-6163E377EFBE@apple.com> Message-ID: <7111BB69-82F7-4725-B5A4-38D9BF22F972@apple.com> On Sep 21, 2009, at 5:07 PM, Evan Cheng wrote: > On Sep 21, 2009, at 3:34 PM, Bill Wendling wrote: > >> On Sep 21, 2009, at 2:39 PM, Evan Cheng wrote: >> >>> >>> On Sep 21, 2009, at 2:19 PM, Bill Wendling wrote: >>> >>>>> >>>> This loop is dead is "HasDef" and "HasUse" are both true. :-) >>> >>> That's not possible. isDef() the opposite of isUse(). >>> >> Yes, but the only affect of the "|=" operator on a boolean is to >> turn it from a "false" to a "true". If HasDef and HasUse are >> already true after their initializations, then the loop will can't >> turn them "false". :-) > > I don't understand your point. Before the loop, HasDef and HasUse > cannot both be true. The only possible simplification here is an > early exit out of the loop if both HasDef and HasUse have become true. > Ah. I see what you mean. Never mind. :) -bw From ssen at apple.com Mon Sep 21 19:49:12 2009 From: ssen at apple.com (Shantonu Sen) Date: Tue, 22 Sep 2009 00:49:12 -0000 Subject: [llvm-commits] [compiler-rt] r82504 - in /compiler-rt/trunk: BlocksRuntime/Block.h BlocksRuntime/Block_private.h BlocksRuntime/CMakeLists.txt BlocksRuntime/runtime.c CMakeLists.txt ConfigureChecks.cmake config.h.cmake lib/apple_versioning.c Message-ID: <200909220049.n8M0nD4N025282@zion.cs.uiuc.edu> Author: ssen Date: Mon Sep 21 19:49:12 2009 New Revision: 82504 URL: http://llvm.org/viewvc/llvm-project?rev=82504&view=rev Log: 1) Remove cmake-specific #define usage from the exported Block.h/Block_private.h headers, since clients won't know what to set. These are moved into runtime.c as appropriate 2) Use cmake checks for CAS builtins, instead of guessing based on GCC #defines (which aren't set by clang and llvm-gcc anyway) 3) "#pragma mark" isn't supported by FSF gcc, so "#if 0" it out. It should still show up in IDEs that support it 4) Fix some compiler warnings. GCC 4.3.3 seems super strict about %p. function pointers can't be cast to void * either. 5) Avoid a warning for apple_versioning.c that "ISO C does not allow empty files" Modified: compiler-rt/trunk/BlocksRuntime/Block.h compiler-rt/trunk/BlocksRuntime/Block_private.h compiler-rt/trunk/BlocksRuntime/CMakeLists.txt compiler-rt/trunk/BlocksRuntime/runtime.c compiler-rt/trunk/CMakeLists.txt compiler-rt/trunk/ConfigureChecks.cmake compiler-rt/trunk/config.h.cmake compiler-rt/trunk/lib/apple_versioning.c Modified: compiler-rt/trunk/BlocksRuntime/Block.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/BlocksRuntime/Block.h?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/BlocksRuntime/Block.h (original) +++ compiler-rt/trunk/BlocksRuntime/Block.h Mon Sep 21 19:49:12 2009 @@ -22,8 +22,8 @@ * */ -#ifndef _Block_H_ -#define _Block_H_ +#ifndef _BLOCK_H_ +#define _BLOCK_H_ #if !defined(BLOCK_EXPORT) # if defined(__cplusplus) @@ -33,14 +33,7 @@ # endif #endif -#include - -#if defined( HAVE_AVAILABILITY_MACROS_H ) && defined( HAVE_TARGET_CONDITIONALS_H ) -#include -#include -#endif /* HAVE_AVAILABILITY_MACROS_H and HAVE_TARGET_CONDITIONALS_H. */ - -#if __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -53,7 +46,7 @@ /* Lose the reference, and if heap based and last reference, recover the memory. */ BLOCK_EXPORT void _Block_release(const void *aBlock); -#if __cplusplus +#if defined(__cplusplus) } #endif Modified: compiler-rt/trunk/BlocksRuntime/Block_private.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/BlocksRuntime/Block_private.h?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/BlocksRuntime/Block_private.h (original) +++ compiler-rt/trunk/BlocksRuntime/Block_private.h Mon Sep 21 19:49:12 2009 @@ -33,16 +33,9 @@ # endif #endif -#include - -#if defined( HAVE_AVAILABILITY_MACROS_H ) && defined( HAVE_TARGET_CONDITIONALS_H ) -#include -#include -#endif /* HAVE_AVAILABILITY_MACROS_H and HAVE_TARGET_CONDITIONALS_H. */ - #include -#if __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -171,9 +164,9 @@ }; -#if __cplusplus +#if defined(__cplusplus) } #endif -#endif +#endif /* _BLOCK_PRIVATE_H_ */ Modified: compiler-rt/trunk/BlocksRuntime/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/BlocksRuntime/CMakeLists.txt?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/BlocksRuntime/CMakeLists.txt (original) +++ compiler-rt/trunk/BlocksRuntime/CMakeLists.txt Mon Sep 21 19:49:12 2009 @@ -6,3 +6,8 @@ ) ADD_LIBRARY( ${PROJECT_NAME} SHARED ${SRCS}) +SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES + INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib ) + +INSTALL( TARGETS ${PROJECT_NAME} DESTINATION lib ) +INSTALL( FILES Block.h Block_private.h DESTINATION include ) Modified: compiler-rt/trunk/BlocksRuntime/runtime.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/BlocksRuntime/runtime.c?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/BlocksRuntime/runtime.c (original) +++ compiler-rt/trunk/BlocksRuntime/runtime.c Mon Sep 21 19:49:12 2009 @@ -27,10 +27,23 @@ #include #include #include +#include -#if TARGET_OS_MAC +#include "config.h" + +#ifdef HAVE_AVAILABILITY_MACROS_H +#include +#endif + +#ifdef HAVE_TARGET_CONDITIONALS_H +#include +#endif + +#if defined(HAVE_OSATOMIC_COMPARE_AND_SWAP_INT) && defined(HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG) +#ifdef HAVE_LIBKERN_OSATOMIC_H #include -#elif TARGET_OS_WIN32 +#endif +#elif defined(__WIN32__) #define _CRT_SECURE_NO_WARNINGS 1 #include static __inline bool OSAtomicCompareAndSwapLong(long oldl, long newl, long volatile *dst) @@ -50,8 +63,7 @@ * a 64-bit system, make sure we have an 8-byte atomic function * available. */ -#elif __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 && \ - ((__SIZEOF_LONG__ != 8) || __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) +#elif defined(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT) && defined(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG) static __inline bool OSAtomicCompareAndSwapLong(long oldl, long newl, long volatile *dst) { return __sync_bool_compare_and_swap(dst, oldl, newl); @@ -61,6 +73,8 @@ { return __sync_bool_compare_and_swap(dst, oldi, newi); } +#else +#error unknown atomic compare-and-swap primitive #endif @@ -143,7 +157,7 @@ /*********************** GC support stub routines ************************/ -#if !TARGET_OS_WIN32 +#if 0 #pragma mark GC Support Routines #endif @@ -171,11 +185,7 @@ } static void _Block_assign_weak_default(const void *ptr, void *dest) { -#if !TARGET_OS_WIN32 - *(long *)dest = (long)ptr; -#else *(void **)dest = (void *)ptr; -#endif } static void _Block_memmove_default(void *dst, void *src, unsigned long size) { @@ -260,7 +270,7 @@ Internal Support routines for copying ********************************************************************************/ -#if !TARGET_OS_WIN32 +#if 0 #pragma mark Copy/Release support #endif @@ -429,7 +439,7 @@ * ***********************************************************/ -#if !TARGET_OS_WIN32 +#if 0 #pragma mark SPI/API #endif @@ -460,7 +470,7 @@ ; } else { - printf("Block_release called upon a stack Block: %p, ignored\n", aBlock); + printf("Block_release called upon a stack Block: %p, ignored\n", (void *)aBlock); } } @@ -498,7 +508,7 @@ } -#if !TARGET_OS_WIN32 +#if 0 #pragma mark Compiler SPI entry points #endif @@ -595,7 +605,7 @@ /******************* Debugging support ********************/ -#if !TARGET_OS_WIN32 +#if 0 #pragma mark Debugging #endif @@ -612,7 +622,7 @@ printf("Block compiled by obsolete compiler, please recompile source for this Block\n"); exit(1); } - cp += sprintf(cp, "^%p (new layout) =\n", closure); + cp += sprintf(cp, "^%p (new layout) =\n", (void *)closure); if (closure->isa == NULL) { cp += sprintf(cp, "isa: NULL\n"); } @@ -632,7 +642,7 @@ cp += sprintf(cp, "isa: finalizing Block\n"); } else { - cp += sprintf(cp, "isa?: %p\n", closure->isa); + cp += sprintf(cp, "isa?: %p\n", (void *)closure->isa); } cp += sprintf(cp, "flags:"); if (closure->flags & BLOCK_HAS_DESCRIPTOR) { @@ -651,16 +661,16 @@ cp += sprintf(cp, " HASCTOR"); } cp += sprintf(cp, "\nrefcount: %u\n", closure->flags & BLOCK_REFCOUNT_MASK); - cp += sprintf(cp, "invoke: %p\n", closure->invoke); + cp += sprintf(cp, "invoke: %#lx\n", (uintptr_t)closure->invoke); { struct Block_descriptor *dp = closure->descriptor; - cp += sprintf(cp, "descriptor: %p\n", dp); + cp += sprintf(cp, "descriptor: %p\n", (void *)dp); cp += sprintf(cp, "descriptor->reserved: %lu\n", dp->reserved); cp += sprintf(cp, "descriptor->size: %lu\n", dp->size); if (closure->flags & BLOCK_HAS_COPY_DISPOSE) { - cp += sprintf(cp, "descriptor->copy helper: %p\n", dp->copy); - cp += sprintf(cp, "descriptor->dispose helper: %p\n", dp->dispose); + cp += sprintf(cp, "descriptor->copy helper: %#lx\n", (uintptr_t)dp->copy); + cp += sprintf(cp, "descriptor->dispose helper: %#lx\n", (uintptr_t)dp->dispose); } } return buffer; @@ -670,13 +680,13 @@ const char *_Block_byref_dump(struct Block_byref *src) { static char buffer[256]; char *cp = buffer; - cp += sprintf(cp, "byref data block %p contents:\n", src); - cp += sprintf(cp, " forwarding: %p\n", src->forwarding); + cp += sprintf(cp, "byref data block %p contents:\n", (void *)src); + cp += sprintf(cp, " forwarding: %p\n", (void *)src->forwarding); cp += sprintf(cp, " flags: 0x%x\n", src->flags); cp += sprintf(cp, " size: %d\n", src->size); if (src->flags & BLOCK_HAS_COPY_DISPOSE) { - cp += sprintf(cp, " copy helper: %p\n", src->byref_keep); - cp += sprintf(cp, " dispose helper: %p\n", src->byref_destroy); + cp += sprintf(cp, " copy helper: %#lx\n", (uintptr_t)src->byref_keep); + cp += sprintf(cp, " dispose helper: %#lx\n", (uintptr_t)src->byref_destroy); } return buffer; } Modified: compiler-rt/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/CMakeLists.txt (original) +++ compiler-rt/trunk/CMakeLists.txt Mon Sep 21 19:49:12 2009 @@ -26,13 +26,6 @@ ${CMAKE_CURRENT_BINARY_DIR} ) -install(DIRECTORY include - DESTINATION . - PATTERN ".svn" EXCLUDE - PATTERN "*.cmake" EXCLUDE - PATTERN "*.in" EXCLUDE - ) - SET( Achitectures i386 x86_64 ppc arm ) Modified: compiler-rt/trunk/ConfigureChecks.cmake URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/ConfigureChecks.cmake?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/ConfigureChecks.cmake (original) +++ compiler-rt/trunk/ConfigureChecks.cmake Mon Sep 21 19:49:12 2009 @@ -1,5 +1,7 @@ INCLUDE( CheckIncludeFile ) INCLUDE( CheckFunctionExists ) +INCLUDE( CheckSymbolExists ) +INCLUDE( CheckCSourceCompiles ) SET( PACKAGE ${PACKAGE_NAME} ) SET( VERSION ${PACKAGE_VERSION} ) @@ -11,6 +13,26 @@ CHECK_INCLUDE_FILE( sys/byteorder.h HAVE_SYS_BYTEORDER_H ) CHECK_INCLUDE_FILE( AvailabilityMacros.h HAVE_AVAILABILITY_MACROS_H ) CHECK_INCLUDE_FILE( TargetConditionals.h HAVE_TARGET_CONDITIONALS_H ) +CHECK_INCLUDE_FILE( libkern/OSAtomic.h HAVE_LIBKERN_OSATOMIC_H ) # FUNCTIONS CHECK_FUNCTION_EXISTS( sysconf HAVE_SYSCONF ) +CHECK_SYMBOL_EXISTS( OSAtomicCompareAndSwapInt libkern/OSAtomic.h HAVE_OSATOMIC_COMPARE_AND_SWAP_INT ) +CHECK_SYMBOL_EXISTS( OSAtomicCompareAndSwapLong libkern/OSAtomic.h HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG ) + +# BUILTIN +CHECK_C_SOURCE_COMPILES( " +volatile int a; +int main(int argc, char *argv[]) { + (void)__sync_bool_compare_and_swap(&a, 1, 2); + return 0; +} +" HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT ) + +CHECK_C_SOURCE_COMPILES( " +volatile long a; +int main(int argc, char *argv[]) { + (void)__sync_bool_compare_and_swap(&a, 1, 2); + return 0; +} +" HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG ) Modified: compiler-rt/trunk/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/config.h.cmake?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/config.h.cmake (original) +++ compiler-rt/trunk/config.h.cmake Mon Sep 21 19:49:12 2009 @@ -1,2 +1,12 @@ #cmakedefine HAVE_SYS_BYTEORDER_H ${HAVE_SYS_BYTEORDER} -#cmakedefine __Apple__ ${CMAKE_HOST_APPLE} +#cmakedefine HAVE_AVAILABILITY_MACROS_H ${HAVE_AVAILABILITY_MACROS_H} +#cmakedefine HAVE_TARGET_CONDITIONALS_H ${HAVE_TARGET_CONDITIONALS_H} +#cmakedefine HAVE_LIBKERN_OSATOMIC_H ${HAVE_LIBKERN_OSATOMIC_H} + +#cmakedefine HAVE_SYSCONF ${HAVE_SYSCONF} + +#cmakedefine HAVE_OSATOMIC_COMPARE_AND_SWAP_INT ${HAVE_OSATOMIC_COMPARE_AND_SWAP_INT} +#cmakedefine HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG ${HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG} + +#cmakedefine HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT ${HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT} +#cmakedefine HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG ${HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG} Modified: compiler-rt/trunk/lib/apple_versioning.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/apple_versioning.c?rev=82504&r1=82503&r2=82504&view=diff ============================================================================== --- compiler-rt/trunk/lib/apple_versioning.c (original) +++ compiler-rt/trunk/lib/apple_versioning.c Mon Sep 21 19:49:12 2009 @@ -143,5 +143,8 @@ NOT_HERE_BEFORE_10_6(__trampoline_setup) #endif /* __ppc__ */ +#else /* !__APPLE__ */ -#endif /* __APPLE__*/ +extern int avoid_empty_file; + +#endif /* !__APPLE__*/ From daniel at zuster.org Mon Sep 21 19:57:42 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 21 Sep 2009 17:57:42 -0700 Subject: [llvm-commits] [llvm] r82434 - /llvm/trunk/include/llvm/Support/FormattedStream.h In-Reply-To: <0DCBD0E8-72AA-4179-9966-A76E2985B73B@apple.com> References: <200909210356.n8L3u3is009480@zion.cs.uiuc.edu> <0DCBD0E8-72AA-4179-9966-A76E2985B73B@apple.com> Message-ID: <6a8523d60909211757l223ad3eft3370e22df23663e6@mail.gmail.com> On Mon, Sep 21, 2009 at 4:21 PM, Dan Gohman wrote: > Hi Daniel, > > With this change, errs() is now becoming buffered, which is > very inconvenient. Only if you write to it via a formatted ostream. And 10x slowdown is also inconvenient... :) Let's talk about this in person, I'm fairly skeptical that the "right" solution is having formatted ostream mutate the buffering on the underlying stream *ever*. - Daniel > On Sep 20, 2009, at 8:56 PM, Daniel Dunbar wrote: > >> Author: ddunbar >> Date: Sun Sep 20 22:56:00 2009 >> New Revision: 82434 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82434&view=rev >> Log: >> Don't allow formatted_ostream to be unbuffered, even if its underlying >> buffer >> is. >> - The problem is that formatted_ostream forces its underlying buffer to be >> ?unbuffered, so if some client happens to wrap a formatted_ostream around >> ?something, but still use the underlying stream, then we can end up >> writing on >> ?a fully unbuffered output (which was never intended to be unbuffered). >> >> - This makes clang (and presumably llvm-gcc) -emit-llvm -S a mere 10x >> faster. >> >> Modified: >> ? llvm/trunk/include/llvm/Support/FormattedStream.h >> >> Modified: llvm/trunk/include/llvm/Support/FormattedStream.h >> URL: >> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=82434&r1=82433&r2=82434&view=diff >> >> >> ============================================================================== >> --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) >> +++ llvm/trunk/include/llvm/Support/FormattedStream.h Sun Sep 20 22:56:00 >> 2009 >> @@ -105,10 +105,15 @@ >> ? ? ?// own buffering, and it doesn't need or want TheStream to do another >> ? ? ?// layer of buffering underneath. Resize the buffer to what TheStream >> ? ? ?// had been using, and tell TheStream not to do its own buffering. >> + ? ? ?// >> + ? ? ?// If the underlying stream is unbuffered, just use its preferred >> buffer >> + ? ? ?// size. We can't treat this as an honest wish for unbuffered >> output, >> + ? ? ?// because it could very well be a stream we previously forced to >> be >> + ? ? ?// unbuffered. >> ? ? ?if (size_t BufferSize = TheStream->GetBufferSize()) >> ? ? ? ?SetBufferSize(BufferSize); >> ? ? ?else >> - ? ? ? ?SetUnbuffered(); >> + ? ? ? ?SetBuffered(); >> ? ? ?TheStream->SetUnbuffered(); >> >> ? ? ?Scanned = 0; >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From gohman at apple.com Mon Sep 21 20:36:14 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Sep 2009 18:36:14 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> Message-ID: <5B6312FC-7AB6-47BD-850C-BDDBC73EE839@apple.com> On Sep 21, 2009, at 2:12 PM, Evan Cheng wrote: > + float Weight = li_->getSpillWeight(HasDef, HasUse, loopDepth > +1); > - RegInt.weight += > - li_->getSpillWeight(mop.isDef(), mop.isUse(), > loopDepth); Why the change from loopDepth to loopDepth+1? This seems inconsistent with LiveIntervalAnalysis.cpp's call to getSpillWeight, which just passes in the normal spill weight. Dan From evan.cheng at apple.com Mon Sep 21 20:39:40 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 18:39:40 -0700 Subject: [llvm-commits] [llvm] r82485 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/ARM/remat.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll test/CodeGen/X86/2008-07-11-SpillerBug.ll test/CodeGen/X86/2009-04-20-LinearScanOpt.ll test/CodeGen/X86/2009-09-21-NoSpillLoopCount.ll test/CodeGen/X86/stack-color-with-reg.ll In-Reply-To: <5B6312FC-7AB6-47BD-850C-BDDBC73EE839@apple.com> References: <200909212112.n8LLCQj9028495@zion.cs.uiuc.edu> <5B6312FC-7AB6-47BD-850C-BDDBC73EE839@apple.com> Message-ID: <2116CD49-8F3D-4965-8C81-914F9E8E9F09@apple.com> On Sep 21, 2009, at 6:36 PM, Dan Gohman wrote: > > On Sep 21, 2009, at 2:12 PM, Evan Cheng wrote: > >> + float Weight = li_->getSpillWeight(HasDef, HasUse, >> loopDepth+1); > >> - RegInt.weight += >> - li_->getSpillWeight(mop.isDef(), mop.isUse(), >> loopDepth); > > Why the change from loopDepth to loopDepth+1? This seems inconsistent > with LiveIntervalAnalysis.cpp's call to getSpillWeight, which just > passes in the normal spill weight. Oops. That's a real cut and paste bug. Evan > > Dan > From evan.cheng at apple.com Mon Sep 21 20:48:19 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Sep 2009 01:48:19 -0000 Subject: [llvm-commits] [llvm] r82505 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll test/CodeGen/X86/2008-02-22-ReMatBug.ll Message-ID: <200909220148.n8M1mJSo000456@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 21 20:48:19 2009 New Revision: 82505 URL: http://llvm.org/viewvc/llvm-project?rev=82505&view=rev Log: Fix a pasto. Also simplify for Bill's benefit. Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=82505&r1=82504&r2=82505&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Sep 21 20:48:19 2009 @@ -2571,17 +2571,19 @@ continue; bool HasDef = mopi.isDef(); - bool HasUse = mopi.isUse(); + bool HasUse = !HasDef; for (unsigned j = i+1; j != e; ++j) { const MachineOperand &mopj = MI->getOperand(j); if (!mopj.isReg() || mopj.getReg() != Reg) continue; HasDef |= mopj.isDef(); HasUse |= mopj.isUse(); + if (HasDef && HasUse) + break; } LiveInterval &RegInt = li_->getInterval(Reg); - float Weight = li_->getSpillWeight(HasDef, HasUse, loopDepth+1); + float Weight = li_->getSpillWeight(HasDef, HasUse, loopDepth); if (HasDef && isExit) { // Looks like this is a loop count variable update. MachineInstrIndex DefIdx = Modified: llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll?rev=82505&r1=82504&r2=82505&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll Mon Sep 21 20:48:19 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 161 +; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 162 %"struct.Adv5::Ekin<3>" = type <{ i8 }> %"struct.Adv5::X::Energyflux<3>" = type { double } Modified: llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll?rev=82505&r1=82504&r2=82505&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-02-22-ReMatBug.ll Mon Sep 21 20:48:19 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 2 +; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 3 ; rdar://5761454 %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* } From daniel at zuster.org Mon Sep 21 21:02:33 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 02:02:33 -0000 Subject: [llvm-commits] [llvm] r82506 - in /llvm/trunk: include/llvm/Support/ValueHandle.h lib/VMCore/Value.cpp Message-ID: <200909220202.n8M22Ytv002305@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 21:02:33 2009 New Revision: 82506 URL: http://llvm.org/viewvc/llvm-project?rev=82506&view=rev Log: Add a TrackingVH value handle. This is designed for tracking a value even when it might move (like WeakVH), but it is an error to delete the referenced value (unlike WeakVH0. TrackingVH is templated like AssertingVH on the tracked Value subclass, it is an error to RAUW a tracked value to an incompatible type. For implementation reasons the latter error is only diagnosed on accesses to a mis-RAUWed TrackingVH, because we don't want a virtual interface in a templated class. The former error is also only diagnosed on access, so that clients are allowed to delete a tracked value, as long as they don't use it. This makes it easier for the client to reason about destruction. Modified: llvm/trunk/include/llvm/Support/ValueHandle.h llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/include/llvm/Support/ValueHandle.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ValueHandle.h?rev=82506&r1=82505&r2=82506&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/ValueHandle.h (original) +++ llvm/trunk/include/llvm/Support/ValueHandle.h Mon Sep 21 21:02:33 2009 @@ -45,8 +45,9 @@ /// fully general Callback version does have a vtable. enum HandleBaseKind { Assert, - Weak, - Callback + Callback, + Tracking, + Weak }; private: @@ -92,13 +93,13 @@ protected: Value *getValPtr() const { return VP; } -private: static bool isValid(Value *V) { return V && V != DenseMapInfo::getEmptyKey() && V != DenseMapInfo::getTombstoneKey(); } +private: // Callbacks made from Value. static void ValueIsDeleted(Value *V); static void ValueIsRAUWd(Value *Old, Value *New); @@ -223,6 +224,88 @@ template<> struct simplify_type > : public simplify_type > {}; +/// TrackingVH - This is a value handle that tracks a Value (or Value subclass), +/// even across RAUW operations. +/// +/// TrackingVH is designed for situations where a client needs to hold a handle +/// to a Value (or subclass) across some operations which may move that value, +/// but should never destroy it or replace it with some unacceptable type. +/// +/// It is an error to do anything with a TrackingVH whose value has been +/// destroyed, except to destruct it. +/// +/// It is an error to attempt to replace a value with one of a type which is +/// incompatible with any of its outstanding TrackingVHs. +template +class TrackingVH : public ValueHandleBase { + void CheckValidity() const { + Value *VP = ValueHandleBase::getValPtr(); + + // Null is always ok. + if (!VP) + return; + + // Check that this value is valid (i.e., it hasn't been deleted). We + // explicitly delay this check until access to avoid requiring clients to be + // unnecessarily careful w.r.t. destruction. + assert(ValueHandleBase::isValid(VP) && "Tracked Value was deleted!"); + + // Check that the value is a member of the correct subclass. We would like + // to check this property on assignment for better debugging, but we don't + // want to require a virtual interface on this VH. Instead we allow RAUW to + // replace this value with a value of an invalid type, and check it here. + assert(isa(VP) && + "Tracked Value was replaced by one with an invalid type!"); + } + + ValueTy *getValPtr() const { + CheckValidity(); + return static_cast(ValueHandleBase::getValPtr()); + } + void setValPtr(ValueTy *P) { + CheckValidity(); + ValueHandleBase::operator=(GetAsValue(P)); + } + + // Convert a ValueTy*, which may be const, to the type the base + // class expects. + static Value *GetAsValue(Value *V) { return V; } + static Value *GetAsValue(const Value *V) { return const_cast(V); } + +public: + TrackingVH() : ValueHandleBase(Tracking) {} + TrackingVH(ValueTy *P) : ValueHandleBase(Tracking, P) {} + TrackingVH(const TrackingVH &RHS) : ValueHandleBase(Tracking, RHS) {} + + operator ValueTy*() const { + return getValPtr(); + } + + ValueTy *operator=(ValueTy *RHS) { + setValPtr(RHS); + return getValPtr(); + } + ValueTy *operator=(const TrackingVH &RHS) { + setValPtr(RHS.getValPtr()); + return getValPtr(); + } + + ValueTy *operator->() const { return getValPtr(); } + ValueTy &operator*() const { return *getValPtr(); } +}; + +// Specialize simplify_type to allow TrackingVH to participate in +// dyn_cast, isa, etc. +template struct simplify_type; +template<> struct simplify_type > { + typedef Value* SimpleType; + static SimpleType getSimplifiedValue(const TrackingVH &AVH) { + return static_cast(AVH); + } +}; +template<> struct simplify_type > + : public simplify_type > {}; + /// CallbackVH - This is a value handle that allows subclasses to define /// callbacks that run when the underlying Value has RAUW called on it or is /// destroyed. This class can be used as the key of a map, as long as the user Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=82506&r1=82505&r2=82506&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Mon Sep 21 21:02:33 2009 @@ -503,6 +503,11 @@ #endif llvm_unreachable("An asserting value handle still pointed to this" " value!"); + case Tracking: + // Mark that this value has been deleted by setting it to an invalid Value + // pointer. + ThisNode->operator=(DenseMapInfo::getTombstoneKey()); + break; case Weak: // Weak just goes to null, which will unlink it from the list. ThisNode->operator=(0); @@ -539,6 +544,14 @@ case Assert: // Asserting handle does not follow RAUW implicitly. break; + case Tracking: + // Tracking goes to new value like a WeakVH. Note that this may make it + // something incompatible with its templated type. We don't want to have a + // virtual (or inline) interface to handle this though, so instead we make + // the TrackingVH accessors guarantee that a client never seesl this + // value. + + // FALLTHROUGH case Weak: // Weak goes to the new value, which will unlink it from Old's list. ThisNode->operator=(New); From daniel at zuster.org Mon Sep 21 21:03:19 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 02:03:19 -0000 Subject: [llvm-commits] [llvm] r82507 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp Message-ID: <200909220203.n8M23Jp5002414@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 21:03:18 2009 New Revision: 82507 URL: http://llvm.org/viewvc/llvm-project?rev=82507&view=rev Log: Switch DIDescriptor to use a TrackingVH. - This makes it much safer to work with debug info, since it was extraordinarily easy to have dangling pointers thanks to MDNode uniquing. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h 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=82507&r1=82506&r2=82507&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Sep 21 21:03:18 2009 @@ -24,6 +24,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Support/ValueHandle.h" namespace llvm { class BasicBlock; @@ -45,7 +46,7 @@ class DIDescriptor { protected: - MDNode *DbgNode; + TrackingVH DbgNode; /// DIDescriptor constructor. If the specified node is non-null, check /// to make sure that the tag in the descriptor matches 'RequiredTag'. If Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=82507&r1=82506&r2=82507&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Sep 21 21:03:18 2009 @@ -267,8 +267,17 @@ return; assert (!D.isNull() && "Can not replace with null"); - DbgNode->replaceAllUsesWith(D.getNode()); - delete DbgNode; + + // Since we use a TrackingVH for the node, its easy for clients to manufacture + // legitimate situations where they want to replaceAllUsesWith() on something + // which, due to uniquing, has merged with the source. We shield clients from + // this detail by allowing a value to be replaced with replaceAllUsesWith() + // itself. + if (getNode() != D.getNode()) { + MDNode *Node = DbgNode; + Node->replaceAllUsesWith(D.getNode()); + delete Node; + } } /// Verify - Verify that a compile unit is well formed. @@ -395,7 +404,7 @@ /// dump - Print descriptor. void DIDescriptor::dump() const { errs() << "[" << dwarf::TagString(getTag()) << "] "; - errs().write_hex((intptr_t)DbgNode) << ']'; + errs().write_hex((intptr_t) &*DbgNode) << ']'; } /// dump - Print compile unit. From daniel at zuster.org Mon Sep 21 22:34:41 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 03:34:41 -0000 Subject: [llvm-commits] [llvm] r82516 - /llvm/trunk/lib/Support/StringRef.cpp Message-ID: <200909220334.n8M3Yfsr013906@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 22:34:40 2009 New Revision: 82516 URL: http://llvm.org/viewvc/llvm-project?rev=82516&view=rev Log: Workaround what I believe is an MSVC bug where it emits a definition for a static const class member into each translation unit, with external linkage??? - If someone understands this issue better, please clue me in, I haven't consulted the standard yet. Modified: llvm/trunk/lib/Support/StringRef.cpp Modified: llvm/trunk/lib/Support/StringRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=82516&r1=82515&r2=82516&view=diff ============================================================================== --- llvm/trunk/lib/Support/StringRef.cpp (original) +++ llvm/trunk/lib/Support/StringRef.cpp Mon Sep 21 22:34:40 2009 @@ -10,7 +10,10 @@ #include "llvm/ADT/StringRef.h" using namespace llvm; +// MSVC emits references to this into the translation units which reference it. +#ifndef _MSC_VER const size_t StringRef::npos; +#endif //===----------------------------------------------------------------------===// // String Searching From daniel at zuster.org Mon Sep 21 22:34:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 03:34:53 -0000 Subject: [llvm-commits] [llvm] r82517 - in /llvm/trunk: include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp Message-ID: <200909220334.n8M3YrEO013942@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 22:34:53 2009 New Revision: 82517 URL: http://llvm.org/viewvc/llvm-project?rev=82517&view=rev Log: Switch FoldingSet::AddString to StringRef based API. - This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h llvm/trunk/lib/Support/FoldingSet.cpp Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=82517&r1=82516&r2=82517&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Mon Sep 21 22:34:53 2009 @@ -18,7 +18,7 @@ #include "llvm/Support/DataTypes.h" #include "llvm/ADT/SmallVector.h" -#include +#include "llvm/ADT/StringRef.h" #include namespace llvm { @@ -227,9 +227,7 @@ void AddInteger(long long I); void AddInteger(unsigned long long I); void AddBoolean(bool B) { AddInteger(B ? 1U : 0U); } - void AddString(const char* String, const char* End); - void AddString(const std::string &String); - void AddString(const char* String); + void AddString(StringRef String); template inline void Add(const T& x) { FoldingSetTrait::Profile(x, *this); } Modified: llvm/trunk/lib/Support/FoldingSet.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=82517&r1=82516&r2=82517&view=diff ============================================================================== --- llvm/trunk/lib/Support/FoldingSet.cpp (original) +++ llvm/trunk/lib/Support/FoldingSet.cpp Mon Sep 21 22:34:53 2009 @@ -63,14 +63,14 @@ Bits.push_back(unsigned(I >> 32)); } -void FoldingSetNodeID::AddString(const char *String, const char *End) { - unsigned Size = static_cast(End - String); +void FoldingSetNodeID::AddString(StringRef String) { + unsigned Size = String.size(); Bits.push_back(Size); if (!Size) return; unsigned Units = Size / 4; unsigned Pos = 0; - const unsigned *Base = (const unsigned *)String; + const unsigned *Base = (const unsigned*) String.data(); // If the string is aligned do a bulk transfer. if (!((intptr_t)Base & 3)) { @@ -100,14 +100,6 @@ Bits.push_back(V); } -void FoldingSetNodeID::AddString(const char *String) { - AddString(String, String + strlen(String)); -} - -void FoldingSetNodeID::AddString(const std::string &String) { - AddString(&*String.begin(), &*String.end()); -} - /// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to /// lookup the node in the FoldingSetImpl. unsigned FoldingSetNodeID::ComputeHash() const { From daniel at zuster.org Mon Sep 21 23:43:20 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 21 Sep 2009 21:43:20 -0700 Subject: [llvm-commits] [llvm] r81826 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc In-Reply-To: <200909150339.n8F3dn4T018712@zion.cs.uiuc.edu> References: <200909150339.n8F3dn4T018712@zion.cs.uiuc.edu> Message-ID: <6a8523d60909212143g6e24a16n953f37fe07738f07@mail.gmail.com> Hi Mikhail, This isn't safe, for exactly the same reasons as I fixed it before here: http://llvm.org/viewvc/llvm-project?view=rev&revision=77953 and it breaks ExecuteAndWait in exactly the same way. I'm reverting it for now. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090727/083264.html If the motivation is supporting GetProcessId pre XP then this should be recorded in the Program object. I also see no reason to make a Program object copyable -- what would this mean? The program object should essentially be opaque, it is implemented by the System layer, which may well be non-copyable. I know we don't currently have a good way of running tests on Windows, but please verify that ExecuteAndWait doesn't break when modifying this code... - Daniel On Mon, Sep 14, 2009 at 8:39 PM, Mikhail Glushenkov wrote: > Author: foldr > Date: Mon Sep 14 22:39:45 2009 > New Revision: 81826 > > URL: http://llvm.org/viewvc/llvm-project?rev=81826&view=rev > Log: > Get rid of GetProcessId in Win32/Program.inc. > > GetProcessId was introduced only in XP. As a bonus, this change makes Program > objects copyable, since Program is now basically a PID. > > Modified: > ? ?llvm/trunk/include/llvm/System/Program.h > ? ?llvm/trunk/lib/System/Unix/Program.inc > ? ?llvm/trunk/lib/System/Win32/Program.inc > > Modified: llvm/trunk/include/llvm/System/Program.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Program.h?rev=81826&r1=81825&r2=81826&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/System/Program.h (original) > +++ llvm/trunk/include/llvm/System/Program.h Mon Sep 14 22:39:45 2009 > @@ -29,22 +29,18 @@ > ? /// @since 1.4 > ? /// @brief An abstraction for finding and executing programs. > ? class Program { > - ? ?/// Opaque handle for target specific data. > - ? ?void *Data_; > > - ? ?// Noncopyable. > - ? ?Program(const Program& other); > - ? ?Program& operator=(const Program& other); > + ? ?unsigned Pid_; > > ? ? /// @name Methods > ? ? /// @{ > ? public: > > - ? ?Program(); > - ? ?~Program(); > + ? ?Program() : Pid_(0) {} > + ? ?~Program() {} > > ? ? /// Return process ID of this program. > - ? ?unsigned GetPid() const; > + ? ?unsigned GetPid() const { return Pid_; } > > ? ? /// This function executes the program using the \p arguments provided. ?The > ? ? /// invoked program will inherit the stdin, stdout, and stderr file > > Modified: llvm/trunk/lib/System/Unix/Program.inc > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=81826&r1=81825&r2=81826&view=diff > > ============================================================================== > --- llvm/trunk/lib/System/Unix/Program.inc (original) > +++ llvm/trunk/lib/System/Unix/Program.inc Mon Sep 14 22:39:45 2009 > @@ -34,15 +34,6 @@ > ?namespace llvm { > ?using namespace sys; > > -Program::Program() : Data_(0) {} > - > -Program::~Program() {} > - > -unsigned Program::GetPid() const { > - ?uint64_t pid = reinterpret_cast(Data_); > - ?return static_cast(pid); > -} > - > ?// This function just uses the PATH environment variable to find the program. > ?Path > ?Program::FindProgramByName(const std::string& progName) { > @@ -214,7 +205,7 @@ > ? ? ? break; > ? } > > - ?Data_ = reinterpret_cast(child); > + ?Pid_ = child; > > ? return true; > ?} > @@ -226,7 +217,7 @@ > ?#ifdef HAVE_SYS_WAIT_H > ? struct sigaction Act, Old; > > - ?if (Data_ == 0) { > + ?if (Pid_ == 0) { > ? ? MakeErrMsg(ErrMsg, "Process not started!"); > ? ? return -1; > ? } > @@ -242,8 +233,7 @@ > > ? // Parent process: Wait for the child process to terminate. > ? int status; > - ?uint64_t pid = reinterpret_cast(Data_); > - ?pid_t child = static_cast(pid); > + ?pid_t child = Pid_; > ? while (wait(&status) != child) > ? ? if (secondsToWait && errno == EINTR) { > ? ? ? // Kill the child. > @@ -291,15 +281,12 @@ > > ?bool > ?Program::Kill(std::string* ErrMsg) { > - ?if (Data_ == 0) { > + ?if (Pid_ == 0) { > ? ? MakeErrMsg(ErrMsg, "Process not started!"); > ? ? return true; > ? } > > - ?uint64_t pid64 = reinterpret_cast(Data_); > - ?pid_t pid = static_cast(pid64); > - > - ?if (kill(pid, SIGKILL) != 0) { > + ?if (kill(Pid_, SIGKILL) != 0) { > ? ? MakeErrMsg(ErrMsg, "The process couldn't be killed!"); > ? ? return true; > ? } > > Modified: llvm/trunk/lib/System/Win32/Program.inc > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Program.inc?rev=81826&r1=81825&r2=81826&view=diff > > ============================================================================== > --- llvm/trunk/lib/System/Win32/Program.inc (original) > +++ llvm/trunk/lib/System/Win32/Program.inc Mon Sep 14 22:39:45 2009 > @@ -25,21 +25,6 @@ > ?namespace llvm { > ?using namespace sys; > > -Program::Program() : Data_(0) {} > - > -Program::~Program() { > - ?if (Data_) { > - ? ?HANDLE hProcess = reinterpret_cast(Data_); > - ? ?CloseHandle(hProcess); > - ? ?Data_ = 0; > - ?} > -} > - > -unsigned Program::GetPid() const { > - ?HANDLE hProcess = reinterpret_cast(Data_); > - ?return GetProcessId(hProcess); > -} > - > ?// This function just uses the PATH environment variable to find the program. > ?Path > ?Program::FindProgramByName(const std::string& progName) { > @@ -137,11 +122,6 @@ > ? ? ? ? ? ? ? ? ?const Path** redirects, > ? ? ? ? ? ? ? ? ?unsigned memoryLimit, > ? ? ? ? ? ? ? ? ?std::string* ErrMsg) { > - ?if (Data_) { > - ? ?HANDLE hProcess = reinterpret_cast(Data_); > - ? ?CloseHandle(Data_); > - ? ?Data_ = 0; > - ?} > > ? if (!path.canExecute()) { > ? ? if (ErrMsg) > @@ -269,9 +249,10 @@ > ? ? ? ? ? ? ? ?path.str() + "'"); > ? ? return false; > ? } > - ?Data_ = reinterpret_cast(pi.hProcess); > + ?Pid_ = pi.dwProcessId; > > ? // Make sure these get closed no matter what. > + ?AutoHandle hProcess(pi.hProcess); > ? AutoHandle hThread(pi.hThread); > > ? // Assign the process to a job if a memory limit is defined. > @@ -305,12 +286,17 @@ > ?int > ?Program::Wait(unsigned secondsToWait, > ? ? ? ? ? ? ? std::string* ErrMsg) { > - ?if (Data_ == 0) { > + ?if (Pid_ == 0) { > ? ? MakeErrMsg(ErrMsg, "Process not started!"); > ? ? return -1; > ? } > > - ?HANDLE hProcess = reinterpret_cast(Data_); > + ?HANDLE hOpen = OpenProcess(SYNCHRONIZE, FALSE, Pid_); > + ?if (hOpen == NULL) { > + ? ?MakeErrMsg(ErrMsg, "OpenProcess failed!"); > + ? ?return -1; > + ?} > + ?AutoHandle hProcess(hOpen); > > ? // Wait for the process to terminate. > ? DWORD millisecondsToWait = INFINITE; > @@ -341,12 +327,18 @@ > > ?bool > ?Program::Kill(std::string* ErrMsg) { > - ?if (Data_ == 0) { > + ?if (Pid_ == 0) { > ? ? MakeErrMsg(ErrMsg, "Process not started!"); > ? ? return true; > ? } > > - ?HANDLE hProcess = reinterpret_cast(Data_); > + ?HANDLE hOpen = OpenProcess(PROCESS_TERMINATE, FALSE, Pid_); > + ?if (hOpen == NULL) { > + ? ?MakeErrMsg(ErrMsg, "OpenProcess failed!"); > + ? ?return true; > + ?} > + ?AutoHandle hProcess(hOpen); > + > ? if (TerminateProcess(hProcess, 1) == 0) { > ? ? MakeErrMsg(ErrMsg, "The process couldn't be killed!"); > ? ? return true; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Mon Sep 21 23:44:26 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 04:44:26 -0000 Subject: [llvm-commits] [llvm] r82520 - /llvm/trunk/utils/lit/TestRunner.py Message-ID: <200909220444.n8M4iQTF023071@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 23:44:26 2009 New Revision: 82520 URL: http://llvm.org/viewvc/llvm-project?rev=82520&view=rev Log: lit: When executing commands internally, perform PATH resolution ourselves. Modified: llvm/trunk/utils/lit/TestRunner.py Modified: llvm/trunk/utils/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestRunner.py?rev=82520&r1=82519&r2=82520&view=diff ============================================================================== --- llvm/trunk/utils/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/TestRunner.py Mon Sep 21 23:44:26 2009 @@ -5,6 +5,11 @@ import Test import Util +class InternalShellError(Exception): + def __init__(self, command, message): + self.command = command + self.message = message + def executeCommand(command, cwd=None, env=None): p = subprocess.Popen(command, cwd=cwd, stdin=subprocess.PIPE, @@ -94,6 +99,13 @@ stderrIsStdout = True else: stderrIsStdout = False + + # Resolve the executable path ourselves. + args = list(j.args) + args[0] = Util.which(args[0], cfg.environment['PATH']) + if not args[0]: + raise InternalShellError(j, '%r: command not found' % j.args[0]) + procs.append(subprocess.Popen(j.args, cwd=cwd, stdin = stdin, stdout = stdout, @@ -159,7 +171,12 @@ return (Test.FAIL, "shell parser error on: %r" % ln) results = [] - exitCode = executeShCmd(cmd, test.config, cwd, results) + try: + exitCode = executeShCmd(cmd, test.config, cwd, results) + except InternalShellError,e: + out = '' + err = e.message + exitCode = 255 out = err = '' for i,(cmd, cmd_out,cmd_err,res) in enumerate(results): @@ -225,7 +242,11 @@ return out,err,exitCode else: results = [] - exitCode = executeShCmd(cmd, test.config, cwd, results) + try: + exitCode = executeShCmd(cmd, test.config, cwd, results) + except InternalShellError,e: + results.append((e.command, '', e.message + '\n', 255)) + exitCode = 255 out = err = '' From daniel at zuster.org Mon Sep 21 23:44:37 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 04:44:37 -0000 Subject: [llvm-commits] [llvm] r82521 - /llvm/trunk/utils/lit/TestRunner.py Message-ID: <200909220444.n8M4ibLb023100@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 23:44:37 2009 New Revision: 82521 URL: http://llvm.org/viewvc/llvm-project?rev=82521&view=rev Log: lit: Don't use close_fds=True on Windows. Modified: llvm/trunk/utils/lit/TestRunner.py Modified: llvm/trunk/utils/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestRunner.py?rev=82521&r1=82520&r2=82521&view=diff ============================================================================== --- llvm/trunk/utils/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/TestRunner.py Mon Sep 21 23:44:37 2009 @@ -5,11 +5,15 @@ import Test import Util +import platform + class InternalShellError(Exception): def __init__(self, command, message): self.command = command self.message = message +# Don't use close_fds on Windows. +kUseCloseFDs = platform.system() != 'Windows' def executeCommand(command, cwd=None, env=None): p = subprocess.Popen(command, cwd=cwd, stdin=subprocess.PIPE, @@ -111,7 +115,7 @@ stdout = stdout, stderr = stderr, env = cfg.environment, - close_fds = True)) + close_fds = kUseCloseFDs)) # Immediately close stdin for any process taking stdin from us. if stdin == subprocess.PIPE: From daniel at zuster.org Mon Sep 21 23:44:56 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 04:44:56 -0000 Subject: [llvm-commits] [llvm] r82522 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc Message-ID: <200909220444.n8M4iveX023155@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Sep 21 23:44:56 2009 New Revision: 82522 URL: http://llvm.org/viewvc/llvm-project?rev=82522&view=rev Log: Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks ExecuteAndWait. Modified: llvm/trunk/include/llvm/System/Program.h llvm/trunk/lib/System/Unix/Program.inc llvm/trunk/lib/System/Win32/Program.inc Modified: llvm/trunk/include/llvm/System/Program.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Program.h?rev=82522&r1=82521&r2=82522&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Program.h (original) +++ llvm/trunk/include/llvm/System/Program.h Mon Sep 21 23:44:56 2009 @@ -29,18 +29,22 @@ /// @since 1.4 /// @brief An abstraction for finding and executing programs. class Program { + /// Opaque handle for target specific data. + void *Data_; - unsigned Pid_; + // Noncopyable. + Program(const Program& other); + Program& operator=(const Program& other); /// @name Methods /// @{ public: - Program() : Pid_(0) {} - ~Program() {} + Program(); + ~Program(); /// Return process ID of this program. - unsigned GetPid() const { return Pid_; } + unsigned GetPid() const; /// This function executes the program using the \p arguments provided. The /// invoked program will inherit the stdin, stdout, and stderr file Modified: llvm/trunk/lib/System/Unix/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=82522&r1=82521&r2=82522&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Program.inc (original) +++ llvm/trunk/lib/System/Unix/Program.inc Mon Sep 21 23:44:56 2009 @@ -34,6 +34,15 @@ namespace llvm { using namespace sys; +Program::Program() : Data_(0) {} + +Program::~Program() {} + +unsigned Program::GetPid() const { + uint64_t pid = reinterpret_cast(Data_); + return static_cast(pid); +} + // This function just uses the PATH environment variable to find the program. Path Program::FindProgramByName(const std::string& progName) { @@ -205,7 +214,7 @@ break; } - Pid_ = child; + Data_ = reinterpret_cast(child); return true; } @@ -217,7 +226,7 @@ #ifdef HAVE_SYS_WAIT_H struct sigaction Act, Old; - if (Pid_ == 0) { + if (Data_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return -1; } @@ -233,7 +242,8 @@ // Parent process: Wait for the child process to terminate. int status; - pid_t child = Pid_; + uint64_t pid = reinterpret_cast(Data_); + pid_t child = static_cast(pid); while (wait(&status) != child) if (secondsToWait && errno == EINTR) { // Kill the child. @@ -281,12 +291,15 @@ bool Program::Kill(std::string* ErrMsg) { - if (Pid_ == 0) { + if (Data_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return true; } - if (kill(Pid_, SIGKILL) != 0) { + uint64_t pid64 = reinterpret_cast(Data_); + pid_t pid = static_cast(pid64); + + if (kill(pid, SIGKILL) != 0) { MakeErrMsg(ErrMsg, "The process couldn't be killed!"); return true; } Modified: llvm/trunk/lib/System/Win32/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Program.inc?rev=82522&r1=82521&r2=82522&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Program.inc (original) +++ llvm/trunk/lib/System/Win32/Program.inc Mon Sep 21 23:44:56 2009 @@ -25,6 +25,21 @@ namespace llvm { using namespace sys; +Program::Program() : Data_(0) {} + +Program::~Program() { + if (Data_) { + HANDLE hProcess = reinterpret_cast(Data_); + CloseHandle(hProcess); + Data_ = 0; + } +} + +unsigned Program::GetPid() const { + HANDLE hProcess = reinterpret_cast(Data_); + return GetProcessId(hProcess); +} + // This function just uses the PATH environment variable to find the program. Path Program::FindProgramByName(const std::string& progName) { @@ -122,6 +137,11 @@ const Path** redirects, unsigned memoryLimit, std::string* ErrMsg) { + if (Data_) { + HANDLE hProcess = reinterpret_cast(Data_); + CloseHandle(Data_); + Data_ = 0; + } if (!path.canExecute()) { if (ErrMsg) @@ -249,10 +269,9 @@ path.str() + "'"); return false; } - Pid_ = pi.dwProcessId; + Data_ = reinterpret_cast(pi.hProcess); // Make sure these get closed no matter what. - AutoHandle hProcess(pi.hProcess); AutoHandle hThread(pi.hThread); // Assign the process to a job if a memory limit is defined. @@ -286,17 +305,12 @@ int Program::Wait(unsigned secondsToWait, std::string* ErrMsg) { - if (Pid_ == 0) { + if (Data_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return -1; } - HANDLE hOpen = OpenProcess(SYNCHRONIZE, FALSE, Pid_); - if (hOpen == NULL) { - MakeErrMsg(ErrMsg, "OpenProcess failed!"); - return -1; - } - AutoHandle hProcess(hOpen); + HANDLE hProcess = reinterpret_cast(Data_); // Wait for the process to terminate. DWORD millisecondsToWait = INFINITE; @@ -327,18 +341,12 @@ bool Program::Kill(std::string* ErrMsg) { - if (Pid_ == 0) { + if (Data_ == 0) { MakeErrMsg(ErrMsg, "Process not started!"); return true; } - HANDLE hOpen = OpenProcess(PROCESS_TERMINATE, FALSE, Pid_); - if (hOpen == NULL) { - MakeErrMsg(ErrMsg, "OpenProcess failed!"); - return true; - } - AutoHandle hProcess(hOpen); - + HANDLE hProcess = reinterpret_cast(Data_); if (TerminateProcess(hProcess, 1) == 0) { MakeErrMsg(ErrMsg, "The process couldn't be killed!"); return true; From stoklund at 2pi.dk Mon Sep 21 23:50:03 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Tue, 22 Sep 2009 06:50:03 +0200 Subject: [llvm-commits] [llvm] r82503 - /llvm/trunk/lib/CodeGen/LowerSubregs.cpp References: <200909220029.n8M0TfoX022615@zion.cs.uiuc.edu> Message-ID: <87ljk7vb0k.fsf@2pi.dk> Evan Cheng writes: > Minor bug fix. LowerSubregs should translate > %S0 = EXTRACT_SUBREG %Q0, 1 > to > %S0 = IMPLICIT_DEF %Q0 > > Implicit_def does not *read* any register so the operand should be > marked "implicit". The missing "implicit" marker on the operand is > wrong, but it doesn't actually break anything. Thanks. Is IMPLICIT_DEF variadic? Otherwise, the machine code verifier should have caught this. /jakob From daniel at zuster.org Tue Sep 22 01:09:14 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 06:09:14 -0000 Subject: [llvm-commits] [llvm] r82527 - /llvm/trunk/utils/lit/TestRunner.py Message-ID: <200909220609.n8M69EKR001264@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 01:09:13 2009 New Revision: 82527 URL: http://llvm.org/viewvc/llvm-project?rev=82527&view=rev Log: Actually use the arguments with the resolved executable path. Modified: llvm/trunk/utils/lit/TestRunner.py Modified: llvm/trunk/utils/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestRunner.py?rev=82527&r1=82526&r2=82527&view=diff ============================================================================== --- llvm/trunk/utils/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/TestRunner.py Tue Sep 22 01:09:13 2009 @@ -110,7 +110,7 @@ if not args[0]: raise InternalShellError(j, '%r: command not found' % j.args[0]) - procs.append(subprocess.Popen(j.args, cwd=cwd, + procs.append(subprocess.Popen(args, cwd=cwd, stdin = stdin, stdout = stdout, stderr = stderr, From daniel at zuster.org Tue Sep 22 01:09:22 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 06:09:22 -0000 Subject: [llvm-commits] [llvm] r82528 - /llvm/trunk/tools/llvm-config/llvm-config.in.in Message-ID: <200909220609.n8M69MR2001290@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 01:09:22 2009 New Revision: 82528 URL: http://llvm.org/viewvc/llvm-project?rev=82528&view=rev Log: llvm-config: Remove unused variables. Modified: llvm/trunk/tools/llvm-config/llvm-config.in.in Modified: llvm/trunk/tools/llvm-config/llvm-config.in.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.in.in?rev=82528&r1=82527&r2=82528&view=diff ============================================================================== --- llvm/trunk/tools/llvm-config/llvm-config.in.in (original) +++ llvm/trunk/tools/llvm-config/llvm-config.in.in Tue Sep 22 01:09:22 2009 @@ -26,17 +26,6 @@ my $LLVM_CONFIGTIME = q{@LLVM_CONFIGTIME@}; my $LLVM_SRC_ROOT = q{@abs_top_srcdir@}; my $LLVM_OBJ_ROOT = q{@abs_top_builddir@}; -my $LLVM_ON_WIN32 = q{@LLVM_ON_WIN32@}; -my $LLVM_ON_UNIX = q{@LLVM_ON_UNIX@}; -my $LLVMGCCDIR = q{@LLVMGCCDIR@}; -my $LLVMGCC = q{@LLVMGCC@}; -my $LLVMGXX = q{@LLVMGXX@}; -my $LLVMGCC_VERSION = q{@LLVMGCC_VERSION@}; -my $LLVMGCC_MAJVERS = q{@LLVMGCC_MAJVERS@}; -my $ENDIAN = q{@ENDIAN@}; -my $SHLIBEXT = q{@SHLIBEXT@}; -my $EXEEXT = q{@EXEEXT@}; -my $OS = q{@OS@}; my $ARCH = lc(q{@ARCH@}); my $TARGET_TRIPLE = q{@target@}; my $TARGETS_TO_BUILD = q{@TARGETS_TO_BUILD@}; From daniel at zuster.org Tue Sep 22 01:09:31 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 06:09:31 -0000 Subject: [llvm-commits] [llvm] r82529 - /llvm/trunk/tools/llvm-config/CMakeLists.txt Message-ID: <200909220609.n8M69Vai001319@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 01:09:31 2009 New Revision: 82529 URL: http://llvm.org/viewvc/llvm-project?rev=82529&view=rev Log: Fix llvm-config --src-root and --obj-root for CMake builds. Modified: llvm/trunk/tools/llvm-config/CMakeLists.txt Modified: llvm/trunk/tools/llvm-config/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/CMakeLists.txt?rev=82529&r1=82528&r2=82529&view=diff ============================================================================== --- llvm/trunk/tools/llvm-config/CMakeLists.txt (original) +++ llvm/trunk/tools/llvm-config/CMakeLists.txt Tue Sep 22 01:09:31 2009 @@ -8,6 +8,8 @@ set(PERL ${PERL_EXECUTABLE}) set(VERSION PACKAGE_VERSION) set(PREFIX ${LLVM_BINARY_DIR}) # TODO: Root for `make install'. +set(abs_top_srcdir ${LLVM_MAIN_SRC_DIR}) +set(abs_top_builddir ${LLVM_BINARY_DIR}) execute_process(COMMAND date OUTPUT_VARIABLE LLVM_CONFIGTIME OUTPUT_STRIP_TRAILING_WHITESPACE) From daniel at zuster.org Tue Sep 22 01:09:37 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 06:09:37 -0000 Subject: [llvm-commits] [llvm] r82530 - /llvm/trunk/CMakeLists.txt Message-ID: <200909220609.n8M69c6B001345@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 01:09:37 2009 New Revision: 82530 URL: http://llvm.org/viewvc/llvm-project?rev=82530&view=rev Log: CMake: Fix definition of LTDL_SHLIB_EXT for Darwin. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=82530&r1=82529&r2=82530&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Tue Sep 22 01:09:37 2009 @@ -145,7 +145,11 @@ if(UNIX) set(LLVM_ON_WIN32 0) set(LLVM_ON_UNIX 1) - set(LTDL_SHLIB_EXT ".so") + if(APPLE) + set(LTDL_SHLIB_EXT ".dylib") + else(APPLE) + set(LTDL_SHLIB_EXT ".so") + endif(APPLE) set(EXEEXT "") # FIXME: Maximum path length is currently set to 'safe' fixed value set(MAXPATHLEN 2024) From evan.cheng at apple.com Tue Sep 22 01:23:17 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Sep 2009 23:23:17 -0700 Subject: [llvm-commits] [llvm] r82503 - /llvm/trunk/lib/CodeGen/LowerSubregs.cpp In-Reply-To: <87ljk7vb0k.fsf@2pi.dk> References: <200909220029.n8M0TfoX022615@zion.cs.uiuc.edu> <87ljk7vb0k.fsf@2pi.dk> Message-ID: <22BC29A2-4D79-4916-9054-9C863EFCE44B@apple.com> On Sep 21, 2009, at 9:50 PM, Jakob Stoklund Olesen wrote: > Evan Cheng writes: > >> Minor bug fix. LowerSubregs should translate >> %S0 = EXTRACT_SUBREG %Q0, 1 >> to >> %S0 = IMPLICIT_DEF %Q0 >> >> Implicit_def does not *read* any register so the operand should be >> marked "implicit". The missing "implicit" marker on the operand is >> wrong, but it doesn't actually break anything. > > Thanks. > > Is IMPLICIT_DEF variadic? Otherwise, the machine code verifier should > have caught this. It's not variadic. I am not sure why the machine verifier didn't catch this. Evan > > /jakob > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From foldr at codedgers.com Tue Sep 22 01:24:24 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 22 Sep 2009 08:24:24 +0200 Subject: [llvm-commits] [llvm] r81826 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc In-Reply-To: <6a8523d60909212143g6e24a16n953f37fe07738f07@mail.gmail.com> References: <200909150339.n8F3dn4T018712@zion.cs.uiuc.edu> <6a8523d60909212143g6e24a16n953f37fe07738f07@mail.gmail.com> Message-ID: <20090922062424.GA8879@localhost.localdomain> Hi Daniel, On Mon, Sep 21, 2009 at 09:43:20PM -0700, Daniel Dunbar wrote: > Hi Mikhail, > > This isn't safe, for exactly the same reasons as I fixed it before here: > http://llvm.org/viewvc/llvm-project?view=rev&revision=77953 > and it breaks ExecuteAndWait in exactly the same way. I'm reverting it > for now. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090727/083264.html Sorry, I haven't seen your previous e-mail. I don't quite understand what causes the race condition, though... > If the motivation is supporting GetProcessId pre XP then this should > be recorded in the Program object. "this" == PID? Yes, I guess that's better than any of the tricks from [1]. > I also see no reason to make a Program object copyable -- what would this > mean? The program object should essentially be opaque, it is implemented by > the System layer, which may well be non-copyable. Well, if the Program object is just a PID, why not make it copyable? Clients may want to store it somewhere (e.g. STL containers). Alternatively, we may add a way to construct a Program from a PID (since there is already a GetPid() method). > I know we don't currently have a good way of running tests on Windows, > but please verify that ExecuteAndWait doesn't break when modifying > this code... Sorry for that. [1] http://www.codeproject.com/KB/threads/GettingProcessID.aspx From baldrick at free.fr Tue Sep 22 02:08:44 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Sep 2009 07:08:44 -0000 Subject: [llvm-commits] [gcc-plugin] r82531 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909220708.n8M78j3c008701@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 22 02:08:44 2009 New Revision: 82531 URL: http://llvm.org/viewvc/llvm-project?rev=82531&view=rev Log: The CALL_EXPR -> GIMPLE_CALL rework broke the case of a function returning a struct, when the returned result is not used. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82531&r1=82530&r2=82531&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 22 02:08:44 2009 @@ -7969,7 +7969,16 @@ void TreeToLLVM::RenderGIMPLE_CALL(gimple stmt) { tree lhs = gimple_call_lhs(stmt); if (!lhs) { - EmitGimpleCallRHS(stmt, 0); + // The returned value is not used. + if (!isAggregateTreeType(gimple_call_return_type(stmt))) { + EmitGimpleCallRHS(stmt, 0); + return; + } + // Create a temporary to hold the returned value. + // TODO: Figure out how to avoid creating this temporary and the + // associated useless code that stores the returned value into it. + MemRef Loc = CreateTempLoc(ConvertType(gimple_call_return_type(stmt))); + EmitGimpleCallRHS(stmt, &Loc); return; } From daniel at zuster.org Tue Sep 22 02:38:25 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 07:38:25 -0000 Subject: [llvm-commits] [llvm] r82532 - /llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp Message-ID: <200909220738.n8M7cPLL013812@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 02:38:23 2009 New Revision: 82532 URL: http://llvm.org/viewvc/llvm-project?rev=82532&view=rev Log: Use Compiler.h macro instead of __attribute__. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp?rev=82532&r1=82531&r2=82532&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp Tue Sep 22 02:38:23 2009 @@ -34,7 +34,7 @@ extern "C" { // Debuggers puts a breakpoint in this function. - void __attribute__((noinline)) __jit_debug_register_code() { } + void DISABLE_INLINE __jit_debug_register_code() { } // We put information about the JITed function in this global, which the // debugger reads. Make sure to specify the version statically, because the From daniel at zuster.org Tue Sep 22 02:38:34 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 07:38:34 -0000 Subject: [llvm-commits] [llvm] r82533 - in /llvm/trunk/test: Makefile lit.site.cfg.in Message-ID: <200909220738.n8M7cYkM013940@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 02:38:33 2009 New Revision: 82533 URL: http://llvm.org/viewvc/llvm-project?rev=82533&view=rev Log: Generate lit.site.cfg from a .in file, as clang does. Added: llvm/trunk/test/lit.site.cfg.in Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=82533&r1=82532&r2=82533&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Tue Sep 22 02:38:33 2009 @@ -190,14 +190,11 @@ lit.site.cfg: site.exp @echo "Making LLVM 'lit.site.cfg' file..." - @echo "## Autogenerated by Makefile ##" > $@ - @echo "# Do not edit!" >> $@ - @echo >> $@ - @echo "# Preserve some key paths for use by main LLVM test suite config." >> $@ - @echo "config.llvm_obj_root = \"\"\"$(LLVM_OBJ_ROOT)\"\"\"" >> $@ - @echo >> $@ - @echo "# Let the main config do the real work." >> $@ - @echo "lit.load_config(config, \"\"\"$(LLVM_SRC_ROOT)/test/lit.cfg\"\"\")" >> $@ + @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \ + -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \ + -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \ + -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \ + $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ Unit/lit.site.cfg: Unit/.dir FORCE @echo "Making LLVM unittest 'lit.site.cfg' file..." Added: llvm/trunk/test/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.site.cfg.in?rev=82533&view=auto ============================================================================== --- llvm/trunk/test/lit.site.cfg.in (added) +++ llvm/trunk/test/lit.site.cfg.in Tue Sep 22 02:38:33 2009 @@ -0,0 +1,9 @@ +## Autogenerated by LLVM/Clang configuration. +# Do not edit! +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvmgcc_dir = "@LLVMGCCDIR@" + +# Let the main config do the real work. +lit.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg") From daniel at zuster.org Tue Sep 22 02:38:44 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 07:38:44 -0000 Subject: [llvm-commits] [llvm] r82534 - in /llvm/trunk: CMakeLists.txt test/CMakeLists.txt test/site.exp.in Message-ID: <200909220738.n8M7cjgX014119@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 02:38:44 2009 New Revision: 82534 URL: http://llvm.org/viewvc/llvm-project?rev=82534&view=rev Log: Initial support for running LLVM tests from cmake. Added: llvm/trunk/test/CMakeLists.txt llvm/trunk/test/site.exp.in Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=82534&r1=82533&r2=82534&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Tue Sep 22 02:38:44 2009 @@ -259,6 +259,7 @@ add_subdirectory(lib/Analysis) add_subdirectory(lib/Analysis/IPA) add_subdirectory(lib/MC) +add_subdirectory(test) add_subdirectory(utils/FileCheck) Added: llvm/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CMakeLists.txt?rev=82534&view=auto ============================================================================== --- llvm/trunk/test/CMakeLists.txt (added) +++ llvm/trunk/test/CMakeLists.txt Tue Sep 22 02:38:44 2009 @@ -0,0 +1,31 @@ +include(GetTargetTriple) +get_target_triple(target) + +foreach(c ${LLVM_TARGETS_TO_BUILD}) + set(TARGETS_BUILT "${TARGETS_BUILT} ${c}") +endforeach(c) +set(TARGETS_TO_BUILD ${TARGETS_BUILT}) + +include(FindPythonInterp) +if(PYTHONINTERP_FOUND) + get_target_property(LLVM_TOOLS_PATH llvm-config RUNTIME_OUTPUT_DIRECTORY) + + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in + ${CMAKE_CURRENT_BINARY_DIR}/site.exp) + + add_custom_target(llvm-test + COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#" + -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#" + -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#" + -e "s#\@LLVMGCC_DIR\@##" + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + COMMAND ${PYTHON_EXECUTABLE} + ${LLVM_SOURCE_DIR}/utils/lit/lit.py + -sv + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + COMMENT "Running LLVM regression tests") + +endif() Added: llvm/trunk/test/site.exp.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/site.exp.in?rev=82534&view=auto ============================================================================== --- llvm/trunk/test/site.exp.in (added) +++ llvm/trunk/test/site.exp.in Tue Sep 22 02:38:44 2009 @@ -0,0 +1,27 @@ +## Autogenerated by LLVM/Clang configuration. +# Do not edit! +set target_triplet "@target@" +set TARGETS_TO_BUILD "@TARGETS_TO_BUILD@" +set llvmgcc_langs "@LLVMGCC_LANGS@" +set llvmgcc_version "@LLVMGCC_VERSION@" +set llvmlibsdir "@LLVM_LIBS_DIR@" +set llvm_bindings "@LLVM_BINDINGS@" +set srcroot "@LLVM_SOURCE_DIR@" +set objroot "@LLVM_BINARY_DIR@" +set srcdir "@LLVM_SOURCE_DIR@" +set objdir "@LLVM_BINARY_DIR@" +set gccpath "@GCCPATH@" +set gxxpath "@GXXPATH@" +set compile_c "@TEST_COMPILE_C_CMD@" +set compile_cxx "@TEST_COMPILE_CXX_CMD@" +set link "@TEST_LINK_CMD@" +set llvmgcc "@LLVMGCC@" +set llvmgxx "@LLVMGXX@" +set llvmgccmajvers "@LLVMGCCMAJVERS@" +set bugpoint_topts "@BUGPOINT_TOPTS@" +set shlibext "@SHLIBEXT@" +set ocamlopt "@OCAMLOPT@" +set valgrind "@VALGRIND@" +set grep "@GREP@" +set gas "@AS@" +set llvmdsymutil "@DSYMUTIL@" From evan.cheng at apple.com Tue Sep 22 03:34:48 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Sep 2009 08:34:48 -0000 Subject: [llvm-commits] [llvm] r82535 - in /llvm/trunk: lib/CodeGen/LiveVariables.cpp test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll Message-ID: <200909220834.n8M8Yn1L032426@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 22 03:34:46 2009 New Revision: 82535 URL: http://llvm.org/viewvc/llvm-project?rev=82535&view=rev Log: Fix PR5024. LiveVariables::FindLastPartialDef should return a set of sub-registers that were defined by the last partial def, not just a single sub-register. Added: llvm/trunk/test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=82535&r1=82534&r2=82535&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Tue Sep 22 03:34:46 2009 @@ -180,9 +180,9 @@ } /// FindLastPartialDef - Return the last partial def of the specified register. -/// Also returns the sub-register that's defined. +/// Also returns the sub-registers that're defined by the instruction. MachineInstr *LiveVariables::FindLastPartialDef(unsigned Reg, - unsigned &PartDefReg) { + SmallSet &PartDefRegs) { unsigned LastDefReg = 0; unsigned LastDefDist = 0; MachineInstr *LastDef = NULL; @@ -198,7 +198,23 @@ LastDefDist = Dist; } } - PartDefReg = LastDefReg; + + if (!LastDef) + return 0; + + PartDefRegs.insert(LastDefReg); + for (unsigned i = 0, e = LastDef->getNumOperands(); i != e; ++i) { + MachineOperand &MO = LastDef->getOperand(i); + if (!MO.isReg() || !MO.isDef() || MO.getReg() == 0) + continue; + unsigned DefReg = MO.getReg(); + if (TRI->isSubRegister(Reg, DefReg)) { + PartDefRegs.insert(DefReg); + for (const unsigned *SubRegs = TRI->getSubRegisters(DefReg); + unsigned SubReg = *SubRegs; ++SubRegs) + PartDefRegs.insert(SubReg); + } + } return LastDef; } @@ -216,8 +232,8 @@ // ... // = EAX // All of the sub-registers must have been defined before the use of Reg! - unsigned PartDefReg = 0; - MachineInstr *LastPartialDef = FindLastPartialDef(Reg, PartDefReg); + SmallSet PartDefRegs; + MachineInstr *LastPartialDef = FindLastPartialDef(Reg, PartDefRegs); // If LastPartialDef is NULL, it must be using a livein register. if (LastPartialDef) { LastPartialDef->addOperand(MachineOperand::CreateReg(Reg, true/*IsDef*/, @@ -228,7 +244,7 @@ unsigned SubReg = *SubRegs; ++SubRegs) { if (Processed.count(SubReg)) continue; - if (SubReg == PartDefReg || TRI->isSubRegister(PartDefReg, SubReg)) + if (PartDefRegs.count(SubReg)) continue; // This part of Reg was defined before the last partial def. It's killed // here. Added: llvm/trunk/test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll?rev=82535&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll Tue Sep 22 03:34:46 2009 @@ -0,0 +1,14 @@ +; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mattr=+neon + +; PR5024 + +%bar = type { <4 x float> } +%foo = type { %bar, %bar, %bar, %bar } + +declare arm_aapcs_vfpcc <4 x float> @bbb(%bar*) nounwind + +define arm_aapcs_vfpcc void @aaa(%foo* noalias sret %agg.result, %foo* %tfrm) nounwind { +entry: + %0 = call arm_aapcs_vfpcc <4 x float> @bbb(%bar* undef) nounwind ; <<4 x float>> [#uses=0] + ret void +} From anton at korobeynikov.info Tue Sep 22 03:42:49 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 22 Sep 2009 12:42:49 +0400 Subject: [llvm-commits] [llvm] r82535 - in /llvm/trunk: lib/CodeGen/LiveVariables.cpp test/CodeGen/ARM/2009-09-21-LiveVariablesBug.ll In-Reply-To: <200909220834.n8M8Yn1L032426@zion.cs.uiuc.edu> References: <200909220834.n8M8Yn1L032426@zion.cs.uiuc.edu> Message-ID: Hello, Evan > URL: http://llvm.org/viewvc/llvm-project?rev=82535&view=rev > Log: > Fix PR5024. LiveVariables::FindLastPartialDef should return a set of sub-registers that were defined by the last partial def, not just a single sub-register. It seems you forgot about some header.. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From evan.cheng at apple.com Tue Sep 22 03:47:59 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Sep 2009 08:47:59 -0000 Subject: [llvm-commits] [llvm] r82536 - /llvm/trunk/include/llvm/CodeGen/LiveVariables.h Message-ID: <200909220848.n8M8lxpJ001784@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 22 03:47:59 2009 New Revision: 82536 URL: http://llvm.org/viewvc/llvm-project?rev=82536&view=rev Log: Forgot this. Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=82536&r1=82535&r2=82536&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Tue Sep 22 03:47:59 2009 @@ -34,6 +34,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SparseBitVector.h" @@ -151,8 +152,9 @@ void HandlePhysRegDef(unsigned Reg, MachineInstr *MI); /// FindLastPartialDef - Return the last partial def of the specified register. - /// Also returns the sub-register that's defined. - MachineInstr *FindLastPartialDef(unsigned Reg, unsigned &PartDefReg); + /// Also returns the sub-registers that're defined by the instruction. + MachineInstr *FindLastPartialDef(unsigned Reg, + SmallSet &PartDefRegs); /// hasRegisterUseBelow - Return true if the specified register is used after /// the current instruction and before its next definition. From edwintorok at gmail.com Tue Sep 22 04:06:44 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 22 Sep 2009 12:06:44 +0300 Subject: [llvm-commits] [llvm] r81826 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc In-Reply-To: <6a8523d60909212143g6e24a16n953f37fe07738f07@mail.gmail.com> References: <200909150339.n8F3dn4T018712@zion.cs.uiuc.edu> <6a8523d60909212143g6e24a16n953f37fe07738f07@mail.gmail.com> Message-ID: <4AB893A4.6090207@gmail.com> On 2009-09-22 07:43, Daniel Dunbar wrote: > Hi Mikhail, > > This isn't safe, for exactly the same reasons as I fixed it before here: > http://llvm.org/viewvc/llvm-project?view=rev&revision=77953 > and it breaks ExecuteAndWait in exactly the same way. I'm reverting it > for now. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090727/083264.html > > If the motivation is supporting GetProcessId pre XP What is the minimum Windows version supported by LLVM? It is not documented here: http://llvm.org/docs/GettingStarted.html#requirements Is it Win2k or WinXP? Best regards, --Edwin From daniel at zuster.org Tue Sep 22 04:50:30 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 09:50:30 -0000 Subject: [llvm-commits] [llvm] r82537 - in /llvm/trunk: lib/System/Win32/Signals.inc utils/lit/TestingConfig.py Message-ID: <200909220950.n8M9oUWk010710@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 04:50:28 2009 New Revision: 82537 URL: http://llvm.org/viewvc/llvm-project?rev=82537&view=rev Log: Add a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in RegisterHandler and use to disable the Win32 crash dialogs. These are a major blocker to any kind of automated testing. Also, tweak the 'lit' test runner to set this variable unconditionally. Modified: llvm/trunk/lib/System/Win32/Signals.inc llvm/trunk/utils/lit/TestingConfig.py Modified: llvm/trunk/lib/System/Win32/Signals.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Signals.inc?rev=82537&r1=82536&r2=82537&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Signals.inc (original) +++ llvm/trunk/lib/System/Win32/Signals.inc Tue Sep 22 04:50:28 2009 @@ -43,6 +43,7 @@ static std::vector > *CallBacksToRun = 0; static bool RegisteredUnhandledExceptionFilter = false; static bool CleanupExecuted = false; +static bool ExitOnUnhandledExceptions = false; static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL; // Windows creates a new thread to execute the console handler when an event @@ -57,8 +58,36 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// +/// CRTReportHook - Function called on a CRT debugging event. +static int CRTReportHook(int ReportType, char *Message, int *Return) { + // Don't cause a DebugBreak() on return. + if (Return) + *Return = 0; + + switch (ReportType) { + default: + case _CRT_ASSERT: + fprintf(stderr, "CRT assert: %s\n", Message); + // FIXME: Is there a way to just crash? Perhaps throw to the unhandled + // exception code? Perhaps SetErrorMode() handles this. + _exit(3); + break; + case _CRT_ERROR: + fprintf(stderr, "CRT error: %s\n", Message); + // FIXME: Is there a way to just crash? Perhaps throw to the unhandled + // exception code? Perhaps SetErrorMode() handles this. + _exit(3); + break; + case _CRT_WARN: + fprintf(stderr, "CRT warn: %s\n", Message); + break; + } + + // Don't call _CrtDbgReport. + return TRUE; +} -static void RegisterHandler() { +static void RegisterHandler() { if (RegisteredUnhandledExceptionFilter) { EnterCriticalSection(&CriticalSection); return; @@ -76,6 +105,12 @@ OldFilter = SetUnhandledExceptionFilter(LLVMUnhandledExceptionFilter); SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE); + // Environment variable to disable any kind of crash dialog. + if (getenv("LLVM_DISABLE_CRT_DEBUG")) { + _CrtSetReportHook(CRTReportHook); + ExitOnUnhandledExceptions = true; + } + // IMPORTANT NOTE: Caller must call LeaveCriticalSection(&CriticalSection) or // else multi-threading problems will ensue. } @@ -235,6 +270,9 @@ assert(0 && "Crashed in LLVMUnhandledExceptionFilter"); } + if (ExitOnUnhandledExceptions) + _exit(-3); + // Allow dialog box to pop up allowing choice to start debugger. if (OldFilter) return (*OldFilter)(ep); Modified: llvm/trunk/utils/lit/TestingConfig.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestingConfig.py?rev=82537&r1=82536&r2=82537&view=diff ============================================================================== --- llvm/trunk/utils/lit/TestingConfig.py (original) +++ llvm/trunk/utils/lit/TestingConfig.py Tue Sep 22 04:50:28 2009 @@ -13,6 +13,7 @@ 'PATH' : os.pathsep.join(litConfig.path + [os.environ.get('PATH','')]), 'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''), + 'LLVM_DISABLE_CRT_DEBUG' : '1', } config = TestingConfig(parent, From daniel at zuster.org Tue Sep 22 04:50:39 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 09:50:39 -0000 Subject: [llvm-commits] [llvm] r82538 - /llvm/trunk/utils/lit/TestRunner.py Message-ID: <200909220950.n8M9odSX010737@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 04:50:38 2009 New Revision: 82538 URL: http://llvm.org/viewvc/llvm-project?rev=82538&view=rev Log: lit: When executing shell scripts internally, don't allow piped stderr on any commands except the last one, instead redirect the stderr to a temporary file. This sidesteps a potential deadlocking issue. Modified: llvm/trunk/utils/lit/TestRunner.py Modified: llvm/trunk/utils/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestRunner.py?rev=82538&r1=82537&r2=82538&view=diff ============================================================================== --- llvm/trunk/utils/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/TestRunner.py Tue Sep 22 04:50:38 2009 @@ -6,6 +6,7 @@ import Util import platform +import tempfile class InternalShellError(Exception): def __init__(self, command, message): @@ -57,7 +58,11 @@ assert isinstance(cmd, ShUtil.Pipeline) procs = [] input = subprocess.PIPE - for j in cmd.commands: + stderrTempFiles = [] + # To avoid deadlock, we use a single stderr stream for piped + # output. This is null until we have seen some output using + # stderr. + for i,j in enumerate(cmd.commands): redirects = [(0,), (1,), (2,)] for r in j.redirects: if r[0] == ('>',2): @@ -104,6 +109,14 @@ else: stderrIsStdout = False + # Don't allow stderr on a PIPE except for the last + # process, this could deadlock. + # + # FIXME: This is slow, but so is deadlock. + if stderr == subprocess.PIPE and j != cmd.commands[-1]: + stderr = tempfile.TemporaryFile(mode='w+b') + stderrTempFiles.append((i, stderr)) + # Resolve the executable path ourselves. args = list(j.args) args[0] = Util.which(args[0], cfg.environment['PATH']) @@ -130,10 +143,10 @@ else: input = subprocess.PIPE - # FIXME: There is a potential for deadlock here, when we have a pipe and - # some process other than the last one ends up blocked on stderr. + # FIXME: There is probably still deadlock potential here. Yawn. procData = [None] * len(procs) procData[-1] = procs[-1].communicate() + for i in range(len(procs) - 1): if procs[i].stdout is not None: out = procs[i].stdout.read() @@ -144,6 +157,11 @@ else: err = '' procData[i] = (out,err) + + # Read stderr out of the temp files. + for i,f in stderrTempFiles: + f.seek(0, 0) + procData[i] = (procData[i][0], f.read()) exitCode = None for i,(out,err) in enumerate(procData): From daniel at zuster.org Tue Sep 22 05:30:34 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 10:30:34 -0000 Subject: [llvm-commits] [llvm] r82544 - /llvm/trunk/lib/VMCore/Value.cpp Message-ID: <200909221030.n8MAUYxQ015869@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 05:30:34 2009 New Revision: 82544 URL: http://llvm.org/viewvc/llvm-project?rev=82544&view=rev Log: Fix commento. Modified: llvm/trunk/lib/VMCore/Value.cpp Modified: llvm/trunk/lib/VMCore/Value.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=82544&r1=82543&r2=82544&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Value.cpp (original) +++ llvm/trunk/lib/VMCore/Value.cpp Tue Sep 22 05:30:34 2009 @@ -548,8 +548,7 @@ // Tracking goes to new value like a WeakVH. Note that this may make it // something incompatible with its templated type. We don't want to have a // virtual (or inline) interface to handle this though, so instead we make - // the TrackingVH accessors guarantee that a client never seesl this - // value. + // the TrackingVH accessors guarantee that a client never sees this value. // FALLTHROUGH case Weak: From daniel at zuster.org Tue Sep 22 05:39:40 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 03:39:40 -0700 Subject: [llvm-commits] [llvm] r81826 - in /llvm/trunk: include/llvm/System/Program.h lib/System/Unix/Program.inc lib/System/Win32/Program.inc In-Reply-To: <20090922062424.GA8879@localhost.localdomain> References: <200909150339.n8F3dn4T018712@zion.cs.uiuc.edu> <6a8523d60909212143g6e24a16n953f37fe07738f07@mail.gmail.com> <20090922062424.GA8879@localhost.localdomain> Message-ID: <6a8523d60909220339j70debacbi73ad5815ed852fe1@mail.gmail.com> On Mon, Sep 21, 2009 at 11:24 PM, Mikhail Glushenkov wrote: > Hi Daniel, > > On Mon, Sep 21, 2009 at 09:43:20PM -0700, Daniel Dunbar wrote: >> Hi Mikhail, >> >> This isn't safe, for exactly the same reasons as I fixed it before here: >> ? http://llvm.org/viewvc/llvm-project?view=rev&revision=77953 >> and it breaks ExecuteAndWait in exactly the same way. I'm reverting it >> for now. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090727/083264.html > > Sorry, I haven't seen your previous e-mail. I don't quite understand what causes > the race condition, though... I'm not sure if its a race condition or just not supported on some versions of Windows, but in general once you have a handle you should hold that handle for as long as you want to use it. Even if the API provides something to get the handle from a PID, its probably best to avoid it. I think the problem in this case is either that the process dies before you try to grab the handle again (via the pid), or its just flat out not supported on my version of Windows (XP SP2). >> If the motivation is supporting GetProcessId pre XP then this should >> be recorded in the Program object. > > "this" == PID? Yes, I guess that's better than any of the tricks from [1]. Yes. >> I also see no reason to make a Program object copyable -- what would this >> mean? The program object should essentially be opaque, it is implemented by >> the System layer, which may well be non-copyable. > > Well, if the Program object is just a PID, why not make it copyable? Clients may > want to store it somewhere (e.g. STL containers). Alternatively, we may add a > way to construct a Program from a PID (since there is already a GetPid() > method). Because it isn't portable to assume that the system can implement the Program API in terms of a PID (where pid == uint32_t, or so), nor can one rely on the system to supply a method to populate all the data in a Program from just a PID. Clients can put a Program* in an STL container just as easily as a PID. - Daniel >> I know we don't currently have a good way of running tests on Windows, >> but please verify that ExecuteAndWait doesn't break when modifying >> this code... > > Sorry for that. > > [1] http://www.codeproject.com/KB/threads/GettingProcessID.aspx > From baldrick at free.fr Tue Sep 22 06:10:53 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Sep 2009 11:10:53 -0000 Subject: [llvm-commits] [gcc-plugin] r82545 - /gcc-plugin/trunk/TODO Message-ID: <200909221110.n8MBArDN020776@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 22 06:10:52 2009 New Revision: 82545 URL: http://llvm.org/viewvc/llvm-project?rev=82545&view=rev Log: Move a few more action items from my head to the TODO list. Modified: gcc-plugin/trunk/TODO Modified: gcc-plugin/trunk/TODO URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/TODO?rev=82545&r1=82544&r2=82545&view=diff ============================================================================== --- gcc-plugin/trunk/TODO (original) +++ gcc-plugin/trunk/TODO Tue Sep 22 06:10:52 2009 @@ -70,8 +70,24 @@ pointlessly, wasting time and memory. Consider emitting local variables on demand instead. + Correctness ----------- If an ssa name refers to a global (can this happen), the SSANames map might need to be updated if the target is altered by changeLLVMConstant. + +An ssa name can be a complex number, causing the plugin to crash. Maybe should +consider complex numbers to be scalars rather than aggregates. Would this get +in the way of sroa? + +If the initializer for a static variable contains the address of a label then +we crash. + + +Features +-------- + +Output proper debug info rather than throwing most of it away. + +Add support for exception handling. From baldrick at free.fr Tue Sep 22 09:46:32 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Sep 2009 14:46:32 -0000 Subject: [llvm-commits] [gcc-plugin] r82546 - in /gcc-plugin/trunk: llvm-backend.cpp llvm-convert.cpp llvm-internal.h Message-ID: <200909221446.n8MEkXLH016167@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 22 09:46:29 2009 New Revision: 82546 URL: http://llvm.org/viewvc/llvm-project?rev=82546&view=rev Log: Collect statistics on the amount of gcc statements and basic blocks converted. Run the garbage collector if it seems like it would free up a lot of memory. Modified: gcc-plugin/trunk/llvm-backend.cpp gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-internal.h Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=82546&r1=82545&r2=82546&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Tue Sep 22 09:46:29 2009 @@ -20,6 +20,7 @@ 02111-1307, USA. */ // LLVM headers +#define DEBUG_TYPE "plugin" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/LLVMContext.h" @@ -41,6 +42,7 @@ #include "llvm/Target/TargetOptions.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/IPO.h" +#include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/ErrorHandling.h" @@ -92,6 +94,12 @@ #include "llvm-cache.h" } +// TODO: Space aliens beamed these numbers into my head. Replace with something +// more down-to-earth. +#define ESTIMATED_MEMORY_PER_BASIC_BLOCK 1500 +#define ESTIMATED_MEMORY_PER_GIMPLE_STATEMENT 128 +#define MIN_BYTES_WORTH_GARBAGE_COLLECTING (1024*1024) + // Non-zero if bytecode from PCH is successfully read. int flag_llvm_pch_read; @@ -136,6 +144,49 @@ static void createPerModuleOptimizationPasses(); //TODOstatic void destroyOptimizationPasses(); + +//===----------------------------------------------------------------------===// +// Statistics +//===----------------------------------------------------------------------===// + +STATISTIC(NumBasicBlocks, "Number of basic blocks converted"); +STATISTIC(NumStatements, "Number of gimple statements converted"); + +/// NoteBasicBlock - Called once for each GCC basic block converted. +void NoteBasicBlock(basic_block bb) { + ++NumBasicBlocks; +} + +/// NoteStatement - Called once for each GCC gimple statement converted. +void NoteStatement(gimple stmt) { + ++NumStatements; +} + +static size_t LastNumBasicBlocks; +static size_t LastNumStatements; + +/// EstimatedCollectableGCCMemory - Return an estimate of the amount of memory +/// we think the GCC garbage collector would free if we ran it. +static size_t EstimatedCollectableGCCMemory() { + return + (NumBasicBlocks - LastNumBasicBlocks) * ESTIMATED_MEMORY_PER_BASIC_BLOCK + + (NumStatements - LastNumStatements) * ESTIMATED_MEMORY_PER_GIMPLE_STATEMENT; +} + +/// isWorthGarbageCollecting - Returns whether running the GCC garbage collector +/// would free up enough memory to make it worthwhile. +static bool isWorthGarbageCollecting() { + return EstimatedCollectableGCCMemory() > MIN_BYTES_WORTH_GARBAGE_COLLECTING; +} + +/// ResetGarbageCollectionStatistics - The memory estimated by the previous +/// statistics will be garbage collected. Reset the statistics. +static void ResetGarbageCollectionStatistics() { + LastNumBasicBlocks = NumBasicBlocks; + LastNumStatements = NumStatements; +} + + //===----------------------------------------------------------------------===// // Matching LLVM Values with GCC DECL trees //===----------------------------------------------------------------------===// @@ -337,6 +388,8 @@ if (time_report || !quiet_flag || flag_detailed_statistics) Args.push_back("--time-passes"); + if (!quiet_flag || flag_detailed_statistics) + Args.push_back("--stats"); if (fast_math_flags_set_p()) Args.push_back("--enable-unsafe-fp-math"); if (!flag_omit_frame_pointer) @@ -1704,6 +1757,13 @@ static unsigned int emit_function (void) { LazilyInitializeModule(); + // The previously converted function is now garbage collectable. If it seems + // worthwhile, run the garbage collector after converting this function (the + // current function will not itself be collected though). + ggc_force_collect = isWorthGarbageCollecting(); + if (ggc_force_collect) + ResetGarbageCollectionStatistics(); + //TODO Don't want to use sorry at this stage... //TODO if (cfun->nonlocal_goto_save_area) //TODO sorry("%Jnon-local gotos not supported by LLVM", fndecl); @@ -1787,6 +1847,15 @@ LazilyInitializeModule(); + // If it seems worthwhile, garbage collect any functions we converted before + // running the optimizers or generating code. + if (isWorthGarbageCollecting()) { + ResetGarbageCollectionStatistics(); + ggc_force_collect = 1; + ggc_collect(); + ggc_force_collect = 0; + } + //TODO timevar_push(TV_LLVM_PERFILE); LLVMContext &Context = getGlobalContext(); Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82546&r1=82545&r2=82546&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 22 09:46:29 2009 @@ -910,6 +910,8 @@ } void TreeToLLVM::EmitBasicBlock(basic_block bb) { + NoteBasicBlock(bb); + // Avoid outputting a pointless branch at the end of the entry block. if (bb != ENTRY_BLOCK_PTR) EmitBlock(getBasicBlock(bb)); @@ -943,23 +945,24 @@ // Render statements. for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) { - gimple gimple_stmt = gsi_stmt(gsi); + gimple stmt = gsi_stmt(gsi); + NoteStatement(stmt); - switch (gimple_code(gimple_stmt)) { + switch (gimple_code(stmt)) { case GIMPLE_ASM: - RenderGIMPLE_ASM(gimple_stmt); + RenderGIMPLE_ASM(stmt); break; case GIMPLE_ASSIGN: - RenderGIMPLE_ASSIGN(gimple_stmt); + RenderGIMPLE_ASSIGN(stmt); break; case GIMPLE_CALL: - RenderGIMPLE_CALL(gimple_stmt); + RenderGIMPLE_CALL(stmt); break; case GIMPLE_COND: - RenderGIMPLE_COND(gimple_stmt); + RenderGIMPLE_COND(stmt); break; case GIMPLE_DEBUG: @@ -967,7 +970,7 @@ break; case GIMPLE_GOTO: - RenderGIMPLE_GOTO(gimple_stmt); + RenderGIMPLE_GOTO(stmt); break; case GIMPLE_LABEL: @@ -976,19 +979,19 @@ break; case GIMPLE_RESX: - RenderGIMPLE_RESX(gimple_stmt); + RenderGIMPLE_RESX(stmt); break; case GIMPLE_RETURN: - RenderGIMPLE_RETURN(gimple_stmt); + RenderGIMPLE_RETURN(stmt); break; case GIMPLE_SWITCH: - RenderGIMPLE_SWITCH(gimple_stmt); + RenderGIMPLE_SWITCH(stmt); break; default: - dump(gimple_stmt); + dump(stmt); llvm_unreachable("Unhandled GIMPLE statement during LLVM emission!"); } } Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=82546&r1=82545&r2=82546&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Tue Sep 22 09:46:29 2009 @@ -97,6 +97,14 @@ /// annotate attribute to a vector to be emitted later. extern void AddAnnotateAttrsToGlobal(GlobalValue *GV, union tree_node* decl); +// Statistics. + +/// NoteBasicBlock - Called once for each GCC basic block converted. +extern void NoteBasicBlock(basic_block bb); + +/// NoteStatement - Called once for each GCC gimple statement converted. +extern void NoteStatement(gimple stmt); + // Mapping between GCC declarations and LLVM values. /// DECL_LLVM - Holds the LLVM expression for the value of a variable or From baldrick at free.fr Tue Sep 22 09:47:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Sep 2009 14:47:21 -0000 Subject: [llvm-commits] [gcc-plugin] r82547 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909221447.n8MElLuh016271@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 22 09:47:21 2009 New Revision: 82547 URL: http://llvm.org/viewvc/llvm-project?rev=82547&view=rev Log: Fix thinko introduced when converting from CALL_EXPR to GIMPLE_CALL. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82547&r1=82546&r2=82547&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 22 09:47:21 2009 @@ -5146,7 +5146,7 @@ Value *ReadWrite = 0; Value *Locality = 0; - if (gimple_call_num_args(stmt) >= 1) { // Args 1/2 are optional + if (gimple_call_num_args(stmt) > 1) { // Args 1/2 are optional ReadWrite = Emit(gimple_call_arg(stmt, 1), 0); if (!isa(ReadWrite)) { error("second argument to %<__builtin_prefetch%> must be a constant"); @@ -5160,7 +5160,7 @@ Type::getInt32Ty(Context), false); } - if (gimple_call_num_args(stmt) >= 2) { + if (gimple_call_num_args(stmt) > 2) { Locality = Emit(gimple_call_arg(stmt, 2), 0); if (!isa(Locality)) { error("third argument to %<__builtin_prefetch%> must be a constant"); From foldr at codedgers.com Tue Sep 22 10:16:06 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 22 Sep 2009 15:16:06 +0000 (UTC) Subject: [llvm-commits] [llvm] r82537 - in /llvm/trunk: lib/System/Win32/Signals.inc utils/lit/TestingConfig.py References: <200909220950.n8M9oUWk010710@zion.cs.uiuc.edu> Message-ID: Hi, Daniel Dunbar writes: > > Author: ddunbar > Date: Tue Sep 22 04:50:28 2009 > New Revision: 82537 > > URL: http://llvm.org/viewvc/llvm-project?rev=82537&view=rev > Log: > Add a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in RegisterHandler and use to > disable the Win32 crash dialogs. These are a major blocker to any kind of automated testing. This breaks the MinGW build: In file included from c:/code/codedgers/llvm/lib/System/Signals.cpp:33: c:/code/codedgers/llvm/lib/System/Win32/Signals.inc: In function `int llvm::CRTReportHook(int, char*, int*)': c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:69: error: `_CRT_ASSERT' was not declared in this scope c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:75: error: `_CRT_ERROR' was not declared in this scope c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:81: error: `_CRT_WARN' was not declared in this scope c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:69: warning: unused variable '_CRT_ASSERT' c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:75: warning: unused variable '_CRT_ERROR' c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:81: warning: unused variable '_CRT_WARN' c:/code/codedgers/llvm/lib/System/Win32/Signals.inc: In function `void llvm::RegisterHandler()': c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:110: error: `_CrtSetReportHook' was not declared in this scope c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:110: warning: unused variable '_CrtSetReportHook' From foldr at codedgers.com Tue Sep 22 10:40:33 2009 From: foldr at codedgers.com (Mikhail Glushenkov) Date: Tue, 22 Sep 2009 15:40:33 -0000 Subject: [llvm-commits] [llvm] r82548 - /llvm/trunk/lib/System/Win32/Program.inc Message-ID: <200909221540.n8MFeXOP023127@zion.cs.uiuc.edu> Author: foldr Date: Tue Sep 22 10:40:32 2009 New Revision: 82548 URL: http://llvm.org/viewvc/llvm-project?rev=82548&view=rev Log: Remove the GetProcessId() call from Win32/Program.inc, take 2. GetProcessId() was introduced only in Windows XP, and we want to support earlier versions. Modified: llvm/trunk/lib/System/Win32/Program.inc Modified: llvm/trunk/lib/System/Win32/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Program.inc?rev=82548&r1=82547&r2=82548&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Program.inc (original) +++ llvm/trunk/lib/System/Win32/Program.inc Tue Sep 22 10:40:32 2009 @@ -22,6 +22,13 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// +namespace { + struct Win32ProcessInfo { + HANDLE hProcess; + DWORD dwProcessId; + }; +} + namespace llvm { using namespace sys; @@ -29,15 +36,16 @@ Program::~Program() { if (Data_) { - HANDLE hProcess = reinterpret_cast(Data_); - CloseHandle(hProcess); + Win32ProcessInfo* wpi = reinterpret_cast(Data_); + CloseHandle(wpi->hProcess); + delete wpi; Data_ = 0; } } unsigned Program::GetPid() const { - HANDLE hProcess = reinterpret_cast(Data_); - return GetProcessId(hProcess); + Win32ProcessInfo* wpi = reinterpret_cast(Data_); + return wpi->dwProcessId; } // This function just uses the PATH environment variable to find the program. @@ -138,8 +146,9 @@ unsigned memoryLimit, std::string* ErrMsg) { if (Data_) { - HANDLE hProcess = reinterpret_cast(Data_); - CloseHandle(Data_); + Win32ProcessInfo* wpi = reinterpret_cast(Data_); + CloseHandle(wpi->hProcess); + delete wpi; Data_ = 0; } @@ -269,7 +278,10 @@ path.str() + "'"); return false; } - Data_ = reinterpret_cast(pi.hProcess); + Win32ProcessInfo* wpi = new Win32ProcessInfo; + wpi->hProcess = pi.hProcess; + wpi->dwProcessId = pi.dwProcessId; + Data_ = wpi; // Make sure these get closed no matter what. AutoHandle hThread(pi.hThread); @@ -310,7 +322,8 @@ return -1; } - HANDLE hProcess = reinterpret_cast(Data_); + Win32ProcessInfo* wpi = reinterpret_cast(Data_); + HANDLE hProcess = wpi->hProcess; // Wait for the process to terminate. DWORD millisecondsToWait = INFINITE; @@ -346,7 +359,8 @@ return true; } - HANDLE hProcess = reinterpret_cast(Data_); + Win32ProcessInfo* wpi = reinterpret_cast(Data_); + HANDLE hProcess = wpi->hProcess; if (TerminateProcess(hProcess, 1) == 0) { MakeErrMsg(ErrMsg, "The process couldn't be killed!"); return true; From baldrick at free.fr Tue Sep 22 10:46:48 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 22 Sep 2009 15:46:48 -0000 Subject: [llvm-commits] [gcc-plugin] r82550 - /gcc-plugin/trunk/TODO Message-ID: <200909221546.n8MFknun023913@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 22 10:46:48 2009 New Revision: 82550 URL: http://llvm.org/viewvc/llvm-project?rev=82550&view=rev Log: This has been done: we now garbage collect GCC memory if it seems useful to do so. Modified: gcc-plugin/trunk/TODO Modified: gcc-plugin/trunk/TODO URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/TODO?rev=82550&r1=82549&r2=82550&view=diff ============================================================================== --- gcc-plugin/trunk/TODO (original) +++ gcc-plugin/trunk/TODO Tue Sep 22 10:46:48 2009 @@ -32,22 +32,6 @@ LLVM/gcc it depends on changes. -Memory management ------------------ - -After we codegen them, GCC functions will be garbage collected if the garbage -collector runs. However the garbage collector is only run if lots of memory -was allocated since the last run. GCC doesn't know how much memory LLVM is -allocating, so we may be allocating vast amounts of LLVM memory converting -gimple into LLVM IR, but nonetheless the garbage collector won't free up GCC -memory for us, even though there might be lots of memory to free. Work out -some way of teaching the garbage collector about the amount of memory allocated -by LLVM. - -After recent changes to the lto tree, it looks like functions are no longer -being garbage collected after they are codegened. Investigate. - - Optimizations ------------- From daniel at zuster.org Tue Sep 22 10:58:35 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 15:58:35 -0000 Subject: [llvm-commits] [llvm] r82551 - /llvm/trunk/lib/System/Win32/Signals.inc Message-ID: <200909221558.n8MFwa82025400@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 10:58:35 2009 New Revision: 82551 URL: http://llvm.org/viewvc/llvm-project?rev=82551&view=rev Log: Hide MSVC specific CRT interaction behind _MSC_VER. Modified: llvm/trunk/lib/System/Win32/Signals.inc Modified: llvm/trunk/lib/System/Win32/Signals.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Signals.inc?rev=82551&r1=82550&r2=82551&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Signals.inc (original) +++ llvm/trunk/lib/System/Win32/Signals.inc Tue Sep 22 10:58:35 2009 @@ -58,6 +58,7 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// +#ifdef _MSC_VER /// CRTReportHook - Function called on a CRT debugging event. static int CRTReportHook(int ReportType, char *Message, int *Return) { // Don't cause a DebugBreak() on return. @@ -86,6 +87,7 @@ // Don't call _CrtDbgReport. return TRUE; } +#endif static void RegisterHandler() { if (RegisteredUnhandledExceptionFilter) { @@ -106,10 +108,12 @@ SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE); // Environment variable to disable any kind of crash dialog. +#ifdef _MSC_VER if (getenv("LLVM_DISABLE_CRT_DEBUG")) { _CrtSetReportHook(CRTReportHook); - ExitOnUnhandledExceptions = true; + ExitOnUnhandledExceptions = true; } +#endif // IMPORTANT NOTE: Caller must call LeaveCriticalSection(&CriticalSection) or // else multi-threading problems will ensue. @@ -270,8 +274,10 @@ assert(0 && "Crashed in LLVMUnhandledExceptionFilter"); } +#ifdef _MSC_VER if (ExitOnUnhandledExceptions) _exit(-3); +#endif // Allow dialog box to pop up allowing choice to start debugger. if (OldFilter) From daniel at zuster.org Tue Sep 22 11:10:36 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 16:10:36 -0000 Subject: [llvm-commits] [llvm] r82552 - /llvm/trunk/lib/System/Win32/Signals.inc Message-ID: <200909221610.n8MGAaiR026952@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 11:10:35 2009 New Revision: 82552 URL: http://llvm.org/viewvc/llvm-project?rev=82552&view=rev Log: .. missed hiding a variable for MSVC only. Modified: llvm/trunk/lib/System/Win32/Signals.inc Modified: llvm/trunk/lib/System/Win32/Signals.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Signals.inc?rev=82552&r1=82551&r2=82552&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Signals.inc (original) +++ llvm/trunk/lib/System/Win32/Signals.inc Tue Sep 22 11:10:35 2009 @@ -43,7 +43,9 @@ static std::vector > *CallBacksToRun = 0; static bool RegisteredUnhandledExceptionFilter = false; static bool CleanupExecuted = false; +#ifdef _MSC_VER static bool ExitOnUnhandledExceptions = false; +#endif static PTOP_LEVEL_EXCEPTION_FILTER OldFilter = NULL; // Windows creates a new thread to execute the console handler when an event From daniel at zuster.org Tue Sep 22 11:33:42 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 16:33:42 -0000 Subject: [llvm-commits] [llvm] r82553 - /llvm/trunk/include/llvm/Support/FormattedStream.h Message-ID: <200909221633.n8MGXgkb029779@zion.cs.uiuc.edu> Author: ddunbar Date: Tue Sep 22 11:33:42 2009 New Revision: 82553 URL: http://llvm.org/viewvc/llvm-project?rev=82553&view=rev Log: Revert "Don't allow formatted_ostream to be unbuffered, even if its underlying buffer", while we work out a solution. Dan convinced me that making debugging annoying for him is worse than 10x being slower for me. :) Modified: llvm/trunk/include/llvm/Support/FormattedStream.h Modified: llvm/trunk/include/llvm/Support/FormattedStream.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=82553&r1=82552&r2=82553&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/FormattedStream.h (original) +++ llvm/trunk/include/llvm/Support/FormattedStream.h Tue Sep 22 11:33:42 2009 @@ -105,15 +105,10 @@ // own buffering, and it doesn't need or want TheStream to do another // layer of buffering underneath. Resize the buffer to what TheStream // had been using, and tell TheStream not to do its own buffering. - // - // If the underlying stream is unbuffered, just use its preferred buffer - // size. We can't treat this as an honest wish for unbuffered output, - // because it could very well be a stream we previously forced to be - // unbuffered. if (size_t BufferSize = TheStream->GetBufferSize()) SetBufferSize(BufferSize); else - SetBuffered(); + SetUnbuffered(); TheStream->SetUnbuffered(); Scanned = 0; From david_goodwin at apple.com Tue Sep 22 11:47:52 2009 From: david_goodwin at apple.com (David Goodwin) Date: Tue, 22 Sep 2009 16:47:52 -0000 Subject: [llvm-commits] [llvm] r82554 - /llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Message-ID: <200909221647.n8MGlq68031573@zion.cs.uiuc.edu> Author: david_goodwin Date: Tue Sep 22 11:47:52 2009 New Revision: 82554 URL: http://llvm.org/viewvc/llvm-project?rev=82554&view=rev Log: Use early returns. Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=82554&r1=82553&r2=82554&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (original) +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Tue Sep 22 11:47:52 2009 @@ -83,75 +83,77 @@ } ExactHazardRecognizer::HazardType ExactHazardRecognizer::getHazardType(SUnit *SU) { - if (!ItinData.isEmpty()) { - unsigned cycle = 0; + if (ItinData.isEmpty()) + return NoHazard; - // Use the itinerary for the underlying instruction to check for - // free FU's in the scoreboard at the appropriate future cycles. - unsigned idx = SU->getInstr()->getDesc().getSchedClass(); - for (const InstrStage *IS = ItinData.beginStage(idx), - *E = ItinData.endStage(idx); IS != E; ++IS) { - // We must find one of the stage's units free for every cycle the - // stage is occupied. FIXME it would be more accurate to find the - // same unit free in all the cycles. - for (unsigned int i = 0; i < IS->getCycles(); ++i) { - assert(((cycle + i) < ScoreboardDepth) && - "Scoreboard depth exceeded!"); - - unsigned index = getFutureIndex(cycle + i); - unsigned freeUnits = IS->getUnits() & ~Scoreboard[index]; - if (!freeUnits) { - DEBUG(errs() << "*** Hazard in cycle " << (cycle + i) << ", "); - DEBUG(errs() << "SU(" << SU->NodeNum << "): "); - DEBUG(SU->getInstr()->dump()); - return Hazard; - } - } + unsigned cycle = 0; + + // Use the itinerary for the underlying instruction to check for + // free FU's in the scoreboard at the appropriate future cycles. + unsigned idx = SU->getInstr()->getDesc().getSchedClass(); + for (const InstrStage *IS = ItinData.beginStage(idx), + *E = ItinData.endStage(idx); IS != E; ++IS) { + // We must find one of the stage's units free for every cycle the + // stage is occupied. FIXME it would be more accurate to find the + // same unit free in all the cycles. + for (unsigned int i = 0; i < IS->getCycles(); ++i) { + assert(((cycle + i) < ScoreboardDepth) && + "Scoreboard depth exceeded!"); - // Advance the cycle to the next stage. - cycle += IS->getNextCycles(); + unsigned index = getFutureIndex(cycle + i); + unsigned freeUnits = IS->getUnits() & ~Scoreboard[index]; + if (!freeUnits) { + DEBUG(errs() << "*** Hazard in cycle " << (cycle + i) << ", "); + DEBUG(errs() << "SU(" << SU->NodeNum << "): "); + DEBUG(SU->getInstr()->dump()); + return Hazard; + } } + + // Advance the cycle to the next stage. + cycle += IS->getNextCycles(); } return NoHazard; } void ExactHazardRecognizer::EmitInstruction(SUnit *SU) { - if (!ItinData.isEmpty()) { - unsigned cycle = 0; + if (ItinData.isEmpty()) + return; - // Use the itinerary for the underlying instruction to reserve FU's - // in the scoreboard at the appropriate future cycles. - unsigned idx = SU->getInstr()->getDesc().getSchedClass(); - for (const InstrStage *IS = ItinData.beginStage(idx), - *E = ItinData.endStage(idx); IS != E; ++IS) { - // We must reserve one of the stage's units for every cycle the - // stage is occupied. FIXME it would be more accurate to reserve - // the same unit free in all the cycles. - for (unsigned int i = 0; i < IS->getCycles(); ++i) { - assert(((cycle + i) < ScoreboardDepth) && - "Scoreboard depth exceeded!"); - - unsigned index = getFutureIndex(cycle + i); - unsigned freeUnits = IS->getUnits() & ~Scoreboard[index]; - - // reduce to a single unit - unsigned freeUnit = 0; - do { - freeUnit = freeUnits; - freeUnits = freeUnit & (freeUnit - 1); - } while (freeUnits); - - assert(freeUnit && "No function unit available!"); - Scoreboard[index] |= freeUnit; - } + unsigned cycle = 0; - // Advance the cycle to the next stage. - cycle += IS->getNextCycles(); + // Use the itinerary for the underlying instruction to reserve FU's + // in the scoreboard at the appropriate future cycles. + unsigned idx = SU->getInstr()->getDesc().getSchedClass(); + for (const InstrStage *IS = ItinData.beginStage(idx), + *E = ItinData.endStage(idx); IS != E; ++IS) { + // We must reserve one of the stage's units for every cycle the + // stage is occupied. FIXME it would be more accurate to reserve + // the same unit free in all the cycles. + for (unsigned int i = 0; i < IS->getCycles(); ++i) { + assert(((cycle + i) < ScoreboardDepth) && + "Scoreboard depth exceeded!"); + + unsigned index = getFutureIndex(cycle + i); + unsigned freeUnits = IS->getUnits() & ~Scoreboard[index]; + + // reduce to a single unit + unsigned freeUnit = 0; + do { + freeUnit = freeUnits; + freeUnits = freeUnit & (freeUnit - 1); + } while (freeUnits); + + assert(freeUnit && "No function unit available!"); + Scoreboard[index] |= freeUnit; } - - DEBUG(dumpScoreboard()); + + // Advance the cycle to the next stage. + cycle += IS->getNextCycles(); } + + DEBUG(dumpScoreboard()); } void ExactHazardRecognizer::AdvanceCycle() { From wendling at apple.com Tue Sep 22 13:31:01 2009 From: wendling at apple.com (Bill Wendling) Date: Tue, 22 Sep 2009 11:31:01 -0700 Subject: [llvm-commits] [llvm] r81928 - /llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp In-Reply-To: <4AB0CE2A.7070206@free.fr> References: <200909152156.n8FLukm5014157@zion.cs.uiuc.edu> <4AB0848D.7040503@free.fr> <672B63E8-77C7-419C-BB04-84DDEA993A13@apple.com> <4AB0CE2A.7070206@free.fr> Message-ID: On Sep 16, 2009, at 4:38 AM, Duncan Sands wrote: > Hi Eric, > >>> not sure how this is possible, got an example? In practice I only >>> ever >>> saw abnormal landing pads due to critical edge splitting. >> >> With the change to using the unwind inst i'll create one every time >> you >> inline something with an unwind afaict since it turns the unwind >> into a >> branch to the invoke's landing pad. > > that makes sense - thanks for the explanation! > Hi Duncan, Here's a testcase that makes this concrete: $ cat testcase.ii struct Foo { Foo(); }; template class Bar { Ty &f; public: Bar(Ty &x) : f(x) {} }; template class Baz { void *pointer; void *create(void *(*make)()); public: Ty &operator() () { create(make); } static void *make() { return new Ty; } }; class Qux { char *f; public: ~Qux() { if (f) delete f; } }; class Zork { struct Bork : public Qux, public Foo {}; static Baz sessionMap; public: static void m() { Bar _(sessionMap()); } }; void Func1() { Zork::m(); } $ llvm-g++ -O3 -S -dA testcase.ii -emit-llvm -o - 2>&1 | grep br | grep lpad br i1 %4, label %lpad, label %bb.i.i br label %lpad (Most of this stuff comes from hash_map/vector code.) -bw From vhernandez at apple.com Tue Sep 22 13:50:04 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Tue, 22 Sep 2009 18:50:04 -0000 Subject: [llvm-commits] [llvm] r82561 - in /llvm/trunk/lib: Analysis/MallocHelper.cpp VMCore/Verifier.cpp Message-ID: <200909221850.n8MIo4Nq014945@zion.cs.uiuc.edu> Author: hernande Date: Tue Sep 22 13:50:03 2009 New Revision: 82561 URL: http://llvm.org/viewvc/llvm-project?rev=82561&view=rev Log: No need to verify that malloc's return type is i8*. Modified: llvm/trunk/lib/Analysis/MallocHelper.cpp llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/Analysis/MallocHelper.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MallocHelper.cpp?rev=82561&r1=82560&r2=82561&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MallocHelper.cpp (original) +++ llvm/trunk/lib/Analysis/MallocHelper.cpp Tue Sep 22 13:50:03 2009 @@ -155,7 +155,7 @@ if (BCI && CI->hasOneUse()) return cast(BCI->getDestTy()); - // Malloc call was not bitcast, so the type is the malloc's return type, i8*. + // Malloc call was not bitcast, so type is the malloc function's return type. if (!BCI) return cast(CI->getType()); Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=82561&r1=82560&r2=82561&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Sep 22 13:50:03 2009 @@ -1143,16 +1143,6 @@ if (Function *F = CI.getCalledFunction()) if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) visitIntrinsicFunctionCall(ID, CI); - - // Code here matches isMalloc from MallocHelper, which is not in VMCore. - const Module* M = CI.getParent()->getParent()->getParent(); - Constant *MallocFunc = M->getFunction("malloc"); - - if (CI.getOperand(0) == MallocFunc) { - const PointerType *PTy = - PointerType::getUnqual(Type::getInt8Ty(CI.getParent()->getContext())); - Assert1(CI.getType() == PTy, "Malloc call must return i8*", &CI); - } } void Verifier::visitInvokeInst(InvokeInst &II) { From dpatel at apple.com Tue Sep 22 15:54:13 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Sep 2009 20:54:13 -0000 Subject: [llvm-commits] [llvm] r82568 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200909222054.n8MKsDAX030931@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 22 15:54:13 2009 New Revision: 82568 URL: http://llvm.org/viewvc/llvm-project?rev=82568&view=rev Log: Check exisiting dbg MDKind first. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=82568&r1=82567&r2=82568&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Sep 22 15:54:13 2009 @@ -134,10 +134,10 @@ /// SetCurrentLocation - This specifies the location information used /// by debugging information. void SetCurrentLocation(MDNode *L) { - if (MDKind == 0) { - Context.getMetadata().RegisterMDKind("dbg"); + if (MDKind == 0) MDKind = Context.getMetadata().getMDKind("dbg"); - } + if (MDKind == 0) + MDKind = Context.getMetadata().RegisterMDKind("dbg"); CurLocation = L; } From bob.wilson at apple.com Tue Sep 22 15:56:30 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 22 Sep 2009 20:56:30 -0000 Subject: [llvm-commits] [test-suite] r82569 - /test-suite/trunk/Makefile.rules Message-ID: <200909222056.n8MKuUeI031251@zion.cs.uiuc.edu> Author: bwilson Date: Tue Sep 22 15:56:30 2009 New Revision: 82569 URL: http://llvm.org/viewvc/llvm-project?rev=82569&view=rev Log: Change LCC1 and LCC1XX to be copied from LLVMCC1 and LLVMCC1PLUS. They had been derived from LLVMGCCLIBEXEC, but if that variable is not defined, they end up being set to "/cc1" and "/cc1plus". Since these variables are used as dependencies in make rules, having them defined with those bogus values causes make to ignore the pattern rules where they are used, leading to very unexpected errors that are hard to track down. Also remove LCOLLECT2 since I can't anything that uses it. Modified: test-suite/trunk/Makefile.rules Modified: test-suite/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=82569&r1=82568&r2=82569&view=diff ============================================================================== --- test-suite/trunk/Makefile.rules (original) +++ test-suite/trunk/Makefile.rules Tue Sep 22 15:56:30 2009 @@ -811,9 +811,8 @@ endif -LCC1 := $(LLVMGCCLIBEXEC)/cc1 -LCC1XX := $(LLVMGCCLIBEXEC)/cc1plus -LCOLLECT2 :=$(LLVMGCCLIBEXEC)/collect2 +LCC1 := $(LLVMCC1) +LCC1XX := $(LLVMCC1PLUS) #--------------------------------------------------------- From dpatel at apple.com Tue Sep 22 15:56:32 2009 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Sep 2009 20:56:32 -0000 Subject: [llvm-commits] [llvm] r82570 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200909222056.n8MKuWJD031266@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 22 15:56:31 2009 New Revision: 82570 URL: http://llvm.org/viewvc/llvm-project?rev=82570&view=rev Log: Add SetLocation() to allow IRBuilder user to set location info for an instruction already created. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=82570&r1=82569&r2=82570&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Sep 22 15:56:31 2009 @@ -131,8 +131,8 @@ InsertPt = IP; } - /// SetCurrentLocation - This specifies the location information used - /// by debugging information. + /// SetCurrentLocation - Set location information used by debugging + /// information. void SetCurrentLocation(MDNode *L) { if (MDKind == 0) MDKind = Context.getMetadata().getMDKind("dbg"); @@ -142,7 +142,13 @@ } MDNode *getCurrentLocation() const { return CurLocation; } - + + /// SetLocation - Set location information for the given instruction. + void SetLocation(Instruction *I) { + if (CurLocation) + Context.getMetadata().setMD(MDKind, CurLocation, I); + } + /// Insert - Insert and return the specified instruction. template InstTy *Insert(InstTy *I, const Twine &Name = "") const { From idadesub at users.sourceforge.net Tue Sep 22 16:14:50 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Tue, 22 Sep 2009 21:14:50 -0000 Subject: [llvm-commits] [llvm] r82572 - in /llvm/trunk: docs/tutorial/LangImpl2.html docs/tutorial/LangImpl3.html docs/tutorial/LangImpl4.html docs/tutorial/LangImpl5.html docs/tutorial/LangImpl6.html docs/tutorial/LangImpl7.html examples/Kaleidoscope/toy.cpp Message-ID: <200909222114.n8MLEoqE001209@zion.cs.uiuc.edu> Author: erickt Date: Tue Sep 22 16:14:49 2009 New Revision: 82572 URL: http://llvm.org/viewvc/llvm-project?rev=82572&view=rev Log: Sync c++ kaleidoscope tutorial with test. Modified: llvm/trunk/docs/tutorial/LangImpl2.html llvm/trunk/docs/tutorial/LangImpl3.html llvm/trunk/docs/tutorial/LangImpl4.html llvm/trunk/docs/tutorial/LangImpl5.html llvm/trunk/docs/tutorial/LangImpl6.html llvm/trunk/docs/tutorial/LangImpl7.html llvm/trunk/examples/Kaleidoscope/toy.cpp Modified: llvm/trunk/docs/tutorial/LangImpl2.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl2.html?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl2.html (original) +++ llvm/trunk/docs/tutorial/LangImpl2.html Tue Sep 22 16:14:49 2009 @@ -84,7 +84,7 @@ class NumberExprAST : public ExprAST { double Val; public: - explicit NumberExprAST(double val) : Val(val) {} + NumberExprAST(double val) : Val(val) {} }; @@ -107,7 +107,7 @@ class VariableExprAST : public ExprAST { std::string Name; public: - explicit VariableExprAST(const std::string &name) : Name(name) {} + VariableExprAST(const std::string &name) : Name(name) {} }; /// BinaryExprAST - Expression class for a binary operator. @@ -333,9 +333,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -833,7 +833,7 @@ tok_def = -2, tok_extern = -3, // primary - tok_identifier = -4, tok_number = -5, + tok_identifier = -4, tok_number = -5 }; static std::string IdentifierStr; // Filled in if tok_identifier @@ -901,14 +901,14 @@ class NumberExprAST : public ExprAST { double Val; public: - explicit NumberExprAST(double val) : Val(val) {} + NumberExprAST(double val) : Val(val) {} }; /// VariableExprAST - Expression class for referencing a variable, like "a". class VariableExprAST : public ExprAST { std::string Name; public: - explicit VariableExprAST(const std::string &name) : Name(name) {} + VariableExprAST(const std::string &name) : Name(name) {} }; /// BinaryExprAST - Expression class for a binary operator. @@ -1004,9 +1004,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -1150,7 +1150,7 @@ //===----------------------------------------------------------------------===// static void HandleDefinition() { - if (FunctionAST *F = ParseDefinition()) { + if (ParseDefinition()) { fprintf(stderr, "Parsed a function definition.\n"); } else { // Skip token for error recovery. @@ -1159,7 +1159,7 @@ } static void HandleExtern() { - if (PrototypeAST *P = ParseExtern()) { + if (ParseExtern()) { fprintf(stderr, "Parsed an extern\n"); } else { // Skip token for error recovery. @@ -1169,7 +1169,7 @@ static void HandleTopLevelExpression() { // Evaluate a top-level expression into an anonymous function. - if (FunctionAST *F = ParseTopLevelExpr()) { + if (ParseTopLevelExpr()) { fprintf(stderr, "Parsed a top-level expr\n"); } else { // Skip token for error recovery. @@ -1207,7 +1207,9 @@ fprintf(stderr, "ready> "); getNextToken(); + // Run the main "interpreter loop" now. MainLoop(); + return 0; } Modified: llvm/trunk/docs/tutorial/LangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.html?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl3.html (original) +++ llvm/trunk/docs/tutorial/LangImpl3.html Tue Sep 22 16:14:49 2009 @@ -79,7 +79,7 @@ class NumberExprAST : public ExprAST { double Val; public: - explicit NumberExprAST(double val) : Val(val) {} + NumberExprAST(double val) : Val(val) {} virtual Value *Codegen(); }; ... @@ -464,9 +464,10 @@ if (Value *RetVal = Body->Codegen()) { // Finish off the function. Builder.CreateRet(RetVal); - + // Validate the generated code, checking for consistency. verifyFunction(*TheFunction); + return TheFunction; } @@ -708,7 +709,7 @@ tok_def = -2, tok_extern = -3, // primary - tok_identifier = -4, tok_number = -5, + tok_identifier = -4, tok_number = -5 }; static std::string IdentifierStr; // Filled in if tok_identifier @@ -777,7 +778,7 @@ class NumberExprAST : public ExprAST { double Val; public: - explicit NumberExprAST(double val) : Val(val) {} + NumberExprAST(double val) : Val(val) {} virtual Value *Codegen(); }; @@ -785,7 +786,7 @@ class VariableExprAST : public ExprAST { std::string Name; public: - explicit VariableExprAST(const std::string &name) : Name(name) {} + VariableExprAST(const std::string &name) : Name(name) {} virtual Value *Codegen(); }; @@ -810,7 +811,8 @@ }; /// PrototypeAST - This class represents the "prototype" for a function, -/// which captures its argument names as well as if it is an operator. +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). class PrototypeAST { std::string Name; std::vector<std::string> Args; @@ -837,7 +839,7 @@ //===----------------------------------------------------------------------===// /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser it looking at. getNextToken reads another token from the +/// token the parser is looking at. getNextToken reads another token from the /// lexer and updates CurTok with its results. static int CurTok; static int getNextToken() { @@ -885,9 +887,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -1058,7 +1060,8 @@ case '<': L = Builder.CreateFCmpULT(L, R, "cmptmp"); // Convert bool 0/1 to double 0.0 or 1.0 - return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), "booltmp"); + return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), + "booltmp"); default: return ErrorV("invalid binary operator"); } } @@ -1138,9 +1141,10 @@ if (Value *RetVal = Body->Codegen()) { // Finish off the function. Builder.CreateRet(RetVal); - + // Validate the generated code, checking for consistency. verifyFunction(*TheFunction); + return TheFunction; } @@ -1178,7 +1182,7 @@ } static void HandleTopLevelExpression() { - // Evaluate a top level expression into an anonymous function. + // Evaluate a top-level expression into an anonymous function. if (FunctionAST *F = ParseTopLevelExpr()) { if (Function *LF = F->Codegen()) { fprintf(stderr, "Read top-level expression:"); @@ -1196,7 +1200,7 @@ fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: return; - case ';': getNextToken(); break; // ignore top level semicolons. + case ';': getNextToken(); break; // ignore top-level semicolons. case tok_def: HandleDefinition(); break; case tok_extern: HandleExtern(); break; default: HandleTopLevelExpression(); break; @@ -1204,8 +1208,6 @@ } } - - //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// @@ -1222,7 +1224,7 @@ //===----------------------------------------------------------------------===// int main() { - TheModule = new Module("my cool jit", getGlobalContext()); + LLVMContext &Context = getGlobalContext(); // Install standard binary operators. // 1 is lowest precedence. @@ -1235,8 +1237,15 @@ fprintf(stderr, "ready> "); getNextToken(); + // Make the module, which holds all the code. + TheModule = new Module("my cool jit", Context); + + // Run the main "interpreter loop" now. MainLoop(); + + // Print out all of the generated code. TheModule->dump(); + return 0; } Modified: llvm/trunk/docs/tutorial/LangImpl4.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl4.html?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl4.html (original) +++ llvm/trunk/docs/tutorial/LangImpl4.html Tue Sep 22 16:14:49 2009 @@ -324,7 +324,7 @@
 static void HandleTopLevelExpression() {
-  // Evaluate a top level expression into an anonymous function.
+  // Evaluate a top-level expression into an anonymous function.
   if (FunctionAST *F = ParseTopLevelExpr()) {
     if (Function *LF = F->Codegen()) {
       LF->dump();  // Dump the function for exposition purposes.
@@ -334,7 +334,7 @@
       
       // Cast it to the right type (takes no arguments, returns a double) so we
       // can call it as a native function.
-      double (*FP)() = (double (*)())FPtr;
+      double (*FP)() = (double (*)())(intptr_t)FPtr;
       fprintf(stderr, "Evaluated to %f\n", FP());
     }
 
@@ -363,7 +363,7 @@

Well this looks like it is basically working. The dump of the function shows the "no argument function that always returns double" that we synthesize -for each top level expression that is typed in. This demonstrates very basic +for each top-level expression that is typed in. This demonstrates very basic functionality, but can we do more?

@@ -499,7 +499,7 @@
    # Compile
-   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
+   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit interpreter native` -O3 -o toy
    # Run
    ./toy
 
@@ -546,7 +546,7 @@ tok_def = -2, tok_extern = -3, // primary - tok_identifier = -4, tok_number = -5, + tok_identifier = -4, tok_number = -5 }; static std::string IdentifierStr; // Filled in if tok_identifier @@ -648,7 +648,8 @@ }; /// PrototypeAST - This class represents the "prototype" for a function, -/// which captures its argument names as well as if it is an operator. +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). class PrototypeAST { std::string Name; std::vector<std::string> Args; @@ -675,7 +676,7 @@ //===----------------------------------------------------------------------===// /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser it looking at. getNextToken reads another token from the +/// token the parser is looking at. getNextToken reads another token from the /// lexer and updates CurTok with its results. static int CurTok; static int getNextToken() { @@ -723,9 +724,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -1024,7 +1025,7 @@ } static void HandleTopLevelExpression() { - // Evaluate a top level expression into an anonymous function. + // Evaluate a top-level expression into an anonymous function. if (FunctionAST *F = ParseTopLevelExpr()) { if (Function *LF = F->Codegen()) { // JIT the function, returning a function pointer. @@ -1047,7 +1048,7 @@ fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: return; - case ';': getNextToken(); break; // ignore top level semicolons. + case ';': getNextToken(); break; // ignore top-level semicolons. case tok_def: HandleDefinition(); break; case tok_extern: HandleExtern(); break; default: HandleTopLevelExpression(); break; @@ -1055,8 +1056,6 @@ } } - - //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// Modified: llvm/trunk/docs/tutorial/LangImpl5.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl5.html?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl5.html (original) +++ llvm/trunk/docs/tutorial/LangImpl5.html Tue Sep 22 16:14:49 2009 @@ -472,7 +472,8 @@ // Emit merge block. TheFunction->getBasicBlockList().push_back(MergeBB); Builder.SetInsertPoint(MergeBB); - PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), "iftmp"); + PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), + "iftmp"); PN->addIncoming(ThenV, ThenBB); PN->addIncoming(ElseV, ElseBB); @@ -1062,7 +1063,8 @@ }; /// PrototypeAST - This class represents the "prototype" for a function, -/// which captures its argument names as well as if it is an operator. +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). class PrototypeAST { std::string Name; std::vector<std::string> Args; @@ -1089,7 +1091,7 @@ //===----------------------------------------------------------------------===// /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser it looking at. getNextToken reads another token from the +/// token the parser is looking at. getNextToken reads another token from the /// lexer and updates CurTok with its results. static int CurTok; static int getNextToken() { @@ -1137,9 +1139,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -1239,7 +1241,6 @@ return new ForExprAST(IdName, Start, End, Step, Body); } - /// primary /// ::= identifierexpr /// ::= numberexpr @@ -1550,7 +1551,7 @@ // for expr always returns 0.0. - return getGlobalContext().getNullValue(Type::getDoubleTy(getGlobalContext())); + return Constant::getNullValue(Type::getDoubleTy(getGlobalContext())); } Function *PrototypeAST::Codegen() { @@ -1655,7 +1656,7 @@ } static void HandleTopLevelExpression() { - // Evaluate a top level expression into an anonymous function. + // Evaluate a top-level expression into an anonymous function. if (FunctionAST *F = ParseTopLevelExpr()) { if (Function *LF = F->Codegen()) { // JIT the function, returning a function pointer. @@ -1678,7 +1679,7 @@ fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: return; - case ';': getNextToken(); break; // ignore top level semicolons. + case ';': getNextToken(); break; // ignore top-level semicolons. case tok_def: HandleDefinition(); break; case tok_extern: HandleExtern(); break; default: HandleTopLevelExpression(); break; @@ -1686,8 +1687,6 @@ } } - - //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// @@ -1704,6 +1703,9 @@ //===----------------------------------------------------------------------===// int main() { + InitializeNativeTarget(); + LLVMContext &Context = getGlobalContext(); + // Install standard binary operators. // 1 is lowest precedence. BinopPrecedence['<'] = 10; @@ -1716,7 +1718,7 @@ getNextToken(); // Make the module, which holds all the code. - TheModule = new Module("my cool jit", getGlobalContext()); + TheModule = new Module("my cool jit", Context); ExistingModuleProvider *OurModuleProvider = new ExistingModuleProvider(TheModule); Modified: llvm/trunk/docs/tutorial/LangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl6.html?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl6.html (original) +++ llvm/trunk/docs/tutorial/LangImpl6.html Tue Sep 22 16:14:49 2009 @@ -306,7 +306,7 @@ functions (because the "prototype" boils down to a function with the right name) everything falls into place.

-

The final piece of code we are missing, is a bit of top level magic:

+

The final piece of code we are missing, is a bit of top-level magic:

@@ -795,7 +795,6 @@
 
 
- @@ -998,7 +997,8 @@ }; /// PrototypeAST - This class represents the "prototype" for a function, -/// which captures its argument names as well as if it is an operator. +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes), as well as if it is an operator. class PrototypeAST { std::string Name; std::vector<std::string> Args; @@ -1038,7 +1038,7 @@ //===----------------------------------------------------------------------===// /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser it looking at. getNextToken reads another token from the +/// token the parser is looking at. getNextToken reads another token from the /// lexer and updates CurTok with its results. static int CurTok; static int getNextToken() { @@ -1086,9 +1086,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -1188,7 +1188,6 @@ return new ForExprAST(IdName, Start, End, Step, Body); } - /// primary /// ::= identifierexpr /// ::= numberexpr @@ -1272,7 +1271,7 @@ static PrototypeAST *ParsePrototype() { std::string FnName; - unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. + unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. unsigned BinaryPrecedence = 30; switch (CurTok) { @@ -1389,7 +1388,6 @@ return Builder.CreateCall(F, OperandV, "unop"); } - Value *BinaryExprAST::Codegen() { Value *L = LHS->Codegen(); Value *R = RHS->Codegen(); @@ -1402,7 +1400,8 @@ case '<': L = Builder.CreateFCmpULT(L, R, "cmptmp"); // Convert bool 0/1 to double 0.0 or 1.0 - return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), "booltmp"); + return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), + "booltmp"); default: break; } @@ -1687,7 +1686,7 @@ } static void HandleTopLevelExpression() { - // Evaluate a top level expression into an anonymous function. + // Evaluate a top-level expression into an anonymous function. if (FunctionAST *F = ParseTopLevelExpr()) { if (Function *LF = F->Codegen()) { // JIT the function, returning a function pointer. @@ -1710,7 +1709,7 @@ fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: return; - case ';': getNextToken(); break; // ignore top level semicolons. + case ';': getNextToken(); break; // ignore top-level semicolons. case tok_def: HandleDefinition(); break; case tok_extern: HandleExtern(); break; default: HandleTopLevelExpression(); break; @@ -1718,8 +1717,6 @@ } } - - //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// @@ -1743,6 +1740,9 @@ //===----------------------------------------------------------------------===// int main() { + InitializeNativeTarget(); + LLVMContext &Context = getGlobalContext(); + // Install standard binary operators. // 1 is lowest precedence. BinopPrecedence['<'] = 10; @@ -1755,7 +1755,7 @@ getNextToken(); // Make the module, which holds all the code. - TheModule = new Module("my cool jit", getGlobalContext()); + TheModule = new Module("my cool jit", Context); ExistingModuleProvider *OurModuleProvider = new ExistingModuleProvider(TheModule); Modified: llvm/trunk/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl7.html?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/docs/tutorial/LangImpl7.html (original) +++ llvm/trunk/docs/tutorial/LangImpl7.html Tue Sep 22 16:14:49 2009 @@ -1197,7 +1197,8 @@ }; /// PrototypeAST - This class represents the "prototype" for a function, -/// which captures its argument names as well as if it is an operator. +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes), as well as if it is an operator. class PrototypeAST { std::string Name; std::vector<std::string> Args; @@ -1239,7 +1240,7 @@ //===----------------------------------------------------------------------===// /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser it looking at. getNextToken reads another token from the +/// token the parser is looking at. getNextToken reads another token from the /// lexer and updates CurTok with its results. static int CurTok; static int getNextToken() { @@ -1287,9 +1288,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -1434,7 +1435,6 @@ return new VarExprAST(VarNames, Body); } - /// primary /// ::= identifierexpr /// ::= numberexpr @@ -1520,7 +1520,7 @@ static PrototypeAST *ParsePrototype() { std::string FnName; - int Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. + unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. unsigned BinaryPrecedence = 30; switch (CurTok) { @@ -1622,10 +1622,10 @@ const std::string &VarName) { IRBuilder<> TmpB(&TheFunction->getEntryBlock(), TheFunction->getEntryBlock().begin()); - return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0, VarName.c_str()); + return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0, + VarName.c_str()); } - Value *NumberExprAST::Codegen() { return ConstantFP::get(getGlobalContext(), APFloat(Val)); } @@ -1650,7 +1650,6 @@ return Builder.CreateCall(F, OperandV, "unop"); } - Value *BinaryExprAST::Codegen() { // Special case '=' because we don't want to emit the LHS as an expression. if (Op == '=') { @@ -1670,7 +1669,6 @@ return Val; } - Value *L = LHS->Codegen(); Value *R = RHS->Codegen(); if (L == 0 || R == 0) return 0; @@ -1801,7 +1799,6 @@ // Make the new basic block for the loop header, inserting after current // block. - BasicBlock *PreheaderBB = Builder.GetInsertBlock(); BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction); // Insert an explicit fall through from the current block to the LoopBB. @@ -1847,7 +1844,6 @@ "loopcond"); // Create the "after loop" block and insert it. - BasicBlock *LoopEndBB = Builder.GetInsertBlock(); BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction); // Insert the conditional branch into the end of LoopEndBB. @@ -1913,7 +1909,6 @@ return BodyVal; } - Function *PrototypeAST::Codegen() { // Make the function type: double(double,double) etc. std::vector<const Type*> Doubles(Args.size(), @@ -1968,7 +1963,6 @@ } } - Function *FunctionAST::Codegen() { NamedValues.clear(); @@ -1986,7 +1980,7 @@ // Add all arguments to the symbol table and create their allocas. Proto->CreateArgumentAllocas(TheFunction); - + if (Value *RetVal = Body->Codegen()) { // Finish off the function. Builder.CreateRet(RetVal); @@ -2039,7 +2033,7 @@ } static void HandleTopLevelExpression() { - // Evaluate a top level expression into an anonymous function. + // Evaluate a top-level expression into an anonymous function. if (FunctionAST *F = ParseTopLevelExpr()) { if (Function *LF = F->Codegen()) { // JIT the function, returning a function pointer. @@ -2062,7 +2056,7 @@ fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: return; - case ';': getNextToken(); break; // ignore top level semicolons. + case ';': getNextToken(); break; // ignore top-level semicolons. case tok_def: HandleDefinition(); break; case tok_extern: HandleExtern(); break; default: HandleTopLevelExpression(); break; @@ -2070,8 +2064,6 @@ } } - - //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// @@ -2095,6 +2087,9 @@ //===----------------------------------------------------------------------===// int main() { + InitializeNativeTarget(); + LLVMContext &Context = getGlobalContext(); + // Install standard binary operators. // 1 is lowest precedence. BinopPrecedence['='] = 2; @@ -2108,7 +2103,7 @@ getNextToken(); // Make the module, which holds all the code. - TheModule = new Module("my cool jit", getGlobalContext()); + TheModule = new Module("my cool jit", Context); ExistingModuleProvider *OurModuleProvider = new ExistingModuleProvider(TheModule); Modified: llvm/trunk/examples/Kaleidoscope/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=82572&r1=82571&r2=82572&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/toy.cpp (original) +++ llvm/trunk/examples/Kaleidoscope/toy.cpp Tue Sep 22 16:14:49 2009 @@ -235,7 +235,7 @@ //===----------------------------------------------------------------------===// /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser it looking at. getNextToken reads another token from the +/// token the parser is looking at. getNextToken reads another token from the /// lexer and updates CurTok with its results. static int CurTok; static int getNextToken() { @@ -283,9 +283,9 @@ ExprAST *Arg = ParseExpression(); if (!Arg) return 0; Args.push_back(Arg); - + if (CurTok == ')') break; - + if (CurTok != ',') return Error("Expected ')' or ',' in argument list"); getNextToken(); @@ -430,7 +430,6 @@ return new VarExprAST(VarNames, Body); } - /// primary /// ::= identifierexpr /// ::= numberexpr @@ -516,7 +515,7 @@ static PrototypeAST *ParsePrototype() { std::string FnName; - unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. + unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. unsigned BinaryPrecedence = 30; switch (CurTok) { @@ -622,7 +621,6 @@ VarName.c_str()); } - Value *NumberExprAST::Codegen() { return ConstantFP::get(getGlobalContext(), APFloat(Val)); } @@ -647,7 +645,6 @@ return Builder.CreateCall(F, OperandV, "unop"); } - Value *BinaryExprAST::Codegen() { // Special case '=' because we don't want to emit the LHS as an expression. if (Op == '=') { @@ -667,7 +664,6 @@ return Val; } - Value *L = LHS->Codegen(); Value *R = RHS->Codegen(); if (L == 0 || R == 0) return 0; @@ -908,7 +904,6 @@ return BodyVal; } - Function *PrototypeAST::Codegen() { // Make the function type: double(double,double) etc. std::vector Doubles(Args.size(), @@ -963,7 +958,6 @@ } } - Function *FunctionAST::Codegen() { NamedValues.clear(); @@ -981,7 +975,7 @@ // Add all arguments to the symbol table and create their allocas. Proto->CreateArgumentAllocas(TheFunction); - + if (Value *RetVal = Body->Codegen()) { // Finish off the function. Builder.CreateRet(RetVal); @@ -1034,7 +1028,7 @@ } static void HandleTopLevelExpression() { - // Evaluate a top level expression into an anonymous function. + // Evaluate a top-level expression into an anonymous function. if (FunctionAST *F = ParseTopLevelExpr()) { if (Function *LF = F->Codegen()) { // JIT the function, returning a function pointer. @@ -1057,7 +1051,7 @@ fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: return; - case ';': getNextToken(); break; // ignore top level semicolons. + case ';': getNextToken(); break; // ignore top-level semicolons. case tok_def: HandleDefinition(); break; case tok_extern: HandleExtern(); break; default: HandleTopLevelExpression(); break; @@ -1065,8 +1059,6 @@ } } - - //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// @@ -1092,7 +1084,7 @@ int main() { InitializeNativeTarget(); LLVMContext &Context = getGlobalContext(); - + // Install standard binary operators. // 1 is lowest precedence. BinopPrecedence['='] = 2; From idadesub at users.sourceforge.net Tue Sep 22 16:15:00 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Tue, 22 Sep 2009 21:15:00 -0000 Subject: [llvm-commits] [llvm] r82573 - in /llvm/trunk/examples/Kaleidoscope: CMakeLists.txt Chapter7/ Chapter7/CMakeLists.txt Chapter7/Makefile Chapter7/toy.cpp Makefile toy.cpp Message-ID: <200909222115.n8MLF08g001257@zion.cs.uiuc.edu> Author: erickt Date: Tue Sep 22 16:15:00 2009 New Revision: 82573 URL: http://llvm.org/viewvc/llvm-project?rev=82573&view=rev Log: Rename Kaleidoscope to show that it's for Chapter 7 of the tutorial. Added: llvm/trunk/examples/Kaleidoscope/Chapter7/ llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt - copied, changed from r82572, llvm/trunk/examples/Kaleidoscope/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile - copied, changed from r82572, llvm/trunk/examples/Kaleidoscope/Makefile llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp - copied, changed from r82572, llvm/trunk/examples/Kaleidoscope/toy.cpp Removed: llvm/trunk/examples/Kaleidoscope/toy.cpp Modified: llvm/trunk/examples/Kaleidoscope/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Makefile Modified: llvm/trunk/examples/Kaleidoscope/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/CMakeLists.txt?rev=82573&r1=82572&r2=82573&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/CMakeLists.txt (original) +++ llvm/trunk/examples/Kaleidoscope/CMakeLists.txt Tue Sep 22 16:15:00 2009 @@ -1,5 +1 @@ -set(LLVM_LINK_COMPONENTS core jit interpreter native) - -add_llvm_example(Kaleidoscope - toy.cpp - ) +add_subdirectory(Chapter7) Copied: llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt (from r82572, llvm/trunk/examples/Kaleidoscope/CMakeLists.txt) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt?p2=llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt&p1=llvm/trunk/examples/Kaleidoscope/CMakeLists.txt&r1=82572&r2=82573&rev=82573&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/CMakeLists.txt (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt Tue Sep 22 16:15:00 2009 @@ -1,5 +1,5 @@ set(LLVM_LINK_COMPONENTS core jit interpreter native) -add_llvm_example(Kaleidoscope +add_llvm_example(Kaleidoscope-Ch7 toy.cpp ) Copied: llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (from r82572, llvm/trunk/examples/Kaleidoscope/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile?p2=llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile&p1=llvm/trunk/examples/Kaleidoscope/Makefile&r1=82572&r2=82573&rev=82573&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile Tue Sep 22 16:15:00 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope/Makefile ----------------------*- Makefile -*-===## +##===- examples/Kaleidoscope-Ch7/Makefile ------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,7 +7,7 @@ # ##===----------------------------------------------------------------------===## LEVEL = ../.. -TOOLNAME = Kaleidoscope +TOOLNAME = Kaleidoscope-Ch7 EXAMPLE_TOOL = 1 LINK_COMPONENTS := core jit interpreter native Copied: llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp (from r82572, llvm/trunk/examples/Kaleidoscope/toy.cpp) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp?p2=llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp&p1=llvm/trunk/examples/Kaleidoscope/toy.cpp&r1=82572&r2=82573&rev=82573&view=diff ============================================================================== (empty) Modified: llvm/trunk/examples/Kaleidoscope/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Makefile?rev=82573&r1=82572&r2=82573&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Makefile Tue Sep 22 16:15:00 2009 @@ -6,10 +6,10 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = Kaleidoscope -EXAMPLE_TOOL = 1 +LEVEL=../.. -LINK_COMPONENTS := core jit interpreter native +include $(LEVEL)/Makefile.config + +PARALLEL_DIRS:= Chapter7 include $(LEVEL)/Makefile.common Removed: llvm/trunk/examples/Kaleidoscope/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/toy.cpp?rev=82572&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/toy.cpp (original) +++ llvm/trunk/examples/Kaleidoscope/toy.cpp (removed) @@ -1,1139 +0,0 @@ -#include "llvm/DerivedTypes.h" -#include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/ExecutionEngine/Interpreter.h" -#include "llvm/ExecutionEngine/JIT.h" -#include "llvm/LLVMContext.h" -#include "llvm/Module.h" -#include "llvm/ModuleProvider.h" -#include "llvm/PassManager.h" -#include "llvm/Analysis/Verifier.h" -#include "llvm/Target/TargetData.h" -#include "llvm/Target/TargetSelect.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Support/IRBuilder.h" -#include -#include -#include -#include -using namespace llvm; - -//===----------------------------------------------------------------------===// -// Lexer -//===----------------------------------------------------------------------===// - -// The lexer returns tokens [0-255] if it is an unknown character, otherwise one -// of these for known things. -enum Token { - tok_eof = -1, - - // commands - tok_def = -2, tok_extern = -3, - - // primary - tok_identifier = -4, tok_number = -5, - - // control - tok_if = -6, tok_then = -7, tok_else = -8, - tok_for = -9, tok_in = -10, - - // operators - tok_binary = -11, tok_unary = -12, - - // var definition - tok_var = -13 -}; - -static std::string IdentifierStr; // Filled in if tok_identifier -static double NumVal; // Filled in if tok_number - -/// gettok - Return the next token from standard input. -static int gettok() { - static int LastChar = ' '; - - // Skip any whitespace. - while (isspace(LastChar)) - LastChar = getchar(); - - if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]* - IdentifierStr = LastChar; - while (isalnum((LastChar = getchar()))) - IdentifierStr += LastChar; - - if (IdentifierStr == "def") return tok_def; - if (IdentifierStr == "extern") return tok_extern; - if (IdentifierStr == "if") return tok_if; - if (IdentifierStr == "then") return tok_then; - if (IdentifierStr == "else") return tok_else; - if (IdentifierStr == "for") return tok_for; - if (IdentifierStr == "in") return tok_in; - if (IdentifierStr == "binary") return tok_binary; - if (IdentifierStr == "unary") return tok_unary; - if (IdentifierStr == "var") return tok_var; - return tok_identifier; - } - - if (isdigit(LastChar) || LastChar == '.') { // Number: [0-9.]+ - std::string NumStr; - do { - NumStr += LastChar; - LastChar = getchar(); - } while (isdigit(LastChar) || LastChar == '.'); - - NumVal = strtod(NumStr.c_str(), 0); - return tok_number; - } - - if (LastChar == '#') { - // Comment until end of line. - do LastChar = getchar(); - while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); - - if (LastChar != EOF) - return gettok(); - } - - // Check for end of file. Don't eat the EOF. - if (LastChar == EOF) - return tok_eof; - - // Otherwise, just return the character as its ascii value. - int ThisChar = LastChar; - LastChar = getchar(); - return ThisChar; -} - -//===----------------------------------------------------------------------===// -// Abstract Syntax Tree (aka Parse Tree) -//===----------------------------------------------------------------------===// - -/// ExprAST - Base class for all expression nodes. -class ExprAST { -public: - virtual ~ExprAST() {} - virtual Value *Codegen() = 0; -}; - -/// NumberExprAST - Expression class for numeric literals like "1.0". -class NumberExprAST : public ExprAST { - double Val; -public: - NumberExprAST(double val) : Val(val) {} - virtual Value *Codegen(); -}; - -/// VariableExprAST - Expression class for referencing a variable, like "a". -class VariableExprAST : public ExprAST { - std::string Name; -public: - VariableExprAST(const std::string &name) : Name(name) {} - const std::string &getName() const { return Name; } - virtual Value *Codegen(); -}; - -/// UnaryExprAST - Expression class for a unary operator. -class UnaryExprAST : public ExprAST { - char Opcode; - ExprAST *Operand; -public: - UnaryExprAST(char opcode, ExprAST *operand) - : Opcode(opcode), Operand(operand) {} - virtual Value *Codegen(); -}; - -/// BinaryExprAST - Expression class for a binary operator. -class BinaryExprAST : public ExprAST { - char Op; - ExprAST *LHS, *RHS; -public: - BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) - : Op(op), LHS(lhs), RHS(rhs) {} - virtual Value *Codegen(); -}; - -/// CallExprAST - Expression class for function calls. -class CallExprAST : public ExprAST { - std::string Callee; - std::vector Args; -public: - CallExprAST(const std::string &callee, std::vector &args) - : Callee(callee), Args(args) {} - virtual Value *Codegen(); -}; - -/// IfExprAST - Expression class for if/then/else. -class IfExprAST : public ExprAST { - ExprAST *Cond, *Then, *Else; -public: - IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else) - : Cond(cond), Then(then), Else(_else) {} - virtual Value *Codegen(); -}; - -/// ForExprAST - Expression class for for/in. -class ForExprAST : public ExprAST { - std::string VarName; - ExprAST *Start, *End, *Step, *Body; -public: - ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, - ExprAST *step, ExprAST *body) - : VarName(varname), Start(start), End(end), Step(step), Body(body) {} - virtual Value *Codegen(); -}; - -/// VarExprAST - Expression class for var/in -class VarExprAST : public ExprAST { - std::vector > VarNames; - ExprAST *Body; -public: - VarExprAST(const std::vector > &varnames, - ExprAST *body) - : VarNames(varnames), Body(body) {} - - virtual Value *Codegen(); -}; - -/// PrototypeAST - This class represents the "prototype" for a function, -/// which captures its argument names as well as if it is an operator. -class PrototypeAST { - std::string Name; - std::vector Args; - bool isOperator; - unsigned Precedence; // Precedence if a binary op. -public: - PrototypeAST(const std::string &name, const std::vector &args, - bool isoperator = false, unsigned prec = 0) - : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {} - - bool isUnaryOp() const { return isOperator && Args.size() == 1; } - bool isBinaryOp() const { return isOperator && Args.size() == 2; } - - char getOperatorName() const { - assert(isUnaryOp() || isBinaryOp()); - return Name[Name.size()-1]; - } - - unsigned getBinaryPrecedence() const { return Precedence; } - - Function *Codegen(); - - void CreateArgumentAllocas(Function *F); -}; - -/// FunctionAST - This class represents a function definition itself. -class FunctionAST { - PrototypeAST *Proto; - ExprAST *Body; -public: - FunctionAST(PrototypeAST *proto, ExprAST *body) - : Proto(proto), Body(body) {} - - Function *Codegen(); -}; - -//===----------------------------------------------------------------------===// -// Parser -//===----------------------------------------------------------------------===// - -/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current -/// token the parser is looking at. getNextToken reads another token from the -/// lexer and updates CurTok with its results. -static int CurTok; -static int getNextToken() { - return CurTok = gettok(); -} - -/// BinopPrecedence - This holds the precedence for each binary operator that is -/// defined. -static std::map BinopPrecedence; - -/// GetTokPrecedence - Get the precedence of the pending binary operator token. -static int GetTokPrecedence() { - if (!isascii(CurTok)) - return -1; - - // Make sure it's a declared binop. - int TokPrec = BinopPrecedence[CurTok]; - if (TokPrec <= 0) return -1; - return TokPrec; -} - -/// Error* - These are little helper functions for error handling. -ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;} -PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; } -FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; } - -static ExprAST *ParseExpression(); - -/// identifierexpr -/// ::= identifier -/// ::= identifier '(' expression* ')' -static ExprAST *ParseIdentifierExpr() { - std::string IdName = IdentifierStr; - - getNextToken(); // eat identifier. - - if (CurTok != '(') // Simple variable ref. - return new VariableExprAST(IdName); - - // Call. - getNextToken(); // eat ( - std::vector Args; - if (CurTok != ')') { - while (1) { - ExprAST *Arg = ParseExpression(); - if (!Arg) return 0; - Args.push_back(Arg); - - if (CurTok == ')') break; - - if (CurTok != ',') - return Error("Expected ')' or ',' in argument list"); - getNextToken(); - } - } - - // Eat the ')'. - getNextToken(); - - return new CallExprAST(IdName, Args); -} - -/// numberexpr ::= number -static ExprAST *ParseNumberExpr() { - ExprAST *Result = new NumberExprAST(NumVal); - getNextToken(); // consume the number - return Result; -} - -/// parenexpr ::= '(' expression ')' -static ExprAST *ParseParenExpr() { - getNextToken(); // eat (. - ExprAST *V = ParseExpression(); - if (!V) return 0; - - if (CurTok != ')') - return Error("expected ')'"); - getNextToken(); // eat ). - return V; -} - -/// ifexpr ::= 'if' expression 'then' expression 'else' expression -static ExprAST *ParseIfExpr() { - getNextToken(); // eat the if. - - // condition. - ExprAST *Cond = ParseExpression(); - if (!Cond) return 0; - - if (CurTok != tok_then) - return Error("expected then"); - getNextToken(); // eat the then - - ExprAST *Then = ParseExpression(); - if (Then == 0) return 0; - - if (CurTok != tok_else) - return Error("expected else"); - - getNextToken(); - - ExprAST *Else = ParseExpression(); - if (!Else) return 0; - - return new IfExprAST(Cond, Then, Else); -} - -/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression -static ExprAST *ParseForExpr() { - getNextToken(); // eat the for. - - if (CurTok != tok_identifier) - return Error("expected identifier after for"); - - std::string IdName = IdentifierStr; - getNextToken(); // eat identifier. - - if (CurTok != '=') - return Error("expected '=' after for"); - getNextToken(); // eat '='. - - - ExprAST *Start = ParseExpression(); - if (Start == 0) return 0; - if (CurTok != ',') - return Error("expected ',' after for start value"); - getNextToken(); - - ExprAST *End = ParseExpression(); - if (End == 0) return 0; - - // The step value is optional. - ExprAST *Step = 0; - if (CurTok == ',') { - getNextToken(); - Step = ParseExpression(); - if (Step == 0) return 0; - } - - if (CurTok != tok_in) - return Error("expected 'in' after for"); - getNextToken(); // eat 'in'. - - ExprAST *Body = ParseExpression(); - if (Body == 0) return 0; - - return new ForExprAST(IdName, Start, End, Step, Body); -} - -/// varexpr ::= 'var' identifier ('=' expression)? -// (',' identifier ('=' expression)?)* 'in' expression -static ExprAST *ParseVarExpr() { - getNextToken(); // eat the var. - - std::vector > VarNames; - - // At least one variable name is required. - if (CurTok != tok_identifier) - return Error("expected identifier after var"); - - while (1) { - std::string Name = IdentifierStr; - getNextToken(); // eat identifier. - - // Read the optional initializer. - ExprAST *Init = 0; - if (CurTok == '=') { - getNextToken(); // eat the '='. - - Init = ParseExpression(); - if (Init == 0) return 0; - } - - VarNames.push_back(std::make_pair(Name, Init)); - - // End of var list, exit loop. - if (CurTok != ',') break; - getNextToken(); // eat the ','. - - if (CurTok != tok_identifier) - return Error("expected identifier list after var"); - } - - // At this point, we have to have 'in'. - if (CurTok != tok_in) - return Error("expected 'in' keyword after 'var'"); - getNextToken(); // eat 'in'. - - ExprAST *Body = ParseExpression(); - if (Body == 0) return 0; - - return new VarExprAST(VarNames, Body); -} - -/// primary -/// ::= identifierexpr -/// ::= numberexpr -/// ::= parenexpr -/// ::= ifexpr -/// ::= forexpr -/// ::= varexpr -static ExprAST *ParsePrimary() { - switch (CurTok) { - default: return Error("unknown token when expecting an expression"); - case tok_identifier: return ParseIdentifierExpr(); - case tok_number: return ParseNumberExpr(); - case '(': return ParseParenExpr(); - case tok_if: return ParseIfExpr(); - case tok_for: return ParseForExpr(); - case tok_var: return ParseVarExpr(); - } -} - -/// unary -/// ::= primary -/// ::= '!' unary -static ExprAST *ParseUnary() { - // If the current token is not an operator, it must be a primary expr. - if (!isascii(CurTok) || CurTok == '(' || CurTok == ',') - return ParsePrimary(); - - // If this is a unary operator, read it. - int Opc = CurTok; - getNextToken(); - if (ExprAST *Operand = ParseUnary()) - return new UnaryExprAST(Opc, Operand); - return 0; -} - -/// binoprhs -/// ::= ('+' unary)* -static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) { - // If this is a binop, find its precedence. - while (1) { - int TokPrec = GetTokPrecedence(); - - // If this is a binop that binds at least as tightly as the current binop, - // consume it, otherwise we are done. - if (TokPrec < ExprPrec) - return LHS; - - // Okay, we know this is a binop. - int BinOp = CurTok; - getNextToken(); // eat binop - - // Parse the unary expression after the binary operator. - ExprAST *RHS = ParseUnary(); - if (!RHS) return 0; - - // If BinOp binds less tightly with RHS than the operator after RHS, let - // the pending operator take RHS as its LHS. - int NextPrec = GetTokPrecedence(); - if (TokPrec < NextPrec) { - RHS = ParseBinOpRHS(TokPrec+1, RHS); - if (RHS == 0) return 0; - } - - // Merge LHS/RHS. - LHS = new BinaryExprAST(BinOp, LHS, RHS); - } -} - -/// expression -/// ::= unary binoprhs -/// -static ExprAST *ParseExpression() { - ExprAST *LHS = ParseUnary(); - if (!LHS) return 0; - - return ParseBinOpRHS(0, LHS); -} - -/// prototype -/// ::= id '(' id* ')' -/// ::= binary LETTER number? (id, id) -/// ::= unary LETTER (id) -static PrototypeAST *ParsePrototype() { - std::string FnName; - - unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. - unsigned BinaryPrecedence = 30; - - switch (CurTok) { - default: - return ErrorP("Expected function name in prototype"); - case tok_identifier: - FnName = IdentifierStr; - Kind = 0; - getNextToken(); - break; - case tok_unary: - getNextToken(); - if (!isascii(CurTok)) - return ErrorP("Expected unary operator"); - FnName = "unary"; - FnName += (char)CurTok; - Kind = 1; - getNextToken(); - break; - case tok_binary: - getNextToken(); - if (!isascii(CurTok)) - return ErrorP("Expected binary operator"); - FnName = "binary"; - FnName += (char)CurTok; - Kind = 2; - getNextToken(); - - // Read the precedence if present. - if (CurTok == tok_number) { - if (NumVal < 1 || NumVal > 100) - return ErrorP("Invalid precedecnce: must be 1..100"); - BinaryPrecedence = (unsigned)NumVal; - getNextToken(); - } - break; - } - - if (CurTok != '(') - return ErrorP("Expected '(' in prototype"); - - std::vector ArgNames; - while (getNextToken() == tok_identifier) - ArgNames.push_back(IdentifierStr); - if (CurTok != ')') - return ErrorP("Expected ')' in prototype"); - - // success. - getNextToken(); // eat ')'. - - // Verify right number of names for operator. - if (Kind && ArgNames.size() != Kind) - return ErrorP("Invalid number of operands for operator"); - - return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence); -} - -/// definition ::= 'def' prototype expression -static FunctionAST *ParseDefinition() { - getNextToken(); // eat def. - PrototypeAST *Proto = ParsePrototype(); - if (Proto == 0) return 0; - - if (ExprAST *E = ParseExpression()) - return new FunctionAST(Proto, E); - return 0; -} - -/// toplevelexpr ::= expression -static FunctionAST *ParseTopLevelExpr() { - if (ExprAST *E = ParseExpression()) { - // Make an anonymous proto. - PrototypeAST *Proto = new PrototypeAST("", std::vector()); - return new FunctionAST(Proto, E); - } - return 0; -} - -/// external ::= 'extern' prototype -static PrototypeAST *ParseExtern() { - getNextToken(); // eat extern. - return ParsePrototype(); -} - -//===----------------------------------------------------------------------===// -// Code Generation -//===----------------------------------------------------------------------===// - -static Module *TheModule; -static IRBuilder<> Builder(getGlobalContext()); -static std::map NamedValues; -static FunctionPassManager *TheFPM; - -Value *ErrorV(const char *Str) { Error(Str); return 0; } - -/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of -/// the function. This is used for mutable variables etc. -static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction, - const std::string &VarName) { - IRBuilder<> TmpB(&TheFunction->getEntryBlock(), - TheFunction->getEntryBlock().begin()); - return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0, - VarName.c_str()); -} - -Value *NumberExprAST::Codegen() { - return ConstantFP::get(getGlobalContext(), APFloat(Val)); -} - -Value *VariableExprAST::Codegen() { - // Look this variable up in the function. - Value *V = NamedValues[Name]; - if (V == 0) return ErrorV("Unknown variable name"); - - // Load the value. - return Builder.CreateLoad(V, Name.c_str()); -} - -Value *UnaryExprAST::Codegen() { - Value *OperandV = Operand->Codegen(); - if (OperandV == 0) return 0; - - Function *F = TheModule->getFunction(std::string("unary")+Opcode); - if (F == 0) - return ErrorV("Unknown unary operator"); - - return Builder.CreateCall(F, OperandV, "unop"); -} - -Value *BinaryExprAST::Codegen() { - // Special case '=' because we don't want to emit the LHS as an expression. - if (Op == '=') { - // Assignment requires the LHS to be an identifier. - VariableExprAST *LHSE = dynamic_cast(LHS); - if (!LHSE) - return ErrorV("destination of '=' must be a variable"); - // Codegen the RHS. - Value *Val = RHS->Codegen(); - if (Val == 0) return 0; - - // Look up the name. - Value *Variable = NamedValues[LHSE->getName()]; - if (Variable == 0) return ErrorV("Unknown variable name"); - - Builder.CreateStore(Val, Variable); - return Val; - } - - Value *L = LHS->Codegen(); - Value *R = RHS->Codegen(); - if (L == 0 || R == 0) return 0; - - switch (Op) { - case '+': return Builder.CreateAdd(L, R, "addtmp"); - case '-': return Builder.CreateSub(L, R, "subtmp"); - case '*': return Builder.CreateMul(L, R, "multmp"); - case '<': - L = Builder.CreateFCmpULT(L, R, "cmptmp"); - // Convert bool 0/1 to double 0.0 or 1.0 - return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), - "booltmp"); - default: break; - } - - // If it wasn't a builtin binary operator, it must be a user defined one. Emit - // a call to it. - Function *F = TheModule->getFunction(std::string("binary")+Op); - assert(F && "binary operator not found!"); - - Value *Ops[] = { L, R }; - return Builder.CreateCall(F, Ops, Ops+2, "binop"); -} - -Value *CallExprAST::Codegen() { - // Look up the name in the global module table. - Function *CalleeF = TheModule->getFunction(Callee); - if (CalleeF == 0) - return ErrorV("Unknown function referenced"); - - // If argument mismatch error. - if (CalleeF->arg_size() != Args.size()) - return ErrorV("Incorrect # arguments passed"); - - std::vector ArgsV; - for (unsigned i = 0, e = Args.size(); i != e; ++i) { - ArgsV.push_back(Args[i]->Codegen()); - if (ArgsV.back() == 0) return 0; - } - - return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp"); -} - -Value *IfExprAST::Codegen() { - Value *CondV = Cond->Codegen(); - if (CondV == 0) return 0; - - // Convert condition to a bool by comparing equal to 0.0. - CondV = Builder.CreateFCmpONE(CondV, - ConstantFP::get(getGlobalContext(), APFloat(0.0)), - "ifcond"); - - Function *TheFunction = Builder.GetInsertBlock()->getParent(); - - // Create blocks for the then and else cases. Insert the 'then' block at the - // end of the function. - BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction); - BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else"); - BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont"); - - Builder.CreateCondBr(CondV, ThenBB, ElseBB); - - // Emit then value. - Builder.SetInsertPoint(ThenBB); - - Value *ThenV = Then->Codegen(); - if (ThenV == 0) return 0; - - Builder.CreateBr(MergeBB); - // Codegen of 'Then' can change the current block, update ThenBB for the PHI. - ThenBB = Builder.GetInsertBlock(); - - // Emit else block. - TheFunction->getBasicBlockList().push_back(ElseBB); - Builder.SetInsertPoint(ElseBB); - - Value *ElseV = Else->Codegen(); - if (ElseV == 0) return 0; - - Builder.CreateBr(MergeBB); - // Codegen of 'Else' can change the current block, update ElseBB for the PHI. - ElseBB = Builder.GetInsertBlock(); - - // Emit merge block. - TheFunction->getBasicBlockList().push_back(MergeBB); - Builder.SetInsertPoint(MergeBB); - PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), - "iftmp"); - - PN->addIncoming(ThenV, ThenBB); - PN->addIncoming(ElseV, ElseBB); - return PN; -} - -Value *ForExprAST::Codegen() { - // Output this as: - // var = alloca double - // ... - // start = startexpr - // store start -> var - // goto loop - // loop: - // ... - // bodyexpr - // ... - // loopend: - // step = stepexpr - // endcond = endexpr - // - // curvar = load var - // nextvar = curvar + step - // store nextvar -> var - // br endcond, loop, endloop - // outloop: - - Function *TheFunction = Builder.GetInsertBlock()->getParent(); - - // Create an alloca for the variable in the entry block. - AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); - - // Emit the start code first, without 'variable' in scope. - Value *StartVal = Start->Codegen(); - if (StartVal == 0) return 0; - - // Store the value into the alloca. - Builder.CreateStore(StartVal, Alloca); - - // Make the new basic block for the loop header, inserting after current - // block. - BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction); - - // Insert an explicit fall through from the current block to the LoopBB. - Builder.CreateBr(LoopBB); - - // Start insertion in LoopBB. - Builder.SetInsertPoint(LoopBB); - - // Within the loop, the variable is defined equal to the PHI node. If it - // shadows an existing variable, we have to restore it, so save it now. - AllocaInst *OldVal = NamedValues[VarName]; - NamedValues[VarName] = Alloca; - - // Emit the body of the loop. This, like any other expr, can change the - // current BB. Note that we ignore the value computed by the body, but don't - // allow an error. - if (Body->Codegen() == 0) - return 0; - - // Emit the step value. - Value *StepVal; - if (Step) { - StepVal = Step->Codegen(); - if (StepVal == 0) return 0; - } else { - // If not specified, use 1.0. - StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); - } - - // Compute the end condition. - Value *EndCond = End->Codegen(); - if (EndCond == 0) return EndCond; - - // Reload, increment, and restore the alloca. This handles the case where - // the body of the loop mutates the variable. - Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str()); - Value *NextVar = Builder.CreateAdd(CurVar, StepVal, "nextvar"); - Builder.CreateStore(NextVar, Alloca); - - // Convert condition to a bool by comparing equal to 0.0. - EndCond = Builder.CreateFCmpONE(EndCond, - ConstantFP::get(getGlobalContext(), APFloat(0.0)), - "loopcond"); - - // Create the "after loop" block and insert it. - BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction); - - // Insert the conditional branch into the end of LoopEndBB. - Builder.CreateCondBr(EndCond, LoopBB, AfterBB); - - // Any new code will be inserted in AfterBB. - Builder.SetInsertPoint(AfterBB); - - // Restore the unshadowed variable. - if (OldVal) - NamedValues[VarName] = OldVal; - else - NamedValues.erase(VarName); - - - // for expr always returns 0.0. - return Constant::getNullValue(Type::getDoubleTy(getGlobalContext())); -} - -Value *VarExprAST::Codegen() { - std::vector OldBindings; - - Function *TheFunction = Builder.GetInsertBlock()->getParent(); - - // Register all variables and emit their initializer. - for (unsigned i = 0, e = VarNames.size(); i != e; ++i) { - const std::string &VarName = VarNames[i].first; - ExprAST *Init = VarNames[i].second; - - // Emit the initializer before adding the variable to scope, this prevents - // the initializer from referencing the variable itself, and permits stuff - // like this: - // var a = 1 in - // var a = a in ... # refers to outer 'a'. - Value *InitVal; - if (Init) { - InitVal = Init->Codegen(); - if (InitVal == 0) return 0; - } else { // If not specified, use 0.0. - InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0)); - } - - AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); - Builder.CreateStore(InitVal, Alloca); - - // Remember the old variable binding so that we can restore the binding when - // we unrecurse. - OldBindings.push_back(NamedValues[VarName]); - - // Remember this binding. - NamedValues[VarName] = Alloca; - } - - // Codegen the body, now that all vars are in scope. - Value *BodyVal = Body->Codegen(); - if (BodyVal == 0) return 0; - - // Pop all our variables from scope. - for (unsigned i = 0, e = VarNames.size(); i != e; ++i) - NamedValues[VarNames[i].first] = OldBindings[i]; - - // Return the body computation. - return BodyVal; -} - -Function *PrototypeAST::Codegen() { - // Make the function type: double(double,double) etc. - std::vector Doubles(Args.size(), - Type::getDoubleTy(getGlobalContext())); - FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()), - Doubles, false); - - Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); - - // If F conflicted, there was already something named 'Name'. If it has a - // body, don't allow redefinition or reextern. - if (F->getName() != Name) { - // Delete the one we just made and get the existing one. - F->eraseFromParent(); - F = TheModule->getFunction(Name); - - // If F already has a body, reject this. - if (!F->empty()) { - ErrorF("redefinition of function"); - return 0; - } - - // If F took a different number of args, reject. - if (F->arg_size() != Args.size()) { - ErrorF("redefinition of function with different # args"); - return 0; - } - } - - // Set names for all arguments. - unsigned Idx = 0; - for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size(); - ++AI, ++Idx) - AI->setName(Args[Idx]); - - return F; -} - -/// CreateArgumentAllocas - Create an alloca for each argument and register the -/// argument in the symbol table so that references to it will succeed. -void PrototypeAST::CreateArgumentAllocas(Function *F) { - Function::arg_iterator AI = F->arg_begin(); - for (unsigned Idx = 0, e = Args.size(); Idx != e; ++Idx, ++AI) { - // Create an alloca for this variable. - AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]); - - // Store the initial value into the alloca. - Builder.CreateStore(AI, Alloca); - - // Add arguments to variable symbol table. - NamedValues[Args[Idx]] = Alloca; - } -} - -Function *FunctionAST::Codegen() { - NamedValues.clear(); - - Function *TheFunction = Proto->Codegen(); - if (TheFunction == 0) - return 0; - - // If this is an operator, install it. - if (Proto->isBinaryOp()) - BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence(); - - // Create a new basic block to start insertion into. - BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction); - Builder.SetInsertPoint(BB); - - // Add all arguments to the symbol table and create their allocas. - Proto->CreateArgumentAllocas(TheFunction); - - if (Value *RetVal = Body->Codegen()) { - // Finish off the function. - Builder.CreateRet(RetVal); - - // Validate the generated code, checking for consistency. - verifyFunction(*TheFunction); - - // Optimize the function. - TheFPM->run(*TheFunction); - - return TheFunction; - } - - // Error reading body, remove function. - TheFunction->eraseFromParent(); - - if (Proto->isBinaryOp()) - BinopPrecedence.erase(Proto->getOperatorName()); - return 0; -} - -//===----------------------------------------------------------------------===// -// Top-Level parsing and JIT Driver -//===----------------------------------------------------------------------===// - -static ExecutionEngine *TheExecutionEngine; - -static void HandleDefinition() { - if (FunctionAST *F = ParseDefinition()) { - if (Function *LF = F->Codegen()) { - fprintf(stderr, "Read function definition:"); - LF->dump(); - } - } else { - // Skip token for error recovery. - getNextToken(); - } -} - -static void HandleExtern() { - if (PrototypeAST *P = ParseExtern()) { - if (Function *F = P->Codegen()) { - fprintf(stderr, "Read extern: "); - F->dump(); - } - } else { - // Skip token for error recovery. - getNextToken(); - } -} - -static void HandleTopLevelExpression() { - // Evaluate a top-level expression into an anonymous function. - if (FunctionAST *F = ParseTopLevelExpr()) { - if (Function *LF = F->Codegen()) { - // JIT the function, returning a function pointer. - void *FPtr = TheExecutionEngine->getPointerToFunction(LF); - - // Cast it to the right type (takes no arguments, returns a double) so we - // can call it as a native function. - double (*FP)() = (double (*)())(intptr_t)FPtr; - fprintf(stderr, "Evaluated to %f\n", FP()); - } - } else { - // Skip token for error recovery. - getNextToken(); - } -} - -/// top ::= definition | external | expression | ';' -static void MainLoop() { - while (1) { - fprintf(stderr, "ready> "); - switch (CurTok) { - case tok_eof: return; - case ';': getNextToken(); break; // ignore top-level semicolons. - case tok_def: HandleDefinition(); break; - case tok_extern: HandleExtern(); break; - default: HandleTopLevelExpression(); break; - } - } -} - -//===----------------------------------------------------------------------===// -// "Library" functions that can be "extern'd" from user code. -//===----------------------------------------------------------------------===// - -/// putchard - putchar that takes a double and returns 0. -extern "C" -double putchard(double X) { - putchar((char)X); - return 0; -} - -/// printd - printf that takes a double prints it as "%f\n", returning 0. -extern "C" -double printd(double X) { - printf("%f\n", X); - return 0; -} - -//===----------------------------------------------------------------------===// -// Main driver code. -//===----------------------------------------------------------------------===// - -int main() { - InitializeNativeTarget(); - LLVMContext &Context = getGlobalContext(); - - // Install standard binary operators. - // 1 is lowest precedence. - BinopPrecedence['='] = 2; - BinopPrecedence['<'] = 10; - BinopPrecedence['+'] = 20; - BinopPrecedence['-'] = 20; - BinopPrecedence['*'] = 40; // highest. - - // Prime the first token. - fprintf(stderr, "ready> "); - getNextToken(); - - // Make the module, which holds all the code. - TheModule = new Module("my cool jit", Context); - - ExistingModuleProvider *OurModuleProvider = - new ExistingModuleProvider(TheModule); - - // Create the JIT. This takes ownership of the module and module provider. - TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); - - FunctionPassManager OurFPM(OurModuleProvider); - - // Set up the optimizer pipeline. Start with registering info about how the - // target lays out data structures. - OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); - // Promote allocas to registers. - OurFPM.add(createPromoteMemoryToRegisterPass()); - // Do simple "peephole" optimizations and bit-twiddling optzns. - OurFPM.add(createInstructionCombiningPass()); - // Reassociate expressions. - OurFPM.add(createReassociatePass()); - // Eliminate Common SubExpressions. - OurFPM.add(createGVNPass()); - // Simplify the control flow graph (deleting unreachable blocks, etc). - OurFPM.add(createCFGSimplificationPass()); - - OurFPM.doInitialization(); - - // Set the global so the code gen can use this. - TheFPM = &OurFPM; - - // Run the main "interpreter loop" now. - MainLoop(); - - TheFPM = 0; - - // Print out all of the generated code. - TheModule->dump(); - - return 0; -} From idadesub at users.sourceforge.net Tue Sep 22 16:15:19 2009 From: idadesub at users.sourceforge.net (Erick Tryzelaar) Date: Tue, 22 Sep 2009 21:15:19 -0000 Subject: [llvm-commits] [llvm] r82574 - in /llvm/trunk/examples/Kaleidoscope: CMakeLists.txt Chapter2/ Chapter2/CMakeLists.txt Chapter2/Makefile Chapter2/toy.cpp Chapter3/ Chapter3/CMakeLists.txt Chapter3/Makefile Chapter3/toy.cpp Chapter4/ Chapter4/CMakeLists.txt Chapter4/Makefile Chapter4/toy.cpp Chapter5/ Chapter5/CMakeLists.txt Chapter5/Makefile Chapter5/toy.cpp Chapter6/ Chapter6/CMakeLists.txt Chapter6/Makefile Chapter6/toy.cpp Chapter7/Makefile Makefile Message-ID: <200909222115.n8MLFK1P001325@zion.cs.uiuc.edu> Author: erickt Date: Tue Sep 22 16:15:19 2009 New Revision: 82574 URL: http://llvm.org/viewvc/llvm-project?rev=82574&view=rev Log: Add examples for Kaleidoscope chapters 2 through 6. Conflicts: examples/Makefile Added: llvm/trunk/examples/Kaleidoscope/Chapter2/ llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter2/Makefile - copied, changed from r82573, llvm/trunk/examples/Kaleidoscope/Makefile llvm/trunk/examples/Kaleidoscope/Chapter2/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter3/ llvm/trunk/examples/Kaleidoscope/Chapter3/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter3/Makefile - copied, changed from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter4/ llvm/trunk/examples/Kaleidoscope/Chapter4/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile - copied, changed from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter5/ llvm/trunk/examples/Kaleidoscope/Chapter5/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile - copied, changed from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp llvm/trunk/examples/Kaleidoscope/Chapter6/ llvm/trunk/examples/Kaleidoscope/Chapter6/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile - copied, changed from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp Modified: llvm/trunk/examples/Kaleidoscope/CMakeLists.txt llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile llvm/trunk/examples/Kaleidoscope/Makefile Modified: llvm/trunk/examples/Kaleidoscope/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/CMakeLists.txt?rev=82574&r1=82573&r2=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/CMakeLists.txt (original) +++ llvm/trunk/examples/Kaleidoscope/CMakeLists.txt Tue Sep 22 16:15:19 2009 @@ -1 +1,6 @@ +add_subdirectory(Chapter2) +add_subdirectory(Chapter3) +add_subdirectory(Chapter4) +add_subdirectory(Chapter5) +add_subdirectory(Chapter6) add_subdirectory(Chapter7) Added: llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter2/CMakeLists.txt Tue Sep 22 16:15:19 2009 @@ -0,0 +1,3 @@ +add_llvm_example(Kaleidoscope-Ch2 + toy.cpp + ) Copied: llvm/trunk/examples/Kaleidoscope/Chapter2/Makefile (from r82573, llvm/trunk/examples/Kaleidoscope/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter2/Makefile?p2=llvm/trunk/examples/Kaleidoscope/Chapter2/Makefile&p1=llvm/trunk/examples/Kaleidoscope/Makefile&r1=82573&r2=82574&rev=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter2/Makefile Tue Sep 22 16:15:19 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope/Makefile ----------------------*- Makefile -*-===## +##===- examples/Kaleidoscope/Chapter2/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,10 +6,8 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL=../.. - -include $(LEVEL)/Makefile.config - -PARALLEL_DIRS:= Chapter7 +LEVEL = ../../.. +TOOLNAME = Kaleidoscope-Ch2 +EXAMPLE_TOOL = 1 include $(LEVEL)/Makefile.common Added: llvm/trunk/examples/Kaleidoscope/Chapter2/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter2/toy.cpp?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter2/toy.cpp (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter2/toy.cpp Tue Sep 22 16:15:19 2009 @@ -0,0 +1,398 @@ +#include +#include +#include +#include +#include + +//===----------------------------------------------------------------------===// +// Lexer +//===----------------------------------------------------------------------===// + +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one +// of these for known things. +enum Token { + tok_eof = -1, + + // commands + tok_def = -2, tok_extern = -3, + + // primary + tok_identifier = -4, tok_number = -5 +}; + +static std::string IdentifierStr; // Filled in if tok_identifier +static double NumVal; // Filled in if tok_number + +/// gettok - Return the next token from standard input. +static int gettok() { + static int LastChar = ' '; + + // Skip any whitespace. + while (isspace(LastChar)) + LastChar = getchar(); + + if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]* + IdentifierStr = LastChar; + while (isalnum((LastChar = getchar()))) + IdentifierStr += LastChar; + + if (IdentifierStr == "def") return tok_def; + if (IdentifierStr == "extern") return tok_extern; + return tok_identifier; + } + + if (isdigit(LastChar) || LastChar == '.') { // Number: [0-9.]+ + std::string NumStr; + do { + NumStr += LastChar; + LastChar = getchar(); + } while (isdigit(LastChar) || LastChar == '.'); + + NumVal = strtod(NumStr.c_str(), 0); + return tok_number; + } + + if (LastChar == '#') { + // Comment until end of line. + do LastChar = getchar(); + while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); + + if (LastChar != EOF) + return gettok(); + } + + // Check for end of file. Don't eat the EOF. + if (LastChar == EOF) + return tok_eof; + + // Otherwise, just return the character as its ascii value. + int ThisChar = LastChar; + LastChar = getchar(); + return ThisChar; +} + +//===----------------------------------------------------------------------===// +// Abstract Syntax Tree (aka Parse Tree) +//===----------------------------------------------------------------------===// + +/// ExprAST - Base class for all expression nodes. +class ExprAST { +public: + virtual ~ExprAST() {} +}; + +/// NumberExprAST - Expression class for numeric literals like "1.0". +class NumberExprAST : public ExprAST { + double Val; +public: + NumberExprAST(double val) : Val(val) {} +}; + +/// VariableExprAST - Expression class for referencing a variable, like "a". +class VariableExprAST : public ExprAST { + std::string Name; +public: + VariableExprAST(const std::string &name) : Name(name) {} +}; + +/// BinaryExprAST - Expression class for a binary operator. +class BinaryExprAST : public ExprAST { + char Op; + ExprAST *LHS, *RHS; +public: + BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) + : Op(op), LHS(lhs), RHS(rhs) {} +}; + +/// CallExprAST - Expression class for function calls. +class CallExprAST : public ExprAST { + std::string Callee; + std::vector Args; +public: + CallExprAST(const std::string &callee, std::vector &args) + : Callee(callee), Args(args) {} +}; + +/// PrototypeAST - This class represents the "prototype" for a function, +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). +class PrototypeAST { + std::string Name; + std::vector Args; +public: + PrototypeAST(const std::string &name, const std::vector &args) + : Name(name), Args(args) {} + +}; + +/// FunctionAST - This class represents a function definition itself. +class FunctionAST { + PrototypeAST *Proto; + ExprAST *Body; +public: + FunctionAST(PrototypeAST *proto, ExprAST *body) + : Proto(proto), Body(body) {} + +}; + +//===----------------------------------------------------------------------===// +// Parser +//===----------------------------------------------------------------------===// + +/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current +/// token the parser is looking at. getNextToken reads another token from the +/// lexer and updates CurTok with its results. +static int CurTok; +static int getNextToken() { + return CurTok = gettok(); +} + +/// BinopPrecedence - This holds the precedence for each binary operator that is +/// defined. +static std::map BinopPrecedence; + +/// GetTokPrecedence - Get the precedence of the pending binary operator token. +static int GetTokPrecedence() { + if (!isascii(CurTok)) + return -1; + + // Make sure it's a declared binop. + int TokPrec = BinopPrecedence[CurTok]; + if (TokPrec <= 0) return -1; + return TokPrec; +} + +/// Error* - These are little helper functions for error handling. +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;} +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; } +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; } + +static ExprAST *ParseExpression(); + +/// identifierexpr +/// ::= identifier +/// ::= identifier '(' expression* ')' +static ExprAST *ParseIdentifierExpr() { + std::string IdName = IdentifierStr; + + getNextToken(); // eat identifier. + + if (CurTok != '(') // Simple variable ref. + return new VariableExprAST(IdName); + + // Call. + getNextToken(); // eat ( + std::vector Args; + if (CurTok != ')') { + while (1) { + ExprAST *Arg = ParseExpression(); + if (!Arg) return 0; + Args.push_back(Arg); + + if (CurTok == ')') break; + + if (CurTok != ',') + return Error("Expected ')' or ',' in argument list"); + getNextToken(); + } + } + + // Eat the ')'. + getNextToken(); + + return new CallExprAST(IdName, Args); +} + +/// numberexpr ::= number +static ExprAST *ParseNumberExpr() { + ExprAST *Result = new NumberExprAST(NumVal); + getNextToken(); // consume the number + return Result; +} + +/// parenexpr ::= '(' expression ')' +static ExprAST *ParseParenExpr() { + getNextToken(); // eat (. + ExprAST *V = ParseExpression(); + if (!V) return 0; + + if (CurTok != ')') + return Error("expected ')'"); + getNextToken(); // eat ). + return V; +} + +/// primary +/// ::= identifierexpr +/// ::= numberexpr +/// ::= parenexpr +static ExprAST *ParsePrimary() { + switch (CurTok) { + default: return Error("unknown token when expecting an expression"); + case tok_identifier: return ParseIdentifierExpr(); + case tok_number: return ParseNumberExpr(); + case '(': return ParseParenExpr(); + } +} + +/// binoprhs +/// ::= ('+' primary)* +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) { + // If this is a binop, find its precedence. + while (1) { + int TokPrec = GetTokPrecedence(); + + // If this is a binop that binds at least as tightly as the current binop, + // consume it, otherwise we are done. + if (TokPrec < ExprPrec) + return LHS; + + // Okay, we know this is a binop. + int BinOp = CurTok; + getNextToken(); // eat binop + + // Parse the primary expression after the binary operator. + ExprAST *RHS = ParsePrimary(); + if (!RHS) return 0; + + // If BinOp binds less tightly with RHS than the operator after RHS, let + // the pending operator take RHS as its LHS. + int NextPrec = GetTokPrecedence(); + if (TokPrec < NextPrec) { + RHS = ParseBinOpRHS(TokPrec+1, RHS); + if (RHS == 0) return 0; + } + + // Merge LHS/RHS. + LHS = new BinaryExprAST(BinOp, LHS, RHS); + } +} + +/// expression +/// ::= primary binoprhs +/// +static ExprAST *ParseExpression() { + ExprAST *LHS = ParsePrimary(); + if (!LHS) return 0; + + return ParseBinOpRHS(0, LHS); +} + +/// prototype +/// ::= id '(' id* ')' +static PrototypeAST *ParsePrototype() { + if (CurTok != tok_identifier) + return ErrorP("Expected function name in prototype"); + + std::string FnName = IdentifierStr; + getNextToken(); + + if (CurTok != '(') + return ErrorP("Expected '(' in prototype"); + + std::vector ArgNames; + while (getNextToken() == tok_identifier) + ArgNames.push_back(IdentifierStr); + if (CurTok != ')') + return ErrorP("Expected ')' in prototype"); + + // success. + getNextToken(); // eat ')'. + + return new PrototypeAST(FnName, ArgNames); +} + +/// definition ::= 'def' prototype expression +static FunctionAST *ParseDefinition() { + getNextToken(); // eat def. + PrototypeAST *Proto = ParsePrototype(); + if (Proto == 0) return 0; + + if (ExprAST *E = ParseExpression()) + return new FunctionAST(Proto, E); + return 0; +} + +/// toplevelexpr ::= expression +static FunctionAST *ParseTopLevelExpr() { + if (ExprAST *E = ParseExpression()) { + // Make an anonymous proto. + PrototypeAST *Proto = new PrototypeAST("", std::vector()); + return new FunctionAST(Proto, E); + } + return 0; +} + +/// external ::= 'extern' prototype +static PrototypeAST *ParseExtern() { + getNextToken(); // eat extern. + return ParsePrototype(); +} + +//===----------------------------------------------------------------------===// +// Top-Level parsing +//===----------------------------------------------------------------------===// + +static void HandleDefinition() { + if (ParseDefinition()) { + fprintf(stderr, "Parsed a function definition.\n"); + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleExtern() { + if (ParseExtern()) { + fprintf(stderr, "Parsed an extern\n"); + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleTopLevelExpression() { + // Evaluate a top-level expression into an anonymous function. + if (ParseTopLevelExpr()) { + fprintf(stderr, "Parsed a top-level expr\n"); + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +/// top ::= definition | external | expression | ';' +static void MainLoop() { + while (1) { + fprintf(stderr, "ready> "); + switch (CurTok) { + case tok_eof: return; + case ';': getNextToken(); break; // ignore top-level semicolons. + case tok_def: HandleDefinition(); break; + case tok_extern: HandleExtern(); break; + default: HandleTopLevelExpression(); break; + } + } +} + +//===----------------------------------------------------------------------===// +// Main driver code. +//===----------------------------------------------------------------------===// + +int main() { + // Install standard binary operators. + // 1 is lowest precedence. + BinopPrecedence['<'] = 10; + BinopPrecedence['+'] = 20; + BinopPrecedence['-'] = 20; + BinopPrecedence['*'] = 40; // highest. + + // Prime the first token. + fprintf(stderr, "ready> "); + getNextToken(); + + // Run the main "interpreter loop" now. + MainLoop(); + + return 0; +} Added: llvm/trunk/examples/Kaleidoscope/Chapter3/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter3/CMakeLists.txt?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter3/CMakeLists.txt (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter3/CMakeLists.txt Tue Sep 22 16:15:19 2009 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS core) + +add_llvm_example(Kaleidoscope-Ch3 + toy.cpp + ) Copied: llvm/trunk/examples/Kaleidoscope/Chapter3/Makefile (from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter3/Makefile?p2=llvm/trunk/examples/Kaleidoscope/Chapter3/Makefile&p1=llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile&r1=82573&r2=82574&rev=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter3/Makefile Tue Sep 22 16:15:19 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope-Ch7/Makefile ------------------*- Makefile -*-===## +##===- examples/Kaleidoscope/Chapter3/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,10 +6,10 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = Kaleidoscope-Ch7 +LEVEL = ../../.. +TOOLNAME = Kaleidoscope-Ch3 EXAMPLE_TOOL = 1 -LINK_COMPONENTS := core jit interpreter native +LINK_COMPONENTS := core include $(LEVEL)/Makefile.common Added: llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp Tue Sep 22 16:15:19 2009 @@ -0,0 +1,563 @@ +#include "llvm/DerivedTypes.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Support/IRBuilder.h" +#include +#include +#include +#include +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Lexer +//===----------------------------------------------------------------------===// + +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one +// of these for known things. +enum Token { + tok_eof = -1, + + // commands + tok_def = -2, tok_extern = -3, + + // primary + tok_identifier = -4, tok_number = -5 +}; + +static std::string IdentifierStr; // Filled in if tok_identifier +static double NumVal; // Filled in if tok_number + +/// gettok - Return the next token from standard input. +static int gettok() { + static int LastChar = ' '; + + // Skip any whitespace. + while (isspace(LastChar)) + LastChar = getchar(); + + if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]* + IdentifierStr = LastChar; + while (isalnum((LastChar = getchar()))) + IdentifierStr += LastChar; + + if (IdentifierStr == "def") return tok_def; + if (IdentifierStr == "extern") return tok_extern; + return tok_identifier; + } + + if (isdigit(LastChar) || LastChar == '.') { // Number: [0-9.]+ + std::string NumStr; + do { + NumStr += LastChar; + LastChar = getchar(); + } while (isdigit(LastChar) || LastChar == '.'); + + NumVal = strtod(NumStr.c_str(), 0); + return tok_number; + } + + if (LastChar == '#') { + // Comment until end of line. + do LastChar = getchar(); + while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); + + if (LastChar != EOF) + return gettok(); + } + + // Check for end of file. Don't eat the EOF. + if (LastChar == EOF) + return tok_eof; + + // Otherwise, just return the character as its ascii value. + int ThisChar = LastChar; + LastChar = getchar(); + return ThisChar; +} + +//===----------------------------------------------------------------------===// +// Abstract Syntax Tree (aka Parse Tree) +//===----------------------------------------------------------------------===// + +/// ExprAST - Base class for all expression nodes. +class ExprAST { +public: + virtual ~ExprAST() {} + virtual Value *Codegen() = 0; +}; + +/// NumberExprAST - Expression class for numeric literals like "1.0". +class NumberExprAST : public ExprAST { + double Val; +public: + NumberExprAST(double val) : Val(val) {} + virtual Value *Codegen(); +}; + +/// VariableExprAST - Expression class for referencing a variable, like "a". +class VariableExprAST : public ExprAST { + std::string Name; +public: + VariableExprAST(const std::string &name) : Name(name) {} + virtual Value *Codegen(); +}; + +/// BinaryExprAST - Expression class for a binary operator. +class BinaryExprAST : public ExprAST { + char Op; + ExprAST *LHS, *RHS; +public: + BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) + : Op(op), LHS(lhs), RHS(rhs) {} + virtual Value *Codegen(); +}; + +/// CallExprAST - Expression class for function calls. +class CallExprAST : public ExprAST { + std::string Callee; + std::vector Args; +public: + CallExprAST(const std::string &callee, std::vector &args) + : Callee(callee), Args(args) {} + virtual Value *Codegen(); +}; + +/// PrototypeAST - This class represents the "prototype" for a function, +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). +class PrototypeAST { + std::string Name; + std::vector Args; +public: + PrototypeAST(const std::string &name, const std::vector &args) + : Name(name), Args(args) {} + + Function *Codegen(); +}; + +/// FunctionAST - This class represents a function definition itself. +class FunctionAST { + PrototypeAST *Proto; + ExprAST *Body; +public: + FunctionAST(PrototypeAST *proto, ExprAST *body) + : Proto(proto), Body(body) {} + + Function *Codegen(); +}; + +//===----------------------------------------------------------------------===// +// Parser +//===----------------------------------------------------------------------===// + +/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current +/// token the parser is looking at. getNextToken reads another token from the +/// lexer and updates CurTok with its results. +static int CurTok; +static int getNextToken() { + return CurTok = gettok(); +} + +/// BinopPrecedence - This holds the precedence for each binary operator that is +/// defined. +static std::map BinopPrecedence; + +/// GetTokPrecedence - Get the precedence of the pending binary operator token. +static int GetTokPrecedence() { + if (!isascii(CurTok)) + return -1; + + // Make sure it's a declared binop. + int TokPrec = BinopPrecedence[CurTok]; + if (TokPrec <= 0) return -1; + return TokPrec; +} + +/// Error* - These are little helper functions for error handling. +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;} +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; } +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; } + +static ExprAST *ParseExpression(); + +/// identifierexpr +/// ::= identifier +/// ::= identifier '(' expression* ')' +static ExprAST *ParseIdentifierExpr() { + std::string IdName = IdentifierStr; + + getNextToken(); // eat identifier. + + if (CurTok != '(') // Simple variable ref. + return new VariableExprAST(IdName); + + // Call. + getNextToken(); // eat ( + std::vector Args; + if (CurTok != ')') { + while (1) { + ExprAST *Arg = ParseExpression(); + if (!Arg) return 0; + Args.push_back(Arg); + + if (CurTok == ')') break; + + if (CurTok != ',') + return Error("Expected ')' or ',' in argument list"); + getNextToken(); + } + } + + // Eat the ')'. + getNextToken(); + + return new CallExprAST(IdName, Args); +} + +/// numberexpr ::= number +static ExprAST *ParseNumberExpr() { + ExprAST *Result = new NumberExprAST(NumVal); + getNextToken(); // consume the number + return Result; +} + +/// parenexpr ::= '(' expression ')' +static ExprAST *ParseParenExpr() { + getNextToken(); // eat (. + ExprAST *V = ParseExpression(); + if (!V) return 0; + + if (CurTok != ')') + return Error("expected ')'"); + getNextToken(); // eat ). + return V; +} + +/// primary +/// ::= identifierexpr +/// ::= numberexpr +/// ::= parenexpr +static ExprAST *ParsePrimary() { + switch (CurTok) { + default: return Error("unknown token when expecting an expression"); + case tok_identifier: return ParseIdentifierExpr(); + case tok_number: return ParseNumberExpr(); + case '(': return ParseParenExpr(); + } +} + +/// binoprhs +/// ::= ('+' primary)* +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) { + // If this is a binop, find its precedence. + while (1) { + int TokPrec = GetTokPrecedence(); + + // If this is a binop that binds at least as tightly as the current binop, + // consume it, otherwise we are done. + if (TokPrec < ExprPrec) + return LHS; + + // Okay, we know this is a binop. + int BinOp = CurTok; + getNextToken(); // eat binop + + // Parse the primary expression after the binary operator. + ExprAST *RHS = ParsePrimary(); + if (!RHS) return 0; + + // If BinOp binds less tightly with RHS than the operator after RHS, let + // the pending operator take RHS as its LHS. + int NextPrec = GetTokPrecedence(); + if (TokPrec < NextPrec) { + RHS = ParseBinOpRHS(TokPrec+1, RHS); + if (RHS == 0) return 0; + } + + // Merge LHS/RHS. + LHS = new BinaryExprAST(BinOp, LHS, RHS); + } +} + +/// expression +/// ::= primary binoprhs +/// +static ExprAST *ParseExpression() { + ExprAST *LHS = ParsePrimary(); + if (!LHS) return 0; + + return ParseBinOpRHS(0, LHS); +} + +/// prototype +/// ::= id '(' id* ')' +static PrototypeAST *ParsePrototype() { + if (CurTok != tok_identifier) + return ErrorP("Expected function name in prototype"); + + std::string FnName = IdentifierStr; + getNextToken(); + + if (CurTok != '(') + return ErrorP("Expected '(' in prototype"); + + std::vector ArgNames; + while (getNextToken() == tok_identifier) + ArgNames.push_back(IdentifierStr); + if (CurTok != ')') + return ErrorP("Expected ')' in prototype"); + + // success. + getNextToken(); // eat ')'. + + return new PrototypeAST(FnName, ArgNames); +} + +/// definition ::= 'def' prototype expression +static FunctionAST *ParseDefinition() { + getNextToken(); // eat def. + PrototypeAST *Proto = ParsePrototype(); + if (Proto == 0) return 0; + + if (ExprAST *E = ParseExpression()) + return new FunctionAST(Proto, E); + return 0; +} + +/// toplevelexpr ::= expression +static FunctionAST *ParseTopLevelExpr() { + if (ExprAST *E = ParseExpression()) { + // Make an anonymous proto. + PrototypeAST *Proto = new PrototypeAST("", std::vector()); + return new FunctionAST(Proto, E); + } + return 0; +} + +/// external ::= 'extern' prototype +static PrototypeAST *ParseExtern() { + getNextToken(); // eat extern. + return ParsePrototype(); +} + +//===----------------------------------------------------------------------===// +// Code Generation +//===----------------------------------------------------------------------===// + +static Module *TheModule; +static IRBuilder<> Builder(getGlobalContext()); +static std::map NamedValues; + +Value *ErrorV(const char *Str) { Error(Str); return 0; } + +Value *NumberExprAST::Codegen() { + return ConstantFP::get(getGlobalContext(), APFloat(Val)); +} + +Value *VariableExprAST::Codegen() { + // Look this variable up in the function. + Value *V = NamedValues[Name]; + return V ? V : ErrorV("Unknown variable name"); +} + +Value *BinaryExprAST::Codegen() { + Value *L = LHS->Codegen(); + Value *R = RHS->Codegen(); + if (L == 0 || R == 0) return 0; + + switch (Op) { + case '+': return Builder.CreateAdd(L, R, "addtmp"); + case '-': return Builder.CreateSub(L, R, "subtmp"); + case '*': return Builder.CreateMul(L, R, "multmp"); + case '<': + L = Builder.CreateFCmpULT(L, R, "cmptmp"); + // Convert bool 0/1 to double 0.0 or 1.0 + return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), + "booltmp"); + default: return ErrorV("invalid binary operator"); + } +} + +Value *CallExprAST::Codegen() { + // Look up the name in the global module table. + Function *CalleeF = TheModule->getFunction(Callee); + if (CalleeF == 0) + return ErrorV("Unknown function referenced"); + + // If argument mismatch error. + if (CalleeF->arg_size() != Args.size()) + return ErrorV("Incorrect # arguments passed"); + + std::vector ArgsV; + for (unsigned i = 0, e = Args.size(); i != e; ++i) { + ArgsV.push_back(Args[i]->Codegen()); + if (ArgsV.back() == 0) return 0; + } + + return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp"); +} + +Function *PrototypeAST::Codegen() { + // Make the function type: double(double,double) etc. + std::vector Doubles(Args.size(), + Type::getDoubleTy(getGlobalContext())); + FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()), + Doubles, false); + + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); + + // If F conflicted, there was already something named 'Name'. If it has a + // body, don't allow redefinition or reextern. + if (F->getName() != Name) { + // Delete the one we just made and get the existing one. + F->eraseFromParent(); + F = TheModule->getFunction(Name); + + // If F already has a body, reject this. + if (!F->empty()) { + ErrorF("redefinition of function"); + return 0; + } + + // If F took a different number of args, reject. + if (F->arg_size() != Args.size()) { + ErrorF("redefinition of function with different # args"); + return 0; + } + } + + // Set names for all arguments. + unsigned Idx = 0; + for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size(); + ++AI, ++Idx) { + AI->setName(Args[Idx]); + + // Add arguments to variable symbol table. + NamedValues[Args[Idx]] = AI; + } + + return F; +} + +Function *FunctionAST::Codegen() { + NamedValues.clear(); + + Function *TheFunction = Proto->Codegen(); + if (TheFunction == 0) + return 0; + + // Create a new basic block to start insertion into. + BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction); + Builder.SetInsertPoint(BB); + + if (Value *RetVal = Body->Codegen()) { + // Finish off the function. + Builder.CreateRet(RetVal); + + // Validate the generated code, checking for consistency. + verifyFunction(*TheFunction); + + return TheFunction; + } + + // Error reading body, remove function. + TheFunction->eraseFromParent(); + return 0; +} + +//===----------------------------------------------------------------------===// +// Top-Level parsing and JIT Driver +//===----------------------------------------------------------------------===// + +static void HandleDefinition() { + if (FunctionAST *F = ParseDefinition()) { + if (Function *LF = F->Codegen()) { + fprintf(stderr, "Read function definition:"); + LF->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleExtern() { + if (PrototypeAST *P = ParseExtern()) { + if (Function *F = P->Codegen()) { + fprintf(stderr, "Read extern: "); + F->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleTopLevelExpression() { + // Evaluate a top-level expression into an anonymous function. + if (FunctionAST *F = ParseTopLevelExpr()) { + if (Function *LF = F->Codegen()) { + fprintf(stderr, "Read top-level expression:"); + LF->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +/// top ::= definition | external | expression | ';' +static void MainLoop() { + while (1) { + fprintf(stderr, "ready> "); + switch (CurTok) { + case tok_eof: return; + case ';': getNextToken(); break; // ignore top-level semicolons. + case tok_def: HandleDefinition(); break; + case tok_extern: HandleExtern(); break; + default: HandleTopLevelExpression(); break; + } + } +} + +//===----------------------------------------------------------------------===// +// "Library" functions that can be "extern'd" from user code. +//===----------------------------------------------------------------------===// + +/// putchard - putchar that takes a double and returns 0. +extern "C" +double putchard(double X) { + putchar((char)X); + return 0; +} + +//===----------------------------------------------------------------------===// +// Main driver code. +//===----------------------------------------------------------------------===// + +int main() { + LLVMContext &Context = getGlobalContext(); + + // Install standard binary operators. + // 1 is lowest precedence. + BinopPrecedence['<'] = 10; + BinopPrecedence['+'] = 20; + BinopPrecedence['-'] = 20; + BinopPrecedence['*'] = 40; // highest. + + // Prime the first token. + fprintf(stderr, "ready> "); + getNextToken(); + + // Make the module, which holds all the code. + TheModule = new Module("my cool jit", Context); + + // Run the main "interpreter loop" now. + MainLoop(); + + // Print out all of the generated code. + TheModule->dump(); + + return 0; +} Added: llvm/trunk/examples/Kaleidoscope/Chapter4/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter4/CMakeLists.txt?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter4/CMakeLists.txt (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter4/CMakeLists.txt Tue Sep 22 16:15:19 2009 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS core jit interpreter native) + +add_llvm_example(Kaleidoscope-Ch4 + toy.cpp + ) Copied: llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile (from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile?p2=llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile&p1=llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile&r1=82573&r2=82574&rev=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter4/Makefile Tue Sep 22 16:15:19 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope-Ch7/Makefile ------------------*- Makefile -*-===## +##===- examples/Kaleidoscope/Chapter4/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,8 +6,8 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = Kaleidoscope-Ch7 +LEVEL = ../../.. +TOOLNAME = Kaleidoscope-Ch4 EXAMPLE_TOOL = 1 LINK_COMPONENTS := core jit interpreter native Added: llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp Tue Sep 22 16:15:19 2009 @@ -0,0 +1,610 @@ +#include "llvm/DerivedTypes.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" +#include "llvm/ExecutionEngine/Interpreter.h" +#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/ModuleProvider.h" +#include "llvm/PassManager.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetSelect.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Support/IRBuilder.h" +#include +#include +#include +#include +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Lexer +//===----------------------------------------------------------------------===// + +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one +// of these for known things. +enum Token { + tok_eof = -1, + + // commands + tok_def = -2, tok_extern = -3, + + // primary + tok_identifier = -4, tok_number = -5 +}; + +static std::string IdentifierStr; // Filled in if tok_identifier +static double NumVal; // Filled in if tok_number + +/// gettok - Return the next token from standard input. +static int gettok() { + static int LastChar = ' '; + + // Skip any whitespace. + while (isspace(LastChar)) + LastChar = getchar(); + + if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]* + IdentifierStr = LastChar; + while (isalnum((LastChar = getchar()))) + IdentifierStr += LastChar; + + if (IdentifierStr == "def") return tok_def; + if (IdentifierStr == "extern") return tok_extern; + return tok_identifier; + } + + if (isdigit(LastChar) || LastChar == '.') { // Number: [0-9.]+ + std::string NumStr; + do { + NumStr += LastChar; + LastChar = getchar(); + } while (isdigit(LastChar) || LastChar == '.'); + + NumVal = strtod(NumStr.c_str(), 0); + return tok_number; + } + + if (LastChar == '#') { + // Comment until end of line. + do LastChar = getchar(); + while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); + + if (LastChar != EOF) + return gettok(); + } + + // Check for end of file. Don't eat the EOF. + if (LastChar == EOF) + return tok_eof; + + // Otherwise, just return the character as its ascii value. + int ThisChar = LastChar; + LastChar = getchar(); + return ThisChar; +} + +//===----------------------------------------------------------------------===// +// Abstract Syntax Tree (aka Parse Tree) +//===----------------------------------------------------------------------===// + +/// ExprAST - Base class for all expression nodes. +class ExprAST { +public: + virtual ~ExprAST() {} + virtual Value *Codegen() = 0; +}; + +/// NumberExprAST - Expression class for numeric literals like "1.0". +class NumberExprAST : public ExprAST { + double Val; +public: + NumberExprAST(double val) : Val(val) {} + virtual Value *Codegen(); +}; + +/// VariableExprAST - Expression class for referencing a variable, like "a". +class VariableExprAST : public ExprAST { + std::string Name; +public: + VariableExprAST(const std::string &name) : Name(name) {} + virtual Value *Codegen(); +}; + +/// BinaryExprAST - Expression class for a binary operator. +class BinaryExprAST : public ExprAST { + char Op; + ExprAST *LHS, *RHS; +public: + BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) + : Op(op), LHS(lhs), RHS(rhs) {} + virtual Value *Codegen(); +}; + +/// CallExprAST - Expression class for function calls. +class CallExprAST : public ExprAST { + std::string Callee; + std::vector Args; +public: + CallExprAST(const std::string &callee, std::vector &args) + : Callee(callee), Args(args) {} + virtual Value *Codegen(); +}; + +/// PrototypeAST - This class represents the "prototype" for a function, +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). +class PrototypeAST { + std::string Name; + std::vector Args; +public: + PrototypeAST(const std::string &name, const std::vector &args) + : Name(name), Args(args) {} + + Function *Codegen(); +}; + +/// FunctionAST - This class represents a function definition itself. +class FunctionAST { + PrototypeAST *Proto; + ExprAST *Body; +public: + FunctionAST(PrototypeAST *proto, ExprAST *body) + : Proto(proto), Body(body) {} + + Function *Codegen(); +}; + +//===----------------------------------------------------------------------===// +// Parser +//===----------------------------------------------------------------------===// + +/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current +/// token the parser is looking at. getNextToken reads another token from the +/// lexer and updates CurTok with its results. +static int CurTok; +static int getNextToken() { + return CurTok = gettok(); +} + +/// BinopPrecedence - This holds the precedence for each binary operator that is +/// defined. +static std::map BinopPrecedence; + +/// GetTokPrecedence - Get the precedence of the pending binary operator token. +static int GetTokPrecedence() { + if (!isascii(CurTok)) + return -1; + + // Make sure it's a declared binop. + int TokPrec = BinopPrecedence[CurTok]; + if (TokPrec <= 0) return -1; + return TokPrec; +} + +/// Error* - These are little helper functions for error handling. +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;} +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; } +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; } + +static ExprAST *ParseExpression(); + +/// identifierexpr +/// ::= identifier +/// ::= identifier '(' expression* ')' +static ExprAST *ParseIdentifierExpr() { + std::string IdName = IdentifierStr; + + getNextToken(); // eat identifier. + + if (CurTok != '(') // Simple variable ref. + return new VariableExprAST(IdName); + + // Call. + getNextToken(); // eat ( + std::vector Args; + if (CurTok != ')') { + while (1) { + ExprAST *Arg = ParseExpression(); + if (!Arg) return 0; + Args.push_back(Arg); + + if (CurTok == ')') break; + + if (CurTok != ',') + return Error("Expected ')' or ',' in argument list"); + getNextToken(); + } + } + + // Eat the ')'. + getNextToken(); + + return new CallExprAST(IdName, Args); +} + +/// numberexpr ::= number +static ExprAST *ParseNumberExpr() { + ExprAST *Result = new NumberExprAST(NumVal); + getNextToken(); // consume the number + return Result; +} + +/// parenexpr ::= '(' expression ')' +static ExprAST *ParseParenExpr() { + getNextToken(); // eat (. + ExprAST *V = ParseExpression(); + if (!V) return 0; + + if (CurTok != ')') + return Error("expected ')'"); + getNextToken(); // eat ). + return V; +} + +/// primary +/// ::= identifierexpr +/// ::= numberexpr +/// ::= parenexpr +static ExprAST *ParsePrimary() { + switch (CurTok) { + default: return Error("unknown token when expecting an expression"); + case tok_identifier: return ParseIdentifierExpr(); + case tok_number: return ParseNumberExpr(); + case '(': return ParseParenExpr(); + } +} + +/// binoprhs +/// ::= ('+' primary)* +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) { + // If this is a binop, find its precedence. + while (1) { + int TokPrec = GetTokPrecedence(); + + // If this is a binop that binds at least as tightly as the current binop, + // consume it, otherwise we are done. + if (TokPrec < ExprPrec) + return LHS; + + // Okay, we know this is a binop. + int BinOp = CurTok; + getNextToken(); // eat binop + + // Parse the primary expression after the binary operator. + ExprAST *RHS = ParsePrimary(); + if (!RHS) return 0; + + // If BinOp binds less tightly with RHS than the operator after RHS, let + // the pending operator take RHS as its LHS. + int NextPrec = GetTokPrecedence(); + if (TokPrec < NextPrec) { + RHS = ParseBinOpRHS(TokPrec+1, RHS); + if (RHS == 0) return 0; + } + + // Merge LHS/RHS. + LHS = new BinaryExprAST(BinOp, LHS, RHS); + } +} + +/// expression +/// ::= primary binoprhs +/// +static ExprAST *ParseExpression() { + ExprAST *LHS = ParsePrimary(); + if (!LHS) return 0; + + return ParseBinOpRHS(0, LHS); +} + +/// prototype +/// ::= id '(' id* ')' +static PrototypeAST *ParsePrototype() { + if (CurTok != tok_identifier) + return ErrorP("Expected function name in prototype"); + + std::string FnName = IdentifierStr; + getNextToken(); + + if (CurTok != '(') + return ErrorP("Expected '(' in prototype"); + + std::vector ArgNames; + while (getNextToken() == tok_identifier) + ArgNames.push_back(IdentifierStr); + if (CurTok != ')') + return ErrorP("Expected ')' in prototype"); + + // success. + getNextToken(); // eat ')'. + + return new PrototypeAST(FnName, ArgNames); +} + +/// definition ::= 'def' prototype expression +static FunctionAST *ParseDefinition() { + getNextToken(); // eat def. + PrototypeAST *Proto = ParsePrototype(); + if (Proto == 0) return 0; + + if (ExprAST *E = ParseExpression()) + return new FunctionAST(Proto, E); + return 0; +} + +/// toplevelexpr ::= expression +static FunctionAST *ParseTopLevelExpr() { + if (ExprAST *E = ParseExpression()) { + // Make an anonymous proto. + PrototypeAST *Proto = new PrototypeAST("", std::vector()); + return new FunctionAST(Proto, E); + } + return 0; +} + +/// external ::= 'extern' prototype +static PrototypeAST *ParseExtern() { + getNextToken(); // eat extern. + return ParsePrototype(); +} + +//===----------------------------------------------------------------------===// +// Code Generation +//===----------------------------------------------------------------------===// + +static Module *TheModule; +static IRBuilder<> Builder(getGlobalContext()); +static std::map NamedValues; +static FunctionPassManager *TheFPM; + +Value *ErrorV(const char *Str) { Error(Str); return 0; } + +Value *NumberExprAST::Codegen() { + return ConstantFP::get(getGlobalContext(), APFloat(Val)); +} + +Value *VariableExprAST::Codegen() { + // Look this variable up in the function. + Value *V = NamedValues[Name]; + return V ? V : ErrorV("Unknown variable name"); +} + +Value *BinaryExprAST::Codegen() { + Value *L = LHS->Codegen(); + Value *R = RHS->Codegen(); + if (L == 0 || R == 0) return 0; + + switch (Op) { + case '+': return Builder.CreateAdd(L, R, "addtmp"); + case '-': return Builder.CreateSub(L, R, "subtmp"); + case '*': return Builder.CreateMul(L, R, "multmp"); + case '<': + L = Builder.CreateFCmpULT(L, R, "cmptmp"); + // Convert bool 0/1 to double 0.0 or 1.0 + return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), + "booltmp"); + default: return ErrorV("invalid binary operator"); + } +} + +Value *CallExprAST::Codegen() { + // Look up the name in the global module table. + Function *CalleeF = TheModule->getFunction(Callee); + if (CalleeF == 0) + return ErrorV("Unknown function referenced"); + + // If argument mismatch error. + if (CalleeF->arg_size() != Args.size()) + return ErrorV("Incorrect # arguments passed"); + + std::vector ArgsV; + for (unsigned i = 0, e = Args.size(); i != e; ++i) { + ArgsV.push_back(Args[i]->Codegen()); + if (ArgsV.back() == 0) return 0; + } + + return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp"); +} + +Function *PrototypeAST::Codegen() { + // Make the function type: double(double,double) etc. + std::vector Doubles(Args.size(), + Type::getDoubleTy(getGlobalContext())); + FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()), + Doubles, false); + + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); + + // If F conflicted, there was already something named 'Name'. If it has a + // body, don't allow redefinition or reextern. + if (F->getName() != Name) { + // Delete the one we just made and get the existing one. + F->eraseFromParent(); + F = TheModule->getFunction(Name); + + // If F already has a body, reject this. + if (!F->empty()) { + ErrorF("redefinition of function"); + return 0; + } + + // If F took a different number of args, reject. + if (F->arg_size() != Args.size()) { + ErrorF("redefinition of function with different # args"); + return 0; + } + } + + // Set names for all arguments. + unsigned Idx = 0; + for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size(); + ++AI, ++Idx) { + AI->setName(Args[Idx]); + + // Add arguments to variable symbol table. + NamedValues[Args[Idx]] = AI; + } + + return F; +} + +Function *FunctionAST::Codegen() { + NamedValues.clear(); + + Function *TheFunction = Proto->Codegen(); + if (TheFunction == 0) + return 0; + + // Create a new basic block to start insertion into. + BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction); + Builder.SetInsertPoint(BB); + + if (Value *RetVal = Body->Codegen()) { + // Finish off the function. + Builder.CreateRet(RetVal); + + // Validate the generated code, checking for consistency. + verifyFunction(*TheFunction); + + // Optimize the function. + TheFPM->run(*TheFunction); + + return TheFunction; + } + + // Error reading body, remove function. + TheFunction->eraseFromParent(); + return 0; +} + +//===----------------------------------------------------------------------===// +// Top-Level parsing and JIT Driver +//===----------------------------------------------------------------------===// + +static ExecutionEngine *TheExecutionEngine; + +static void HandleDefinition() { + if (FunctionAST *F = ParseDefinition()) { + if (Function *LF = F->Codegen()) { + fprintf(stderr, "Read function definition:"); + LF->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleExtern() { + if (PrototypeAST *P = ParseExtern()) { + if (Function *F = P->Codegen()) { + fprintf(stderr, "Read extern: "); + F->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleTopLevelExpression() { + // Evaluate a top-level expression into an anonymous function. + if (FunctionAST *F = ParseTopLevelExpr()) { + if (Function *LF = F->Codegen()) { + // JIT the function, returning a function pointer. + void *FPtr = TheExecutionEngine->getPointerToFunction(LF); + + // Cast it to the right type (takes no arguments, returns a double) so we + // can call it as a native function. + double (*FP)() = (double (*)())(intptr_t)FPtr; + fprintf(stderr, "Evaluated to %f\n", FP()); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +/// top ::= definition | external | expression | ';' +static void MainLoop() { + while (1) { + fprintf(stderr, "ready> "); + switch (CurTok) { + case tok_eof: return; + case ';': getNextToken(); break; // ignore top-level semicolons. + case tok_def: HandleDefinition(); break; + case tok_extern: HandleExtern(); break; + default: HandleTopLevelExpression(); break; + } + } +} + +//===----------------------------------------------------------------------===// +// "Library" functions that can be "extern'd" from user code. +//===----------------------------------------------------------------------===// + +/// putchard - putchar that takes a double and returns 0. +extern "C" +double putchard(double X) { + putchar((char)X); + return 0; +} + +//===----------------------------------------------------------------------===// +// Main driver code. +//===----------------------------------------------------------------------===// + +int main() { + InitializeNativeTarget(); + LLVMContext &Context = getGlobalContext(); + + // Install standard binary operators. + // 1 is lowest precedence. + BinopPrecedence['<'] = 10; + BinopPrecedence['+'] = 20; + BinopPrecedence['-'] = 20; + BinopPrecedence['*'] = 40; // highest. + + // Prime the first token. + fprintf(stderr, "ready> "); + getNextToken(); + + // Make the module, which holds all the code. + TheModule = new Module("my cool jit", Context); + + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); + + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + OurFPM.doInitialization(); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); + + return 0; +} Added: llvm/trunk/examples/Kaleidoscope/Chapter5/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter5/CMakeLists.txt?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter5/CMakeLists.txt (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter5/CMakeLists.txt Tue Sep 22 16:15:19 2009 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS core jit interpreter native) + +add_llvm_example(Kaleidoscope-Ch5 + toy.cpp + ) Copied: llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile (from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile?p2=llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile&p1=llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile&r1=82573&r2=82574&rev=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter5/Makefile Tue Sep 22 16:15:19 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope-Ch7/Makefile ------------------*- Makefile -*-===## +##===- examples/Kaleidoscope/Chapter5/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,8 +6,8 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = Kaleidoscope-Ch7 +LEVEL = ../../.. +TOOLNAME = Kaleidoscope-Ch5 EXAMPLE_TOOL = 1 LINK_COMPONENTS := core jit interpreter native Added: llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp Tue Sep 22 16:15:19 2009 @@ -0,0 +1,855 @@ +#include "llvm/DerivedTypes.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" +#include "llvm/ExecutionEngine/Interpreter.h" +#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/ModuleProvider.h" +#include "llvm/PassManager.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetSelect.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Support/IRBuilder.h" +#include +#include +#include +#include +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Lexer +//===----------------------------------------------------------------------===// + +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one +// of these for known things. +enum Token { + tok_eof = -1, + + // commands + tok_def = -2, tok_extern = -3, + + // primary + tok_identifier = -4, tok_number = -5, + + // control + tok_if = -6, tok_then = -7, tok_else = -8, + tok_for = -9, tok_in = -10 +}; + +static std::string IdentifierStr; // Filled in if tok_identifier +static double NumVal; // Filled in if tok_number + +/// gettok - Return the next token from standard input. +static int gettok() { + static int LastChar = ' '; + + // Skip any whitespace. + while (isspace(LastChar)) + LastChar = getchar(); + + if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]* + IdentifierStr = LastChar; + while (isalnum((LastChar = getchar()))) + IdentifierStr += LastChar; + + if (IdentifierStr == "def") return tok_def; + if (IdentifierStr == "extern") return tok_extern; + if (IdentifierStr == "if") return tok_if; + if (IdentifierStr == "then") return tok_then; + if (IdentifierStr == "else") return tok_else; + if (IdentifierStr == "for") return tok_for; + if (IdentifierStr == "in") return tok_in; + return tok_identifier; + } + + if (isdigit(LastChar) || LastChar == '.') { // Number: [0-9.]+ + std::string NumStr; + do { + NumStr += LastChar; + LastChar = getchar(); + } while (isdigit(LastChar) || LastChar == '.'); + + NumVal = strtod(NumStr.c_str(), 0); + return tok_number; + } + + if (LastChar == '#') { + // Comment until end of line. + do LastChar = getchar(); + while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); + + if (LastChar != EOF) + return gettok(); + } + + // Check for end of file. Don't eat the EOF. + if (LastChar == EOF) + return tok_eof; + + // Otherwise, just return the character as its ascii value. + int ThisChar = LastChar; + LastChar = getchar(); + return ThisChar; +} + +//===----------------------------------------------------------------------===// +// Abstract Syntax Tree (aka Parse Tree) +//===----------------------------------------------------------------------===// + +/// ExprAST - Base class for all expression nodes. +class ExprAST { +public: + virtual ~ExprAST() {} + virtual Value *Codegen() = 0; +}; + +/// NumberExprAST - Expression class for numeric literals like "1.0". +class NumberExprAST : public ExprAST { + double Val; +public: + NumberExprAST(double val) : Val(val) {} + virtual Value *Codegen(); +}; + +/// VariableExprAST - Expression class for referencing a variable, like "a". +class VariableExprAST : public ExprAST { + std::string Name; +public: + VariableExprAST(const std::string &name) : Name(name) {} + virtual Value *Codegen(); +}; + +/// BinaryExprAST - Expression class for a binary operator. +class BinaryExprAST : public ExprAST { + char Op; + ExprAST *LHS, *RHS; +public: + BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) + : Op(op), LHS(lhs), RHS(rhs) {} + virtual Value *Codegen(); +}; + +/// CallExprAST - Expression class for function calls. +class CallExprAST : public ExprAST { + std::string Callee; + std::vector Args; +public: + CallExprAST(const std::string &callee, std::vector &args) + : Callee(callee), Args(args) {} + virtual Value *Codegen(); +}; + +/// IfExprAST - Expression class for if/then/else. +class IfExprAST : public ExprAST { + ExprAST *Cond, *Then, *Else; +public: + IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else) + : Cond(cond), Then(then), Else(_else) {} + virtual Value *Codegen(); +}; + +/// ForExprAST - Expression class for for/in. +class ForExprAST : public ExprAST { + std::string VarName; + ExprAST *Start, *End, *Step, *Body; +public: + ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, + ExprAST *step, ExprAST *body) + : VarName(varname), Start(start), End(end), Step(step), Body(body) {} + virtual Value *Codegen(); +}; + +/// PrototypeAST - This class represents the "prototype" for a function, +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes). +class PrototypeAST { + std::string Name; + std::vector Args; +public: + PrototypeAST(const std::string &name, const std::vector &args) + : Name(name), Args(args) {} + + Function *Codegen(); +}; + +/// FunctionAST - This class represents a function definition itself. +class FunctionAST { + PrototypeAST *Proto; + ExprAST *Body; +public: + FunctionAST(PrototypeAST *proto, ExprAST *body) + : Proto(proto), Body(body) {} + + Function *Codegen(); +}; + +//===----------------------------------------------------------------------===// +// Parser +//===----------------------------------------------------------------------===// + +/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current +/// token the parser is looking at. getNextToken reads another token from the +/// lexer and updates CurTok with its results. +static int CurTok; +static int getNextToken() { + return CurTok = gettok(); +} + +/// BinopPrecedence - This holds the precedence for each binary operator that is +/// defined. +static std::map BinopPrecedence; + +/// GetTokPrecedence - Get the precedence of the pending binary operator token. +static int GetTokPrecedence() { + if (!isascii(CurTok)) + return -1; + + // Make sure it's a declared binop. + int TokPrec = BinopPrecedence[CurTok]; + if (TokPrec <= 0) return -1; + return TokPrec; +} + +/// Error* - These are little helper functions for error handling. +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;} +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; } +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; } + +static ExprAST *ParseExpression(); + +/// identifierexpr +/// ::= identifier +/// ::= identifier '(' expression* ')' +static ExprAST *ParseIdentifierExpr() { + std::string IdName = IdentifierStr; + + getNextToken(); // eat identifier. + + if (CurTok != '(') // Simple variable ref. + return new VariableExprAST(IdName); + + // Call. + getNextToken(); // eat ( + std::vector Args; + if (CurTok != ')') { + while (1) { + ExprAST *Arg = ParseExpression(); + if (!Arg) return 0; + Args.push_back(Arg); + + if (CurTok == ')') break; + + if (CurTok != ',') + return Error("Expected ')' or ',' in argument list"); + getNextToken(); + } + } + + // Eat the ')'. + getNextToken(); + + return new CallExprAST(IdName, Args); +} + +/// numberexpr ::= number +static ExprAST *ParseNumberExpr() { + ExprAST *Result = new NumberExprAST(NumVal); + getNextToken(); // consume the number + return Result; +} + +/// parenexpr ::= '(' expression ')' +static ExprAST *ParseParenExpr() { + getNextToken(); // eat (. + ExprAST *V = ParseExpression(); + if (!V) return 0; + + if (CurTok != ')') + return Error("expected ')'"); + getNextToken(); // eat ). + return V; +} + +/// ifexpr ::= 'if' expression 'then' expression 'else' expression +static ExprAST *ParseIfExpr() { + getNextToken(); // eat the if. + + // condition. + ExprAST *Cond = ParseExpression(); + if (!Cond) return 0; + + if (CurTok != tok_then) + return Error("expected then"); + getNextToken(); // eat the then + + ExprAST *Then = ParseExpression(); + if (Then == 0) return 0; + + if (CurTok != tok_else) + return Error("expected else"); + + getNextToken(); + + ExprAST *Else = ParseExpression(); + if (!Else) return 0; + + return new IfExprAST(Cond, Then, Else); +} + +/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression +static ExprAST *ParseForExpr() { + getNextToken(); // eat the for. + + if (CurTok != tok_identifier) + return Error("expected identifier after for"); + + std::string IdName = IdentifierStr; + getNextToken(); // eat identifier. + + if (CurTok != '=') + return Error("expected '=' after for"); + getNextToken(); // eat '='. + + + ExprAST *Start = ParseExpression(); + if (Start == 0) return 0; + if (CurTok != ',') + return Error("expected ',' after for start value"); + getNextToken(); + + ExprAST *End = ParseExpression(); + if (End == 0) return 0; + + // The step value is optional. + ExprAST *Step = 0; + if (CurTok == ',') { + getNextToken(); + Step = ParseExpression(); + if (Step == 0) return 0; + } + + if (CurTok != tok_in) + return Error("expected 'in' after for"); + getNextToken(); // eat 'in'. + + ExprAST *Body = ParseExpression(); + if (Body == 0) return 0; + + return new ForExprAST(IdName, Start, End, Step, Body); +} + +/// primary +/// ::= identifierexpr +/// ::= numberexpr +/// ::= parenexpr +/// ::= ifexpr +/// ::= forexpr +static ExprAST *ParsePrimary() { + switch (CurTok) { + default: return Error("unknown token when expecting an expression"); + case tok_identifier: return ParseIdentifierExpr(); + case tok_number: return ParseNumberExpr(); + case '(': return ParseParenExpr(); + case tok_if: return ParseIfExpr(); + case tok_for: return ParseForExpr(); + } +} + +/// binoprhs +/// ::= ('+' primary)* +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) { + // If this is a binop, find its precedence. + while (1) { + int TokPrec = GetTokPrecedence(); + + // If this is a binop that binds at least as tightly as the current binop, + // consume it, otherwise we are done. + if (TokPrec < ExprPrec) + return LHS; + + // Okay, we know this is a binop. + int BinOp = CurTok; + getNextToken(); // eat binop + + // Parse the primary expression after the binary operator. + ExprAST *RHS = ParsePrimary(); + if (!RHS) return 0; + + // If BinOp binds less tightly with RHS than the operator after RHS, let + // the pending operator take RHS as its LHS. + int NextPrec = GetTokPrecedence(); + if (TokPrec < NextPrec) { + RHS = ParseBinOpRHS(TokPrec+1, RHS); + if (RHS == 0) return 0; + } + + // Merge LHS/RHS. + LHS = new BinaryExprAST(BinOp, LHS, RHS); + } +} + +/// expression +/// ::= primary binoprhs +/// +static ExprAST *ParseExpression() { + ExprAST *LHS = ParsePrimary(); + if (!LHS) return 0; + + return ParseBinOpRHS(0, LHS); +} + +/// prototype +/// ::= id '(' id* ')' +static PrototypeAST *ParsePrototype() { + if (CurTok != tok_identifier) + return ErrorP("Expected function name in prototype"); + + std::string FnName = IdentifierStr; + getNextToken(); + + if (CurTok != '(') + return ErrorP("Expected '(' in prototype"); + + std::vector ArgNames; + while (getNextToken() == tok_identifier) + ArgNames.push_back(IdentifierStr); + if (CurTok != ')') + return ErrorP("Expected ')' in prototype"); + + // success. + getNextToken(); // eat ')'. + + return new PrototypeAST(FnName, ArgNames); +} + +/// definition ::= 'def' prototype expression +static FunctionAST *ParseDefinition() { + getNextToken(); // eat def. + PrototypeAST *Proto = ParsePrototype(); + if (Proto == 0) return 0; + + if (ExprAST *E = ParseExpression()) + return new FunctionAST(Proto, E); + return 0; +} + +/// toplevelexpr ::= expression +static FunctionAST *ParseTopLevelExpr() { + if (ExprAST *E = ParseExpression()) { + // Make an anonymous proto. + PrototypeAST *Proto = new PrototypeAST("", std::vector()); + return new FunctionAST(Proto, E); + } + return 0; +} + +/// external ::= 'extern' prototype +static PrototypeAST *ParseExtern() { + getNextToken(); // eat extern. + return ParsePrototype(); +} + +//===----------------------------------------------------------------------===// +// Code Generation +//===----------------------------------------------------------------------===// + +static Module *TheModule; +static IRBuilder<> Builder(getGlobalContext()); +static std::map NamedValues; +static FunctionPassManager *TheFPM; + +Value *ErrorV(const char *Str) { Error(Str); return 0; } + +Value *NumberExprAST::Codegen() { + return ConstantFP::get(getGlobalContext(), APFloat(Val)); +} + +Value *VariableExprAST::Codegen() { + // Look this variable up in the function. + Value *V = NamedValues[Name]; + return V ? V : ErrorV("Unknown variable name"); +} + +Value *BinaryExprAST::Codegen() { + Value *L = LHS->Codegen(); + Value *R = RHS->Codegen(); + if (L == 0 || R == 0) return 0; + + switch (Op) { + case '+': return Builder.CreateAdd(L, R, "addtmp"); + case '-': return Builder.CreateSub(L, R, "subtmp"); + case '*': return Builder.CreateMul(L, R, "multmp"); + case '<': + L = Builder.CreateFCmpULT(L, R, "cmptmp"); + // Convert bool 0/1 to double 0.0 or 1.0 + return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), + "booltmp"); + default: return ErrorV("invalid binary operator"); + } +} + +Value *CallExprAST::Codegen() { + // Look up the name in the global module table. + Function *CalleeF = TheModule->getFunction(Callee); + if (CalleeF == 0) + return ErrorV("Unknown function referenced"); + + // If argument mismatch error. + if (CalleeF->arg_size() != Args.size()) + return ErrorV("Incorrect # arguments passed"); + + std::vector ArgsV; + for (unsigned i = 0, e = Args.size(); i != e; ++i) { + ArgsV.push_back(Args[i]->Codegen()); + if (ArgsV.back() == 0) return 0; + } + + return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp"); +} + +Value *IfExprAST::Codegen() { + Value *CondV = Cond->Codegen(); + if (CondV == 0) return 0; + + // Convert condition to a bool by comparing equal to 0.0. + CondV = Builder.CreateFCmpONE(CondV, + ConstantFP::get(getGlobalContext(), APFloat(0.0)), + "ifcond"); + + Function *TheFunction = Builder.GetInsertBlock()->getParent(); + + // Create blocks for the then and else cases. Insert the 'then' block at the + // end of the function. + BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction); + BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else"); + BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont"); + + Builder.CreateCondBr(CondV, ThenBB, ElseBB); + + // Emit then value. + Builder.SetInsertPoint(ThenBB); + + Value *ThenV = Then->Codegen(); + if (ThenV == 0) return 0; + + Builder.CreateBr(MergeBB); + // Codegen of 'Then' can change the current block, update ThenBB for the PHI. + ThenBB = Builder.GetInsertBlock(); + + // Emit else block. + TheFunction->getBasicBlockList().push_back(ElseBB); + Builder.SetInsertPoint(ElseBB); + + Value *ElseV = Else->Codegen(); + if (ElseV == 0) return 0; + + Builder.CreateBr(MergeBB); + // Codegen of 'Else' can change the current block, update ElseBB for the PHI. + ElseBB = Builder.GetInsertBlock(); + + // Emit merge block. + TheFunction->getBasicBlockList().push_back(MergeBB); + Builder.SetInsertPoint(MergeBB); + PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), + "iftmp"); + + PN->addIncoming(ThenV, ThenBB); + PN->addIncoming(ElseV, ElseBB); + return PN; +} + +Value *ForExprAST::Codegen() { + // Output this as: + // ... + // start = startexpr + // goto loop + // loop: + // variable = phi [start, loopheader], [nextvariable, loopend] + // ... + // bodyexpr + // ... + // loopend: + // step = stepexpr + // nextvariable = variable + step + // endcond = endexpr + // br endcond, loop, endloop + // outloop: + + // Emit the start code first, without 'variable' in scope. + Value *StartVal = Start->Codegen(); + if (StartVal == 0) return 0; + + // Make the new basic block for the loop header, inserting after current + // block. + Function *TheFunction = Builder.GetInsertBlock()->getParent(); + BasicBlock *PreheaderBB = Builder.GetInsertBlock(); + BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction); + + // Insert an explicit fall through from the current block to the LoopBB. + Builder.CreateBr(LoopBB); + + // Start insertion in LoopBB. + Builder.SetInsertPoint(LoopBB); + + // Start the PHI node with an entry for Start. + PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str()); + Variable->addIncoming(StartVal, PreheaderBB); + + // Within the loop, the variable is defined equal to the PHI node. If it + // shadows an existing variable, we have to restore it, so save it now. + Value *OldVal = NamedValues[VarName]; + NamedValues[VarName] = Variable; + + // Emit the body of the loop. This, like any other expr, can change the + // current BB. Note that we ignore the value computed by the body, but don't + // allow an error. + if (Body->Codegen() == 0) + return 0; + + // Emit the step value. + Value *StepVal; + if (Step) { + StepVal = Step->Codegen(); + if (StepVal == 0) return 0; + } else { + // If not specified, use 1.0. + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); + } + + Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); + + // Compute the end condition. + Value *EndCond = End->Codegen(); + if (EndCond == 0) return EndCond; + + // Convert condition to a bool by comparing equal to 0.0. + EndCond = Builder.CreateFCmpONE(EndCond, + ConstantFP::get(getGlobalContext(), APFloat(0.0)), + "loopcond"); + + // Create the "after loop" block and insert it. + BasicBlock *LoopEndBB = Builder.GetInsertBlock(); + BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction); + + // Insert the conditional branch into the end of LoopEndBB. + Builder.CreateCondBr(EndCond, LoopBB, AfterBB); + + // Any new code will be inserted in AfterBB. + Builder.SetInsertPoint(AfterBB); + + // Add a new entry to the PHI node for the backedge. + Variable->addIncoming(NextVar, LoopEndBB); + + // Restore the unshadowed variable. + if (OldVal) + NamedValues[VarName] = OldVal; + else + NamedValues.erase(VarName); + + + // for expr always returns 0.0. + return Constant::getNullValue(Type::getDoubleTy(getGlobalContext())); +} + +Function *PrototypeAST::Codegen() { + // Make the function type: double(double,double) etc. + std::vector Doubles(Args.size(), + Type::getDoubleTy(getGlobalContext())); + FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()), + Doubles, false); + + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); + + // If F conflicted, there was already something named 'Name'. If it has a + // body, don't allow redefinition or reextern. + if (F->getName() != Name) { + // Delete the one we just made and get the existing one. + F->eraseFromParent(); + F = TheModule->getFunction(Name); + + // If F already has a body, reject this. + if (!F->empty()) { + ErrorF("redefinition of function"); + return 0; + } + + // If F took a different number of args, reject. + if (F->arg_size() != Args.size()) { + ErrorF("redefinition of function with different # args"); + return 0; + } + } + + // Set names for all arguments. + unsigned Idx = 0; + for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size(); + ++AI, ++Idx) { + AI->setName(Args[Idx]); + + // Add arguments to variable symbol table. + NamedValues[Args[Idx]] = AI; + } + + return F; +} + +Function *FunctionAST::Codegen() { + NamedValues.clear(); + + Function *TheFunction = Proto->Codegen(); + if (TheFunction == 0) + return 0; + + // Create a new basic block to start insertion into. + BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction); + Builder.SetInsertPoint(BB); + + if (Value *RetVal = Body->Codegen()) { + // Finish off the function. + Builder.CreateRet(RetVal); + + // Validate the generated code, checking for consistency. + verifyFunction(*TheFunction); + + // Optimize the function. + TheFPM->run(*TheFunction); + + return TheFunction; + } + + // Error reading body, remove function. + TheFunction->eraseFromParent(); + return 0; +} + +//===----------------------------------------------------------------------===// +// Top-Level parsing and JIT Driver +//===----------------------------------------------------------------------===// + +static ExecutionEngine *TheExecutionEngine; + +static void HandleDefinition() { + if (FunctionAST *F = ParseDefinition()) { + if (Function *LF = F->Codegen()) { + fprintf(stderr, "Read function definition:"); + LF->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleExtern() { + if (PrototypeAST *P = ParseExtern()) { + if (Function *F = P->Codegen()) { + fprintf(stderr, "Read extern: "); + F->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleTopLevelExpression() { + // Evaluate a top-level expression into an anonymous function. + if (FunctionAST *F = ParseTopLevelExpr()) { + if (Function *LF = F->Codegen()) { + // JIT the function, returning a function pointer. + void *FPtr = TheExecutionEngine->getPointerToFunction(LF); + + // Cast it to the right type (takes no arguments, returns a double) so we + // can call it as a native function. + double (*FP)() = (double (*)())(intptr_t)FPtr; + fprintf(stderr, "Evaluated to %f\n", FP()); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +/// top ::= definition | external | expression | ';' +static void MainLoop() { + while (1) { + fprintf(stderr, "ready> "); + switch (CurTok) { + case tok_eof: return; + case ';': getNextToken(); break; // ignore top-level semicolons. + case tok_def: HandleDefinition(); break; + case tok_extern: HandleExtern(); break; + default: HandleTopLevelExpression(); break; + } + } +} + +//===----------------------------------------------------------------------===// +// "Library" functions that can be "extern'd" from user code. +//===----------------------------------------------------------------------===// + +/// putchard - putchar that takes a double and returns 0. +extern "C" +double putchard(double X) { + putchar((char)X); + return 0; +} + +//===----------------------------------------------------------------------===// +// Main driver code. +//===----------------------------------------------------------------------===// + +int main() { + InitializeNativeTarget(); + LLVMContext &Context = getGlobalContext(); + + // Install standard binary operators. + // 1 is lowest precedence. + BinopPrecedence['<'] = 10; + BinopPrecedence['+'] = 20; + BinopPrecedence['-'] = 20; + BinopPrecedence['*'] = 40; // highest. + + // Prime the first token. + fprintf(stderr, "ready> "); + getNextToken(); + + // Make the module, which holds all the code. + TheModule = new Module("my cool jit", Context); + + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); + + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + OurFPM.doInitialization(); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); + + return 0; +} Added: llvm/trunk/examples/Kaleidoscope/Chapter6/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter6/CMakeLists.txt?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter6/CMakeLists.txt (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter6/CMakeLists.txt Tue Sep 22 16:15:19 2009 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS core jit interpreter native) + +add_llvm_example(Kaleidoscope-Ch6 + toy.cpp + ) Copied: llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile (from r82573, llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile) URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile?p2=llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile&p1=llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile&r1=82573&r2=82574&rev=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter6/Makefile Tue Sep 22 16:15:19 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope-Ch7/Makefile ------------------*- Makefile -*-===## +##===- examples/Kaleidoscope/Chapter6/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,8 +6,8 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = Kaleidoscope-Ch7 +LEVEL = ../../.. +TOOLNAME = Kaleidoscope-Ch6 EXAMPLE_TOOL = 1 LINK_COMPONENTS := core jit interpreter native Added: llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp?rev=82574&view=auto ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp (added) +++ llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp Tue Sep 22 16:15:19 2009 @@ -0,0 +1,973 @@ +#include "llvm/DerivedTypes.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" +#include "llvm/ExecutionEngine/Interpreter.h" +#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/LLVMContext.h" +#include "llvm/Module.h" +#include "llvm/ModuleProvider.h" +#include "llvm/PassManager.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetSelect.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Support/IRBuilder.h" +#include +#include +#include +#include +using namespace llvm; + +//===----------------------------------------------------------------------===// +// Lexer +//===----------------------------------------------------------------------===// + +// The lexer returns tokens [0-255] if it is an unknown character, otherwise one +// of these for known things. +enum Token { + tok_eof = -1, + + // commands + tok_def = -2, tok_extern = -3, + + // primary + tok_identifier = -4, tok_number = -5, + + // control + tok_if = -6, tok_then = -7, tok_else = -8, + tok_for = -9, tok_in = -10, + + // operators + tok_binary = -11, tok_unary = -12 +}; + +static std::string IdentifierStr; // Filled in if tok_identifier +static double NumVal; // Filled in if tok_number + +/// gettok - Return the next token from standard input. +static int gettok() { + static int LastChar = ' '; + + // Skip any whitespace. + while (isspace(LastChar)) + LastChar = getchar(); + + if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]* + IdentifierStr = LastChar; + while (isalnum((LastChar = getchar()))) + IdentifierStr += LastChar; + + if (IdentifierStr == "def") return tok_def; + if (IdentifierStr == "extern") return tok_extern; + if (IdentifierStr == "if") return tok_if; + if (IdentifierStr == "then") return tok_then; + if (IdentifierStr == "else") return tok_else; + if (IdentifierStr == "for") return tok_for; + if (IdentifierStr == "in") return tok_in; + if (IdentifierStr == "binary") return tok_binary; + if (IdentifierStr == "unary") return tok_unary; + return tok_identifier; + } + + if (isdigit(LastChar) || LastChar == '.') { // Number: [0-9.]+ + std::string NumStr; + do { + NumStr += LastChar; + LastChar = getchar(); + } while (isdigit(LastChar) || LastChar == '.'); + + NumVal = strtod(NumStr.c_str(), 0); + return tok_number; + } + + if (LastChar == '#') { + // Comment until end of line. + do LastChar = getchar(); + while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); + + if (LastChar != EOF) + return gettok(); + } + + // Check for end of file. Don't eat the EOF. + if (LastChar == EOF) + return tok_eof; + + // Otherwise, just return the character as its ascii value. + int ThisChar = LastChar; + LastChar = getchar(); + return ThisChar; +} + +//===----------------------------------------------------------------------===// +// Abstract Syntax Tree (aka Parse Tree) +//===----------------------------------------------------------------------===// + +/// ExprAST - Base class for all expression nodes. +class ExprAST { +public: + virtual ~ExprAST() {} + virtual Value *Codegen() = 0; +}; + +/// NumberExprAST - Expression class for numeric literals like "1.0". +class NumberExprAST : public ExprAST { + double Val; +public: + NumberExprAST(double val) : Val(val) {} + virtual Value *Codegen(); +}; + +/// VariableExprAST - Expression class for referencing a variable, like "a". +class VariableExprAST : public ExprAST { + std::string Name; +public: + VariableExprAST(const std::string &name) : Name(name) {} + virtual Value *Codegen(); +}; + +/// UnaryExprAST - Expression class for a unary operator. +class UnaryExprAST : public ExprAST { + char Opcode; + ExprAST *Operand; +public: + UnaryExprAST(char opcode, ExprAST *operand) + : Opcode(opcode), Operand(operand) {} + virtual Value *Codegen(); +}; + +/// BinaryExprAST - Expression class for a binary operator. +class BinaryExprAST : public ExprAST { + char Op; + ExprAST *LHS, *RHS; +public: + BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) + : Op(op), LHS(lhs), RHS(rhs) {} + virtual Value *Codegen(); +}; + +/// CallExprAST - Expression class for function calls. +class CallExprAST : public ExprAST { + std::string Callee; + std::vector Args; +public: + CallExprAST(const std::string &callee, std::vector &args) + : Callee(callee), Args(args) {} + virtual Value *Codegen(); +}; + +/// IfExprAST - Expression class for if/then/else. +class IfExprAST : public ExprAST { + ExprAST *Cond, *Then, *Else; +public: + IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else) + : Cond(cond), Then(then), Else(_else) {} + virtual Value *Codegen(); +}; + +/// ForExprAST - Expression class for for/in. +class ForExprAST : public ExprAST { + std::string VarName; + ExprAST *Start, *End, *Step, *Body; +public: + ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, + ExprAST *step, ExprAST *body) + : VarName(varname), Start(start), End(end), Step(step), Body(body) {} + virtual Value *Codegen(); +}; + +/// PrototypeAST - This class represents the "prototype" for a function, +/// which captures its name, and its argument names (thus implicitly the number +/// of arguments the function takes), as well as if it is an operator. +class PrototypeAST { + std::string Name; + std::vector Args; + bool isOperator; + unsigned Precedence; // Precedence if a binary op. +public: + PrototypeAST(const std::string &name, const std::vector &args, + bool isoperator = false, unsigned prec = 0) + : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {} + + bool isUnaryOp() const { return isOperator && Args.size() == 1; } + bool isBinaryOp() const { return isOperator && Args.size() == 2; } + + char getOperatorName() const { + assert(isUnaryOp() || isBinaryOp()); + return Name[Name.size()-1]; + } + + unsigned getBinaryPrecedence() const { return Precedence; } + + Function *Codegen(); +}; + +/// FunctionAST - This class represents a function definition itself. +class FunctionAST { + PrototypeAST *Proto; + ExprAST *Body; +public: + FunctionAST(PrototypeAST *proto, ExprAST *body) + : Proto(proto), Body(body) {} + + Function *Codegen(); +}; + +//===----------------------------------------------------------------------===// +// Parser +//===----------------------------------------------------------------------===// + +/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current +/// token the parser is looking at. getNextToken reads another token from the +/// lexer and updates CurTok with its results. +static int CurTok; +static int getNextToken() { + return CurTok = gettok(); +} + +/// BinopPrecedence - This holds the precedence for each binary operator that is +/// defined. +static std::map BinopPrecedence; + +/// GetTokPrecedence - Get the precedence of the pending binary operator token. +static int GetTokPrecedence() { + if (!isascii(CurTok)) + return -1; + + // Make sure it's a declared binop. + int TokPrec = BinopPrecedence[CurTok]; + if (TokPrec <= 0) return -1; + return TokPrec; +} + +/// Error* - These are little helper functions for error handling. +ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;} +PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; } +FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; } + +static ExprAST *ParseExpression(); + +/// identifierexpr +/// ::= identifier +/// ::= identifier '(' expression* ')' +static ExprAST *ParseIdentifierExpr() { + std::string IdName = IdentifierStr; + + getNextToken(); // eat identifier. + + if (CurTok != '(') // Simple variable ref. + return new VariableExprAST(IdName); + + // Call. + getNextToken(); // eat ( + std::vector Args; + if (CurTok != ')') { + while (1) { + ExprAST *Arg = ParseExpression(); + if (!Arg) return 0; + Args.push_back(Arg); + + if (CurTok == ')') break; + + if (CurTok != ',') + return Error("Expected ')' or ',' in argument list"); + getNextToken(); + } + } + + // Eat the ')'. + getNextToken(); + + return new CallExprAST(IdName, Args); +} + +/// numberexpr ::= number +static ExprAST *ParseNumberExpr() { + ExprAST *Result = new NumberExprAST(NumVal); + getNextToken(); // consume the number + return Result; +} + +/// parenexpr ::= '(' expression ')' +static ExprAST *ParseParenExpr() { + getNextToken(); // eat (. + ExprAST *V = ParseExpression(); + if (!V) return 0; + + if (CurTok != ')') + return Error("expected ')'"); + getNextToken(); // eat ). + return V; +} + +/// ifexpr ::= 'if' expression 'then' expression 'else' expression +static ExprAST *ParseIfExpr() { + getNextToken(); // eat the if. + + // condition. + ExprAST *Cond = ParseExpression(); + if (!Cond) return 0; + + if (CurTok != tok_then) + return Error("expected then"); + getNextToken(); // eat the then + + ExprAST *Then = ParseExpression(); + if (Then == 0) return 0; + + if (CurTok != tok_else) + return Error("expected else"); + + getNextToken(); + + ExprAST *Else = ParseExpression(); + if (!Else) return 0; + + return new IfExprAST(Cond, Then, Else); +} + +/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression +static ExprAST *ParseForExpr() { + getNextToken(); // eat the for. + + if (CurTok != tok_identifier) + return Error("expected identifier after for"); + + std::string IdName = IdentifierStr; + getNextToken(); // eat identifier. + + if (CurTok != '=') + return Error("expected '=' after for"); + getNextToken(); // eat '='. + + + ExprAST *Start = ParseExpression(); + if (Start == 0) return 0; + if (CurTok != ',') + return Error("expected ',' after for start value"); + getNextToken(); + + ExprAST *End = ParseExpression(); + if (End == 0) return 0; + + // The step value is optional. + ExprAST *Step = 0; + if (CurTok == ',') { + getNextToken(); + Step = ParseExpression(); + if (Step == 0) return 0; + } + + if (CurTok != tok_in) + return Error("expected 'in' after for"); + getNextToken(); // eat 'in'. + + ExprAST *Body = ParseExpression(); + if (Body == 0) return 0; + + return new ForExprAST(IdName, Start, End, Step, Body); +} + +/// primary +/// ::= identifierexpr +/// ::= numberexpr +/// ::= parenexpr +/// ::= ifexpr +/// ::= forexpr +static ExprAST *ParsePrimary() { + switch (CurTok) { + default: return Error("unknown token when expecting an expression"); + case tok_identifier: return ParseIdentifierExpr(); + case tok_number: return ParseNumberExpr(); + case '(': return ParseParenExpr(); + case tok_if: return ParseIfExpr(); + case tok_for: return ParseForExpr(); + } +} + +/// unary +/// ::= primary +/// ::= '!' unary +static ExprAST *ParseUnary() { + // If the current token is not an operator, it must be a primary expr. + if (!isascii(CurTok) || CurTok == '(' || CurTok == ',') + return ParsePrimary(); + + // If this is a unary operator, read it. + int Opc = CurTok; + getNextToken(); + if (ExprAST *Operand = ParseUnary()) + return new UnaryExprAST(Opc, Operand); + return 0; +} + +/// binoprhs +/// ::= ('+' unary)* +static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) { + // If this is a binop, find its precedence. + while (1) { + int TokPrec = GetTokPrecedence(); + + // If this is a binop that binds at least as tightly as the current binop, + // consume it, otherwise we are done. + if (TokPrec < ExprPrec) + return LHS; + + // Okay, we know this is a binop. + int BinOp = CurTok; + getNextToken(); // eat binop + + // Parse the unary expression after the binary operator. + ExprAST *RHS = ParseUnary(); + if (!RHS) return 0; + + // If BinOp binds less tightly with RHS than the operator after RHS, let + // the pending operator take RHS as its LHS. + int NextPrec = GetTokPrecedence(); + if (TokPrec < NextPrec) { + RHS = ParseBinOpRHS(TokPrec+1, RHS); + if (RHS == 0) return 0; + } + + // Merge LHS/RHS. + LHS = new BinaryExprAST(BinOp, LHS, RHS); + } +} + +/// expression +/// ::= unary binoprhs +/// +static ExprAST *ParseExpression() { + ExprAST *LHS = ParseUnary(); + if (!LHS) return 0; + + return ParseBinOpRHS(0, LHS); +} + +/// prototype +/// ::= id '(' id* ')' +/// ::= binary LETTER number? (id, id) +/// ::= unary LETTER (id) +static PrototypeAST *ParsePrototype() { + std::string FnName; + + unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary. + unsigned BinaryPrecedence = 30; + + switch (CurTok) { + default: + return ErrorP("Expected function name in prototype"); + case tok_identifier: + FnName = IdentifierStr; + Kind = 0; + getNextToken(); + break; + case tok_unary: + getNextToken(); + if (!isascii(CurTok)) + return ErrorP("Expected unary operator"); + FnName = "unary"; + FnName += (char)CurTok; + Kind = 1; + getNextToken(); + break; + case tok_binary: + getNextToken(); + if (!isascii(CurTok)) + return ErrorP("Expected binary operator"); + FnName = "binary"; + FnName += (char)CurTok; + Kind = 2; + getNextToken(); + + // Read the precedence if present. + if (CurTok == tok_number) { + if (NumVal < 1 || NumVal > 100) + return ErrorP("Invalid precedecnce: must be 1..100"); + BinaryPrecedence = (unsigned)NumVal; + getNextToken(); + } + break; + } + + if (CurTok != '(') + return ErrorP("Expected '(' in prototype"); + + std::vector ArgNames; + while (getNextToken() == tok_identifier) + ArgNames.push_back(IdentifierStr); + if (CurTok != ')') + return ErrorP("Expected ')' in prototype"); + + // success. + getNextToken(); // eat ')'. + + // Verify right number of names for operator. + if (Kind && ArgNames.size() != Kind) + return ErrorP("Invalid number of operands for operator"); + + return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence); +} + +/// definition ::= 'def' prototype expression +static FunctionAST *ParseDefinition() { + getNextToken(); // eat def. + PrototypeAST *Proto = ParsePrototype(); + if (Proto == 0) return 0; + + if (ExprAST *E = ParseExpression()) + return new FunctionAST(Proto, E); + return 0; +} + +/// toplevelexpr ::= expression +static FunctionAST *ParseTopLevelExpr() { + if (ExprAST *E = ParseExpression()) { + // Make an anonymous proto. + PrototypeAST *Proto = new PrototypeAST("", std::vector()); + return new FunctionAST(Proto, E); + } + return 0; +} + +/// external ::= 'extern' prototype +static PrototypeAST *ParseExtern() { + getNextToken(); // eat extern. + return ParsePrototype(); +} + +//===----------------------------------------------------------------------===// +// Code Generation +//===----------------------------------------------------------------------===// + +static Module *TheModule; +static IRBuilder<> Builder(getGlobalContext()); +static std::map NamedValues; +static FunctionPassManager *TheFPM; + +Value *ErrorV(const char *Str) { Error(Str); return 0; } + +Value *NumberExprAST::Codegen() { + return ConstantFP::get(getGlobalContext(), APFloat(Val)); +} + +Value *VariableExprAST::Codegen() { + // Look this variable up in the function. + Value *V = NamedValues[Name]; + return V ? V : ErrorV("Unknown variable name"); +} + +Value *UnaryExprAST::Codegen() { + Value *OperandV = Operand->Codegen(); + if (OperandV == 0) return 0; + + Function *F = TheModule->getFunction(std::string("unary")+Opcode); + if (F == 0) + return ErrorV("Unknown unary operator"); + + return Builder.CreateCall(F, OperandV, "unop"); +} + +Value *BinaryExprAST::Codegen() { + Value *L = LHS->Codegen(); + Value *R = RHS->Codegen(); + if (L == 0 || R == 0) return 0; + + switch (Op) { + case '+': return Builder.CreateAdd(L, R, "addtmp"); + case '-': return Builder.CreateSub(L, R, "subtmp"); + case '*': return Builder.CreateMul(L, R, "multmp"); + case '<': + L = Builder.CreateFCmpULT(L, R, "cmptmp"); + // Convert bool 0/1 to double 0.0 or 1.0 + return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), + "booltmp"); + default: break; + } + + // If it wasn't a builtin binary operator, it must be a user defined one. Emit + // a call to it. + Function *F = TheModule->getFunction(std::string("binary")+Op); + assert(F && "binary operator not found!"); + + Value *Ops[] = { L, R }; + return Builder.CreateCall(F, Ops, Ops+2, "binop"); +} + +Value *CallExprAST::Codegen() { + // Look up the name in the global module table. + Function *CalleeF = TheModule->getFunction(Callee); + if (CalleeF == 0) + return ErrorV("Unknown function referenced"); + + // If argument mismatch error. + if (CalleeF->arg_size() != Args.size()) + return ErrorV("Incorrect # arguments passed"); + + std::vector ArgsV; + for (unsigned i = 0, e = Args.size(); i != e; ++i) { + ArgsV.push_back(Args[i]->Codegen()); + if (ArgsV.back() == 0) return 0; + } + + return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp"); +} + +Value *IfExprAST::Codegen() { + Value *CondV = Cond->Codegen(); + if (CondV == 0) return 0; + + // Convert condition to a bool by comparing equal to 0.0. + CondV = Builder.CreateFCmpONE(CondV, + ConstantFP::get(getGlobalContext(), APFloat(0.0)), + "ifcond"); + + Function *TheFunction = Builder.GetInsertBlock()->getParent(); + + // Create blocks for the then and else cases. Insert the 'then' block at the + // end of the function. + BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction); + BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else"); + BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont"); + + Builder.CreateCondBr(CondV, ThenBB, ElseBB); + + // Emit then value. + Builder.SetInsertPoint(ThenBB); + + Value *ThenV = Then->Codegen(); + if (ThenV == 0) return 0; + + Builder.CreateBr(MergeBB); + // Codegen of 'Then' can change the current block, update ThenBB for the PHI. + ThenBB = Builder.GetInsertBlock(); + + // Emit else block. + TheFunction->getBasicBlockList().push_back(ElseBB); + Builder.SetInsertPoint(ElseBB); + + Value *ElseV = Else->Codegen(); + if (ElseV == 0) return 0; + + Builder.CreateBr(MergeBB); + // Codegen of 'Else' can change the current block, update ElseBB for the PHI. + ElseBB = Builder.GetInsertBlock(); + + // Emit merge block. + TheFunction->getBasicBlockList().push_back(MergeBB); + Builder.SetInsertPoint(MergeBB); + PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), + "iftmp"); + + PN->addIncoming(ThenV, ThenBB); + PN->addIncoming(ElseV, ElseBB); + return PN; +} + +Value *ForExprAST::Codegen() { + // Output this as: + // ... + // start = startexpr + // goto loop + // loop: + // variable = phi [start, loopheader], [nextvariable, loopend] + // ... + // bodyexpr + // ... + // loopend: + // step = stepexpr + // nextvariable = variable + step + // endcond = endexpr + // br endcond, loop, endloop + // outloop: + + // Emit the start code first, without 'variable' in scope. + Value *StartVal = Start->Codegen(); + if (StartVal == 0) return 0; + + // Make the new basic block for the loop header, inserting after current + // block. + Function *TheFunction = Builder.GetInsertBlock()->getParent(); + BasicBlock *PreheaderBB = Builder.GetInsertBlock(); + BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction); + + // Insert an explicit fall through from the current block to the LoopBB. + Builder.CreateBr(LoopBB); + + // Start insertion in LoopBB. + Builder.SetInsertPoint(LoopBB); + + // Start the PHI node with an entry for Start. + PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str()); + Variable->addIncoming(StartVal, PreheaderBB); + + // Within the loop, the variable is defined equal to the PHI node. If it + // shadows an existing variable, we have to restore it, so save it now. + Value *OldVal = NamedValues[VarName]; + NamedValues[VarName] = Variable; + + // Emit the body of the loop. This, like any other expr, can change the + // current BB. Note that we ignore the value computed by the body, but don't + // allow an error. + if (Body->Codegen() == 0) + return 0; + + // Emit the step value. + Value *StepVal; + if (Step) { + StepVal = Step->Codegen(); + if (StepVal == 0) return 0; + } else { + // If not specified, use 1.0. + StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0)); + } + + Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); + + // Compute the end condition. + Value *EndCond = End->Codegen(); + if (EndCond == 0) return EndCond; + + // Convert condition to a bool by comparing equal to 0.0. + EndCond = Builder.CreateFCmpONE(EndCond, + ConstantFP::get(getGlobalContext(), APFloat(0.0)), + "loopcond"); + + // Create the "after loop" block and insert it. + BasicBlock *LoopEndBB = Builder.GetInsertBlock(); + BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction); + + // Insert the conditional branch into the end of LoopEndBB. + Builder.CreateCondBr(EndCond, LoopBB, AfterBB); + + // Any new code will be inserted in AfterBB. + Builder.SetInsertPoint(AfterBB); + + // Add a new entry to the PHI node for the backedge. + Variable->addIncoming(NextVar, LoopEndBB); + + // Restore the unshadowed variable. + if (OldVal) + NamedValues[VarName] = OldVal; + else + NamedValues.erase(VarName); + + + // for expr always returns 0.0. + return Constant::getNullValue(Type::getDoubleTy(getGlobalContext())); +} + +Function *PrototypeAST::Codegen() { + // Make the function type: double(double,double) etc. + std::vector Doubles(Args.size(), + Type::getDoubleTy(getGlobalContext())); + FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()), + Doubles, false); + + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); + + // If F conflicted, there was already something named 'Name'. If it has a + // body, don't allow redefinition or reextern. + if (F->getName() != Name) { + // Delete the one we just made and get the existing one. + F->eraseFromParent(); + F = TheModule->getFunction(Name); + + // If F already has a body, reject this. + if (!F->empty()) { + ErrorF("redefinition of function"); + return 0; + } + + // If F took a different number of args, reject. + if (F->arg_size() != Args.size()) { + ErrorF("redefinition of function with different # args"); + return 0; + } + } + + // Set names for all arguments. + unsigned Idx = 0; + for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size(); + ++AI, ++Idx) { + AI->setName(Args[Idx]); + + // Add arguments to variable symbol table. + NamedValues[Args[Idx]] = AI; + } + + return F; +} + +Function *FunctionAST::Codegen() { + NamedValues.clear(); + + Function *TheFunction = Proto->Codegen(); + if (TheFunction == 0) + return 0; + + // If this is an operator, install it. + if (Proto->isBinaryOp()) + BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence(); + + // Create a new basic block to start insertion into. + BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction); + Builder.SetInsertPoint(BB); + + if (Value *RetVal = Body->Codegen()) { + // Finish off the function. + Builder.CreateRet(RetVal); + + // Validate the generated code, checking for consistency. + verifyFunction(*TheFunction); + + // Optimize the function. + TheFPM->run(*TheFunction); + + return TheFunction; + } + + // Error reading body, remove function. + TheFunction->eraseFromParent(); + + if (Proto->isBinaryOp()) + BinopPrecedence.erase(Proto->getOperatorName()); + return 0; +} + +//===----------------------------------------------------------------------===// +// Top-Level parsing and JIT Driver +//===----------------------------------------------------------------------===// + +static ExecutionEngine *TheExecutionEngine; + +static void HandleDefinition() { + if (FunctionAST *F = ParseDefinition()) { + if (Function *LF = F->Codegen()) { + fprintf(stderr, "Read function definition:"); + LF->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleExtern() { + if (PrototypeAST *P = ParseExtern()) { + if (Function *F = P->Codegen()) { + fprintf(stderr, "Read extern: "); + F->dump(); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +static void HandleTopLevelExpression() { + // Evaluate a top-level expression into an anonymous function. + if (FunctionAST *F = ParseTopLevelExpr()) { + if (Function *LF = F->Codegen()) { + // JIT the function, returning a function pointer. + void *FPtr = TheExecutionEngine->getPointerToFunction(LF); + + // Cast it to the right type (takes no arguments, returns a double) so we + // can call it as a native function. + double (*FP)() = (double (*)())(intptr_t)FPtr; + fprintf(stderr, "Evaluated to %f\n", FP()); + } + } else { + // Skip token for error recovery. + getNextToken(); + } +} + +/// top ::= definition | external | expression | ';' +static void MainLoop() { + while (1) { + fprintf(stderr, "ready> "); + switch (CurTok) { + case tok_eof: return; + case ';': getNextToken(); break; // ignore top-level semicolons. + case tok_def: HandleDefinition(); break; + case tok_extern: HandleExtern(); break; + default: HandleTopLevelExpression(); break; + } + } +} + +//===----------------------------------------------------------------------===// +// "Library" functions that can be "extern'd" from user code. +//===----------------------------------------------------------------------===// + +/// putchard - putchar that takes a double and returns 0. +extern "C" +double putchard(double X) { + putchar((char)X); + return 0; +} + +/// printd - printf that takes a double prints it as "%f\n", returning 0. +extern "C" +double printd(double X) { + printf("%f\n", X); + return 0; +} + +//===----------------------------------------------------------------------===// +// Main driver code. +//===----------------------------------------------------------------------===// + +int main() { + InitializeNativeTarget(); + LLVMContext &Context = getGlobalContext(); + + // Install standard binary operators. + // 1 is lowest precedence. + BinopPrecedence['<'] = 10; + BinopPrecedence['+'] = 20; + BinopPrecedence['-'] = 20; + BinopPrecedence['*'] = 40; // highest. + + // Prime the first token. + fprintf(stderr, "ready> "); + getNextToken(); + + // Make the module, which holds all the code. + TheModule = new Module("my cool jit", Context); + + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); + + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + OurFPM.doInitialization(); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); + + return 0; +} Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile?rev=82574&r1=82573&r2=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile Tue Sep 22 16:15:19 2009 @@ -1,4 +1,4 @@ -##===- examples/Kaleidoscope-Ch7/Makefile ------------------*- Makefile -*-===## +##===- examples/Kaleidoscope/Chapter7/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -6,7 +6,7 @@ # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## -LEVEL = ../.. +LEVEL = ../../.. TOOLNAME = Kaleidoscope-Ch7 EXAMPLE_TOOL = 1 Modified: llvm/trunk/examples/Kaleidoscope/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Makefile?rev=82574&r1=82573&r2=82574&view=diff ============================================================================== --- llvm/trunk/examples/Kaleidoscope/Makefile (original) +++ llvm/trunk/examples/Kaleidoscope/Makefile Tue Sep 22 16:15:19 2009 @@ -10,6 +10,6 @@ include $(LEVEL)/Makefile.config -PARALLEL_DIRS:= Chapter7 +PARALLEL_DIRS:= Chapter2 Chapter3 Chapter4 Chapter5 Chapter6 Chapter7 include $(LEVEL)/Makefile.common From evan at fallingsnow.net Tue Sep 22 16:36:56 2009 From: evan at fallingsnow.net (Evan Phoenix) Date: Tue, 22 Sep 2009 14:36:56 -0700 Subject: [llvm-commits] [PATCH] Reduce number of stubs used in 64bit code In-Reply-To: <381539BB-D0CA-435E-B426-A2AD3E6489B3@fallingsnow.net> References: <381539BB-D0CA-435E-B426-A2AD3E6489B3@fallingsnow.net> Message-ID: Anyone have a comment on this? If not, it would be great to make it into 2.6 if possible. Thanks! - Evan On Sep 1, 2009, at 2:34 PM, Evan Phoenix wrote: > Currently the JIT running on a x86_64 platform can only call an > external function through a stub. This is because of a conservative > decision about how the encoding of a pc-relative address would > should up in the machine code stream. These stubs incur a penalty, > so any stubs that can be eliminated should be. > > The attached patch allows the JITEmitter to override the CodeGen's > decision to use a stub by validating if a stub is actually needed. > Thus any calling functions who's pc-relative offset fits directly in > a call instruction are used the same as they would on a 32bit > platform. > > "Long" calls are still done via the stub mechanism. > > This only effects the calling of externally defined functions. It > changes nothing with regard to lazy/future JIT'd LLVM functions. > > Thanks, > > - Evan Phoenix > > > stubs5.diff>_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Sep 22 16:43:45 2009 From: clattner at apple.com (Chris Lattner) Date: Tue, 22 Sep 2009 14:43:45 -0700 Subject: [llvm-commits] [PATCH] Reduce number of stubs used in 64bit code In-Reply-To: References: <381539BB-D0CA-435E-B426-A2AD3E6489B3@fallingsnow.net> Message-ID: <3C7F47E2-0E57-4CAF-8763-35B234E4C758@apple.com> On Sep 22, 2009, at 2:36 PM, Evan Phoenix wrote: > Anyone have a comment on this? If not, it would be great to make it > into 2.6 if possible. I don't have an opinion, but it is too late for 2.6, sorry. -Chris > > Thanks! > > - Evan > > On Sep 1, 2009, at 2:34 PM, Evan Phoenix wrote: > >> Currently the JIT running on a x86_64 platform can only call an >> external function through a stub. This is because of a conservative >> decision about how the encoding of a pc-relative address would >> should up in the machine code stream. These stubs incur a penalty, >> so any stubs that can be eliminated should be. >> >> The attached patch allows the JITEmitter to override the CodeGen's >> decision to use a stub by validating if a stub is actually needed. >> Thus any calling functions who's pc-relative offset fits directly in >> a call instruction are used the same as they would on a 32bit >> platform. >> >> "Long" calls are still done via the stub mechanism. >> >> This only effects the calling of externally defined functions. It >> changes nothing with regard to lazy/future JIT'd LLVM functions. >> >> Thanks, >> >> - Evan Phoenix >> >> >> > stubs5.diff>_______________________________________________ >> 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 evan at fallingsnow.net Tue Sep 22 16:45:47 2009 From: evan at fallingsnow.net (Evan Phoenix) Date: Tue, 22 Sep 2009 14:45:47 -0700 Subject: [llvm-commits] [PATCH] Reduce number of stubs used in 64bit code In-Reply-To: <3C7F47E2-0E57-4CAF-8763-35B234E4C758@apple.com> References: <381539BB-D0CA-435E-B426-A2AD3E6489B3@fallingsnow.net> <3C7F47E2-0E57-4CAF-8763-35B234E4C758@apple.com> Message-ID: <9E5D6806-2976-4FB2-8AC2-40E3F93BFA50@fallingsnow.net> On Sep 22, 2009, at 2:43 PM, Chris Lattner wrote: > > On Sep 22, 2009, at 2:36 PM, Evan Phoenix wrote: > >> Anyone have a comment on this? If not, it would be great to make it >> into 2.6 if possible. > > I don't have an opinion, but it is too late for 2.6, sorry. > Darn, well, trunk is better than nothin'! - Evan > -Chris > >> >> Thanks! >> >> - Evan >> >> On Sep 1, 2009, at 2:34 PM, Evan Phoenix wrote: >> >>> Currently the JIT running on a x86_64 platform can only call an >>> external function through a stub. This is because of a conservative >>> decision about how the encoding of a pc-relative address would >>> should up in the machine code stream. These stubs incur a penalty, >>> so any stubs that can be eliminated should be. >>> >>> The attached patch allows the JITEmitter to override the CodeGen's >>> decision to use a stub by validating if a stub is actually needed. >>> Thus any calling functions who's pc-relative offset fits directly in >>> a call instruction are used the same as they would on a 32bit >>> platform. >>> >>> "Long" calls are still done via the stub mechanism. >>> >>> This only effects the calling of externally defined functions. It >>> changes nothing with regard to lazy/future JIT'd LLVM functions. >>> >>> Thanks, >>> >>> - Evan Phoenix >>> >>> >>> >> stubs5.diff>_______________________________________________ >>> 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 daniel at zuster.org Tue Sep 22 17:32:30 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 22 Sep 2009 15:32:30 -0700 Subject: [llvm-commits] [llvm] r82537 - in /llvm/trunk: lib/System/Win32/Signals.inc utils/lit/TestingConfig.py In-Reply-To: References: <200909220950.n8M9oUWk010710@zion.cs.uiuc.edu> Message-ID: <6a8523d60909221532s61f53990jd4baf7a0ec1e4a9e@mail.gmail.com> Fixed, I hope? Sorry, that was a total thinko. - Daniel On Tue, Sep 22, 2009 at 8:16 AM, Mikhail Glushenkov wrote: > Hi, > > Daniel Dunbar writes: > >> >> Author: ddunbar >> Date: Tue Sep 22 04:50:28 2009 >> New Revision: 82537 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82537&view=rev >> Log: >> Add a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in > RegisterHandler and use to >> disable the Win32 crash dialogs. These are a major blocker to any kind of > automated testing. > > This breaks the MinGW build: > > In file included from c:/code/codedgers/llvm/lib/System/Signals.cpp:33: > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc: In function `int > llvm::CRTReportHook(int, char*, int*)': > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:69: error: `_CRT_ASSERT' was > not declared in this scope > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:75: error: `_CRT_ERROR' was > not declared in this scope > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:81: error: `_CRT_WARN' was > not declared in this scope > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:69: warning: unused variable > '_CRT_ASSERT' > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:75: warning: unused variable > '_CRT_ERROR' > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:81: warning: unused variable > '_CRT_WARN' > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc: In function `void > llvm::RegisterHandler()': > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:110: error: > `_CrtSetReportHook' was not declared in this scope > c:/code/codedgers/llvm/lib/System/Win32/Signals.inc:110: warning: unused > variable '_CrtSetReportHook' > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From anton at korobeynikov.info Tue Sep 22 17:35:14 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Wed, 23 Sep 2009 02:35:14 +0400 Subject: [llvm-commits] [llvm] r82537 - in /llvm/trunk: lib/System/Win32/Signals.inc utils/lit/TestingConfig.py In-Reply-To: <6a8523d60909221532s61f53990jd4baf7a0ec1e4a9e@mail.gmail.com> References: <200909220950.n8M9oUWk010710@zion.cs.uiuc.edu> <6a8523d60909221532s61f53990jd4baf7a0ec1e4a9e@mail.gmail.com> Message-ID: > Fixed, I hope? Sorry, that was a total thinko. Yes. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From isanbard at gmail.com Tue Sep 22 18:47:18 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Sep 2009 23:47:18 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82590 - in /llvm-gcc-4.2/tags/Apple: llvmgcc42-2207.4/ llvmgcc42-2208.2/ Message-ID: <200909222347.n8MNlIse021308@zion.cs.uiuc.edu> Author: void Date: Tue Sep 22 18:47:18 2009 New Revision: 82590 URL: http://llvm.org/viewvc/llvm-project?rev=82590&view=rev Log: Renaming llvmgcc42-2208.2 to llvmgcc42-2207.4. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.4/ - copied from r82589, llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ From isanbard at gmail.com Tue Sep 22 18:46:48 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Sep 2009 23:46:48 -0000 Subject: [llvm-commits] [llvm] r82589 - in /llvm/tags/Apple: llvmCore-2207.4/ llvmCore-2208.2/ Message-ID: <200909222346.n8MNkmbo021236@zion.cs.uiuc.edu> Author: void Date: Tue Sep 22 18:46:47 2009 New Revision: 82589 URL: http://llvm.org/viewvc/llvm-project?rev=82589&view=rev Log: Renaming llvmCore-2208.2 to llvmCore-2207.4. Added: llvm/tags/Apple/llvmCore-2207.4/ - copied from r82588, llvm/tags/Apple/llvmCore-2208.2/ Removed: llvm/tags/Apple/llvmCore-2208.2/ From mrs at apple.com Tue Sep 22 19:13:31 2009 From: mrs at apple.com (Mike Stump) Date: Wed, 23 Sep 2009 00:13:31 -0000 Subject: [llvm-commits] [llvm] r82591 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200909230013.n8N0DVHX024647@zion.cs.uiuc.edu> Author: mrs Date: Tue Sep 22 19:13:30 2009 New Revision: 82591 URL: http://llvm.org/viewvc/llvm-project?rev=82591&view=rev Log: This is overly constraining with respect to clang. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=82591&r1=82590&r2=82591&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Sep 22 19:13:30 2009 @@ -662,9 +662,6 @@ std::string typeName; blockStruct.getName(typeName); - assert(typeName.find ("__Block_byref_") == 0 - && "Attempting to get Block location of non-Block variable!"); - // Find the __forwarding field and the variable field in the __Block_byref // struct. From tonic at nondot.org Tue Sep 22 19:18:08 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 22 Sep 2009 19:18:08 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909230018.n8N0I806025335@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.19 -> 1.20 --- Log message: No onsite registration. --- Diffs of the changes: (+2 -2) index.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.19 llvm-www/devmtg/2009-10/index.php:1.20 --- llvm-www/devmtg/2009-10/index.php:1.19 Fri Sep 18 19:00:38 2009 +++ llvm-www/devmtg/2009-10/index.php Tue Sep 22 19:17:05 2009 @@ -62,8 +62,8 @@

Attendance is free and open to everyone, but we ask that everyone planning on -attending to register so that we get a rough -estimate of attendance.

+attending to register. No onsite registration will be allowed.

+

We also ask that everyone planning on attending register (including speakers). This gives us an accurate tally of how many people will be there.

From tonic at nondot.org Tue Sep 22 19:18:53 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 22 Sep 2009 19:18:53 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909230018.n8N0IrZD025456@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.20 -> 1.21 --- Log message: Remove line. --- Diffs of the changes: (+0 -5) index.php | 5 ----- 1 files changed, 5 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.20 llvm-www/devmtg/2009-10/index.php:1.21 --- llvm-www/devmtg/2009-10/index.php:1.20 Tue Sep 22 19:17:05 2009 +++ llvm-www/devmtg/2009-10/index.php Tue Sep 22 19:18:37 2009 @@ -64,11 +64,6 @@

Attendance is free and open to everyone, but we ask that everyone planning on attending to register. No onsite registration will be allowed.

- -

We also ask that everyone planning on attending register (including -speakers). This gives us an accurate tally of how many people will be there.

- -

This table lists all attendees who have registered to attend this year's conference.

From tonic at nondot.org Tue Sep 22 19:19:56 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 22 Sep 2009 19:19:56 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909230019.n8N0JuIJ025608@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.21 -> 1.22 --- Log message: Comment out line that makes no sense now. --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.21 llvm-www/devmtg/2009-10/index.php:1.22 --- llvm-www/devmtg/2009-10/index.php:1.21 Tue Sep 22 19:18:37 2009 +++ llvm-www/devmtg/2009-10/index.php Tue Sep 22 19:19:41 2009 @@ -90,7 +90,7 @@ -->

Total Confirmed:

-

If your name is misspelled, or organization affiliation isn't correct, please email us, and we'll correct it. +

Agenda
From tonic at nondot.org Tue Sep 22 19:21:22 2009 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 22 Sep 2009 19:21:22 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909230021.n8N0LMD9025819@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.22 -> 1.23 --- Log message: Add note that list of attendees is offline. --- Diffs of the changes: (+1 -0) index.php | 1 + 1 files changed, 1 insertion(+) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.22 llvm-www/devmtg/2009-10/index.php:1.23 --- llvm-www/devmtg/2009-10/index.php:1.22 Tue Sep 22 19:19:41 2009 +++ llvm-www/devmtg/2009-10/index.php Tue Sep 22 19:21:05 2009 @@ -67,6 +67,7 @@

This table lists all attendees who have registered to attend this year's conference.

+

The list of attendees is offline for now.

-

This is not a finalized schedule, but a list of the talks that will be given. We will update once we have the final schedule. You can expect the day to start at 8:45, with breakfast from 8:00-8:45.

+ +

2009 LLVM Developers' Meeting Agenda:

- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TimeTalk TitleSpeaker
8:00-8:45BREAKFAST
8:45-9:00WelcomeChris Lattner, Apple
9:00-9:35ClangSteve Naroff, Apple
9:35-10:10CodeGen Overview and Focus on SelectionDAGsDan Gohman
10:10-10:30BREAK
10:30-11:05Register AllocationEvan Cheng, Apple
11:05-11:40Building an Efficient JITNate Begeman, Apple
11:40-12:10LLVM Panel DiscussionLLVM Code Owners
12:10-1:30LUNCH
1:30-2:05
Garage1:Adobe Image Foundation and Adobe PixelBender -Chuck Rose III, Adobe
Garage2:
2:10-2:45
Garage1:Finding Bugs with Source Code AnalysisTed Kremenek
Garage2:Building a JIT compiler for PHP in 2 daysNuno Lopes, Instituto Superior Tecnico
2:50-3:25
Garage1:llvmc2 -Anton Korobeynikov, Saint Petersburg State University
Garage2:SVA: Using LLVM to Provide Memory SafetyJohn Criswell, University of Illinois
3:25-3:45BREAK
3:45-4:20
Garage1:The VMKit Project -Nicolas Geoffray, Universite Pierre et Marie Curie
Garage2:The LLVM Hardware BackendTim Sander, Technischen Universitat Darmstadt
4:25-5:00
Garage1:Targeting the Adobe Flash Virtual MachineScott Petersen, Adobe
5:30-7:30DINNER (Must have registered w/ dinner option)
8:00-8:45BREAKFAST (Piano Bar)
8:45-9:00
Town Hall:WelcomeChris Lattner, Apple
9:00-9:40
Town Hall:State of ClangDoug Gregor, Chris Lattner, Ted Kremenek, Apple
9:40-10:20
Town Hall:Tutorial: Building a backend in 24 hours +Anton Korobeynikov, Saint Petersburg State University
Garage 1/2:Precise and Efficient Garbage Collection in VMKit with MMTk +Nicolas Geoffray, Universite Pierre et Marie Curie
10:20-10:40BREAK
10:40-11:20
Town Hall:Unladen Swallow: Python on LLVM +Colin Winter, Google
Garage 1/2:Reimplementing llvm-gcc as a gcc plugin +Duncan Sands, Deep Blue Capital
11:20-12:00
Town Hall:ScalarEvolution and Loop Optimization +Dan Gohman, Apple
Garage 1/2:Object Code Emission +Bruno Cardoso Lopes, University of Campinas
12:00-1:00LUNCH (Piano Bar and Upstairs)
1:00-1:40
Town Hall:LLVM on 180k CoresDavid Greene, Cray
Garage 1/2:The Parfait Bug-Checker +Cristina Cifuentes, Sun Microsystems
1:40-2:20
Town Hall:Optimizing ActionScript Bytecode using LLVMScott Petersen, Adobe
Garage 1/2:Targeting XCore resources from LLVM +Richard Osborne, XMOS
2:20-3:00
Town Hall:Future Works in LLVM Register AllocationLang Hames, Apple / The University of Sydney
Garage 1/2:CoVaC: Compiler Validation by Program Analysis of the Cross-Product +Anna Zaks, New York University
3:00-3:20BREAK
3:20-4:00
Town Hall:(Title TBD)Nate Begeman, Apple
Garage 1/2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C +Santosh Nagarakatte, University of Pennsylvania
4:00-4:40
Town Hall:PLANG: Translating NVIDIA PTX language to LLVM IRVinod Grover, NVIDIA
Garage 1/2:Accelerating Ruby with LLVM +Evan Phoenix, Engine Yard / Rubinius
4:40-5:20
Town Hall:LLVM Code Owners
5:30-7:30DINNER (Piano Bar, Must have registered w/ dinner option)
--->
BOFs

Unique to this year's Developer Meeting, we will have Birds-of-a-Feather sessions (BOFs) that will coincide with the talks. For those unfamiliar with BOFs, these are attendee organized meetings for people to meet, exchange ideas, and share information on a variety of topics. BOF slots will be 40 minutes long. BOFs will be printed on the official schedule and be put on the website so attendees can plan to attend. @@ -171,7 +184,7 @@ href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=4+Infinite+Loop,+Cupertino,+CA+95014&sll=37.333228,-122.028923&sspn=0.010561,0.020964&ie=UTF8&ll=37.333228,-122.028923&spn=0.010561,0.020964&z=16&iwloc=addr">Infinite Loop 4 at Apple Inc.'s campus. The conference center is publicly accessible to non-Apple employees. You must check in at the lobby desk and receive a name badge. -The conference is held on the second floor in rooms Garage 1 and Garage 2. There will be signs to assist you in locating the room. +The conference is held on the first floor in Town Hall and Piano Bar, and on the second floor in rooms Garage 1 and Garage 2.

Parking
From tonic at nondot.org Wed Sep 23 16:36:58 2009 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 23 Sep 2009 16:36:58 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909232136.n8NLaw2B006618@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.24 -> 1.25 --- Log message: Change title to bold. --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.24 llvm-www/devmtg/2009-10/index.php:1.25 --- llvm-www/devmtg/2009-10/index.php:1.24 Wed Sep 23 16:30:31 2009 +++ llvm-www/devmtg/2009-10/index.php Wed Sep 23 16:36:43 2009 @@ -168,7 +168,7 @@ Garage 1/2:Accelerating Ruby with LLVM Evan Phoenix, Engine Yard / Rubinius 4:40-5:20 -Town Hall:LLVM Code Owners +Town Hall:LLVM Code Owners 5:30-7:30DINNER (Piano Bar, Must have registered w/ dinner option) From david_goodwin at apple.com Wed Sep 23 16:38:08 2009 From: david_goodwin at apple.com (David Goodwin) Date: Wed, 23 Sep 2009 21:38:08 -0000 Subject: [llvm-commits] [llvm] r82657 - in /llvm/trunk/lib/Target/ARM: ARM.td ARMInstrNEON.td ARMSchedule.td ARMScheduleV6.td ARMScheduleV7.td Message-ID: <200909232138.n8NLc87n006796@zion.cs.uiuc.edu> Author: david_goodwin Date: Wed Sep 23 16:38:08 2009 New Revision: 82657 URL: http://llvm.org/viewvc/llvm-project?rev=82657&view=rev Log: Checkpoint NEON scheduling itineraries. Modified: llvm/trunk/lib/Target/ARM/ARM.td llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/lib/Target/ARM/ARMSchedule.td llvm/trunk/lib/Target/ARM/ARMScheduleV6.td llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Modified: llvm/trunk/lib/Target/ARM/ARM.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td?rev=82657&r1=82656&r2=82657&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARM.td (original) +++ llvm/trunk/lib/Target/ARM/ARM.td Wed Sep 23 16:38:08 2009 @@ -92,30 +92,21 @@ def : ProcNoItin<"iwmmxt", [ArchV5TE]>; // V6 Processors. -def : Processor<"arm1136j-s", V6Itineraries, - [ArchV6]>; -def : Processor<"arm1136jf-s", V6Itineraries, - [ArchV6, FeatureVFP2]>; -def : Processor<"arm1176jz-s", V6Itineraries, - [ArchV6]>; -def : Processor<"arm1176jzf-s", V6Itineraries, - [ArchV6, FeatureVFP2]>; -def : Processor<"mpcorenovfp", V6Itineraries, - [ArchV6]>; -def : Processor<"mpcore", V6Itineraries, - [ArchV6, FeatureVFP2]>; +def : ProcNoItin<"arm1136j-s", [ArchV6]>; +def : ProcNoItin<"arm1136jf-s", [ArchV6, FeatureVFP2]>; +def : ProcNoItin<"arm1176jz-s", [ArchV6]>; +def : ProcNoItin<"arm1176jzf-s", [ArchV6, FeatureVFP2]>; +def : ProcNoItin<"mpcorenovfp", [ArchV6]>; +def : ProcNoItin<"mpcore", [ArchV6, FeatureVFP2]>; // V6T2 Processors. -def : Processor<"arm1156t2-s", V6Itineraries, - [ArchV6T2, FeatureThumb2]>; -def : Processor<"arm1156t2f-s", V6Itineraries, - [ArchV6T2, FeatureThumb2, FeatureVFP2]>; +def : ProcNoItin<"arm1156t2-s", [ArchV6T2, FeatureThumb2]>; +def : ProcNoItin<"arm1156t2f-s", [ArchV6T2, FeatureThumb2, FeatureVFP2]>; // V7 Processors. def : Processor<"cortex-a8", CortexA8Itineraries, [ArchV7A, FeatureThumb2, FeatureNEON, FeatureNEONFP]>; -def : Processor<"cortex-a9", CortexA9Itineraries, - [ArchV7A, FeatureThumb2, FeatureNEON]>; +def : ProcNoItin<"cortex-a9", [ArchV7A, FeatureThumb2, FeatureNEON]>; //===----------------------------------------------------------------------===// // Register File Description Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=82657&r1=82656&r2=82657&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Wed Sep 23 16:38:08 2009 @@ -110,7 +110,7 @@ let mayLoad = 1 in { def VLDMD : NI<(outs), (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops), - NoItinerary, + IIC_fpLoadm, "vldm${addr:submode} ${addr:base}, $dst1", []> { let Inst{27-25} = 0b110; @@ -120,7 +120,7 @@ def VLDMS : NI<(outs), (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops), - NoItinerary, + IIC_fpLoadm, "vldm${addr:submode} ${addr:base}, $dst1", []> { let Inst{27-25} = 0b110; @@ -132,7 +132,7 @@ // Use vldmia to load a Q register as a D register pair. def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr), - NoItinerary, + IIC_fpLoadm, "vldmia $addr, ${dst:dregpair}", [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> { let Inst{27-25} = 0b110; @@ -144,7 +144,7 @@ // Use vstmia to store a Q register as a D register pair. def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr), - NoItinerary, + IIC_fpStorem, "vstmia $addr, ${src:dregpair}", [(store (v2f64 QPR:$src), addrmode4:$addr)]> { let Inst{27-25} = 0b110; @@ -156,11 +156,11 @@ // VLD1 : Vector Load (multiple single elements) class VLD1D - : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), NoItinerary, + : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), IIC_VLD1, !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "", [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>; class VLD1Q - : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), NoItinerary, + : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), IIC_VLD1, !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "", [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>; @@ -180,7 +180,7 @@ // VLD2 : Vector Load (multiple 2-element structures) class VLD2D - : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), NoItinerary, + : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), IIC_VLD2, !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>; def VLD2d8 : VLD2D<"vld2.8">; @@ -190,7 +190,7 @@ // VLD3 : Vector Load (multiple 3-element structures) class VLD3D : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), (ins addrmode6:$addr), - NoItinerary, + IIC_VLD3, !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>; def VLD3d8 : VLD3D<"vld3.8">; @@ -200,7 +200,7 @@ // VLD4 : Vector Load (multiple 4-element structures) class VLD4D : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4), - (ins addrmode6:$addr), NoItinerary, + (ins addrmode6:$addr), IIC_VLD4, !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"), "", []>; @@ -212,7 +212,7 @@ class VLD2LND : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane), - NoItinerary, + IIC_VLD2, !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane]\\}, $addr"), "$src1 = $dst1, $src2 = $dst2", []>; @@ -224,7 +224,7 @@ class VLD3LND : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, - nohash_imm:$lane), NoItinerary, + nohash_imm:$lane), IIC_VLD3, !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane]\\}, $addr"), "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>; @@ -237,7 +237,7 @@ class VLD4LND : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4, - nohash_imm:$lane), NoItinerary, + nohash_imm:$lane), IIC_VLD4, !strconcat(OpcodeStr, "\t\\{$dst1[$lane],$dst2[$lane],$dst3[$lane],$dst4[$lane]\\}, $addr"), "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>; @@ -249,11 +249,11 @@ // VST1 : Vector Store (multiple single elements) class VST1D - : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), NoItinerary, + : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), IIC_VST, !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "", [(IntOp addrmode6:$addr, (Ty DPR:$src))]>; class VST1Q - : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), NoItinerary, + : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), IIC_VST, !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "", [(IntOp addrmode6:$addr, (Ty QPR:$src))]>; @@ -273,7 +273,7 @@ // VST2 : Vector Store (multiple 2-element structures) class VST2D - : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), NoItinerary, + : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST, !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>; def VST2d8 : VST2D<"vst2.8">; @@ -283,7 +283,7 @@ // VST3 : Vector Store (multiple 3-element structures) class VST3D : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), - NoItinerary, + IIC_VST, !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>; def VST3d8 : VST3D<"vst3.8">; @@ -293,7 +293,7 @@ // VST4 : Vector Store (multiple 4-element structures) class VST4D : NLdSt<(outs), (ins addrmode6:$addr, - DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), NoItinerary, + DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), IIC_VST, !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"), "", []>; @@ -304,7 +304,7 @@ // VST2LN : Vector Store (single 2-element structure from one lane) class VST2LND : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane), - NoItinerary, + IIC_VST, !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane]\\}, $addr"), "", []>; @@ -315,7 +315,7 @@ // VST3LN : Vector Store (single 3-element structure from one lane) class VST3LND : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, - nohash_imm:$lane), NoItinerary, + nohash_imm:$lane), IIC_VST, !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane],$src3[$lane]\\}, $addr"), "", []>; @@ -326,7 +326,7 @@ // VST4LN : Vector Store (single 4-element structure from one lane) class VST4LND : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, - DPR:$src4, nohash_imm:$lane), NoItinerary, + DPR:$src4, nohash_imm:$lane), IIC_VST, !strconcat(OpcodeStr, "\t\\{$src1[$lane],$src2[$lane],$src3[$lane],$src4[$lane]\\}, $addr"), "", []>; @@ -385,13 +385,13 @@ bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode OpNode> : N2V; class N2VQ op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode OpNode> : N2V; // Basic 2-register operations, scalar single-precision. @@ -400,7 +400,7 @@ ValueType ResTy, ValueType OpTy, SDNode OpNode> : N2V; + IIC_VUNAD, !strconcat(OpcodeStr, "\t$dst, $src"), "", []>; class N2VDsPat : NEONFPPat<(ResTy (OpNode SPR:$a)), @@ -410,24 +410,27 @@ // Basic 2-register intrinsics, both double- and quad-register. class N2VDInt op24_23, bits<2> op21_20, bits<2> op19_18, - bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, + bits<2> op17_16, bits<5> op11_7, bit op4, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; class N2VQInt op24_23, bits<2> op21_20, bits<2> op19_18, - bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, + bits<2> op17_16, bits<5> op11_7, bit op4, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; // Basic 2-register intrinsics, scalar single-precision class N2VDInts op24_23, bits<2> op21_20, bits<2> op19_18, - bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, + bits<2> op17_16, bits<5> op11_7, bit op4, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; class N2VDIntsPat @@ -439,38 +442,40 @@ // Narrow 2-register intrinsics. class N2VNInt op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16, bits<5> op11_7, bit op6, bit op4, - string OpcodeStr, ValueType TyD, ValueType TyQ, Intrinsic IntOp> + InstrItinClass itin, string OpcodeStr, + ValueType TyD, ValueType TyQ, Intrinsic IntOp> : N2V; // Long 2-register intrinsics. (This is currently only used for VMOVL and is // derived from N2VImm instead of N2V because of the way the size is encoded.) class N2VLInt op21_16, bits<4> op11_8, bit op7, - bit op6, bit op4, string OpcodeStr, ValueType TyQ, ValueType TyD, - Intrinsic IntOp> + bit op6, bit op4, InstrItinClass itin, string OpcodeStr, + ValueType TyQ, ValueType TyD, Intrinsic IntOp> : N2VImm; // 2-register shuffles (VTRN/VZIP/VUZP), both double- and quad-register. class N2VDShuffle op19_18, bits<5> op11_7, string OpcodeStr> : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 0, 0, (outs DPR:$dst1, DPR:$dst2), - (ins DPR:$src1, DPR:$src2), NoItinerary, + (ins DPR:$src1, DPR:$src2), IIC_VPERMD, !strconcat(OpcodeStr, "\t$dst1, $dst2"), "$src1 = $dst1, $src2 = $dst2", []>; -class N2VQShuffle op19_18, bits<5> op11_7, string OpcodeStr> +class N2VQShuffle op19_18, bits<5> op11_7, + InstrItinClass itin, string OpcodeStr> : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2), - (ins QPR:$src1, QPR:$src2), NoItinerary, + (ins QPR:$src1, QPR:$src2), itin, !strconcat(OpcodeStr, "\t$dst1, $dst2"), "$src1 = $dst1, $src2 = $dst2", []>; // Basic 3-register operations, both double- and quad-register. class N3VD op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType ResTy, ValueType OpTy, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable> : N3V { let isCommutable = Commutable; @@ -501,10 +506,10 @@ } class N3VQ op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType ResTy, ValueType OpTy, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable> : N3V { let isCommutable = Commutable; @@ -939,22 +944,24 @@ // First with only element sizes of 8, 16 and 32 bits: multiclass N3V_QHS op11_8, bit op4, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, string OpcodeStr, SDNode OpNode, bit Commutable = 0> { // 64-bit vector types. - def v8i8 : N3VD; - def v4i16 : N3VD; - def v2i32 : N3VD; + def v8i8 : N3VD; + def v4i16 : N3VD; + def v2i32 : N3VD; // 128-bit vector types. - def v16i8 : N3VQ; - def v8i16 : N3VQ; - def v4i32 : N3VQ; + def v16i8 : N3VQ; + def v8i16 : N3VQ; + def v4i32 : N3VQ; } multiclass N3VSL_HS op11_8, string OpcodeStr, SDNode ShOp> { @@ -966,26 +973,29 @@ // ....then also with element size 64 bits: multiclass N3V_QHSD op11_8, bit op4, + InstrItinClass itinD, InstrItinClass itinQ, string OpcodeStr, SDNode OpNode, bit Commutable = 0> - : N3V_QHS { - def v1i64 : N3VD; - def v2i64 : N3VQ; + : N3V_QHS { + def v1i64 : N3VD; + def v2i64 : N3VQ; } // Neon Narrowing 2-register vector intrinsics, // source operand element sizes of 16, 32 and 64 bits: multiclass N2VNInt_HSD op24_23, bits<2> op21_20, bits<2> op17_16, - bits<5> op11_7, bit op6, bit op4, string OpcodeStr, + bits<5> op11_7, bit op6, bit op4, + InstrItinClass itin, string OpcodeStr, Intrinsic IntOp> { def v8i8 : N2VNInt; + itin, !strconcat(OpcodeStr, "16"), v8i8, v8i16, IntOp>; def v4i16 : N2VNInt; + itin, !strconcat(OpcodeStr, "32"), v4i16, v4i32, IntOp>; def v2i32 : N2VNInt; + itin, !strconcat(OpcodeStr, "64"), v2i32, v2i64, IntOp>; } @@ -994,11 +1004,11 @@ multiclass N2VLInt_QHS op11_8, bit op7, bit op6, bit op4, string OpcodeStr, Intrinsic IntOp> { def v8i16 : N2VLInt; + IIC_VQUNAiD, !strconcat(OpcodeStr, "8"), v8i16, v8i8, IntOp>; def v4i32 : N2VLInt; + IIC_VQUNAiD, !strconcat(OpcodeStr, "16"), v4i32, v4i16, IntOp>; def v2i64 : N2VLInt; + IIC_VQUNAiD, !strconcat(OpcodeStr, "32"), v2i64, v2i32, IntOp>; } @@ -1187,23 +1197,24 @@ // Neon 2-register vector intrinsics, // element sizes of 8, 16 and 32 bits: multiclass N2VInt_QHS op24_23, bits<2> op21_20, bits<2> op17_16, - bits<5> op11_7, bit op4, string OpcodeStr, - Intrinsic IntOp> { + bits<5> op11_7, bit op4, + InstrItinClass itinD, InstrItinClass itinQ, + string OpcodeStr, Intrinsic IntOp> { // 64-bit vector types. def v8i8 : N2VDInt; + itinD, !strconcat(OpcodeStr, "8"), v8i8, v8i8, IntOp>; def v4i16 : N2VDInt; + itinD, !strconcat(OpcodeStr, "16"), v4i16, v4i16, IntOp>; def v2i32 : N2VDInt; + itinD, !strconcat(OpcodeStr, "32"), v2i32, v2i32, IntOp>; // 128-bit vector types. def v16i8 : N2VQInt; + itinQ, !strconcat(OpcodeStr, "8"), v16i8, v16i8, IntOp>; def v8i16 : N2VQInt; + itinQ, !strconcat(OpcodeStr, "16"), v8i16, v8i16, IntOp>; def v4i32 : N2VQInt; + itinQ, !strconcat(OpcodeStr, "32"), v4i32, v4i32, IntOp>; } @@ -1337,9 +1348,9 @@ // Vector Add Operations. // VADD : Vector Add (integer and floating-point) -defm VADD : N3V_QHSD<0, 0, 0b1000, 0, "vadd.i", add, 1>; -def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, "vadd.f32", v2f32, v2f32, fadd, 1>; -def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, "vadd.f32", v4f32, v4f32, fadd, 1>; +defm VADD : N3V_QHSD<0, 0, 0b1000, 0, IIC_VBINiD, IIC_VBINiQ, "vadd.i", add, 1>; +def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>; +def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>; // VADDL : Vector Add Long (Q = D + D) defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, "vaddl.s", int_arm_neon_vaddls, 1>; defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, "vaddl.u", int_arm_neon_vaddlu, 1>; @@ -1363,13 +1374,14 @@ // Vector Multiply Operations. // VMUL : Vector Multiply (integer, polynomial and floating-point) -defm VMUL : N3V_QHS<0, 0, 0b1001, 1, "vmul.i", mul, 1>; +defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q, + IIC_VMULi32Q, "vmul.i", mul, 1>; def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, "vmul.p8", v8i8, v8i8, int_arm_neon_vmulp, 1>; def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, "vmul.p8", v16i8, v16i8, int_arm_neon_vmulp, 1>; -def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, "vmul.f32", v2f32, v2f32, fmul, 1>; -def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, "vmul.f32", v4f32, v4f32, fmul, 1>; +def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>; +def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>; defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>; def VMULslfd : N3VDSL<0b10, 0b1001, "vmul.f32", v2f32, fmul>; def VMULslfq : N3VQSL<0b10, 0b1001, "vmul.f32", v4f32, v2f32, fmul>; @@ -1533,9 +1545,9 @@ // Vector Subtract Operations. // VSUB : Vector Subtract (integer and floating-point) -defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, "vsub.i", sub, 0>; -def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, "vsub.f32", v2f32, v2f32, fsub, 0>; -def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, "vsub.f32", v4f32, v4f32, fsub, 0>; +defm VSUB : N3V_QHSD<1, 0, 0b1000, 0, IIC_VSUBiD, IIC_VSUBiQ, "vsub.i", sub, 0>; +def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>; +def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>; // VSUBL : Vector Subtract Long (Q = D - D) defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, "vsubl.s", int_arm_neon_vsubls, 1>; defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, "vsubl.u", int_arm_neon_vsublu, 1>; @@ -1556,19 +1568,24 @@ // Vector Comparisons. // VCEQ : Vector Compare Equal -defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, "vceq.i", NEONvceq, 1>; -def VCEQfd : N3VD<0,0,0b00,0b1110,0, "vceq.f32", v2i32, v2f32, NEONvceq, 1>; -def VCEQfq : N3VQ<0,0,0b00,0b1110,0, "vceq.f32", v4i32, v4f32, NEONvceq, 1>; +defm VCEQ : N3V_QHS<1, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vceq.i", NEONvceq, 1>; +def VCEQfd : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq.f32", v2i32, v2f32, NEONvceq, 1>; +def VCEQfq : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq.f32", v4i32, v4f32, NEONvceq, 1>; // VCGE : Vector Compare Greater Than or Equal -defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, "vcge.s", NEONvcge, 0>; -defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, "vcge.u", NEONvcgeu, 0>; -def VCGEfd : N3VD<1,0,0b00,0b1110,0, "vcge.f32", v2i32, v2f32, NEONvcge, 0>; -def VCGEfq : N3VQ<1,0,0b00,0b1110,0, "vcge.f32", v4i32, v4f32, NEONvcge, 0>; +defm VCGEs : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vcge.s", NEONvcge, 0>; +defm VCGEu : N3V_QHS<1, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vcge.u", NEONvcgeu, 0>; +def VCGEfd : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge.f32", v2i32, v2f32, NEONvcge, 0>; +def VCGEfq : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge.f32", v4i32, v4f32, NEONvcge, 0>; // VCGT : Vector Compare Greater Than -defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, "vcgt.s", NEONvcgt, 0>; -defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, "vcgt.u", NEONvcgtu, 0>; -def VCGTfd : N3VD<1,0,0b10,0b1110,0, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>; -def VCGTfq : N3VQ<1,0,0b10,0b1110,0, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>; +defm VCGTs : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vcgt.s", NEONvcgt, 0>; +defm VCGTu : N3V_QHS<1, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vcgt.u", NEONvcgtu, 0>; +def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>; +def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>; // VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE) def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, "vacge.f32", v2i32, v2f32, int_arm_neon_vacged, 0>; @@ -1580,25 +1597,26 @@ def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, "vacgt.f32", v4i32, v4f32, int_arm_neon_vacgtq, 0>; // VTST : Vector Test Bits -defm VTST : N3V_QHS<0, 0, 0b1000, 1, "vtst.i", NEONvtst, 1>; +defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vtst.i", NEONvtst, 1>; // Vector Bitwise Operations. // VAND : Vector Bitwise AND -def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, "vand", v2i32, v2i32, and, 1>; -def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, "vand", v4i32, v4i32, and, 1>; +def VANDd : N3VD<0, 0, 0b00, 0b0001, 1, IIC_VBINiD, "vand", v2i32, v2i32, and, 1>; +def VANDq : N3VQ<0, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "vand", v4i32, v4i32, and, 1>; // VEOR : Vector Bitwise Exclusive OR -def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, "veor", v2i32, v2i32, xor, 1>; -def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, "veor", v4i32, v4i32, xor, 1>; +def VEORd : N3VD<1, 0, 0b00, 0b0001, 1, IIC_VBINiD, "veor", v2i32, v2i32, xor, 1>; +def VEORq : N3VQ<1, 0, 0b00, 0b0001, 1, IIC_VBINiQ, "veor", v4i32, v4i32, xor, 1>; // VORR : Vector Bitwise OR -def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, "vorr", v2i32, v2i32, or, 1>; -def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, "vorr", v4i32, v4i32, or, 1>; +def VORRd : N3VD<0, 0, 0b10, 0b0001, 1, IIC_VBINiD, "vorr", v2i32, v2i32, or, 1>; +def VORRq : N3VQ<0, 0, 0b10, 0b0001, 1, IIC_VBINiQ, "vorr", v4i32, v4i32, or, 1>; // VBIC : Vector Bitwise Bit Clear (AND NOT) def VBICd : N3V<0, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst), - (ins DPR:$src1, DPR:$src2), NoItinerary, + (ins DPR:$src1, DPR:$src2), IIC_VBINiD, "vbic\t$dst, $src1, $src2", "", [(set DPR:$dst, (v2i32 (and DPR:$src1, (vnot_conv DPR:$src2))))]>; @@ -1610,7 +1628,7 @@ // VORN : Vector Bitwise OR NOT def VORNd : N3V<0, 0, 0b11, 0b0001, 0, 1, (outs DPR:$dst), - (ins DPR:$src1, DPR:$src2), NoItinerary, + (ins DPR:$src1, DPR:$src2), IIC_VBINiD, "vorn\t$dst, $src1, $src2", "", [(set DPR:$dst, (v2i32 (or DPR:$src1, (vnot_conv DPR:$src2))))]>; @@ -1753,13 +1771,17 @@ // Vector Reciprocal and Reciprocal Square Root Estimate and Step. // VRECPE : Vector Reciprocal Estimate -def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0, "vrecpe.u32", +def VRECPEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0, + IIC_VUNAD, "vrecpe.u32", v2i32, v2i32, int_arm_neon_vrecpe>; -def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0, "vrecpe.u32", +def VRECPEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01000, 0, + IIC_VUNAQ, "vrecpe.u32", v4i32, v4i32, int_arm_neon_vrecpe>; -def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0, "vrecpe.f32", +def VRECPEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0, + IIC_VUNAD, "vrecpe.f32", v2f32, v2f32, int_arm_neon_vrecpe>; -def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0, "vrecpe.f32", +def VRECPEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01010, 0, + IIC_VUNAQ, "vrecpe.f32", v4f32, v4f32, int_arm_neon_vrecpe>; // VRECPS : Vector Reciprocal Step @@ -1769,14 +1791,18 @@ int_arm_neon_vrecps, 1>; // VRSQRTE : Vector Reciprocal Square Root Estimate -def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0, "vrsqrte.u32", - v2i32, v2i32, int_arm_neon_vrsqrte>; -def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0, "vrsqrte.u32", - v4i32, v4i32, int_arm_neon_vrsqrte>; -def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0, "vrsqrte.f32", - v2f32, v2f32, int_arm_neon_vrsqrte>; -def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0, "vrsqrte.f32", - v4f32, v4f32, int_arm_neon_vrsqrte>; +def VRSQRTEd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0, + IIC_VUNAD, "vrsqrte.u32", + v2i32, v2i32, int_arm_neon_vrsqrte>; +def VRSQRTEq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01001, 0, + IIC_VUNAQ, "vrsqrte.u32", + v4i32, v4i32, int_arm_neon_vrsqrte>; +def VRSQRTEfd : N2VDInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0, + IIC_VUNAD, "vrsqrte.f32", + v2f32, v2f32, int_arm_neon_vrsqrte>; +def VRSQRTEfq : N2VQInt<0b11, 0b11, 0b10, 0b11, 0b01011, 0, + IIC_VUNAQ, "vrsqrte.f32", + v4f32, v4f32, int_arm_neon_vrsqrte>; // VRSQRTS : Vector Reciprocal Square Root Step def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, "vrsqrts.f32", v2f32, v2f32, @@ -1914,15 +1940,19 @@ // Vector Absolute and Saturating Absolute. // VABS : Vector Absolute Value -defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0, "vabs.s", +defm VABS : N2VInt_QHS<0b11, 0b11, 0b01, 0b00110, 0, + IIC_VUNAiD, IIC_VUNAiQ, "vabs.s", int_arm_neon_vabs>; -def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0, "vabs.f32", +def VABSfd : N2VDInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0, + IIC_VUNAD, "vabs.f32", v2f32, v2f32, int_arm_neon_vabs>; -def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0, "vabs.f32", +def VABSfq : N2VQInt<0b11, 0b11, 0b10, 0b01, 0b01110, 0, + IIC_VUNAQ, "vabs.f32", v4f32, v4f32, int_arm_neon_vabs>; // VQABS : Vector Saturating Absolute Value -defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0, "vqabs.s", +defm VQABS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01110, 0, + IIC_VQUNAiD, IIC_VQUNAiQ, "vqabs.s", int_arm_neon_vqabs>; // Vector Negate. @@ -1967,21 +1997,26 @@ def : Pat<(v4i32 (vneg_conv QPR:$src)), (VNEGs32q QPR:$src)>; // VQNEG : Vector Saturating Negate -defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0, "vqneg.s", +defm VQNEG : N2VInt_QHS<0b11, 0b11, 0b00, 0b01111, 0, + IIC_VQUNAiD, IIC_VQUNAiQ, "vqneg.s", int_arm_neon_vqneg>; // Vector Bit Counting Operations. // VCLS : Vector Count Leading Sign Bits -defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0, "vcls.s", +defm VCLS : N2VInt_QHS<0b11, 0b11, 0b00, 0b01000, 0, + IIC_VCNTiD, IIC_VCNTiQ, "vcls.s", int_arm_neon_vcls>; // VCLZ : Vector Count Leading Zeros -defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0, "vclz.i", +defm VCLZ : N2VInt_QHS<0b11, 0b11, 0b00, 0b01001, 0, + IIC_VCNTiD, IIC_VCNTiQ, "vclz.i", int_arm_neon_vclz>; // VCNT : Vector Count One Bits -def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0, "vcnt.8", +def VCNTd : N2VDInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0, + IIC_VCNTiD, "vcnt.8", v8i8, v8i8, int_arm_neon_vcnt>; -def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0, "vcnt.8", +def VCNTq : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0, + IIC_VCNTiQ, "vcnt.8", v16i8, v16i8, int_arm_neon_vcnt>; // Vector Move Operations. @@ -2291,14 +2326,14 @@ (DSubReg_f64_other_reg imm:$lane))>; // VMOVN : Vector Narrowing Move -defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, "vmovn.i", +defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn.i", int_arm_neon_vmovn>; // VQMOVN : Vector Saturating Narrowing Move -defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, "vqmovn.s", +defm VQMOVNs : N2VNInt_HSD<0b11,0b11,0b10,0b00101,0,0, IIC_VQUNAiD, "vqmovn.s", int_arm_neon_vqmovns>; -defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, "vqmovn.u", +defm VQMOVNu : N2VNInt_HSD<0b11,0b11,0b10,0b00101,1,0, IIC_VQUNAiD, "vqmovn.u", int_arm_neon_vqmovnu>; -defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, "vqmovun.s", +defm VQMOVNsu : N2VNInt_HSD<0b11,0b11,0b10,0b00100,1,0, IIC_VQUNAiD, "vqmovun.s", int_arm_neon_vqmovnsu>; // VMOVL : Vector Lengthening Move defm VMOVLs : N2VLInt_QHS<0,1,0b1010,0,0,1, "vmovl.s", int_arm_neon_vmovls>; @@ -2440,9 +2475,9 @@ def VTRNd16 : N2VDShuffle<0b01, 0b00001, "vtrn.16">; def VTRNd32 : N2VDShuffle<0b10, 0b00001, "vtrn.32">; -def VTRNq8 : N2VQShuffle<0b00, 0b00001, "vtrn.8">; -def VTRNq16 : N2VQShuffle<0b01, 0b00001, "vtrn.16">; -def VTRNq32 : N2VQShuffle<0b10, 0b00001, "vtrn.32">; +def VTRNq8 : N2VQShuffle<0b00, 0b00001, IIC_VPERMQ, "vtrn.8">; +def VTRNq16 : N2VQShuffle<0b01, 0b00001, IIC_VPERMQ, "vtrn.16">; +def VTRNq32 : N2VQShuffle<0b10, 0b00001, IIC_VPERMQ, "vtrn.32">; // VUZP : Vector Unzip (Deinterleave) @@ -2450,9 +2485,9 @@ def VUZPd16 : N2VDShuffle<0b01, 0b00010, "vuzp.16">; def VUZPd32 : N2VDShuffle<0b10, 0b00010, "vuzp.32">; -def VUZPq8 : N2VQShuffle<0b00, 0b00010, "vuzp.8">; -def VUZPq16 : N2VQShuffle<0b01, 0b00010, "vuzp.16">; -def VUZPq32 : N2VQShuffle<0b10, 0b00010, "vuzp.32">; +def VUZPq8 : N2VQShuffle<0b00, 0b00010, IIC_VPERMQ3, "vuzp.8">; +def VUZPq16 : N2VQShuffle<0b01, 0b00010, IIC_VPERMQ3, "vuzp.16">; +def VUZPq32 : N2VQShuffle<0b10, 0b00010, IIC_VPERMQ3, "vuzp.32">; // VZIP : Vector Zip (Interleave) @@ -2460,9 +2495,9 @@ def VZIPd16 : N2VDShuffle<0b01, 0b00011, "vzip.16">; def VZIPd32 : N2VDShuffle<0b10, 0b00011, "vzip.32">; -def VZIPq8 : N2VQShuffle<0b00, 0b00011, "vzip.8">; -def VZIPq16 : N2VQShuffle<0b01, 0b00011, "vzip.16">; -def VZIPq32 : N2VQShuffle<0b10, 0b00011, "vzip.32">; +def VZIPq8 : N2VQShuffle<0b00, 0b00011, IIC_VPERMQ3, "vzip.8">; +def VZIPq16 : N2VQShuffle<0b01, 0b00011, IIC_VPERMQ3, "vzip.16">; +def VZIPq32 : N2VQShuffle<0b10, 0b00011, IIC_VPERMQ3, "vzip.32">; // Vector Table Lookup and Table Extension. @@ -2550,14 +2585,15 @@ // Vector Absolute used for single-precision FP let neverHasSideEffects = 1 in -def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0, "vabs.f32", +def VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0, + IIC_VUNAD, "vabs.f32", v2f32, v2f32, int_arm_neon_vabs>; def : N2VDIntsPat; // Vector Negate used for single-precision FP let neverHasSideEffects = 1 in def VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0, - (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), NoItinerary, + (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD, "vneg.f32\t$dst, $src", "", []>; def : N2VDIntsPat; Modified: llvm/trunk/lib/Target/ARM/ARMSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSchedule.td?rev=82657&r1=82656&r2=82657&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSchedule.td (original) +++ llvm/trunk/lib/Target/ARM/ARMSchedule.td Wed Sep 23 16:38:08 2009 @@ -61,6 +61,7 @@ def IIC_iStoreru : InstrItinClass; def IIC_iStoresiu : InstrItinClass; def IIC_iStorem : InstrItinClass; +def IIC_Br : InstrItinClass; def IIC_fpSTAT : InstrItinClass; def IIC_fpMOVIS : InstrItinClass; def IIC_fpMOVID : InstrItinClass; @@ -92,7 +93,36 @@ def IIC_fpStore32 : InstrItinClass; def IIC_fpStore64 : InstrItinClass; def IIC_fpStorem : InstrItinClass; -def IIC_Br : InstrItinClass; +def IIC_VLD1 : InstrItinClass; +def IIC_VLD2 : InstrItinClass; +def IIC_VLD3 : InstrItinClass; +def IIC_VLD4 : InstrItinClass; +def IIC_VST : InstrItinClass; +def IIC_VUNAD : InstrItinClass; +def IIC_VUNAQ : InstrItinClass; +def IIC_VBIND : InstrItinClass; +def IIC_VBINQ : InstrItinClass; +def IIC_VMOVD : InstrItinClass; +def IIC_VMOVQ : InstrItinClass; +def IIC_VPERMD : InstrItinClass; +def IIC_VPERMQ : InstrItinClass; +def IIC_VPERMQ3 : InstrItinClass; +def IIC_VCNTiD : InstrItinClass; +def IIC_VCNTiQ : InstrItinClass; +def IIC_VUNAiD : InstrItinClass; +def IIC_VUNAiQ : InstrItinClass; +def IIC_VQUNAiD : InstrItinClass; +def IIC_VQUNAiQ : InstrItinClass; +def IIC_VBINiD : InstrItinClass; +def IIC_VBINiQ : InstrItinClass; +def IIC_VSUBiD : InstrItinClass; +def IIC_VSUBiQ : InstrItinClass; +def IIC_VBINi4D : InstrItinClass; +def IIC_VBINi4Q : InstrItinClass; +def IIC_VMULi16D : InstrItinClass; +def IIC_VMULi32D : InstrItinClass; +def IIC_VMULi16Q : InstrItinClass; +def IIC_VMULi32Q : InstrItinClass; //===----------------------------------------------------------------------===// // Processor instruction itineraries. Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV6.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV6.td?rev=82657&r1=82656&r2=82657&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV6.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV6.td Wed Sep 23 16:38:08 2009 @@ -11,89 +11,4 @@ // //===----------------------------------------------------------------------===// -// TODO: this should model an ARM11 -// Single issue pipeline so every itinerary starts with FU_pipe0 -def V6Itineraries : ProcessorItineraries<[ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<2, [FU_LdSt0]>]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]> -]>; +// TODO: Add model for an ARM11 Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV7.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV7.td?rev=82657&r1=82656&r2=82657&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV7.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Wed Sep 23 16:38:08 2009 @@ -325,96 +325,161 @@ // // FP Store Multiple // use FU_Issue to enforce the 1 load/store per cycle limit - InstrItinData, + InstrItinData, InstrStage<2, [FU_Pipe0], 0>, InstrStage<2, [FU_Pipe1]>, InstrStage<1, [FU_Pipe0, FU_Pipe1]>, InstrStage<1, [FU_LdSt0], 0>, - InstrStage<1, [FU_NLSPipe]>]> -]>; + InstrStage<1, [FU_NLSPipe]>]>, + + // NEON + // Issue through integer pipeline, and execute in NEON unit. + // + // VLD1 + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // VLD2 + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>], [2, 2, 1]>, + // + // VLD3 + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>], [2, 2, 2, 1]>, + // + // VLD4 + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>], [2, 2, 2, 2, 1]>, + // + // VST + InstrItinData, + InstrStage<1, [FU_Pipe0, FU_Pipe1]>, + InstrStage<1, [FU_LdSt0], 0>, + InstrStage<1, [FU_NLSPipe]>]>, + // + // Double-register FP Unary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [5, 2]>, + // + // Quad-register FP Unary + // Result written in N5, but that is relative to the last cycle of multicycle, + // so we use 6 for those cases + InstrItinData, + InstrStage<2, [FU_NPipe]>], [6, 2]>, + // + // Double-register FP Binary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [5, 2, 2]>, + // + // Quad-register FP Binary + // Result written in N5, but that is relative to the last cycle of multicycle, + // so we use 6 for those cases + InstrItinData, + InstrStage<2, [FU_NPipe]>], [6, 2, 2]>, + // + // Double-register Permute Move + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [2, 1]>, + // + // Quad-register Permute Move + // Result written in N2, but that is relative to the last cycle of multicycle, + // so we use 3 for those cases + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 1]>, + // + // Double-register Permute + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [2, 2, 1, 1]>, + // + // Quad-register Permute + // Result written in N2, but that is relative to the last cycle of multicycle, + // so we use 3 for those cases + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 3, 1, 1]>, + // + // Quad-register Permute (3 cycle issue) + // Result written in N2, but that is relative to the last cycle of multicycle, + // so we use 4 for those cases + InstrItinData, + InstrStage<1, [FU_NLSPipe]>, + InstrStage<1, [FU_NPipe], 0>, + InstrStage<2, [FU_NLSPipe]>], [4, 4, 1, 1]>, + // + // Double-register Integer Count + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3, 2]>, + // + // Quad-register Integer Count + // Result written in N3, but that is relative to the last cycle of multicycle, + // so we use 4 for those cases + InstrItinData, + InstrStage<2, [FU_NPipe]>], [4, 2]>, + // + // Double-register Integer Unary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 2]>, + // + // Quad-register Integer Unary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 2]>, + // + // Double-register Integer Q-Unary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 1]>, + // + // Quad-register Integer CountQ-Unary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 1]>, + // + // Double-register Integer Binary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3, 2, 2]>, + // + // Quad-register Integer Binary + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3, 2, 2]>, + // + // Double-register Integer Binary (4 cycle) + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 2, 1]>, + // + // Quad-register Integer Binary (4 cycle) + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 2, 1]>, + // + // Double-register Integer Subtract + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3, 2, 1]>, + // + // Quad-register Integer Subtract + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3, 2, 1]>, + // + // Double-register Integer Multiply (.8, .16) + InstrItinData, + InstrStage<1, [FU_NPipe]>], [6, 2, 2]>, + // + // Double-register Integer Multiply (.32) + InstrItinData, + InstrStage<2, [FU_NPipe]>], [7, 2, 1]>, + // + // Quad-register Integer Multiply (.8, .16) + InstrItinData, + InstrStage<2, [FU_NPipe]>], [7, 2, 2]>, + // + // Quad-register Integer Multiply (.32) + InstrItinData, + InstrStage<1, [FU_NPipe]>, + InstrStage<2, [FU_NLSPipe], 0>, + InstrStage<3, [FU_NPipe]>], [9, 2, 1]> + -// FIXME -def CortexA9Itineraries : ProcessorItineraries<[ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<2, [FU_LdSt0]>]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]> ]>; From daniel at zuster.org Wed Sep 23 16:39:23 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 23 Sep 2009 14:39:23 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> Message-ID: <6a8523d60909231439xafc2ed4h79c3039b65e411a4@mail.gmail.com> Hi Dale, I think you may need to disable FrontendC/2005-07-20-SqrtNoErrno.c as well? It is currently failing on llvm-gcc-i386-darwin9. - Daniel On Wed, Sep 23, 2009 at 11:50 AM, Dale Johannesen wrote: > Author: johannes > Date: Wed Sep 23 13:50:32 2009 > New Revision: 82640 > > URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev > Log: > The result of sqrt(negative) is implementation-defined, but follows > IEEE754 in most current implementations. llvm.sqrt, which has undefined > behavior for such inputs, is an inappropriate substitute which can change > the result. > > > Modified: > ? ?llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=82640&r1=82639&r2=82640&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Sep 23 13:50:32 2009 > @@ -5027,12 +5027,9 @@ > ? case BUILT_IN_SQRT: > ? case BUILT_IN_SQRTF: > ? case BUILT_IN_SQRTL: > - ? ?// If errno math has been disabled, expand these to llvm.sqrt calls. > - ? ?if (!flag_errno_math) { > - ? ? ?Result = EmitBuiltinSQRT(exp); > - ? ? ?Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp))); > - ? ? ?return true; > - ? ?} > + ? ?// The result of sqrt(negative) is implementation-defined, but follows > + ? ?// IEEE754 in most current implementations. llvm.sqrt, which has undefined > + ? ?// behavior for such inputs, is an inappropriate substitute. > ? ? break; > ? case BUILT_IN_POWI: > ? case BUILT_IN_POWIF: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dalej at apple.com Wed Sep 23 16:46:36 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Sep 2009 21:46:36 -0000 Subject: [llvm-commits] [llvm] r82658 - /llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c Message-ID: <200909232146.n8NLkaMx008025@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 23 16:46:36 2009 New Revision: 82658 URL: http://llvm.org/viewvc/llvm-project?rev=82658&view=rev Log: Disable test; what it's testing for is wrong. Modified: llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c Modified: llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c?rev=82658&r1=82657&r2=82658&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c (original) +++ llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c Wed Sep 23 16:46:36 2009 @@ -1,4 +1,7 @@ // RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt +// llvm.sqrt has undefined behavior on negative inputs, so it is +// inappropriate to translate C/C++ sqrt to this. +// XFAIL: * #include float foo(float X) { From dalej at apple.com Wed Sep 23 17:05:24 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Sep 2009 22:05:24 -0000 Subject: [llvm-commits] [llvm] r82660 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Message-ID: <200909232205.n8NM5OCI010421@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 23 17:05:24 2009 New Revision: 82660 URL: http://llvm.org/viewvc/llvm-project?rev=82660&view=rev Log: A minor improvment in accuracy to inline cost computation, and some cosmetics. Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=82660&r1=82659&r2=82660&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Wed Sep 23 17:05:24 2009 @@ -104,7 +104,7 @@ /// analyzeFunction - Fill in the current structure with information gleaned /// from the specified function. void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) { - unsigned NumInsts = 0, NumBlocks = 0, NumVectorInsts = 0; + unsigned NumInsts = 0, NumBlocks = 0, NumVectorInsts = 0, NumRets = 0; // Look at the size of the callee. Each basic block counts as 20 units, and // each instruction counts as 5. @@ -157,6 +157,9 @@ if (GEPI->hasAllConstantIndices()) continue; } + + if (isa(II)) + ++NumRets; ++NumInsts; } @@ -164,6 +167,11 @@ ++NumBlocks; } + // A function with exactly one return has it removed during the inlining + // process (see InlineFunction), so don't count it. + if (NumRets==1) + --NumInsts; + this->NumBlocks = NumBlocks; this->NumInsts = NumInsts; this->NumVectorInsts = NumVectorInsts; @@ -186,11 +194,10 @@ Function *Callee = CS.getCalledFunction(); Function *Caller = TheCall->getParent()->getParent(); - // Don't inline functions which can be redefined at link-time to mean - // something else. - if (Callee->mayBeOverridden() || - // Don't inline functions marked noinline. - Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee)) + // Don't inline functions which can be redefined at link-time to mean + // something else. Don't inline functions marked noinline. + if (Callee->mayBeOverridden() || + Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee)) return llvm::InlineCost::getNever(); // InlineCost - This value measures how good of an inline candidate this call @@ -291,6 +298,7 @@ // likely to be inlined, look at factors that make us not want to inline it. // Don't inline into something too big, which would make it bigger. + // "size" here is the number of basic blocks, not instructions. // InlineCost += Caller->size()/15; From evan.cheng at apple.com Wed Sep 23 17:12:37 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Sep 2009 15:12:37 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> Message-ID: On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: > While this is certainly necessary given the current IR definition, I'm > not too happy about it, as we will lose something because the > optimizers must consider that sqrt might set errno. What I'd like to > do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt > except that it doesn't set errno", and likewise for llvm.pow, etc. It > looks like that was the original intent, actually, but that's not what > it says. Any objections? Are we doing any optimizations on llvm.sqrt? Evan > > On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: > >> Author: johannes >> Date: Wed Sep 23 13:50:32 2009 >> New Revision: 82640 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >> Log: >> The result of sqrt(negative) is implementation-defined, but follows >> IEEE754 in most current implementations. llvm.sqrt, which has >> undefined >> behavior for such inputs, is an inappropriate substitute which can >> change >> the result. > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Sep 23 17:18:59 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Sep 2009 15:18:59 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> Message-ID: <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> Are we generating a call to sqrt now? If so, that's bad. We should be using SSE sqrts* instructions. Evan On Sep 23, 2009, at 3:12 PM, Evan Cheng wrote: > > On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: > >> While this is certainly necessary given the current IR definition, >> I'm >> not too happy about it, as we will lose something because the >> optimizers must consider that sqrt might set errno. What I'd like to >> do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt >> except that it doesn't set errno", and likewise for llvm.pow, etc. >> It >> looks like that was the original intent, actually, but that's not >> what >> it says. Any objections? > > Are we doing any optimizations on llvm.sqrt? > > Evan > >> >> On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: >> >>> Author: johannes >>> Date: Wed Sep 23 13:50:32 2009 >>> New Revision: 82640 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >>> Log: >>> The result of sqrt(negative) is implementation-defined, but follows >>> IEEE754 in most current implementations. llvm.sqrt, which has >>> undefined >>> behavior for such inputs, is an inappropriate substitute which can >>> change >>> the result. >> >> _______________________________________________ >> 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 dalej at apple.com Wed Sep 23 17:19:30 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Sep 2009 15:19:30 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> Message-ID: On Sep 23, 2009, at 3:12 PMPDT, Evan Cheng wrote: > > On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: > >> While this is certainly necessary given the current IR definition, >> I'm >> not too happy about it, as we will lose something because the >> optimizers must consider that sqrt might set errno. What I'd like to >> do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt >> except that it doesn't set errno", and likewise for llvm.pow, etc. >> It >> looks like that was the original intent, actually, but that's not >> what >> it says. Any objections? > > Are we doing any optimizations on llvm.sqrt? It's known to be readonly, while sqrt is not (which I'm sure was the point of having it). Beyond that, it's "optimizing" sqrt(negative) to 0 in ConstantFoldCall and perhaps other places. I'd like to get rid of that, but it seems permissible under the current definition. > Evan > >> >> On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: >> >>> Author: johannes >>> Date: Wed Sep 23 13:50:32 2009 >>> New Revision: 82640 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >>> Log: >>> The result of sqrt(negative) is implementation-defined, but follows >>> IEEE754 in most current implementations. llvm.sqrt, which has >>> undefined >>> behavior for such inputs, is an inappropriate substitute which can >>> change >>> the result. >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dalej at apple.com Wed Sep 23 17:21:51 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Sep 2009 15:21:51 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> Message-ID: <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> On Sep 23, 2009, at 3:18 PMPDT, Evan Cheng wrote: > Are we generating a call to sqrt now? If so, that's bad. We should > be using SSE sqrts* instructions. Agreed. My proposed semantic change would fix that. > Evan > > On Sep 23, 2009, at 3:12 PM, Evan Cheng wrote: > >> >> On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: >> >>> While this is certainly necessary given the current IR definition, >>> I'm >>> not too happy about it, as we will lose something because the >>> optimizers must consider that sqrt might set errno. What I'd like >>> to >>> do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt >>> except that it doesn't set errno", and likewise for llvm.pow, >>> etc. It >>> looks like that was the original intent, actually, but that's not >>> what >>> it says. Any objections? >> >> Are we doing any optimizations on llvm.sqrt? >> >> Evan >> >>> >>> On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: >>> >>>> Author: johannes >>>> Date: Wed Sep 23 13:50:32 2009 >>>> New Revision: 82640 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >>>> Log: >>>> The result of sqrt(negative) is implementation-defined, but follows >>>> IEEE754 in most current implementations. llvm.sqrt, which has >>>> undefined >>>> behavior for such inputs, is an inappropriate substitute which can >>>> change >>>> the result. >>> >>> _______________________________________________ >>> 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 gohman at apple.com Wed Sep 23 17:26:29 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Sep 2009 15:26:29 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> Message-ID: Using an intrinsic to convey "this function need not set errno" seem like a very heavy-weight solution. Wouldn't it be better to make use of the "readonly" or "readnone" function attributes? A "sqrt" call with "readonly" can be known to not set errno. The intention of the "like the libm sqrt functions would" language was to support vector forms of these intrinsics, which should behave the same way as the scalar forms. Dan On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: > While this is certainly necessary given the current IR definition, I'm > not too happy about it, as we will lose something because the > optimizers must consider that sqrt might set errno. What I'd like to > do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt > except that it doesn't set errno", and likewise for llvm.pow, etc. It > looks like that was the original intent, actually, but that's not what > it says. Any objections? > > On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: > >> Author: johannes >> Date: Wed Sep 23 13:50:32 2009 >> New Revision: 82640 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >> Log: >> The result of sqrt(negative) is implementation-defined, but follows >> IEEE754 in most current implementations. llvm.sqrt, which has >> undefined >> behavior for such inputs, is an inappropriate substitute which can >> change >> the result. > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Wed Sep 23 17:32:23 2009 From: dalej at apple.com (Dale Johannesen) Date: Wed, 23 Sep 2009 15:32:23 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> Message-ID: <500BE82E-EDB7-44AD-BAC2-06CD21264CC5@apple.com> On Sep 23, 2009, at 3:26 PMPDT, Dan Gohman wrote: > Using an intrinsic to convey "this function need not set errno" seem > like a very heavy-weight solution. Wouldn't it be better to make use > of the "readonly" or "readnone" function attributes? A "sqrt" call > with "readonly" can be known to not set errno. As far as errno goes, I agree that would be better, but we'd also like to recognize it as sqrt for the purpose of generating sqrt instructions on appropriate hardware. Without an intrinsic we'd need to do name lookup, I guess, which seems inappropriate for non-C-based languages. > The intention of the "like the libm sqrt functions would" language was > to support vector forms of these intrinsics, which should behave the > same way as the scalar forms. > > Dan > > On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: > >> While this is certainly necessary given the current IR definition, >> I'm >> not too happy about it, as we will lose something because the >> optimizers must consider that sqrt might set errno. What I'd like to >> do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt >> except that it doesn't set errno", and likewise for llvm.pow, etc. >> It >> looks like that was the original intent, actually, but that's not >> what >> it says. Any objections? >> >> On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: >> >>> Author: johannes >>> Date: Wed Sep 23 13:50:32 2009 >>> New Revision: 82640 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >>> Log: >>> The result of sqrt(negative) is implementation-defined, but follows >>> IEEE754 in most current implementations. llvm.sqrt, which has >>> undefined >>> behavior for such inputs, is an inappropriate substitute which can >>> change >>> the result. >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From gohman at apple.com Wed Sep 23 17:36:40 2009 From: gohman at apple.com (Dan Gohman) Date: Wed, 23 Sep 2009 15:36:40 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <500BE82E-EDB7-44AD-BAC2-06CD21264CC5@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <500BE82E-EDB7-44AD-BAC2-06CD21264CC5@apple.com> Message-ID: <90C8B81D-E108-44FD-ACEB-24D77C4B02A8@apple.com> On Sep 23, 2009, at 3:32 PM, Dale Johannesen wrote: > On Sep 23, 2009, at 3:26 PMPDT, Dan Gohman wrote: > >> Using an intrinsic to convey "this function need not set errno" seem >> like a very heavy-weight solution. Wouldn't it be better to make use >> of the "readonly" or "readnone" function attributes? A "sqrt" call >> with "readonly" can be known to not set errno. > > As far as errno goes, I agree that would be better, but we'd also > like to recognize it as sqrt for the purpose of generating sqrt > instructions on appropriate hardware. Without an intrinsic we'd > need to do name lookup, I guess, which seems inappropriate for non-C- > based languages. It's all the latest fashion apparently. LLVM now recognizes "malloc" magically, for example. Dan From jlerouge at apple.com Wed Sep 23 18:16:52 2009 From: jlerouge at apple.com (Julien Lerouge) Date: Wed, 23 Sep 2009 16:16:52 -0700 Subject: [llvm-commits] [PATCH] Fix install name inconsistency for loadable modules Message-ID: <20090923231651.GC11511@pom.apple.com> Hello, When building a loadable module, the rules in Makefile.rules are set to generate libraries without the "lib" prefix, but the install target puts back that prefix. The attached patch changes that behaviour to install the file without the "lib" prefix, if the target is a loadable module. Thanks, Julien -- Julien Lerouge PGP Key Id: 0xB1964A62 PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62 PGP Public Key from: keyserver.pgp.com -------------- next part -------------- Index: Makefile.rules =================================================================== --- Makefile.rules (revision 82664) +++ Makefile.rules (working copy) @@ -1004,12 +1004,15 @@ all-local:: $(LibName.SO) -ifdef LINK_LIBS_IN_SHARED ifdef LOADABLE_MODULE -SharedLibKindMessage := "Loadable Module" + SharedLibKindMessage := "Loadable Module" + DestSharedLib = $(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT) else -SharedLibKindMessage := "Shared Library" + SharedLibKindMessage := "Shared Library" + DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) endif + +ifdef LINK_LIBS_IN_SHARED $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \ $(LIBRARYNAME)$(SHLIBEXT) @@ -1032,17 +1035,16 @@ uninstall-local:: $(Echo) Uninstall circumvented with NO_INSTALL else -DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) - install-local:: $(DestSharedLib) $(DestSharedLib): $(LibName.SO) $(PROJ_libdir) - $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib) + $(Echo) Installing $(BuildMode) $(SharedLibKindMessage) $(DestSharedLib) $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib) uninstall-local:: - $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) - -$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).* + $(Echo) Uninstalling $(BuildMode) $(SharedLibKindMessage) \ + $(DestSharedLib) + -$(Verb) $(RM) -f $(DestSharedLib) endif endif From echristo at apple.com Wed Sep 23 18:17:12 2009 From: echristo at apple.com (Eric Christopher) Date: Wed, 23 Sep 2009 23:17:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82667 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200909232317.n8NNHCQE019391@zion.cs.uiuc.edu> Author: echristo Date: Wed Sep 23 18:17:12 2009 New Revision: 82667 URL: http://llvm.org/viewvc/llvm-project?rev=82667&view=rev Log: Use the current InsertPt not the original instruction since we may have incremented the insert point. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=82667&r1=82666&r2=82667&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Sep 23 18:17:12 2009 @@ -2878,7 +2878,7 @@ } // If the instruction is an invoke, the init is inserted on the normal edge. - if (InvokeInst *II = dyn_cast(I)) { + if (InvokeInst *II = dyn_cast(InsertPt)) { InsertPt = II->getNormalDest()->begin(); while (isa(InsertPt)) ++InsertPt; From vhernandez at apple.com Wed Sep 23 19:03:19 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Wed, 23 Sep 2009 17:03:19 -0700 Subject: [llvm-commits] [PATCH] auto-upgrade malloc instructions to malloc calls Message-ID: This patch: 1. Gets malloc instructions to be auto-upgraded to malloc calls in LLParser and BitcodeReader. 2. Updates Core and BrainF to no longer create malloc instructions. 3. Updates testcases that made assumptions that were no longer true without malloc instructions. -------------- next part -------------- A non-text attachment was scrubbed... Name: AutoupgradeMalloc.diff Type: application/octet-stream Size: 17608 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090923/d26332a1/attachment.obj -------------- next part -------------- After this patch, there are no MallocInsts created by LLVM, and MallocInst can be torn out. Victor From isanbard at gmail.com Wed Sep 23 19:13:31 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 00:13:31 -0000 Subject: [llvm-commits] [llvm] r82669 - /llvm/tags/Apple/llvmCore-2207.5/ Message-ID: <200909240013.n8O0DVq4026481@zion.cs.uiuc.edu> Author: void Date: Wed Sep 23 19:13:31 2009 New Revision: 82669 URL: http://llvm.org/viewvc/llvm-project?rev=82669&view=rev Log: Creating llvmCore-2207.5 from Bender-SWB. Added: llvm/tags/Apple/llvmCore-2207.5/ - copied from r82668, llvm/branches/Apple/Bender-SWB/ From isanbard at gmail.com Wed Sep 23 19:13:39 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 00:13:39 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82670 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.5/ Message-ID: <200909240013.n8O0Ddu0026508@zion.cs.uiuc.edu> Author: void Date: Wed Sep 23 19:13:39 2009 New Revision: 82670 URL: http://llvm.org/viewvc/llvm-project?rev=82670&view=rev Log: Creating llvmgcc42-2207.5 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.5/ - copied from r82669, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From devang.patel at gmail.com Wed Sep 23 19:40:51 2009 From: devang.patel at gmail.com (Devang Patel) Date: Wed, 23 Sep 2009 17:40:51 -0700 Subject: [llvm-commits] [llvm] r82591 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: <200909230013.n8N0DVHX024647@zion.cs.uiuc.edu> References: <200909230013.n8N0DVHX024647@zion.cs.uiuc.edu> Message-ID: <352a1fb20909231740s1fecd6ev3c0dd236824f8f37@mail.gmail.com> On Tue, Sep 22, 2009 at 5:13 PM, Mike Stump wrote: > Author: mrs > Date: Tue Sep 22 19:13:30 2009 > New Revision: 82591 > > URL: http://llvm.org/viewvc/llvm-project?rev=82591&view=rev > Log: > This is overly constraining with respect to clang. > > Modified: > ? ?llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=82591&r1=82590&r2=82591&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Sep 22 19:13:30 2009 > @@ -662,9 +662,6 @@ > ? std::string typeName; > ? blockStruct.getName(typeName); > > - ?assert(typeName.find ("__Block_byref_") == 0 > - ? ? ? ? && "Attempting to get Block location of non-Block variable!"); > - Why ? Pl. explain. - Devang From kremenek at apple.com Wed Sep 23 19:54:43 2009 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 24 Sep 2009 00:54:43 -0000 Subject: [llvm-commits] [llvm] r82673 - /llvm/tags/checker/checker-0.221/ Message-ID: <200909240054.n8O0shFY031760@zion.cs.uiuc.edu> Author: kremenek Date: Wed Sep 23 19:54:43 2009 New Revision: 82673 URL: http://llvm.org/viewvc/llvm-project?rev=82673&view=rev Log: Tagging checker-0.221. Added: llvm/tags/checker/checker-0.221/ - copied from r82672, llvm/trunk/ From evan.cheng at apple.com Wed Sep 23 20:10:49 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Sep 2009 18:10:49 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> Message-ID: On Sep 23, 2009, at 3:21 PM, Dale Johannesen wrote: > > On Sep 23, 2009, at 3:18 PMPDT, Evan Cheng wrote: > >> Are we generating a call to sqrt now? If so, that's bad. We should >> be using SSE sqrts* instructions. > > Agreed. My proposed semantic change would fix that. You mean change to llvm.sqrt and then llvm-gcc can switch bad to generating the intrinsic? It seems like the current fix is not what we want. Perhaps we should revert it first? According to Chris, the semantics of sqrt of negative value is defined and this is just some optimization bug. Evan > >> Evan >> >> On Sep 23, 2009, at 3:12 PM, Evan Cheng wrote: >> >>> >>> On Sep 23, 2009, at 2:18 PM, Dale Johannesen wrote: >>> >>>> While this is certainly necessary given the current IR >>>> definition, I'm >>>> not too happy about it, as we will lose something because the >>>> optimizers must consider that sqrt might set errno. What I'd >>>> like to >>>> do is redefine llvm.sqrt in the IR to mean "same behavior as sqrt >>>> except that it doesn't set errno", and likewise for llvm.pow, >>>> etc. It >>>> looks like that was the original intent, actually, but that's not >>>> what >>>> it says. Any objections? >>> >>> Are we doing any optimizations on llvm.sqrt? >>> >>> Evan >>> >>>> >>>> On Sep 23, 2009, at 11:50 AMPDT, Dale Johannesen wrote: >>>> >>>>> Author: johannes >>>>> Date: Wed Sep 23 13:50:32 2009 >>>>> New Revision: 82640 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=82640&view=rev >>>>> Log: >>>>> The result of sqrt(negative) is implementation-defined, but >>>>> follows >>>>> IEEE754 in most current implementations. llvm.sqrt, which has >>>>> undefined >>>>> behavior for such inputs, is an inappropriate substitute which can >>>>> change >>>>> the result. >>>> >>>> _______________________________________________ >>>> 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 jyasskin at google.com Wed Sep 23 20:14:07 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Thu, 24 Sep 2009 01:14:07 -0000 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp Message-ID: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> Author: jyasskin Date: Wed Sep 23 20:14:07 2009 New Revision: 82675 URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev Log: Roll back r82348, which introduced an infinite loop in ParseCStringVector() that a trivial unittest would have caught. This revision also adds the trivial unittest. Added: llvm/trunk/unittests/Support/CommandLineTest.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 @@ -351,31 +351,42 @@ /// using strdup(), so it is the caller's responsibility to free() /// them later. /// -static void ParseCStringVector(std::vector &OutputVector, - const char *Input) { +static void ParseCStringVector(std::vector &output, + const char *input) { // Characters which will be treated as token separators: - StringRef Delims = " \v\f\t\r\n"; + static const char *const delims = " \v\f\t\r\n"; - StringRef WorkStr(Input); - while (!WorkStr.empty()) { - // If the first character is a delimiter, strip them off. - if (Delims.find(WorkStr[0]) != StringRef::npos) { - size_t Pos = WorkStr.find_first_not_of(Delims); - if (Pos == StringRef::npos) Pos = WorkStr.size(); - WorkStr = WorkStr.substr(Pos); - continue; + std::string work(input); + // Skip past any delims at head of input string. + size_t pos = work.find_first_not_of(delims); + // If the string consists entirely of delims, then exit early. + if (pos == std::string::npos) return; + // Otherwise, jump forward to beginning of first word. + work = work.substr(pos); + // Find position of first delimiter. + pos = work.find_first_of(delims); + + while (!work.empty() && pos != std::string::npos) { + // Everything from 0 to POS is the next word to copy. + output.push_back(strdup(work.substr(0,pos).c_str())); + // Is there another word in the string? + size_t nextpos = work.find_first_not_of(delims, pos + 1); + if (nextpos != std::string::npos) { + // Yes? Then remove delims from beginning ... + work = work.substr(work.find_first_not_of(delims, pos + 1)); + // and find the end of the word. + pos = work.find_first_of(delims); + } else { + // No? (Remainder of string is delims.) End the loop. + work = ""; + pos = std::string::npos; } - - // Find position of first delimiter. - size_t Pos = WorkStr.find_first_of(Delims); - if (Pos == StringRef::npos) Pos = WorkStr.size(); - - // Everything from 0 to Pos is the next word to copy. - char *NewStr = (char*)malloc(Pos+1); - memcpy(NewStr, WorkStr.data(), Pos); - NewStr[Pos] = 0; - OutputVector.push_back(NewStr); } + + // If `input' ended with non-delim char, then we'll get here with + // the last word of `input' in `work'; copy it now. + if (!work.empty()) + output.push_back(strdup(work.c_str())); } /// ParseEnvironmentOptions - An alternative entry point to the Added: llvm/trunk/unittests/Support/CommandLineTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto ============================================================================== --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 @@ -0,0 +1,48 @@ +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/CommandLine.h" + +#include "gtest/gtest.h" + +#include +#include + +using namespace llvm; + +namespace { + +class TempEnvVar { + public: + TempEnvVar(const char *name, const char *value) + : name(name) { + const char *old_value = getenv(name); + EXPECT_EQ(NULL, old_value) << old_value; + setenv(name, value, true); + } + + ~TempEnvVar() { + unsetenv(name); + } + + private: + const char *const name; +}; + +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; + +cl::opt EnvironmentTestOption("env-test-opt"); +TEST(CommandLineTest, ParseEnvironment) { + TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); + EXPECT_EQ("", EnvironmentTestOption); + cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); + EXPECT_EQ("hello", EnvironmentTestOption); +} + +} // anonymous namespace From jyasskin at google.com Wed Sep 23 20:16:56 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Wed, 23 Sep 2009 18:16:56 -0700 Subject: [llvm-commits] [llvm] r82348 - /llvm/trunk/lib/Support/CommandLine.cpp In-Reply-To: <200909200133.n8K1XliV032206@zion.cs.uiuc.edu> References: <200909200133.n8K1XliV032206@zion.cs.uiuc.edu> Message-ID: FYI, this change introduced an infinite loop by failing to shrink WorkStr when it copies a word. I've rolled it back in r82675 and added a small part of the unittest that ought to be there to protect refactorings like this. On Sat, Sep 19, 2009 at 6:33 PM, Chris Lattner wrote: > Author: lattner > Date: Sat Sep 19 20:33:46 2009 > New Revision: 82348 > > URL: http://llvm.org/viewvc/llvm-project?rev=82348&view=rev > Log: > rewrite ParseCStringVector in terms of stringref. > > Modified: > ? ?llvm/trunk/lib/Support/CommandLine.cpp > > Modified: llvm/trunk/lib/Support/CommandLine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82348&r1=82347&r2=82348&view=diff > > ============================================================================== > --- llvm/trunk/lib/Support/CommandLine.cpp (original) > +++ llvm/trunk/lib/Support/CommandLine.cpp Sat Sep 19 20:33:46 2009 > @@ -296,42 +296,31 @@ > ?/// using strdup(), so it is the caller's responsibility to free() > ?/// them later. > ?/// > -static void ParseCStringVector(std::vector &output, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { > +static void ParseCStringVector(std::vector &OutputVector, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { > ? // Characters which will be treated as token separators: > - ?static const char *const delims = " \v\f\t\r\n"; > + ?StringRef Delims = " \v\f\t\r\n"; > > - ?std::string work(input); > - ?// Skip past any delims at head of input string. > - ?size_t pos = work.find_first_not_of(delims); > - ?// If the string consists entirely of delims, then exit early. > - ?if (pos == std::string::npos) return; > - ?// Otherwise, jump forward to beginning of first word. > - ?work = work.substr(pos); > - ?// Find position of first delimiter. > - ?pos = work.find_first_of(delims); > - > - ?while (!work.empty() && pos != std::string::npos) { > - ? ?// Everything from 0 to POS is the next word to copy. > - ? ?output.push_back(strdup(work.substr(0,pos).c_str())); > - ? ?// Is there another word in the string? > - ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); > - ? ?if (nextpos != std::string::npos) { > - ? ? ?// Yes? Then remove delims from beginning ... > - ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); > - ? ? ?// and find the end of the word. > - ? ? ?pos = work.find_first_of(delims); > - ? ?} else { > - ? ? ?// No? (Remainder of string is delims.) End the loop. > - ? ? ?work = ""; > - ? ? ?pos = std::string::npos; > + ?StringRef WorkStr(Input); > + ?while (!WorkStr.empty()) { > + ? ?// If the first character is a delimiter, strip them off. > + ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { > + ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); > + ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); > + ? ? ?WorkStr = WorkStr.substr(Pos); > + ? ? ?continue; > ? ? } > + > + ? ?// Find position of first delimiter. > + ? ?size_t Pos = WorkStr.find_first_of(Delims); > + ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); > + > + ? ?// Everything from 0 to Pos is the next word to copy. > + ? ?char *NewStr = (char*)malloc(Pos+1); > + ? ?memcpy(NewStr, WorkStr.data(), Pos); > + ? ?NewStr[Pos] = 0; > + ? ?OutputVector.push_back(NewStr); > ? } > - > - ?// If `input' ended with non-delim char, then we'll get here with > - ?// the last word of `input' in `work'; copy it now. > - ?if (!work.empty()) > - ? ?output.push_back(strdup(work.c_str())); > ?} > > ?/// ParseEnvironmentOptions - An alternative entry point to the > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From evan.cheng at apple.com Wed Sep 23 21:15:23 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Sep 2009 02:15:23 -0000 Subject: [llvm-commits] [llvm] r82676 - in /llvm/trunk: include/llvm/CodeGen/LiveVariables.h lib/CodeGen/LiveVariables.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2008-08-05-SpillerBug.ll test/CodeGen/X86/2009-09-23-LiveVariablesBug.ll Message-ID: <200909240215.n8O2FNbY009275@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 23 21:15:22 2009 New Revision: 82676 URL: http://llvm.org/viewvc/llvm-project?rev=82676&view=rev Log: Clean up LiveVariables and change how it deals with partial updates and kills. This also eliminate the horrible check which scan forward to the end of the basic block. It should be faster and more accurate. Added: llvm/trunk/test/CodeGen/X86/2009-09-23-LiveVariablesBug.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/test/CodeGen/X86/2008-08-05-SpillerBug.ll Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=82676&r1=82675&r2=82676&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Wed Sep 23 21:15:22 2009 @@ -150,21 +150,14 @@ void HandlePhysRegUse(unsigned Reg, MachineInstr *MI); void HandlePhysRegDef(unsigned Reg, MachineInstr *MI, - SmallVector &Defs, - SmallVector &SuperDefs); + SmallVector &Defs); void UpdatePhysRegDefs(MachineInstr *MI, SmallVector &Defs); - void UpdateSuperRegDefs(MachineInstr *MI, SmallVector &Defs); /// FindLastPartialDef - Return the last partial def of the specified register. /// Also returns the sub-registers that're defined by the instruction. MachineInstr *FindLastPartialDef(unsigned Reg, SmallSet &PartDefRegs); - /// hasRegisterUseBelow - Return true if the specified register is used after - /// the current instruction and before its next definition. - bool hasRegisterUseBelow(unsigned Reg, MachineBasicBlock::iterator I, - MachineBasicBlock *MBB); - /// analyzePHINodes - Gather information about the PHI nodes in here. In /// particular, we want to map the variable information of a virtual /// register which is used in a PHI node. We map that to the BB the vreg Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=82676&r1=82675&r2=82676&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Sep 23 21:15:22 2009 @@ -265,78 +265,13 @@ PhysRegUse[SubReg] = MI; } -/// hasRegisterUseBelow - Return true if the specified register is used after -/// the current instruction and before it's next definition. -bool LiveVariables::hasRegisterUseBelow(unsigned Reg, - MachineBasicBlock::iterator I, - MachineBasicBlock *MBB) { - if (I == MBB->end()) - return false; - - // First find out if there are any uses / defs below. - bool hasDistInfo = true; - unsigned CurDist = DistanceMap[I]; - SmallVector Uses; - SmallVector Defs; - for (MachineRegisterInfo::reg_iterator RI = MRI->reg_begin(Reg), - RE = MRI->reg_end(); RI != RE; ++RI) { - MachineOperand &UDO = RI.getOperand(); - MachineInstr *UDMI = &*RI; - if (UDMI->getParent() != MBB) - continue; - DenseMap::iterator DI = DistanceMap.find(UDMI); - bool isBelow = false; - if (DI == DistanceMap.end()) { - // Must be below if it hasn't been assigned a distance yet. - isBelow = true; - hasDistInfo = false; - } else if (DI->second > CurDist) - isBelow = true; - if (isBelow) { - if (UDO.isUse()) - Uses.push_back(UDMI); - if (UDO.isDef()) - Defs.push_back(UDMI); - } - } - - if (Uses.empty()) - // No uses below. - return false; - else if (!Uses.empty() && Defs.empty()) - // There are uses below but no defs below. - return true; - // There are both uses and defs below. We need to know which comes first. - if (!hasDistInfo) { - // Complete DistanceMap for this MBB. This information is computed only - // once per MBB. - ++I; - ++CurDist; - for (MachineBasicBlock::iterator E = MBB->end(); I != E; ++I, ++CurDist) - DistanceMap.insert(std::make_pair(I, CurDist)); - } - - unsigned EarliestUse = DistanceMap[Uses[0]]; - for (unsigned i = 1, e = Uses.size(); i != e; ++i) { - unsigned Dist = DistanceMap[Uses[i]]; - if (Dist < EarliestUse) - EarliestUse = Dist; - } - for (unsigned i = 0, e = Defs.size(); i != e; ++i) { - unsigned Dist = DistanceMap[Defs[i]]; - if (Dist < EarliestUse) - // The register is defined before its first use below. - return false; - } - return true; -} - bool LiveVariables::HandlePhysRegKill(unsigned Reg, MachineInstr *MI) { - if (!PhysRegUse[Reg] && !PhysRegDef[Reg]) + MachineInstr *LastDef = PhysRegDef[Reg]; + MachineInstr *LastUse = PhysRegUse[Reg]; + if (!LastDef && !LastUse) return false; - MachineInstr *LastRefOrPartRef = PhysRegUse[Reg] - ? PhysRegUse[Reg] : PhysRegDef[Reg]; + MachineInstr *LastRefOrPartRef = LastUse ? LastUse : LastDef; unsigned LastRefOrPartRefDist = DistanceMap[LastRefOrPartRef]; // The whole register is used. // AL = @@ -355,9 +290,22 @@ // AX = AL // = AL // AX = + MachineInstr *LastPartDef = 0; + unsigned LastPartDefDist = 0; SmallSet PartUses; for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) { + MachineInstr *Def = PhysRegDef[SubReg]; + if (Def && Def != LastDef) { + // There was a def of this sub-register in between. This is a partial + // def, keep track of the last one. + unsigned Dist = DistanceMap[Def]; + if (Dist > LastPartDefDist) { + LastPartDefDist = Dist; + LastPartDef = Def; + } + continue; + } if (MachineInstr *Use = PhysRegUse[SubReg]) { PartUses.insert(SubReg); for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS) @@ -370,46 +318,47 @@ } } - if (LastRefOrPartRef == PhysRegDef[Reg] && LastRefOrPartRef != MI) - // If the last reference is the last def, then it's not used at all. - // That is, unless we are currently processing the last reference itself. - LastRefOrPartRef->addRegisterDead(Reg, TRI, true); - - // Partial uses. Mark register def dead and add implicit def of - // sub-registers which are used. - // EAX = op AL - // That is, EAX def is dead but AL def extends pass it. - // Enable this after live interval analysis is fixed to improve codegen! - else if (!PhysRegUse[Reg]) { + if (LastRefOrPartRef == PhysRegDef[Reg] && LastRefOrPartRef != MI) { + if (LastPartDef) + // The last partial def kills the register. + LastPartDef->addOperand(MachineOperand::CreateReg(Reg, false/*IsDef*/, + true/*IsImp*/, true/*IsKill*/)); + else + // If the last reference is the last def, then it's not used at all. + // That is, unless we are currently processing the last reference itself. + LastRefOrPartRef->addRegisterDead(Reg, TRI, true); + } else if (!PhysRegUse[Reg]) { + // Partial uses. Mark register def dead and add implicit def of + // sub-registers which are used. + // EAX = op AL + // That is, EAX def is dead but AL def extends pass it. PhysRegDef[Reg]->addRegisterDead(Reg, TRI, true); for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) { - if (PartUses.count(SubReg)) { - bool NeedDef = true; - if (PhysRegDef[Reg] == PhysRegDef[SubReg]) { - MachineOperand *MO = PhysRegDef[Reg]->findRegisterDefOperand(SubReg); - if (MO) { - NeedDef = false; - assert(!MO->isDead()); - } + if (!PartUses.count(SubReg)) + continue; + bool NeedDef = true; + if (PhysRegDef[Reg] == PhysRegDef[SubReg]) { + MachineOperand *MO = PhysRegDef[Reg]->findRegisterDefOperand(SubReg); + if (MO) { + NeedDef = false; + assert(!MO->isDead()); } - if (NeedDef) - PhysRegDef[Reg]->addOperand(MachineOperand::CreateReg(SubReg, - true, true)); - LastRefOrPartRef->addRegisterKilled(SubReg, TRI, true); - for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS) - PartUses.erase(*SS); } + if (NeedDef) + PhysRegDef[Reg]->addOperand(MachineOperand::CreateReg(SubReg, + true/*IsDef*/, true/*IsImp*/)); + LastRefOrPartRef->addRegisterKilled(SubReg, TRI, true); + for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS) + PartUses.erase(*SS); } - } - else + } else LastRefOrPartRef->addRegisterKilled(Reg, TRI, true); return true; } void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI, - SmallVector &Defs, - SmallVector &SuperDefs) { + SmallVector &Defs) { // What parts of the register are previously defined? SmallSet Live; if (PhysRegDef[Reg] || PhysRegUse[Reg]) { @@ -425,6 +374,8 @@ // AL = // AH = // = AX + if (Live.count(SubReg)) + continue; if (PhysRegDef[SubReg] || PhysRegUse[SubReg]) { Live.insert(SubReg); for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS) @@ -435,49 +386,18 @@ // Start from the largest piece, find the last time any part of the register // is referenced. - if (!HandlePhysRegKill(Reg, MI)) { - // Only some of the sub-registers are used. - for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); - unsigned SubReg = *SubRegs; ++SubRegs) { - if (!Live.count(SubReg)) - // Skip if this sub-register isn't defined. - continue; - if (HandlePhysRegKill(SubReg, MI)) { - Live.erase(SubReg); - for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS) - Live.erase(*SS); - } - } - assert(Live.empty() && "Not all defined registers are killed / dead?"); + HandlePhysRegKill(Reg, MI); + // Only some of the sub-registers are used. + for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); + unsigned SubReg = *SubRegs; ++SubRegs) { + if (!Live.count(SubReg)) + // Skip if this sub-register isn't defined. + continue; + HandlePhysRegKill(SubReg, MI); } - if (MI) { - // Does this extend the live range of a super-register? - SmallSet Processed; - for (const unsigned *SuperRegs = TRI->getSuperRegisters(Reg); - unsigned SuperReg = *SuperRegs; ++SuperRegs) { - if (Processed.count(SuperReg)) - continue; - MachineInstr *LastRef = PhysRegUse[SuperReg] - ? PhysRegUse[SuperReg] : PhysRegDef[SuperReg]; - if (LastRef && LastRef != MI) { - // The larger register is previously defined. Now a smaller part is - // being re-defined. Treat it as read/mod/write if there are uses - // below. - // EAX = - // AX = EAX, EAX - // ... - // = EAX - SuperDefs.push_back(SuperReg); - Processed.insert(SuperReg); - for (const unsigned *SS = TRI->getSubRegisters(SuperReg); *SS; ++SS) - Processed.insert(*SS); - } - } - - // Remember this def. - Defs.push_back(Reg); - } + if (MI) + Defs.push_back(Reg); // Remember this def. } void LiveVariables::UpdatePhysRegDefs(MachineInstr *MI, @@ -510,51 +430,6 @@ }; } -void LiveVariables::UpdateSuperRegDefs(MachineInstr *MI, - SmallVector &SuperDefs) { - // This instruction has defined part of some registers. If there are no - // more uses below MI, then the last use / def becomes kill / dead. - if (SuperDefs.empty()) - return; - - RegSorter RS(TRI); - std::sort(SuperDefs.begin(), SuperDefs.end(), RS); - SmallSet Processed; - for (unsigned j = 0, ee = SuperDefs.size(); j != ee; ++j) { - unsigned SuperReg = SuperDefs[j]; - if (!Processed.insert(SuperReg)) - continue; - if (hasRegisterUseBelow(SuperReg, MI, MI->getParent())) { - // Previous use / def is not the last use / dead def. It's now - // partially re-defined. - MI->addOperand(MachineOperand::CreateReg(SuperReg, false/*IsDef*/, - true/*IsImp*/,true/*IsKill*/)); - MI->addOperand(MachineOperand::CreateReg(SuperReg, true/*IsDef*/, - true/*IsImp*/)); - PhysRegDef[SuperReg] = MI; - PhysRegUse[SuperReg] = NULL; - for (const unsigned *SS = TRI->getSubRegisters(SuperReg); *SS; ++SS) { - Processed.insert(*SS); - PhysRegDef[*SS] = MI; - PhysRegUse[*SS] = NULL; - } - } else { - // Previous use / def is kill / dead. It's not being re-defined. - HandlePhysRegKill(SuperReg, MI); - PhysRegDef[SuperReg] = 0; - PhysRegUse[SuperReg] = NULL; - for (const unsigned *SS = TRI->getSubRegisters(SuperReg); *SS; ++SS) { - Processed.insert(*SS); - if (PhysRegDef[*SS] == MI) - continue; // This instruction may have defined it. - PhysRegDef[*SS] = MI; - PhysRegUse[*SS] = NULL; - } - } - } - SuperDefs.clear(); -} - bool LiveVariables::runOnMachineFunction(MachineFunction &mf) { MF = &mf; MRI = &mf.getRegInfo(); @@ -588,14 +463,11 @@ // Mark live-in registers as live-in. SmallVector Defs; - SmallVector SuperDefs; for (MachineBasicBlock::const_livein_iterator II = MBB->livein_begin(), EE = MBB->livein_end(); II != EE; ++II) { assert(TargetRegisterInfo::isPhysicalRegister(*II) && "Cannot have a live-in virtual register!"); - HandlePhysRegDef(*II, 0, Defs, SuperDefs); - UpdatePhysRegDefs(0, Defs); - SuperDefs.clear(); + HandlePhysRegDef(*II, 0, Defs); } // Loop over all of the instructions, processing them. @@ -641,12 +513,9 @@ unsigned MOReg = DefRegs[i]; if (TargetRegisterInfo::isVirtualRegister(MOReg)) HandleVirtRegDef(MOReg, MI); - else if (!ReservedRegisters[MOReg]) { - HandlePhysRegDef(MOReg, MI, Defs, SuperDefs); - } + else if (!ReservedRegisters[MOReg]) + HandlePhysRegDef(MOReg, MI, Defs); } - - UpdateSuperRegDefs(MI, SuperDefs); UpdatePhysRegDefs(MI, Defs); } @@ -685,11 +554,8 @@ // Loop over PhysRegDef / PhysRegUse, killing any registers that are // available at the end of the basic block. for (unsigned i = 0; i != NumRegs; ++i) - if (PhysRegDef[i] || PhysRegUse[i]) { - HandlePhysRegDef(i, 0, Defs, SuperDefs); - UpdatePhysRegDefs(0, Defs); - SuperDefs.clear(); - } + if (PhysRegDef[i] || PhysRegUse[i]) + HandlePhysRegDef(i, 0, Defs); std::fill(PhysRegDef, PhysRegDef + NumRegs, (MachineInstr*)0); std::fill(PhysRegUse, PhysRegUse + NumRegs, (MachineInstr*)0); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=82676&r1=82675&r2=82676&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Sep 23 21:15:22 2009 @@ -268,6 +268,16 @@ return false; } +static void +TransferImplicitOps(MachineInstr *MI, MachineInstr *NewMI) { + for (unsigned i = MI->getDesc().getNumOperands(), e = MI->getNumOperands(); + i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (MO.isReg() && MO.isImplicit()) + NewMI->addOperand(MO); + } +} + /// RemoveCopyByCommutingDef - We found a non-trivially-coalescable copy with IntA /// being the source and IntB being the dest, thus this defines a value number /// in IntB. If the source value number (in IntA) is defined by a commutable @@ -416,7 +426,7 @@ ++UI; if (JoinedCopies.count(UseMI)) continue; - MachineInstrIndex UseIdx = li_->getInstructionIndex(UseMI); + MachineInstrIndex UseIdx= li_->getUseIndex(li_->getInstructionIndex(UseMI)); LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx); if (ULR == IntA.end() || ULR->valno != AValNo) continue; @@ -427,7 +437,7 @@ if (Extended) UseMO.setIsKill(false); else - BKills.push_back(li_->getNextSlot(li_->getUseIndex(UseIdx))); + BKills.push_back(li_->getNextSlot(UseIdx)); } unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; if (!tii_->isMoveInstr(*UseMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) @@ -724,6 +734,7 @@ } } + TransferImplicitOps(CopyMI, NewMI); li_->ReplaceMachineInstrInMaps(CopyMI, NewMI); CopyMI->eraseFromParent(); ReMatCopies.insert(CopyMI); Modified: llvm/trunk/test/CodeGen/X86/2008-08-05-SpillerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-08-05-SpillerBug.ll?rev=82676&r1=82675&r2=82676&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-08-05-SpillerBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-08-05-SpillerBug.ll Wed Sep 23 21:15:22 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 56 +; RUN: llc < %s -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 59 ; PR2568 @g_3 = external global i16 ; [#uses=1] Added: llvm/trunk/test/CodeGen/X86/2009-09-23-LiveVariablesBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-09-23-LiveVariablesBug.ll?rev=82676&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-09-23-LiveVariablesBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-09-23-LiveVariablesBug.ll Wed Sep 23 21:15:22 2009 @@ -0,0 +1,91 @@ +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 + +; rdar://7247745 + +%struct._lck_mtx_ = type { %union.anon } +%struct._lck_rw_t_internal_ = type <{ i16, i8, i8, i32, i32, i32 }> +%struct.anon = type { i64, i64, [2 x i8], i8, i8, i32 } +%struct.memory_object = type { i32, i32, %struct.memory_object_pager_ops* } +%struct.memory_object_control = type { i32, i32, %struct.vm_object* } +%struct.memory_object_pager_ops = type { void (%struct.memory_object*)*, void (%struct.memory_object*)*, i32 (%struct.memory_object*, %struct.memory_object_control*, i32)*, i32 (%struct.memory_object*)*, i32 (%struct.memory_object*, i64, i32, i32, i32*)*, i32 (%struct.memory_object*, i64, i32, i64*, i32*, i32, i32, i32)*, i32 (%struct.memory_object*, i64, i32)*, i32 (%struct.memory_object*, i64, i64, i32)*, i32 (%struct.memory_object*, i64, i64, i32)*, i32 (%struct.memory_object*, i32)*, i32 (%struct.memory_object*)*, i8* } +%struct.queue_entry = type { %struct.queue_entry*, %struct.queue_entry* } +%struct.upl = type { %struct._lck_mtx_, i32, i32, %struct.vm_object*, i64, i32, i64, %struct.vm_object*, i32, i8* } +%struct.upl_page_info = type <{ i32, i8, [3 x i8] }> +%struct.vm_object = type { %struct.queue_entry, %struct._lck_rw_t_internal_, i64, %struct.vm_page*, i32, i32, i32, i32, %struct.vm_object*, %struct.vm_object*, i64, %struct.memory_object*, i64, %struct.memory_object_control*, i32, i16, i16, [2 x i8], i8, i8, %struct.queue_entry, %struct.queue_entry, i64, i32, i32, i32, i8*, i64, i8, i8, [2 x i8], %struct.queue_entry } +%struct.vm_page = type { %struct.queue_entry, %struct.queue_entry, %struct.vm_page*, %struct.vm_object*, i64, [2 x i8], i8, i8, i32, i8, i8, i8, i8, i32 } +%union.anon = type { %struct.anon } + +declare i64 @OSAddAtomic64(i64, i64*) noredzone noimplicitfloat + +define i32 @upl_commit_range(%struct.upl* %upl, i32 %offset, i32 %size, i32 %flags, %struct.upl_page_info* %page_list, i32 %count, i32* nocapture %empty) nounwind noredzone noimplicitfloat { +entry: + br i1 undef, label %if.then, label %if.end + +if.end: ; preds = %entry + br i1 undef, label %if.end143, label %if.then136 + +if.then136: ; preds = %if.end + unreachable + +if.end143: ; preds = %if.end + br i1 undef, label %if.else155, label %if.then153 + +if.then153: ; preds = %if.end143 + br label %while.cond + +if.else155: ; preds = %if.end143 + unreachable + +while.cond: ; preds = %if.end1039, %if.then153 + br i1 undef, label %if.then1138, label %while.body + +while.body: ; preds = %while.cond + br i1 undef, label %if.end260, label %if.then217 + +if.then217: ; preds = %while.body + br i1 undef, label %if.end260, label %if.then230 + +if.then230: ; preds = %if.then217 + br i1 undef, label %if.then246, label %if.end260 + +if.then246: ; preds = %if.then230 + br label %if.end260 + +if.end260: ; preds = %if.then246, %if.then230, %if.then217, %while.body + br i1 undef, label %if.end296, label %if.then266 + +if.then266: ; preds = %if.end260 + unreachable + +if.end296: ; preds = %if.end260 + br i1 undef, label %if.end1039, label %if.end306 + +if.end306: ; preds = %if.end296 + br i1 undef, label %if.end796, label %if.then616 + +if.then616: ; preds = %if.end306 + br i1 undef, label %commit_next_page, label %do.body716 + +do.body716: ; preds = %if.then616 + %call721 = call i64 @OSAddAtomic64(i64 1, i64* undef) nounwind noredzone noimplicitfloat ; [#uses=0] + call void asm sideeffect "movq\090x0($0),%rdi\0A\09movq\090x8($0),%rsi\0A\09.section __DATA, __data\0A\09.globl __dtrace_probeDOLLAR${:uid}4794___vminfo____pgrec\0A\09__dtrace_probeDOLLAR${:uid}4794___vminfo____pgrec:.quad 1f\0A\09.text\0A\091:nop\0A\09nop\0A\09nop\0A\09", "r,~{memory},~{di},~{si},~{dirflag},~{fpsr},~{flags}"(i64* undef) nounwind + br label %commit_next_page + +if.end796: ; preds = %if.end306 + unreachable + +commit_next_page: ; preds = %do.body716, %if.then616 + br i1 undef, label %if.end1039, label %if.then1034 + +if.then1034: ; preds = %commit_next_page + br label %if.end1039 + +if.end1039: ; preds = %if.then1034, %commit_next_page, %if.end296 + br label %while.cond + +if.then1138: ; preds = %while.cond + unreachable + +if.then: ; preds = %entry + ret i32 4 +} From evan.cheng at apple.com Wed Sep 23 21:27:09 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Sep 2009 02:27:09 -0000 Subject: [llvm-commits] [llvm] r82677 - in /llvm/trunk: lib/CodeGen/RegisterScavenging.cpp test/CodeGen/ARM/2009-09-23-LiveVariablesBug.ll Message-ID: <200909240227.n8O2RAio010748@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 23 21:27:09 2009 New Revision: 82677 URL: http://llvm.org/viewvc/llvm-project?rev=82677&view=rev Log: Fix PR5024 with a big hammer: disable the double-def assertion in the scavenger. LiveVariables add implicit kills to correctly track partial register kills. This works well enough and is fairly accurate. But coalescer can make it impossible to maintain these markers. e.g. BL , %R0, %S0, %R0, %R1, %R2, %R3, %R12, %LR, %D0, ... .. %reg1031 = FLDS , 0, 14, %reg0, Mem:LD4[ConstantPool] .. %S0 = FCPYS %reg1031, 14, %reg0, %D0 When reg1031 and S0 are coalesced, the copy (FCPYS) will be eliminated the the implicit-kill of D0 is lost. In this case it's possible to move the marker to the FLDS. But in many cases, this is not possible. Suppose %reg1031 = FOO , %D0 .. %S0 = FCPYS %reg1031, 14, %reg0, %D0 When FCPYS goes away, the definition of S0 is the "FOO" instruction. However, transferring the D0 implicit-kill to FOO doesn't work since it is the def of D0 itself. We need to fix this in another time by introducing a "kill" pseudo instruction to track liveness. Disabling the assertion is not ideal, but machine verifier is doing that job now. It's important to know double-def is not a miscomputation since it means a register should be free but it's not tracked as free. It's a performance issue instead. Added: llvm/trunk/test/CodeGen/ARM/2009-09-23-LiveVariablesBug.ll Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=82677&r1=82676&r2=82677&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Wed Sep 23 21:27:09 2009 @@ -109,45 +109,6 @@ Tracking = false; } -#ifndef NDEBUG -/// isLiveInButUnusedBefore - Return true if register is livein the MBB not -/// not used before it reaches the MI that defines register. -static bool isLiveInButUnusedBefore(unsigned Reg, MachineInstr *MI, - MachineBasicBlock *MBB, - const TargetRegisterInfo *TRI, - MachineRegisterInfo* MRI) { - // First check if register is livein. - bool isLiveIn = false; - for (MachineBasicBlock::const_livein_iterator I = MBB->livein_begin(), - E = MBB->livein_end(); I != E; ++I) - if (Reg == *I || TRI->isSuperRegister(Reg, *I)) { - isLiveIn = true; - break; - } - if (!isLiveIn) - return false; - - // Is there any use of it before the specified MI? - SmallPtrSet UsesInMBB; - for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(Reg), - UE = MRI->use_end(); UI != UE; ++UI) { - MachineOperand &UseMO = UI.getOperand(); - if (UseMO.isReg() && UseMO.isUndef()) - continue; - MachineInstr *UseMI = &*UI; - if (UseMI->getParent() == MBB) - UsesInMBB.insert(UseMI); - } - if (UsesInMBB.empty()) - return true; - - for (MachineBasicBlock::iterator I = MBB->begin(), E = MI; I != E; ++I) - if (UsesInMBB.count(&*I)) - return false; - return true; -} -#endif - void RegScavenger::addRegWithSubRegs(BitVector &BV, unsigned Reg) { BV.set(Reg); for (const unsigned *R = TRI->getSubRegisters(Reg); *R; R++) @@ -221,9 +182,13 @@ "Using an early clobbered register!"); } else { assert(MO.isDef()); +#if 0 + // FIXME: Enable this once we've figured out how to correctly transfer + // implicit kills during codegen passes like the coalescer. assert((KillRegs.test(Reg) || isUnused(Reg) || isLiveInButUnusedBefore(Reg, MI, MBB, TRI, MRI)) && "Re-defining a live register!"); +#endif } } Added: llvm/trunk/test/CodeGen/ARM/2009-09-23-LiveVariablesBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-23-LiveVariablesBug.ll?rev=82677&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-09-23-LiveVariablesBug.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-09-23-LiveVariablesBug.ll Wed Sep 23 21:27:09 2009 @@ -0,0 +1,21 @@ +; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mattr=+neon + +; PR5024 + +%struct.1 = type { %struct.4, %struct.4 } +%struct.4 = type { <4 x float> } + +define arm_aapcs_vfpcc %struct.1* @hhh3(%struct.1* %this, <4 x float> %lenation.0, <4 x float> %legalation.0) nounwind { +entry: + %0 = call arm_aapcs_vfpcc %struct.4* @sss1(%struct.4* undef, float 0.000000e+00) nounwind ; <%struct.4*> [#uses=0] + %1 = call arm_aapcs_vfpcc %struct.4* @qqq1(%struct.4* null, float 5.000000e-01) nounwind ; <%struct.4*> [#uses=0] + %val92 = load <4 x float>* null ; <<4 x float>> [#uses=1] + %2 = call arm_aapcs_vfpcc %struct.4* @zzz2(%struct.4* undef, <4 x float> %val92) nounwind ; <%struct.4*> [#uses=0] + ret %struct.1* %this +} + +declare arm_aapcs_vfpcc %struct.4* @qqq1(%struct.4*, float) nounwind + +declare arm_aapcs_vfpcc %struct.4* @sss1(%struct.4*, float) nounwind + +declare arm_aapcs_vfpcc %struct.4* @zzz2(%struct.4*, <4 x float>) nounwind From sabre at nondot.org Wed Sep 23 23:53:24 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Sep 2009 23:53:24 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240453.n8O4rOcK028552@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.25 -> 1.26 --- Log message: formatting experiment --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.25 llvm-www/devmtg/2009-10/index.php:1.26 --- llvm-www/devmtg/2009-10/index.php:1.25 Wed Sep 23 16:36:43 2009 +++ llvm-www/devmtg/2009-10/index.php Wed Sep 23 23:52:51 2009 @@ -125,7 +125,7 @@ - + From sabre at nondot.org Wed Sep 23 23:56:46 2009 From: sabre at nondot.org (Chris Lattner) Date: Wed, 23 Sep 2009 23:56:46 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240456.n8O4ukxw028994@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.26 -> 1.27 --- Log message: more cleanup --- Diffs of the changes: (+10 -10) index.php | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.26 llvm-www/devmtg/2009-10/index.php:1.27 --- llvm-www/devmtg/2009-10/index.php:1.26 Wed Sep 23 23:52:51 2009 +++ llvm-www/devmtg/2009-10/index.php Wed Sep 23 23:56:29 2009 @@ -127,47 +127,47 @@ - + - + - + - + - + - + - + - + - + - +
TimeTalk TitleSpeaker
8:00-8:45BREAKFAST (Piano Bar)
8:45-9:00
8:45-9:00
Town Hall:WelcomeChris Lattner, Apple
9:00-9:40
Town Hall:State of ClangDoug Gregor, Chris Lattner, Ted Kremenek, Apple
8:00-8:45BREAKFAST (Piano Bar)
8:45-9:00
Town Hall:WelcomeChris Lattner, Apple
9:00-9:40
9:00-9:40
Town Hall:State of ClangDoug Gregor, Chris Lattner, Ted Kremenek, Apple
9:40-10:20
9:40-10:20
Town Hall:Tutorial: Building a backend in 24 hours Anton Korobeynikov, Saint Petersburg State University
Garage 1/2:Precise and Efficient Garbage Collection in VMKit with MMTk Nicolas Geoffray, Universite Pierre et Marie Curie
10:20-10:40BREAK
10:40-11:20
10:40-11:20
Town Hall:Unladen Swallow: Python on LLVM Colin Winter, Google
Garage 1/2:Reimplementing llvm-gcc as a gcc plugin Duncan Sands, Deep Blue Capital
11:20-12:00
11:20-12:00
Town Hall:ScalarEvolution and Loop Optimization Dan Gohman, Apple
Garage 1/2:Object Code Emission Bruno Cardoso Lopes, University of Campinas
12:00-1:00LUNCH (Piano Bar and Upstairs)
1:00-1:40
1:00-1:40
Town Hall:LLVM on 180k CoresDavid Greene, Cray
Garage 1/2:The Parfait Bug-Checker Cristina Cifuentes, Sun Microsystems
1:40-2:20
1:40-2:20
Town Hall:Optimizing ActionScript Bytecode using LLVMScott Petersen, Adobe
Garage 1/2:Targeting XCore resources from LLVM Richard Osborne, XMOS
2:20-3:00
2:20-3:00
Town Hall:Future Works in LLVM Register AllocationLang Hames, Apple / The University of Sydney
Garage 1/2:CoVaC: Compiler Validation by Program Analysis of the Cross-Product Anna Zaks, New York University
3:00-3:20BREAK
3:20-4:00
3:20-4:00
Town Hall:(Title TBD)Nate Begeman, Apple
Garage 1/2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C Santosh Nagarakatte, University of Pennsylvania
4:00-4:40
4:00-4:40
Town Hall:PLANG: Translating NVIDIA PTX language to LLVM IRVinod Grover, NVIDIA
Garage 1/2:Accelerating Ruby with LLVM Evan Phoenix, Engine Yard / Rubinius
4:40-5:20
4:40-5:20
Town Hall:LLVM Code Owners
5:30-7:30DINNER (Piano Bar, Must have registered w/ dinner option)
From sabre at nondot.org Thu Sep 24 00:01:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 00:01:47 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240501.n8O51lHU029681@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.27 -> 1.28 --- Log message: more formatting --- Diffs of the changes: (+25 -5) index.php | 30 +++++++++++++++++++++++++----- 1 files changed, 25 insertions(+), 5 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.27 llvm-www/devmtg/2009-10/index.php:1.28 --- llvm-www/devmtg/2009-10/index.php:1.27 Wed Sep 23 23:56:29 2009 +++ llvm-www/devmtg/2009-10/index.php Thu Sep 24 00:01:31 2009 @@ -124,52 +124,72 @@ - + + + + + - + + + + + - + + + + + + - + + + + + + - + + +
TimeTalk TitleSpeaker
8:00-8:45BREAKFAST (Piano Bar)
8:00-8:45
Piano Bar:Breakfast
8:45-9:00
Town Hall:WelcomeChris Lattner, Apple
9:00-9:40
Town Hall:State of ClangDoug Gregor, Chris Lattner, Ted Kremenek, Apple
9:40-10:20
Town Hall:Tutorial: Building a backend in 24 hours Anton Korobeynikov, Saint Petersburg State University
Garage 1/2:Precise and Efficient Garbage Collection in VMKit with MMTk Nicolas Geoffray, Universite Pierre et Marie Curie
10:20-10:40BREAK
10:20-10:40
BREAK
10:40-11:20
Town Hall:Unladen Swallow: Python on LLVM Colin Winter, Google
Garage 1/2:Reimplementing llvm-gcc as a gcc plugin Duncan Sands, Deep Blue Capital
11:20-12:00
Town Hall:ScalarEvolution and Loop Optimization Dan Gohman, Apple
Garage 1/2:Object Code Emission Bruno Cardoso Lopes, University of Campinas
12:00-1:00LUNCH (Piano Bar and Upstairs)
12:00-1:00
Piano BarLunch
1:00-1:40
Town Hall:LLVM on 180k CoresDavid Greene, Cray
Garage 1/2:The Parfait Bug-Checker Cristina Cifuentes, Sun Microsystems
1:40-2:20
Town Hall:Optimizing ActionScript Bytecode using LLVMScott Petersen, Adobe
Garage 1/2:Targeting XCore resources from LLVM Richard Osborne, XMOS
2:20-3:00
Town Hall:Future Works in LLVM Register AllocationLang Hames, Apple / The University of Sydney
Garage 1/2:CoVaC: Compiler Validation by Program Analysis of the Cross-Product Anna Zaks, New York University
3:00-3:20BREAK
3:00-3:20
BREAK
3:20-4:00
Town Hall:(Title TBD)Nate Begeman, Apple
Garage 1/2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C Santosh Nagarakatte, University of Pennsylvania
4:00-4:40
Town Hall:PLANG: Translating NVIDIA PTX language to LLVM IRVinod Grover, NVIDIA
Garage 1/2:Accelerating Ruby with LLVM Evan Phoenix, Engine Yard / Rubinius
4:40-5:20
Town Hall:LLVM Code Owners
5:30-7:30DINNER (Piano Bar, Must have registered w/ dinner option)
5:30-7:30
Piano Bar:Dinner - Must have registered with dinner option
BOFs
From sabre at nondot.org Thu Sep 24 00:03:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 00:03:43 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240503.n8O53hjg029960@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.28 -> 1.29 --- Log message: formatting changes. --- Diffs of the changes: (+3 -3) index.php | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.28 llvm-www/devmtg/2009-10/index.php:1.29 --- llvm-www/devmtg/2009-10/index.php:1.28 Thu Sep 24 00:01:31 2009 +++ llvm-www/devmtg/2009-10/index.php Thu Sep 24 00:03:26 2009 @@ -140,7 +140,7 @@ Nicolas Geoffray, Universite Pierre et Marie Curie 10:20-10:40 -BREAK +Everywhere:Break 10:40-11:20 Town Hall:Unladen Swallow: Python on LLVM @@ -173,7 +173,7 @@ Anna Zaks, New York University 3:00-3:20 -BREAK +Everywhere:Break 3:20-4:00 Town Hall:(Title TBD)Nate Begeman, Apple @@ -189,7 +189,7 @@ Town Hall:LLVM Code Owners 5:30-7:30 -Piano Bar:Dinner - Must have registered with dinner option +Piano Bar:Dinner - Must have registered with dinner option
BOFs
From sabre at nondot.org Thu Sep 24 00:10:35 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 00:10:35 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240510.n8O5AZZg030865@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.29 -> 1.30 --- Log message: bof it up --- Diffs of the changes: (+2 -2) index.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.29 llvm-www/devmtg/2009-10/index.php:1.30 --- llvm-www/devmtg/2009-10/index.php:1.29 Thu Sep 24 00:03:26 2009 +++ llvm-www/devmtg/2009-10/index.php Thu Sep 24 00:10:20 2009 @@ -186,14 +186,14 @@ Evan Phoenix, Engine Yard / Rubinius 4:40-5:20 -Town Hall:LLVM Code Owners +Town Hall:LLVM Code Owners Discussion 5:30-7:30 Piano Bar:Dinner - Must have registered with dinner option
BOFs
-

Unique to this year's Developer Meeting, we will have Birds-of-a-Feather sessions (BOFs) that will coincide with the talks. For those unfamiliar with BOFs, these are attendee organized meetings for people to meet, exchange ideas, and share information on a variety of topics. BOF slots will be 40 minutes long. BOFs will be printed on the official schedule and be put on the website so attendees can plan to attend. +

Unique to this year's Developer Meeting, we will have Birds-of-a-Feather sessions (BOFs) that will coincide with the talks. For those unfamiliar with BOFs, these are informal attendee-organized meetings for people to meet, exchange ideas, and share information on a variety of topics. BOFs can range from an informal discussion to a full presentation, at the organizer's discression. BOF slots will be 40 minutes long and will not be video taped. BOFs will be scheduled against whichever talk slot the organizer prefers, will be printed on the official schedule, and be put on the website so attendees can plan to attend.

If you are interested in organizing a BOF, please email us no later than September 26th.

From clattner at apple.com Thu Sep 24 00:12:49 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Sep 2009 22:12:49 -0700 Subject: [llvm-commits] [llvm] r82591 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: <352a1fb20909231740s1fecd6ev3c0dd236824f8f37@mail.gmail.com> References: <200909230013.n8N0DVHX024647@zion.cs.uiuc.edu> <352a1fb20909231740s1fecd6ev3c0dd236824f8f37@mail.gmail.com> Message-ID: On Sep 23, 2009, at 5:40 PM, Devang Patel wrote: >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Sep 22 >> 19:13:30 2009 >> @@ -662,9 +662,6 @@ >> std::string typeName; >> blockStruct.getName(typeName); >> >> - assert(typeName.find ("__Block_byref_") == 0 >> - && "Attempting to get Block location of non-Block >> variable!"); >> - > > Why ? Pl. explain. Why is an assertion against the name of the type valid in any case? -Chris From clattner at apple.com Thu Sep 24 00:32:02 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Sep 2009 22:32:02 -0700 Subject: [llvm-commits] [llvm] r82660 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp In-Reply-To: <200909232205.n8NM5OCI010421@zion.cs.uiuc.edu> References: <200909232205.n8NM5OCI010421@zion.cs.uiuc.edu> Message-ID: <2844833E-4DA1-4AF9-84C6-8BF95775DEEC@apple.com> On Sep 23, 2009, at 3:05 PM, Dale Johannesen wrote: > Author: johannes > Date: Wed Sep 23 17:05:24 2009 > New Revision: 82660 > > URL: http://llvm.org/viewvc/llvm-project?rev=82660&view=rev > Log: > A minor improvment in accuracy to inline cost > computation, and some cosmetics. Am I missing something here? It looks like you compute NumRets but don't use it for anything... -Chris > > > Modified: > llvm/trunk/lib/Transforms/Utils/InlineCost.cpp > > Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=82660&r1=82659&r2=82660&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) > +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Wed Sep 23 > 17:05:24 2009 > @@ -104,7 +104,7 @@ > /// analyzeFunction - Fill in the current structure with information > gleaned > /// from the specified function. > void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) { > - unsigned NumInsts = 0, NumBlocks = 0, NumVectorInsts = 0; > + unsigned NumInsts = 0, NumBlocks = 0, NumVectorInsts = 0, NumRets > = 0; > > // Look at the size of the callee. Each basic block counts as 20 > units, and > // each instruction counts as 5. > @@ -157,6 +157,9 @@ > if (GEPI->hasAllConstantIndices()) > continue; > } > + > + if (isa(II)) > + ++NumRets; > > ++NumInsts; > } > @@ -164,6 +167,11 @@ > ++NumBlocks; > } > > + // A function with exactly one return has it removed during the > inlining > + // process (see InlineFunction), so don't count it. > + if (NumRets==1) > + --NumInsts; > + > this->NumBlocks = NumBlocks; > this->NumInsts = NumInsts; > this->NumVectorInsts = NumVectorInsts; > @@ -186,11 +194,10 @@ > Function *Callee = CS.getCalledFunction(); > Function *Caller = TheCall->getParent()->getParent(); > > - // Don't inline functions which can be redefined at link-time > to mean > - // something else. > - if (Callee->mayBeOverridden() || > - // Don't inline functions marked noinline. > - Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count > (Callee)) > + // Don't inline functions which can be redefined at link-time to > mean > + // something else. Don't inline functions marked noinline. > + if (Callee->mayBeOverridden() || > + Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count > (Callee)) > return llvm::InlineCost::getNever(); > > // InlineCost - This value measures how good of an inline > candidate this call > @@ -291,6 +298,7 @@ > // likely to be inlined, look at factors that make us not want to > inline it. > > // Don't inline into something too big, which would make it bigger. > + // "size" here is the number of basic blocks, not instructions. > // > InlineCost += Caller->size()/15; > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Thu Sep 24 00:34:35 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Sep 2009 22:34:35 -0700 Subject: [llvm-commits] [llvm] r82629 - /llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp In-Reply-To: <200909231635.n8NGZP7g032607@zion.cs.uiuc.edu> References: <200909231635.n8NGZP7g032607@zion.cs.uiuc.edu> Message-ID: On Sep 23, 2009, at 9:35 AM, David Goodwin wrote: > Author: david_goodwin > Date: Wed Sep 23 11:35:25 2009 > New Revision: 82629 > > URL: http://llvm.org/viewvc/llvm-project?rev=82629&view=rev > Log: > Fix bug in kill flag updating for post-register-allocation > scheduling. When the kill flag of a superreg needs to be cleared > because there are one or more subregs live, we instead add implicit- > defs of those subregs and leave the kill flag on the superreg. This > allows us to end the live-range of the superreg without ending the > live-ranges of the subregs. > Hmm. This seems wrong. You have changed the code so the live registers are defined by implicit_def's. Why not remove the kill of the superreg and add kills of the sub-registers that are no longer used? Evan > Modified: > llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp > > Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=82629&r1=82628&r2=82629&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original) > +++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Wed Sep 23 > 11:35:25 2009 > @@ -178,6 +178,11 @@ > unsigned LastNewReg, > const TargetRegisterClass *); > void StartBlockForKills(MachineBasicBlock *BB); > + > + // ToggleKillFlag - Toggle a register operand kill flag. Other > + // adjustments may be made to the instruction if necessary. > Return > + // true if the operand has been deleted, false if not. > + bool ToggleKillFlag(MachineInstr *MI, MachineOperand &MO); > }; > } > > @@ -822,6 +827,40 @@ > } > } > > +bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI, > + MachineOperand &MO) { > + // Setting kill flag... > + if (!MO.isKill()) { > + MO.setIsKill(true); > + return false; > + } > + > + // If MO itself is live, clear the kill flag... > + if (KillIndices[MO.getReg()] != ~0u) { > + MO.setIsKill(false); > + return false; > + } > + > + // If any subreg of MO is live, then create an imp-def for that > + // subreg and keep MO marked as killed. > + bool AllDead = true; > + const unsigned SuperReg = MO.getReg(); > + for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg); > + *Subreg; ++Subreg) { > + if (KillIndices[*Subreg] != ~0u) { > + MI->addOperand(MachineOperand::CreateReg(*Subreg, > + true /*IsDef*/, > + true /*IsImp*/, > + false /*IsKill*/, > + false /*IsDead*/)); > + AllDead = false; > + } > + } > + > + MO.setIsKill(AllDead); > + return false; > +} > + > /// FixupKills - Fix the register kill flags, they may have been made > /// incorrect by instruction reordering. > /// > @@ -860,9 +899,9 @@ > } > } > > - // Examine all used registers and set kill flag. When a register > - // is used multiple times we only set the kill flag on the first > - // use. > + // Examine all used registers and set/clear kill flag. When a > + // register is used multiple times we only set the kill flag on > + // the first use. > killedRegs.clear(); > for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { > MachineOperand &MO = MI->getOperand(i); > @@ -889,8 +928,12 @@ > } > > if (MO.isKill() != kill) { > - MO.setIsKill(kill); > - DEBUG(errs() << "Fixed " << MO << " in "); > + bool removed = ToggleKillFlag(MI, MO); > + if (removed) { > + DEBUG(errs() << "Fixed in "); > + } else { > + DEBUG(errs() << "Fixed " << MO << " in "); > + } > DEBUG(MI->dump()); > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Thu Sep 24 00:35:41 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Sep 2009 22:35:41 -0700 Subject: [llvm-commits] [llvm] r82660 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp In-Reply-To: <2844833E-4DA1-4AF9-84C6-8BF95775DEEC@apple.com> References: <200909232205.n8NM5OCI010421@zion.cs.uiuc.edu> <2844833E-4DA1-4AF9-84C6-8BF95775DEEC@apple.com> Message-ID: On Sep 23, 2009, at 10:32 PM, Chris Lattner wrote: > > On Sep 23, 2009, at 3:05 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Wed Sep 23 17:05:24 2009 >> New Revision: 82660 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82660&view=rev >> Log: >> A minor improvment in accuracy to inline cost >> computation, and some cosmetics. > > Am I missing something here? It looks like you compute NumRets but > don't use it for anything... It's used: > + // A function with exactly one return has it removed during the > inlining > + // process (see InlineFunction), so don't count it. > + if (NumRets==1) > + --NumInsts; Evan > > -Chris > >> >> >> Modified: >> llvm/trunk/lib/Transforms/Utils/InlineCost.cpp >> >> Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=82660&r1=82659&r2=82660&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) >> +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Wed Sep 23 >> 17:05:24 2009 >> @@ -104,7 +104,7 @@ >> /// analyzeFunction - Fill in the current structure with information >> gleaned >> /// from the specified function. >> void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) { >> - unsigned NumInsts = 0, NumBlocks = 0, NumVectorInsts = 0; >> + unsigned NumInsts = 0, NumBlocks = 0, NumVectorInsts = 0, NumRets >> = 0; >> >> // Look at the size of the callee. Each basic block counts as 20 >> units, and >> // each instruction counts as 5. >> @@ -157,6 +157,9 @@ >> if (GEPI->hasAllConstantIndices()) >> continue; >> } >> + >> + if (isa(II)) >> + ++NumRets; >> >> ++NumInsts; >> } >> @@ -164,6 +167,11 @@ >> ++NumBlocks; >> } >> >> + // A function with exactly one return has it removed during the >> inlining >> + // process (see InlineFunction), so don't count it. >> + if (NumRets==1) >> + --NumInsts; >> + >> this->NumBlocks = NumBlocks; >> this->NumInsts = NumInsts; >> this->NumVectorInsts = NumVectorInsts; >> @@ -186,11 +194,10 @@ >> Function *Callee = CS.getCalledFunction(); >> Function *Caller = TheCall->getParent()->getParent(); >> >> - // Don't inline functions which can be redefined at link-time >> to mean >> - // something else. >> - if (Callee->mayBeOverridden() || >> - // Don't inline functions marked noinline. >> - Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count >> (Callee)) >> + // Don't inline functions which can be redefined at link-time to >> mean >> + // something else. Don't inline functions marked noinline. >> + if (Callee->mayBeOverridden() || >> + Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count >> (Callee)) >> return llvm::InlineCost::getNever(); >> >> // InlineCost - This value measures how good of an inline >> candidate this call >> @@ -291,6 +298,7 @@ >> // likely to be inlined, look at factors that make us not want to >> inline it. >> >> // Don't inline into something too big, which would make it bigger. >> + // "size" here is the number of basic blocks, not instructions. >> // >> InlineCost += Caller->size()/15; >> >> >> >> _______________________________________________ >> 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 Thu Sep 24 00:36:34 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Sep 2009 22:36:34 -0700 Subject: [llvm-commits] [llvm] r82660 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp In-Reply-To: References: <200909232205.n8NM5OCI010421@zion.cs.uiuc.edu> <2844833E-4DA1-4AF9-84C6-8BF95775DEEC@apple.com> Message-ID: On Sep 23, 2009, at 10:35 PM, Evan Cheng wrote: > > On Sep 23, 2009, at 10:32 PM, Chris Lattner wrote: > >> >> On Sep 23, 2009, at 3:05 PM, Dale Johannesen wrote: >> >>> Author: johannes >>> Date: Wed Sep 23 17:05:24 2009 >>> New Revision: 82660 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=82660&view=rev >>> Log: >>> A minor improvment in accuracy to inline cost >>> computation, and some cosmetics. >> >> Am I missing something here? It looks like you compute NumRets but >> don't use it for anything... > > It's used: > > >> + // A function with exactly one return has it removed during the >> inlining >> + // process (see InlineFunction), so don't count it. >> + if (NumRets==1) >> + --NumInsts; Oh duh, I read that as "if NumRets == 1, --NumRets". Thanks! :) -Chris From sabre at nondot.org Thu Sep 24 00:38:36 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 05:38:36 -0000 Subject: [llvm-commits] [llvm] r82683 - /llvm/trunk/lib/Support/CommandLine.cpp Message-ID: <200909240538.n8O5canH001911@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 00:38:36 2009 New Revision: 82683 URL: http://llvm.org/viewvc/llvm-project?rev=82683&view=rev Log: reapply r82348 with a fix, thanks Jeffrey. Modified: llvm/trunk/lib/Support/CommandLine.cpp Modified: llvm/trunk/lib/Support/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82683&r1=82682&r2=82683&view=diff ============================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp (original) +++ llvm/trunk/lib/Support/CommandLine.cpp Thu Sep 24 00:38:36 2009 @@ -351,42 +351,33 @@ /// using strdup(), so it is the caller's responsibility to free() /// them later. /// -static void ParseCStringVector(std::vector &output, - const char *input) { +static void ParseCStringVector(std::vector &OutputVector, + const char *Input) { // Characters which will be treated as token separators: - static const char *const delims = " \v\f\t\r\n"; + StringRef Delims = " \v\f\t\r\n"; - std::string work(input); - // Skip past any delims at head of input string. - size_t pos = work.find_first_not_of(delims); - // If the string consists entirely of delims, then exit early. - if (pos == std::string::npos) return; - // Otherwise, jump forward to beginning of first word. - work = work.substr(pos); - // Find position of first delimiter. - pos = work.find_first_of(delims); - - while (!work.empty() && pos != std::string::npos) { - // Everything from 0 to POS is the next word to copy. - output.push_back(strdup(work.substr(0,pos).c_str())); - // Is there another word in the string? - size_t nextpos = work.find_first_not_of(delims, pos + 1); - if (nextpos != std::string::npos) { - // Yes? Then remove delims from beginning ... - work = work.substr(work.find_first_not_of(delims, pos + 1)); - // and find the end of the word. - pos = work.find_first_of(delims); - } else { - // No? (Remainder of string is delims.) End the loop. - work = ""; - pos = std::string::npos; + StringRef WorkStr(Input); + while (!WorkStr.empty()) { + // If the first character is a delimiter, strip them off. + if (Delims.find(WorkStr[0]) != StringRef::npos) { + size_t Pos = WorkStr.find_first_not_of(Delims); + if (Pos == StringRef::npos) Pos = WorkStr.size(); + WorkStr = WorkStr.substr(Pos); + continue; } + + // Find position of first delimiter. + size_t Pos = WorkStr.find_first_of(Delims); + if (Pos == StringRef::npos) Pos = WorkStr.size(); + + // Everything from 0 to Pos is the next word to copy. + char *NewStr = (char*)malloc(Pos+1); + memcpy(NewStr, WorkStr.data(), Pos); + NewStr[Pos] = 0; + OutputVector.push_back(NewStr); + + WorkStr = WorkStr.substr(Pos); } - - // If `input' ended with non-delim char, then we'll get here with - // the last word of `input' in `work'; copy it now. - if (!work.empty()) - output.push_back(strdup(work.c_str())); } /// ParseEnvironmentOptions - An alternative entry point to the From david_goodwin at apple.com Thu Sep 24 00:41:37 2009 From: david_goodwin at apple.com (David Goodwin) Date: Wed, 23 Sep 2009 22:41:37 -0700 Subject: [llvm-commits] [llvm] r82629 - /llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp In-Reply-To: References: <200909231635.n8NGZP7g032607@zion.cs.uiuc.edu> Message-ID: <9C05B77E-5E8D-4E95-83DA-4675F6787F3E@apple.com> Because then the superreg is never killed... I think that will cause an assertion in the following code when the superreg is defined again. David On Sep 23, 2009, at 10:34 PM, Evan Cheng wrote: > > On Sep 23, 2009, at 9:35 AM, David Goodwin wrote: > >> Author: david_goodwin >> Date: Wed Sep 23 11:35:25 2009 >> New Revision: 82629 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82629&view=rev >> Log: >> Fix bug in kill flag updating for post-register-allocation >> scheduling. When the kill flag of a superreg needs to be cleared >> because there are one or more subregs live, we instead add implicit- >> defs of those subregs and leave the kill flag on the superreg. This >> allows us to end the live-range of the superreg without ending the >> live-ranges of the subregs. >> > > Hmm. This seems wrong. You have changed the code so the live > registers are defined by implicit_def's. Why not remove the kill of > the superreg and add kills of the sub-registers that are no longer > used? > > Evan > > >> Modified: >> llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp >> >> Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=82629&r1=82628&r2=82629&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original) >> +++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Wed Sep 23 >> 11:35:25 2009 >> @@ -178,6 +178,11 @@ >> unsigned LastNewReg, >> const TargetRegisterClass *); >> void StartBlockForKills(MachineBasicBlock *BB); >> + >> + // ToggleKillFlag - Toggle a register operand kill flag. Other >> + // adjustments may be made to the instruction if necessary. >> Return >> + // true if the operand has been deleted, false if not. >> + bool ToggleKillFlag(MachineInstr *MI, MachineOperand &MO); >> }; >> } >> >> @@ -822,6 +827,40 @@ >> } >> } >> >> +bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI, >> + MachineOperand &MO) { >> + // Setting kill flag... >> + if (!MO.isKill()) { >> + MO.setIsKill(true); >> + return false; >> + } >> + >> + // If MO itself is live, clear the kill flag... >> + if (KillIndices[MO.getReg()] != ~0u) { >> + MO.setIsKill(false); >> + return false; >> + } >> + >> + // If any subreg of MO is live, then create an imp-def for that >> + // subreg and keep MO marked as killed. >> + bool AllDead = true; >> + const unsigned SuperReg = MO.getReg(); >> + for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg); >> + *Subreg; ++Subreg) { >> + if (KillIndices[*Subreg] != ~0u) { >> + MI->addOperand(MachineOperand::CreateReg(*Subreg, >> + true /*IsDef*/, >> + true /*IsImp*/, >> + false /*IsKill*/, >> + false /*IsDead*/)); >> + AllDead = false; >> + } >> + } >> + >> + MO.setIsKill(AllDead); >> + return false; >> +} >> + >> /// FixupKills - Fix the register kill flags, they may have been made >> /// incorrect by instruction reordering. >> /// >> @@ -860,9 +899,9 @@ >> } >> } >> >> - // Examine all used registers and set kill flag. When a register >> - // is used multiple times we only set the kill flag on the first >> - // use. >> + // Examine all used registers and set/clear kill flag. When a >> + // register is used multiple times we only set the kill flag on >> + // the first use. >> killedRegs.clear(); >> for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { >> MachineOperand &MO = MI->getOperand(i); >> @@ -889,8 +928,12 @@ >> } >> >> if (MO.isKill() != kill) { >> - MO.setIsKill(kill); >> - DEBUG(errs() << "Fixed " << MO << " in "); >> + bool removed = ToggleKillFlag(MI, MO); >> + if (removed) { >> + DEBUG(errs() << "Fixed in "); >> + } else { >> + DEBUG(errs() << "Fixed " << MO << " in "); >> + } >> DEBUG(MI->dump()); >> } >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From sabre at nondot.org Thu Sep 24 00:44:53 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 05:44:53 -0000 Subject: [llvm-commits] [llvm] r82684 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Message-ID: <200909240544.n8O5iric002715@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 00:44:53 2009 New Revision: 82684 URL: http://llvm.org/viewvc/llvm-project?rev=82684&view=rev Log: unconditionally compute MMI even if the target doesn't support EH or Debug info, because the target may use it for other things, this fixes PR5036 Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=82684&r1=82683&r2=82684&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu Sep 24 00:44:53 2009 @@ -130,15 +130,12 @@ << '\n' << MAI->getCommentString() << " End of file scope inline assembly\n"; - if (MAI->doesSupportDebugInformation() || - MAI->doesSupportExceptionHandling()) { - MMI = getAnalysisIfAvailable(); - if (MMI) - MMI->AnalyzeModule(M); - DW = getAnalysisIfAvailable(); - if (DW) - DW->BeginModule(&M, MMI, O, this, MAI); - } + MMI = getAnalysisIfAvailable(); + if (MMI) + MMI->AnalyzeModule(M); + DW = getAnalysisIfAvailable(); + if (DW) + DW->BeginModule(&M, MMI, O, this, MAI); return false; } From evan.cheng at apple.com Thu Sep 24 00:51:11 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 23 Sep 2009 22:51:11 -0700 Subject: [llvm-commits] [llvm] r82629 - /llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp In-Reply-To: <9C05B77E-5E8D-4E95-83DA-4675F6787F3E@apple.com> References: <200909231635.n8NGZP7g032607@zion.cs.uiuc.edu> <9C05B77E-5E8D-4E95-83DA-4675F6787F3E@apple.com> Message-ID: On Sep 23, 2009, at 10:41 PM, David Goodwin wrote: > Because then the superreg is never killed... I think that will cause > an assertion in the following code when the superreg is defined again. That means the superreg kill should be moved down to the last use of any of subreg. BTW, I have disabled the scavenger double-def assertion for now. I've found coalescer can eliminate instructions which carry the extra kill markers. It's not always possible to move the markers. My long term plan is: 1. Introduce "kill" pseudo instruction that terminate liveness of instructions. 2. Move physical liveness computation out of livevariables and allow codegen passes like postalloc sched to use it. Note double defs is not a miscomputation. It's just a performance issue. That's why I've decided to disable the assertion for now. Evan > > David > > On Sep 23, 2009, at 10:34 PM, Evan Cheng wrote: > >> >> On Sep 23, 2009, at 9:35 AM, David Goodwin wrote: >> >>> Author: david_goodwin >>> Date: Wed Sep 23 11:35:25 2009 >>> New Revision: 82629 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=82629&view=rev >>> Log: >>> Fix bug in kill flag updating for post-register-allocation >>> scheduling. When the kill flag of a superreg needs to be cleared >>> because there are one or more subregs live, we instead add >>> implicit-defs of those subregs and leave the kill flag on the >>> superreg. This allows us to end the live-range of the superreg >>> without ending the live-ranges of the subregs. >>> >> >> Hmm. This seems wrong. You have changed the code so the live >> registers are defined by implicit_def's. Why not remove the kill of >> the superreg and add kills of the sub-registers that are no longer >> used? >> >> Evan >> >> >>> Modified: >>> llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp >>> >>> Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=82629&r1=82628&r2=82629&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Wed Sep 23 >>> 11:35:25 2009 >>> @@ -178,6 +178,11 @@ >>> unsigned LastNewReg, >>> const TargetRegisterClass *); >>> void StartBlockForKills(MachineBasicBlock *BB); >>> + >>> + // ToggleKillFlag - Toggle a register operand kill flag. Other >>> + // adjustments may be made to the instruction if necessary. >>> Return >>> + // true if the operand has been deleted, false if not. >>> + bool ToggleKillFlag(MachineInstr *MI, MachineOperand &MO); >>> }; >>> } >>> >>> @@ -822,6 +827,40 @@ >>> } >>> } >>> >>> +bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI, >>> + MachineOperand &MO) { >>> + // Setting kill flag... >>> + if (!MO.isKill()) { >>> + MO.setIsKill(true); >>> + return false; >>> + } >>> + >>> + // If MO itself is live, clear the kill flag... >>> + if (KillIndices[MO.getReg()] != ~0u) { >>> + MO.setIsKill(false); >>> + return false; >>> + } >>> + >>> + // If any subreg of MO is live, then create an imp-def for that >>> + // subreg and keep MO marked as killed. >>> + bool AllDead = true; >>> + const unsigned SuperReg = MO.getReg(); >>> + for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg); >>> + *Subreg; ++Subreg) { >>> + if (KillIndices[*Subreg] != ~0u) { >>> + MI->addOperand(MachineOperand::CreateReg(*Subreg, >>> + true /*IsDef*/, >>> + true /*IsImp*/, >>> + false /*IsKill*/, >>> + false /*IsDead*/)); >>> + AllDead = false; >>> + } >>> + } >>> + >>> + MO.setIsKill(AllDead); >>> + return false; >>> +} >>> + >>> /// FixupKills - Fix the register kill flags, they may have been >>> made >>> /// incorrect by instruction reordering. >>> /// >>> @@ -860,9 +899,9 @@ >>> } >>> } >>> >>> - // Examine all used registers and set kill flag. When a >>> register >>> - // is used multiple times we only set the kill flag on the >>> first >>> - // use. >>> + // Examine all used registers and set/clear kill flag. When a >>> + // register is used multiple times we only set the kill flag on >>> + // the first use. >>> killedRegs.clear(); >>> for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { >>> MachineOperand &MO = MI->getOperand(i); >>> @@ -889,8 +928,12 @@ >>> } >>> >>> if (MO.isKill() != kill) { >>> - MO.setIsKill(kill); >>> - DEBUG(errs() << "Fixed " << MO << " in "); >>> + bool removed = ToggleKillFlag(MI, MO); >>> + if (removed) { >>> + DEBUG(errs() << "Fixed in "); >>> + } else { >>> + DEBUG(errs() << "Fixed " << MO << " in "); >>> + } >>> DEBUG(MI->dump()); >>> } >>> >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > From clattner at apple.com Thu Sep 24 00:53:54 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Sep 2009 22:53:54 -0700 Subject: [llvm-commits] [llvm] r82658 - /llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c In-Reply-To: <200909232146.n8NLkaMx008025@zion.cs.uiuc.edu> References: <200909232146.n8NLkaMx008025@zion.cs.uiuc.edu> Message-ID: <24DE1DF7-821F-4EB5-B436-48BC405671DF@apple.com> On Sep 23, 2009, at 2:46 PM, Dale Johannesen wrote: > Author: johannes > Date: Wed Sep 23 16:46:36 2009 > New Revision: 82658 > > URL: http://llvm.org/viewvc/llvm-project?rev=82658&view=rev > Log: > Disable test; what it's testing for is wrong. Please unconditionally remove this test. Thanks, -Chris > > > Modified: > llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c > > Modified: llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c?rev=82658&r1=82657&r2=82658&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c (original) > +++ llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c Wed Sep 23 > 16:46:36 2009 > @@ -1,4 +1,7 @@ > // RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt > +// llvm.sqrt has undefined behavior on negative inputs, so it is > +// inappropriate to translate C/C++ sqrt to this. > +// XFAIL: * > #include > > float foo(float X) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu Sep 24 01:04:10 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Sep 2009 23:04:10 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> Message-ID: <2909ED8F-1969-44A3-8018-5F033AA59ACE@apple.com> On Sep 23, 2009, at 6:10 PM, Evan Cheng wrote: On Sep 23, 2009, at 3:21 PM, Dale Johannesen wrote: >> On Sep 23, 2009, at 3:18 PMPDT, Evan Cheng wrote: >> >>> Are we generating a call to sqrt now? If so, that's bad. We should >>> be using SSE sqrts* instructions. >> >> Agreed. My proposed semantic change would fix that. > > You mean change to llvm.sqrt and then llvm-gcc can switch bad to > generating the intrinsic? It seems like the current fix is not what we > want. Perhaps we should revert it first? > > According to Chris, the semantics of sqrt of negative value is defined > and this is just some optimization bug. Sorry, I'm just catching up on this now. There are a couple of things that confuse the issue, but I'll just try to keep it "to the point" instead of rambling about history. 1. I did tell Evan that sqrt is defined on negative number, but I misunderstood and didn't think about llvm.sqrt. Please disregard my comment Evan. llvm.sqrt should be undefined on negative numbers as langref says, and llvm-gcc/clang should only transform sqrt to llvm.sqrt if the appropriate "I don't care about fp semantics" flag is set. 2. Dale's patch to llvm-gcc is ok, but it would be better to still do the transformation when -ffast-math is specified or whatever the more precise "nan's aren't generated" flag is. We should do the same thing for clang as well. 3. Please make sure that llvm-gcc/clang on the mac (and other targets with -fno-math-errno) are producing a call to sqrt that is marked as readnone. Given this, the mid-level optimizer should hoist and cse the calls to sqrt just as well as it did calls to llvm.sqrt. 4. The constant folding of llvm.sqrt(-123) -> 0 is ok because the intrinsic really is undefined on negative. The constant folding of sqrt(-123) doesn't fold if the input is negative, so it will just not optimize the curious case. 5. Please make the X86 backend compile calls to readonly/readnone "sqrt" produce a sqrtsd (etc) instruction. We really don't want to get a function call on the mac (or other x86 target with -fno-math- errno). Like malloc, if someone cares about -fno-builtin-sqrt, they can solve the general problem. We already constant fold "real sqrt" calls in Analysis/ConstantFolding.cpp anyway. 6. Please add handling of "real sqrt" to llvm::CannotBeNegativeZero to match the handling of llvm.sqrt. Thanks! -Chris From clattner at apple.com Thu Sep 24 01:04:39 2009 From: clattner at apple.com (Chris Lattner) Date: Wed, 23 Sep 2009 23:04:39 -0700 Subject: [llvm-commits] [llvm] r82658 - /llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c In-Reply-To: <24DE1DF7-821F-4EB5-B436-48BC405671DF@apple.com> References: <200909232146.n8NLkaMx008025@zion.cs.uiuc.edu> <24DE1DF7-821F-4EB5-B436-48BC405671DF@apple.com> Message-ID: <9556CB58-7831-4109-9A40-F0694C41FED3@apple.com> On Sep 23, 2009, at 10:53 PM, Chris Lattner wrote: > > On Sep 23, 2009, at 2:46 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Wed Sep 23 16:46:36 2009 >> New Revision: 82658 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82658&view=rev >> Log: >> Disable test; what it's testing for is wrong. > > Please unconditionally remove this test. Thanks, Better yet, change it to check that the sqrt function is marked readnone. -Chris From sabre at nondot.org Thu Sep 24 01:12:27 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 01:12:27 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240612.n8O6CRTi006273@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.30 -> 1.31 --- Log message: last tweaks? --- Diffs of the changes: (+2 -2) index.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.30 llvm-www/devmtg/2009-10/index.php:1.31 --- llvm-www/devmtg/2009-10/index.php:1.30 Thu Sep 24 00:10:20 2009 +++ llvm-www/devmtg/2009-10/index.php Thu Sep 24 01:12:11 2009 @@ -123,7 +123,7 @@

2009 LLVM Developers' Meeting Agenda:

- + @@ -140,7 +140,7 @@ Nicolas Geoffray, Universite Pierre et Marie Curie -Everywhere: + - @@ -176,7 +176,7 @@ - + @@ -186,7 +186,7 @@ Evan Phoenix, Engine Yard / Rubinius - + From sabre at nondot.org Thu Sep 24 01:17:27 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 01:17:27 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240617.n8O6HRbC006986@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.32 -> 1.33 --- Log message: another tweak. --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.32 llvm-www/devmtg/2009-10/index.php:1.33 --- llvm-www/devmtg/2009-10/index.php:1.32 Thu Sep 24 01:15:48 2009 +++ llvm-www/devmtg/2009-10/index.php Thu Sep 24 01:17:10 2009 @@ -176,7 +176,7 @@ - + From daniel at zuster.org Thu Sep 24 01:23:57 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Thu, 24 Sep 2009 06:23:57 -0000 Subject: [llvm-commits] [llvm] r82685 - in /llvm/trunk: CMakeLists.txt test/Scripts/count test/Scripts/not utils/Makefile utils/count/ utils/count/CMakeLists.txt utils/count/Makefile utils/count/count.c utils/not/ utils/not/CMakeLists.txt utils/not/Makefile utils/not/not.cpp Message-ID: <200909240623.n8O6NwYm007815@zion.cs.uiuc.edu> Author: ddunbar Date: Thu Sep 24 01:23:57 2009 New Revision: 82685 URL: http://llvm.org/viewvc/llvm-project?rev=82685&view=rev Log: Add count/not tools as executables. - Apparently, I'm willing to do incredibly stupid things in the name of portability. Added: llvm/trunk/utils/count/ llvm/trunk/utils/count/CMakeLists.txt llvm/trunk/utils/count/Makefile llvm/trunk/utils/count/count.c llvm/trunk/utils/not/ llvm/trunk/utils/not/CMakeLists.txt llvm/trunk/utils/not/Makefile llvm/trunk/utils/not/not.cpp Removed: llvm/trunk/test/Scripts/count llvm/trunk/test/Scripts/not Modified: llvm/trunk/CMakeLists.txt llvm/trunk/utils/Makefile Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=82685&r1=82684&r2=82685&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Sep 24 01:23:57 2009 @@ -262,6 +262,8 @@ add_subdirectory(test) add_subdirectory(utils/FileCheck) +add_subdirectory(utils/count) +add_subdirectory(utils/not) set(LLVM_ENUM_ASM_PRINTERS "") set(LLVM_ENUM_ASM_PARSERS "") Removed: llvm/trunk/test/Scripts/count URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/count?rev=82684&view=auto ============================================================================== --- llvm/trunk/test/Scripts/count (original) +++ llvm/trunk/test/Scripts/count (removed) @@ -1,17 +0,0 @@ -#!/bin/sh -# -# Program: count -# -# Synopsis: Count the number of lines of input on stdin and test that it -# matches the specified number. -# -# Syntax: count - -set -e -set -u -input_lines=`wc -l` -if [ "$input_lines" -ne "$1" ]; then - echo "count: expected $1 lines and got ${input_lines}." - exit 1 -fi -exit 0 Removed: llvm/trunk/test/Scripts/not URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/not?rev=82684&view=auto ============================================================================== --- llvm/trunk/test/Scripts/not (original) +++ llvm/trunk/test/Scripts/not (removed) @@ -1,12 +0,0 @@ -#!/bin/sh -# -# Program: not -# -# Synopsis: Inverse the output of the program specified on the command line -# -# Syntax: not command - -if "$@" -then exit 1 -else exit 0 -fi Modified: llvm/trunk/utils/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/Makefile?rev=82685&r1=82684&r2=82685&view=diff ============================================================================== --- llvm/trunk/utils/Makefile (original) +++ llvm/trunk/utils/Makefile Thu Sep 24 01:23:57 2009 @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = .. -PARALLEL_DIRS := TableGen fpcmp PerfectShuffle FileCheck FileUpdate unittest +PARALLEL_DIRS := TableGen fpcmp PerfectShuffle FileCheck FileUpdate count not unittest EXTRA_DIST := cgiplotNLT.pl check-each-file codegen-diff countloc.sh cvsupdate \ DSAclean.py DSAextract.py emacs findsym.pl GenLibDeps.pl \ Added: llvm/trunk/utils/count/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/count/CMakeLists.txt?rev=82685&view=auto ============================================================================== --- llvm/trunk/utils/count/CMakeLists.txt (added) +++ llvm/trunk/utils/count/CMakeLists.txt Thu Sep 24 01:23:57 2009 @@ -0,0 +1,3 @@ +add_executable(count + count.c + ) Added: llvm/trunk/utils/count/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/count/Makefile?rev=82685&view=auto ============================================================================== --- llvm/trunk/utils/count/Makefile (added) +++ llvm/trunk/utils/count/Makefile Thu Sep 24 01:23:57 2009 @@ -0,0 +1,20 @@ +##===- utils/count/Makefile --------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../.. +TOOLNAME = count +USEDLIBS = + +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + +# Don't install this utility +NO_INSTALL = 1 + +include $(LEVEL)/Makefile.common Added: llvm/trunk/utils/count/count.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/count/count.c?rev=82685&view=auto ============================================================================== --- llvm/trunk/utils/count/count.c (added) +++ llvm/trunk/utils/count/count.c Thu Sep 24 01:23:57 2009 @@ -0,0 +1,48 @@ +/*===- count.c - The 'count' testing tool ---------------------------------===*\ + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * +\*===----------------------------------------------------------------------===*/ + +#include +#include + +int main(int argc, char **argv) { + unsigned Count, NumLines, NumRead; + char Buffer[4096], *End; + + if (argc != 2) { + fprintf(stderr, "usage: %s \n", argv[0]); + return 2; + } + + Count = strtol(argv[1], &End, 10); + if (*End != '\0' && End != argv[1]) { + fprintf(stderr, "%s: invalid count argument '%s'\n", argv[0], argv[1]); + return 2; + } + + NumLines = 0; + while ((NumRead = fread(Buffer, 1, sizeof(Buffer), stdin))) { + unsigned i; + + for (i = 0; i != NumRead; ++i) + if (Buffer[i] == '\n') + ++NumLines; + } + + if (!feof(stdin)) { + fprintf(stderr, "%s: error reading stdin\n", argv[0]); + return 3; + } + + if (Count != NumLines) { + fprintf(stderr, "Expected %d lines, got %d.\n", Count, NumLines); + return 1; + } + + return 0; +} Added: llvm/trunk/utils/not/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/not/CMakeLists.txt?rev=82685&view=auto ============================================================================== --- llvm/trunk/utils/not/CMakeLists.txt (added) +++ llvm/trunk/utils/not/CMakeLists.txt Thu Sep 24 01:23:57 2009 @@ -0,0 +1,11 @@ +add_executable(not + not.cpp + ) + +target_link_libraries(not LLVMSystem) +if( MINGW ) + target_link_libraries(not imagehlp psapi) +endif( MINGW ) +if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD ) + target_link_libraries(not pthread) +endif() Added: llvm/trunk/utils/not/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/not/Makefile?rev=82685&view=auto ============================================================================== --- llvm/trunk/utils/not/Makefile (added) +++ llvm/trunk/utils/not/Makefile Thu Sep 24 01:23:57 2009 @@ -0,0 +1,21 @@ +##===- utils/not/Makefile ----------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL = ../.. +TOOLNAME = not +USEDLIBS = LLVMSupport.a LLVMSystem.a + +# This tool has no plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + +# Don't install this utility +NO_INSTALL = 1 + +include $(LEVEL)/Makefile.common + Added: llvm/trunk/utils/not/not.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/not/not.cpp?rev=82685&view=auto ============================================================================== --- llvm/trunk/utils/not/not.cpp (added) +++ llvm/trunk/utils/not/not.cpp Thu Sep 24 01:23:57 2009 @@ -0,0 +1,17 @@ +//===- not.cpp - The 'not' testing tool -----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/System/Path.h" +#include "llvm/System/Program.h" +using namespace llvm; + +int main(int argc, const char **argv) { + sys::Path Program = sys::Program::FindProgramByName(argv[1]); + return !sys::Program::ExecuteAndWait(Program, argv + 1); +} From edwintorok at gmail.com Thu Sep 24 03:18:50 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 11:18:50 +0300 Subject: [llvm-commits] [PATCH] auto-upgrade malloc instructions to malloc calls In-Reply-To: References: Message-ID: <4ABB2B6A.9030000@gmail.com> On 2009-09-24 03:03, Victor Hernandez wrote: > This patch: > 1. Gets malloc instructions to be auto-upgraded to malloc calls in > LLParser and BitcodeReader. > 2. Updates Core and BrainF to no longer create malloc instructions. > 3. Updates testcases that made assumptions that were no longer true > without malloc instructions. > > > > After this patch, there are no MallocInsts created by LLVM, and > MallocInst can be torn out. > Hi, Is it still possible to create a function called 'malloc', that does something else than a libc malloc? For example in a freestanding environment, or when -fno-builtin is used. Best regards, --Edwin From edwintorok at gmail.com Thu Sep 24 03:22:54 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 11:22:54 +0300 Subject: [llvm-commits] [llvm] r82685 - in /llvm/trunk: CMakeLists.txt test/Scripts/count test/Scripts/not utils/Makefile utils/count/ utils/count/CMakeLists.txt utils/count/Makefile utils/count/count.c utils/not/ utils/not/CMakeLists.txt utils/not/Makefile utils/not/not.cpp In-Reply-To: <200909240623.n8O6NwYm007815@zion.cs.uiuc.edu> References: <200909240623.n8O6NwYm007815@zion.cs.uiuc.edu> Message-ID: <4ABB2C5E.3080102@gmail.com> On 2009-09-24 09:23, Daniel Dunbar wrote: > Author: ddunbar > Date: Thu Sep 24 01:23:57 2009 > New Revision: 82685 > > URL: http://llvm.org/viewvc/llvm-project?rev=82685&view=rev > Log: > Add count/not tools as executables. > - Apparently, I'm willing to do incredibly stupid things in the name of portability. > How many tests still use count/not? Can't they be converted to CHECK: ? Best regards, --Edwin From stoklund at 2pi.dk Thu Sep 24 04:41:10 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Thu, 24 Sep 2009 11:41:10 +0200 Subject: [llvm-commits] [llvm] r82629 - /llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp References: <200909231635.n8NGZP7g032607@zion.cs.uiuc.edu> <9C05B77E-5E8D-4E95-83DA-4675F6787F3E@apple.com> Message-ID: <87fxac8ytl.fsf@chora.dk> Evan Cheng writes: > On Sep 23, 2009, at 10:41 PM, David Goodwin wrote: > >> Because then the superreg is never killed... I think that will cause >> an assertion in the following code when the superreg is defined again. > > That means the superreg kill should be moved down to the last use of > any of subreg. This would be dangerous because sibling subregs may be used between the superreg kill and the last subreg use. LowerSubregs used to do it like this, and it caused some problems. Now it uses an IMPLICIT_DEF instruction to kill the superreg. This should be changed to a KILL instruction when that is introduced. Example: %AL = extract_subreg %AX, 1 %AH = mov bar %AH foo %AL %AX must be killed before %AH is defined, so it is necessary to insert a dummy instruction: KILL %AX, %AL %AH = mov bar %AH foo %AL This would be illegal: %AH = mov ; *** redefining %AH while %AX is live bar %AH foo %AL, %AX > My long term plan is: > 1. Introduce "kill" pseudo instruction that terminate liveness of > instructions. > 2. Move physical liveness computation out of livevariables and allow > codegen passes like postalloc sched to use it. Currently physical liveness is tracked in the machine verifier, in the register scavenger, and in the post-ra scheduler. They have subtle differences. It would definitely be a good idea to have the rules implemented only once. > Note double defs is not a miscomputation. It's just a performance > issue. That's why I've decided to disable the assertion for now. Right. From edwintorok at gmail.com Thu Sep 24 04:47:19 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Thu, 24 Sep 2009 09:47:19 -0000 Subject: [llvm-commits] [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Message-ID: <200909240947.n8O9lJGj014772@zion.cs.uiuc.edu> Author: edwin Date: Thu Sep 24 04:47:18 2009 New Revision: 82689 URL: http://llvm.org/viewvc/llvm-project?rev=82689&view=rev Log: Don't constant propagate byval pointers, since they are not really pointers, but rather structs passed by value. This fixes PR5038. Added: llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=82689&r1=82688&r2=82689&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Thu Sep 24 04:47:18 2009 @@ -130,7 +130,8 @@ Function::arg_iterator AI = F.arg_begin(); for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) { // Do we have a constant argument? - if (ArgumentConstants[i].second || AI->use_empty()) + if (ArgumentConstants[i].second || AI->use_empty() || + (AI->hasByValAttr() && isa(AI->getType()))) continue; Value *V = ArgumentConstants[i].first; Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=82689&r1=82688&r2=82689&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Thu Sep 24 04:47:18 2009 @@ -1267,6 +1267,10 @@ for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI, ++CAI) { LatticeVal &IV = ValueState[AI]; + if (AI->hasByValAttr() && isa(AI->getType())) { + IV.markOverdefined(); + continue; + } if (!IV.isOverdefined()) mergeInValue(IV, AI, getValueState(*CAI)); } Added: llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll?rev=82689&view=auto ============================================================================== --- llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll (added) +++ llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Thu Sep 24 04:47:18 2009 @@ -0,0 +1,24 @@ +; RUN: llvm-as <%s | opt -ipsccp | llvm-dis | FileCheck %s +; Don't constant-propagate byval pointers, since they are not pointers! +; PR5038 +%struct.MYstr = type { i8, i32 } + at mystr = internal global %struct.MYstr zeroinitializer ; <%struct.MYstr*> [#uses=3] +define internal void @vfu1(%struct.MYstr* byval align 4 %u) nounwind { +entry: + %0 = getelementptr %struct.MYstr* %u, i32 0, i32 1 ; [#uses=1] + store i32 99, i32* %0, align 4 +; CHECK: %struct.MYstr* %u + %1 = getelementptr %struct.MYstr* %u, i32 0, i32 0 ; [#uses=1] + store i8 97, i8* %1, align 4 +; CHECK: %struct.MYstr* %u + br label %return + +return: ; preds = %entry + ret void +} +define void @unions() nounwind { +entry: + call void @vfu1(%struct.MYstr* byval align 4 @mystr) nounwind + ret void +} + From edwintorok at gmail.com Thu Sep 24 05:07:17 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 13:07:17 +0300 Subject: [llvm-commits] [Fwd: [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll] Message-ID: <4ABB44D5.2050500@gmail.com> Hi Tanya, If there is still time, can you pull this into 2.6? It fixes a rather serious bug in ipsccp, see PR5038 (modifying a struct passed byval changed the original struct passed, because IPSCCP constant propagated the pointer). It may pessimize the code in some cases (struct passed byval, then read from it, the pointer is no longer const-propagated), but that is better than generating wrong code. P.S.: why are struct passed by value represented as a pointer with byval attribute, when it is not a pointer in the usual sense, rather a pointer to a temporary? Should we introduce a method (for 2.7) in CallSite that tells you wether you can constant-prop/make assumptions based on the parameter passed at the callsite (which would be false for byval). Best regards, --Edwin -------------- next part -------------- An embedded message was scrubbed... From: Torok Edwin Subject: [llvm-commits] [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Date: Thu, 24 Sep 2009 09:47:19 -0000 Size: 7371 Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090924/2b17362a/attachment.eml From sabre at nondot.org Thu Sep 24 10:28:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 08:28:42 -0700 Subject: [llvm-commits] [Fwd: [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll] In-Reply-To: <4ABB44D5.2050500@gmail.com> References: <4ABB44D5.2050500@gmail.com> Message-ID: <57D0EC55-F3B9-41A5-8B6C-D227273BC115@nondot.org> On Sep 24, 2009, at 3:07 AM, T?r?k Edwin wrote: > Hi Tanya, > > If there is still time, can you pull this into 2.6? > > It fixes a rather serious bug in ipsccp, see PR5038 (modifying a > struct > passed byval changed the original struct passed, because IPSCCP > constant > propagated the pointer). I agree that this would be nice to fix for 2.6, but it may be too late. It depends on the fate of PR5004, which is still pending. Tanya, what do you think? -Chris From baldrick at free.fr Thu Sep 24 10:38:18 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Sep 2009 17:38:18 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r82667 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200909232317.n8NNHCQE019391@zion.cs.uiuc.edu> References: <200909232317.n8NNHCQE019391@zion.cs.uiuc.edu> Message-ID: <4ABB926A.6000603@free.fr> Hi Eric, > Use the current InsertPt not the original instruction since we > may have incremented the insert point. got a testcase? Ciao, Duncan. From baldrick at free.fr Thu Sep 24 10:44:48 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Sep 2009 17:44:48 +0200 Subject: [llvm-commits] [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll In-Reply-To: <200909240947.n8O9lJGj014772@zion.cs.uiuc.edu> References: <200909240947.n8O9lJGj014772@zion.cs.uiuc.edu> Message-ID: <4ABB93F0.9070706@free.fr> Hi Edwin, > Don't constant propagate byval pointers, since they are not really pointers, but > rather structs passed by value. isn't this transform ok if the function is readonly? Ciao, Duncan. From dalej at apple.com Thu Sep 24 10:46:53 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 24 Sep 2009 08:46:53 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <2909ED8F-1969-44A3-8018-5F033AA59ACE@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> <2909ED8F-1969-44A3-8018-5F033AA59ACE@apple.com> Message-ID: <70AA2709-500B-4B52-A569-68D6E9ED56B9@apple.com> OK, I'll do all this. May I ask what good llvm.sqrt is when defined this way? It can't be used by any language that follows IEEE754. And gcc produces NaN for sqrt(-3) even with -ffast-math or -ffinite- math-only, so I don't think there is any flag setting where it would be appropriate to use llvm.sqrt. On Sep 23, 2009, at 11:04 PM, Chris Lattner wrote: > On Sep 23, 2009, at 6:10 PM, Evan Cheng wrote: > On Sep 23, 2009, at 3:21 PM, Dale Johannesen wrote: >>> On Sep 23, 2009, at 3:18 PMPDT, Evan Cheng wrote: >>> >>>> Are we generating a call to sqrt now? If so, that's bad. We should >>>> be using SSE sqrts* instructions. >>> >>> Agreed. My proposed semantic change would fix that. >> >> You mean change to llvm.sqrt and then llvm-gcc can switch bad to >> generating the intrinsic? It seems like the current fix is not what >> we >> want. Perhaps we should revert it first? >> >> According to Chris, the semantics of sqrt of negative value is >> defined >> and this is just some optimization bug. > > Sorry, I'm just catching up on this now. There are a couple of > things that confuse the issue, but I'll just try to keep it "to the > point" instead of rambling about history. > > 1. I did tell Evan that sqrt is defined on negative number, but I > misunderstood and didn't think about llvm.sqrt. Please disregard my > comment Evan. llvm.sqrt should be undefined on negative numbers as > langref says, and llvm-gcc/clang should only transform sqrt to > llvm.sqrt if the appropriate "I don't care about fp semantics" flag > is set. > > 2. Dale's patch to llvm-gcc is ok, but it would be better to still > do the transformation when -ffast-math is specified or whatever the > more precise "nan's aren't generated" flag is. We should do the > same thing for clang as well. > > 3. Please make sure that llvm-gcc/clang on the mac (and other > targets with -fno-math-errno) are producing a call to sqrt that is > marked as readnone. Given this, the mid-level optimizer should > hoist and cse the calls to sqrt just as well as it did calls to > llvm.sqrt. > > 4. The constant folding of llvm.sqrt(-123) -> 0 is ok because the > intrinsic really is undefined on negative. The constant folding of > sqrt(-123) doesn't fold if the input is negative, so it will just > not optimize the curious case. > > 5. Please make the X86 backend compile calls to readonly/readnone > "sqrt" produce a sqrtsd (etc) instruction. We really don't want to > get a function call on the mac (or other x86 target with -fno-math- > errno). Like malloc, if someone cares about -fno-builtin-sqrt, they > can solve the general problem. We already constant fold "real sqrt" > calls in Analysis/ConstantFolding.cpp anyway. > > 6. Please add handling of "real sqrt" to llvm::CannotBeNegativeZero > to match the handling of llvm.sqrt. > > Thanks! > > -Chris From baldrick at free.fr Thu Sep 24 10:59:23 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Sep 2009 15:59:23 -0000 Subject: [llvm-commits] [gcc-plugin] r82690 - /gcc-plugin/trunk/llvm-backend.cpp Message-ID: <200909241559.n8OFxNOn029050@zion.cs.uiuc.edu> Author: baldrick Date: Thu Sep 24 10:59:22 2009 New Revision: 82690 URL: http://llvm.org/viewvc/llvm-project?rev=82690&view=rev Log: The last ipa pass now seems to be ipa_struct_reorg. Output global variables after this. Modified: gcc-plugin/trunk/llvm-backend.cpp Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=82690&r1=82689&r2=82690&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Thu Sep 24 10:59:22 2009 @@ -2174,7 +2174,7 @@ // Add an ipa pass that emits global variables, calling emit_global_to_llvm // for each GCC static variable. pass_info.pass = &pass_emit_variables.pass; - pass_info.reference_pass_name = "matrix-reorg"; + pass_info.reference_pass_name = "ipa_struct_reorg"; pass_info.ref_pass_instance_number = 0; pass_info.pos_op = PASS_POS_INSERT_AFTER; register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info); From baldrick at free.fr Thu Sep 24 11:16:27 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 24 Sep 2009 16:16:27 -0000 Subject: [llvm-commits] [gcc-plugin] r82691 - in /gcc-plugin/trunk: llvm-backend.cpp llvm-convert.cpp llvm-internal.h Message-ID: <200909241616.n8OGGRM4031182@zion.cs.uiuc.edu> Author: baldrick Date: Thu Sep 24 11:16:26 2009 New Revision: 82691 URL: http://llvm.org/viewvc/llvm-project?rev=82691&view=rev Log: It seems safer to have the SSANames map take trees to AssertingVH's rather than Value*'s. It's still not completely clear to me whether a value defining an SSAName can be deleted out from under us, so best to check. Modified: gcc-plugin/trunk/llvm-backend.cpp gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-internal.h Modified: gcc-plugin/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=82691&r1=82690&r2=82691&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-backend.cpp (original) +++ gcc-plugin/trunk/llvm-backend.cpp Thu Sep 24 11:16:26 2009 @@ -1788,8 +1788,11 @@ calculate_dominance_info(CDI_DOMINATORS); // Convert the AST to raw/ugly LLVM code. - TreeToLLVM Emitter(current_function_decl); - Function *Fn = Emitter.EmitFunction(); + Function *Fn; + { + TreeToLLVM Emitter(current_function_decl); + Fn = Emitter.EmitFunction(); + } // Free dominator and other ssa data structures. execute_free_datastructures(); Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82691&r1=82690&r2=82691&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Thu Sep 24 11:16:26 2009 @@ -38,6 +38,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" @@ -2106,7 +2107,7 @@ /// EmitSSA_NAME - Return the defining value of the given SSA_NAME. Value *TreeToLLVM::EmitSSA_NAME(tree exp) { - DenseMap::iterator I = SSANames.find(exp); + DenseMap >::iterator I = SSANames.find(exp); if (I != SSANames.end()) return I->second; Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=82691&r1=82690&r2=82691&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Thu Sep 24 11:16:26 2009 @@ -63,6 +63,7 @@ class TargetMachine; class TargetData; class DebugInfo; + template class AssertingVH; } using namespace llvm; @@ -350,7 +351,7 @@ SmallVector PendingPhis; // SSANames - Map from GCC ssa names to the defining LLVM value. - DenseMap SSANames; + DenseMap > SSANames; //===---------------------- Exception Handling --------------------------===// From dpatel at apple.com Thu Sep 24 11:19:12 2009 From: dpatel at apple.com (Devang Patel) Date: Thu, 24 Sep 2009 16:19:12 -0000 Subject: [llvm-commits] [llvm] r82692 - /llvm/trunk/lib/VMCore/Instruction.cpp Message-ID: <200909241619.n8OGJCbS031532@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 24 11:19:11 2009 New Revision: 82692 URL: http://llvm.org/viewvc/llvm-project?rev=82692&view=rev Log: Move parent assertion check before metadata deletion. Modified: llvm/trunk/lib/VMCore/Instruction.cpp Modified: llvm/trunk/lib/VMCore/Instruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=82692&r1=82691&r2=82692&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instruction.cpp (original) +++ llvm/trunk/lib/VMCore/Instruction.cpp Thu Sep 24 11:19:11 2009 @@ -50,11 +50,11 @@ // Out of line virtual method, so the vtable, etc has a home. Instruction::~Instruction() { + assert(Parent == 0 && "Instruction still linked in the program!"); if (hasMetadata()) { LLVMContext &Context = getContext(); Context.pImpl->TheMetadata.ValueIsDeleted(this); } - assert(Parent == 0 && "Instruction still linked in the program!"); } From echristo at apple.com Thu Sep 24 11:27:59 2009 From: echristo at apple.com (Eric Christopher) Date: Thu, 24 Sep 2009 09:27:59 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82667 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <4ABB926A.6000603@free.fr> References: <200909232317.n8NNHCQE019391@zion.cs.uiuc.edu> <4ABB926A.6000603@free.fr> Message-ID: On Sep 24, 2009, at 8:38 AM, Duncan Sands wrote: > Hi Eric, > >> Use the current InsertPt not the original instruction since we >> may have incremented the insert point. > > got a testcase? Nothing shortened, but it was an invoke at the end of an alloca block. We'd increment InsertPt early in the routine and then go back and use I. -eric From bob.wilson at apple.com Thu Sep 24 11:42:28 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 24 Sep 2009 16:42:28 -0000 Subject: [llvm-commits] [llvm] r82693 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200909241642.n8OGgSKo002136@zion.cs.uiuc.edu> Author: bwilson Date: Thu Sep 24 11:42:27 2009 New Revision: 82693 URL: http://llvm.org/viewvc/llvm-project?rev=82693&view=rev Log: Fix a hypothetical problem for targets with StackGrowsUp and a non-zero LocalAreaOffset. (We don't have any of those right now.) PEI::calculateFrameObjectOffsets includes the absolute value of the LocalAreaOffset in the cumulative offset value used to calculate the stack frame size. It then adds the raw value of the LocalAreaOffset to the stack size. For a StackGrowsDown target, that raw value is negative and has the effect of cancelling out the absolute value that was added earlier, but that obviously won't work for a StackGrowsUp target. Change to subtract the absolute value of the LocalAreaOffset. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=82693&r1=82692&r2=82693&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Thu Sep 24 11:42:27 2009 @@ -471,11 +471,12 @@ // Start at the beginning of the local area. // The Offset is the distance from the stack top in the direction // of stack growth -- so it's always nonnegative. - int64_t Offset = TFI.getOffsetOfLocalArea(); + int LocalAreaOffset = TFI.getOffsetOfLocalArea(); if (StackGrowsDown) - Offset = -Offset; - assert(Offset >= 0 + LocalAreaOffset = -LocalAreaOffset; + assert(LocalAreaOffset >= 0 && "Local area offset should be in direction of stack growth"); + int64_t Offset = LocalAreaOffset; // If there are fixed sized objects that are preallocated in the local area, // non-fixed objects can't be allocated right at the start of local area. @@ -588,7 +589,7 @@ } // Update frame info to pretend that this is part of the stack... - FFI->setStackSize(Offset+TFI.getOffsetOfLocalArea()); + FFI->setStackSize(Offset - LocalAreaOffset); // Remember the required stack alignment in case targets need it to perform // dynamic stack alignment. From devang.patel at gmail.com Thu Sep 24 11:50:41 2009 From: devang.patel at gmail.com (Devang Patel) Date: Thu, 24 Sep 2009 09:50:41 -0700 Subject: [llvm-commits] [PATCH] auto-upgrade malloc instructions to malloc calls In-Reply-To: References: Message-ID: <352a1fb20909240950v15eb064asd127b4304e345d90@mail.gmail.com> Victor, On Wed, Sep 23, 2009 at 5:03 PM, Victor Hernandez wrote: > This patch: > 1. Gets malloc instructions to be auto-upgraded to malloc calls in LLParser > and BitcodeReader. > 2. Updates Core and BrainF to no longer create malloc instructions. > 3. Updates testcases that made assumptions that were no longer true without > malloc instructions. > > > > > After this patch, there are no MallocInsts created by LLVM, and MallocInst > can be torn out. > + /// setCalledFunction - Set the function called + void setCalledFunction(Value* func) { how about "Func" or "Fn" instead of "func" ? +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin8" No need to add target info in test cases. - Devang From vhernandez at apple.com Thu Sep 24 12:47:51 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Thu, 24 Sep 2009 17:47:51 -0000 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ Message-ID: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> Author: hernande Date: Thu Sep 24 12:47:49 2009 New Revision: 82694 URL: http://llvm.org/viewvc/llvm-project?rev=82694&view=rev Log: Auto-upgrade malloc instructions to malloc calls. Reviewed by Devang Patel. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/test/Analysis/PointerTracking/sizes.ll llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll llvm/trunk/test/Transforms/InstCombine/cast.ll llvm/trunk/test/Transforms/InstCombine/getelementptr.ll llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll llvm/trunk/test/Transforms/InstCombine/malloc2.ll Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Thu Sep 24 12:47:49 2009 @@ -25,6 +25,7 @@ #include "BrainF.h" #include "llvm/Constants.h" +#include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/ADT/STLExtras.h" #include @@ -78,7 +79,11 @@ //%arr = malloc i8, i32 %d ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), val_mem, "arr"); + BasicBlock* BB = builder->GetInsertBlock(); + const Type* IntPtrTy = IntegerType::getInt32Ty(C); + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, IntegerType::getInt8Ty(C), + val_mem, NULL, "arr"); + BB->getInstList().push_back(cast(ptr_arr)); //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) { Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Thu Sep 24 12:47:49 2009 @@ -1044,7 +1044,7 @@ const Twine &Name = ""); static Value *CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, Value *ArraySize = 0, - const Twine &Name = ""); + Function* MallocF = 0, const Twine &Name = ""); ~CallInst(); @@ -1149,6 +1149,11 @@ const Value *getCalledValue() const { return Op<0>(); } Value *getCalledValue() { return Op<0>(); } + /// setCalledFunction - Set the function called + void setCalledFunction(Value* Fn) { + Op<0>() = Fn; + } + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const CallInst *) { return true; } static inline bool classof(const Instruction *I) { Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Thu Sep 24 12:47:49 2009 @@ -602,6 +602,9 @@ // Scan CurPtr ahead, seeing if there is just whitespace before the newline. if (JustWhitespaceNewLine(CurPtr)) return lltok::kw_zeroext; + } else if (Len == 6 && !memcmp(StartChar, "malloc", 6)) { + // Autoupgrade malloc instruction + return lltok::kw_malloc; } // Keywords for instructions. @@ -641,7 +644,6 @@ INSTKEYWORD(unwind, Unwind); INSTKEYWORD(unreachable, Unreachable); - INSTKEYWORD(malloc, Malloc); INSTKEYWORD(alloca, Alloca); INSTKEYWORD(free, Free); INSTKEYWORD(load, Load); Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Sep 24 12:47:49 2009 @@ -69,6 +69,27 @@ /// ValidateEndOfModule - Do final validity and sanity checks at the end of the /// module. bool LLParser::ValidateEndOfModule() { + // Update auto-upgraded malloc calls from "autoupgrade_malloc" to "malloc". + if (MallocF) { + MallocF->setName("malloc"); + // If setName() does not set the name to "malloc", then there is already a + // declaration of "malloc". In that case, iterate over all calls to MallocF + // and get them to call the declared "malloc" instead. + if (MallocF->getName() != "malloc") { + Function* realMallocF = M->getFunction("malloc"); + for (User::use_iterator UI = MallocF->use_begin(), UE= MallocF->use_end(); + UI != UE; ) { + User* user = *UI; + UI++; + if (CallInst *Call = dyn_cast(user)) + Call->setCalledFunction(realMallocF); + } + if (!realMallocF->doesNotAlias(0)) realMallocF->setDoesNotAlias(0); + MallocF->eraseFromParent(); + MallocF = NULL; + } + } + if (!ForwardRefTypes.empty()) return Error(ForwardRefTypes.begin()->second.second, "use of undefined type named '" + @@ -2776,8 +2797,8 @@ case lltok::kw_call: return ParseCall(Inst, PFS, false); case lltok::kw_tail: return ParseCall(Inst, PFS, true); // Memory. - case lltok::kw_alloca: - case lltok::kw_malloc: return ParseAlloc(Inst, PFS, KeywordVal); + case lltok::kw_alloca: return ParseAlloc(Inst, PFS); + case lltok::kw_malloc: return ParseAlloc(Inst, PFS, BB, false); case lltok::kw_free: return ParseFree(Inst, PFS); case lltok::kw_load: return ParseLoad(Inst, PFS, false); case lltok::kw_store: return ParseStore(Inst, PFS, false); @@ -3286,7 +3307,7 @@ } /// ParsePHI -/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' Value?? ']')* +/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' Value????? ']')* bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) { PATypeHolder Ty(Type::getVoidTy(Context)); Value *Op0, *Op1; @@ -3431,7 +3452,7 @@ /// ::= 'malloc' Type (',' TypeAndValue)? (',' OptionalInfo)? /// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalInfo)? bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, - unsigned Opc) { + BasicBlock* BB, bool isAlloca) { PATypeHolder Ty(Type::getVoidTy(Context)); Value *Size = 0; LocTy SizeLoc; @@ -3451,10 +3472,21 @@ if (Size && Size->getType() != Type::getInt32Ty(Context)) return Error(SizeLoc, "element count must be i32"); - if (Opc == Instruction::Malloc) - Inst = new MallocInst(Ty, Size, Alignment); - else + if (isAlloca) Inst = new AllocaInst(Ty, Size, Alignment); + else { + // Autoupgrade old malloc instruction to malloc call. + const Type* IntPtrTy = Type::getInt32Ty(Context); + const Type* Int8PtrTy = PointerType::getUnqual(Type::getInt8Ty(Context)); + if (!MallocF) + // Prototype malloc as "void *autoupgrade_malloc(int32)". + MallocF = cast(M->getOrInsertFunction("autoupgrade_malloc", + Int8PtrTy, IntPtrTy, NULL)); + // "autoupgrade_malloc" updated to "malloc" in ValidateEndOfModule(). + + Inst = cast(CallInst::CreateMalloc(BB, IntPtrTy, Ty, + Size, MallocF)); + } return false; } Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Sep 24 12:47:49 2009 @@ -75,9 +75,11 @@ std::map > ForwardRefVals; std::map > ForwardRefValIDs; std::vector NumberedVals; + Function* MallocF; public: LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) : - Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M(m) {} + Context(m->getContext()), Lex(F, SM, Err, m->getContext()), + M(m), MallocF(NULL) {} bool Run(); LLVMContext& getContext() { return Context; } @@ -276,7 +278,8 @@ bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS); bool ParsePHI(Instruction *&I, PerFunctionState &PFS); bool ParseCall(Instruction *&I, PerFunctionState &PFS, bool isTail); - bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, unsigned Opc); + bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, + BasicBlock *BB = 0, bool isAlloca = true); bool ParseFree(Instruction *&I, PerFunctionState &PFS); bool ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile); bool ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile); Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Sep 24 12:47:49 2009 @@ -2046,14 +2046,21 @@ } case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align] + // Autoupgrade malloc instruction to malloc call. if (Record.size() < 3) return Error("Invalid MALLOC record"); const PointerType *Ty = dyn_cast_or_null(getTypeByID(Record[0])); Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context)); - unsigned Align = Record[2]; if (!Ty || !Size) return Error("Invalid MALLOC record"); - I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> 1); + if (!CurBB) return Error("Invalid malloc instruction with no BB"); + const Type* Int32Ty = IntegerType::getInt32Ty(CurBB->getContext()); + if (Size->getType() != Int32Ty) + Size = CastInst::CreateIntegerCast(Size, Int32Ty, false /*ZExt*/, + "", CurBB); + Value* Malloc = CallInst::CreateMalloc(CurBB, Int32Ty, + Ty->getElementType(), Size, NULL); + I = cast(Malloc); InstructionList.push_back(I); break; } Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Thu Sep 24 12:47:49 2009 @@ -1636,12 +1636,16 @@ LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name) { - return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), 0, Name)); + const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); + return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), IntPtrT, + unwrap(Ty), 0, 0, Twine(Name))); } LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name) { - return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), unwrap(Val), Name)); + const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); + return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), IntPtrT, + unwrap(Ty), unwrap(Val), 0, Twine(Name))); } LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Sep 24 12:47:49 2009 @@ -462,7 +462,8 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, - Value *ArraySize, const Twine &NameStr) { + Value *ArraySize, Function* MallocF, + const Twine &NameStr) { assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) && "createMalloc needs either InsertBefore or InsertAtEnd"); @@ -499,10 +500,11 @@ BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd; Module* M = BB->getParent()->getParent(); const Type *BPTy = PointerType::getUnqual(Type::getInt8Ty(BB->getContext())); - // prototype malloc as "void *malloc(size_t)" - Constant *MallocF = M->getOrInsertFunction("malloc", BPTy, IntPtrTy, NULL); - if (!cast(MallocF)->doesNotAlias(0)) - cast(MallocF)->setDoesNotAlias(0); + if (!MallocF) + // prototype malloc as "void *malloc(size_t)" + MallocF = cast(M->getOrInsertFunction("malloc", BPTy, + IntPtrTy, NULL)); + if (!MallocF->doesNotAlias(0)) MallocF->setDoesNotAlias(0); const PointerType *AllocPtrType = PointerType::getUnqual(AllocTy); CallInst *MCall = NULL; Value *MCast = NULL; @@ -531,7 +533,8 @@ Value *CallInst::CreateMalloc(Instruction *InsertBefore, const Type *IntPtrTy, const Type *AllocTy, Value *ArraySize, const Twine &Name) { - return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, ArraySize, Name); + return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, + ArraySize, NULL, Name); } /// CreateMalloc - Generate the IR for a call to malloc: @@ -544,8 +547,9 @@ /// responsibility of the caller. Value *CallInst::CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, Value *ArraySize, - const Twine &Name) { - return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, ArraySize, Name); + Function* MallocF, const Twine &Name) { + return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, + ArraySize, MallocF, Name); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/test/Analysis/PointerTracking/sizes.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/PointerTracking/sizes.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Analysis/PointerTracking/sizes.ll (original) +++ llvm/trunk/test/Analysis/PointerTracking/sizes.ll Thu Sep 24 12:47:49 2009 @@ -63,7 +63,7 @@ define i32 @foo2(i32 %n) nounwind { entry: %call = malloc i8, i32 %n ; [#uses=1] -; CHECK: %call = +; CHECK: %malloccall = ; CHECK: ==> %n elements, %n bytes allocated %call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; [#uses=1] ; CHECK: %call2 = Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll (original) +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll Thu Sep 24 12:47:49 2009 @@ -1,4 +1,6 @@ -; RUN: opt < %s -globalopt -S | not grep malloc +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin8" @G = internal global i32* null ; [#uses=3] Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll (original) +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll Thu Sep 24 12:47:49 2009 @@ -1,4 +1,6 @@ -; RUN: opt < %s -globalopt -S | not grep malloc +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin8" @G = internal global i32* null ; [#uses=4] Modified: llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll Thu Sep 24 12:47:49 2009 @@ -1,6 +1,6 @@ ; test that casted mallocs get converted to malloc of the right type ; RUN: opt < %s -instcombine -S | \ -; RUN: not grep bitcast +; RUN: grep bitcast | count 1 ; The target datalayout is important for this test case. We have to tell ; instcombine that the ABI alignment for a long is 4-bytes, not 8, otherwise Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/cast.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/cast.ll Thu Sep 24 12:47:49 2009 @@ -79,9 +79,9 @@ } define i32* @test12() { - %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] - %c = bitcast [4 x i8]* %p to i32* ; [#uses=1] - ret i32* %c + %c = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] + %p = bitcast [4 x i8]* %c to i32* ; [#uses=1] + ret i32* %p } define i8* @test13(i64 %A) { %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; [#uses=1] Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/getelementptr.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/getelementptr.ll Thu Sep 24 12:47:49 2009 @@ -58,7 +58,7 @@ %B = getelementptr i32* %A, i64 2 ret i32* %B ; CHECK: @test6 -; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 +; CHECK: getelementptr i8* %malloccall, i64 8 } define i32* @test7(i32* %I, i64 %C, i64 %D) { Modified: llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Thu Sep 24 12:47:49 2009 @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 0} -; RUN: opt < %s -instcombine -S | not grep malloc +; RUN: opt < %s -instcombine -globaldce -S | not grep malloc ; PR1201 define i32 @main(i32 %argc, i8** %argv) { %c_19 = alloca i8* ; [#uses=2] Modified: llvm/trunk/test/Transforms/InstCombine/malloc2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc2.ll?rev=82694&r1=82693&r2=82694&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/malloc2.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/malloc2.ll Thu Sep 24 12:47:49 2009 @@ -1,5 +1,4 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 0} -; RUN: opt < %s -instcombine -S | not grep malloc ; PR1313 define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { From echristo at apple.com Thu Sep 24 12:51:17 2009 From: echristo at apple.com (Eric Christopher) Date: Thu, 24 Sep 2009 10:51:17 -0700 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ In-Reply-To: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> References: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> Message-ID: On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote: > ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); > - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), > val_mem, "arr"); > + BasicBlock* BB = builder->GetInsertBlock(); > + const Type* IntPtrTy = IntegerType::getInt32Ty(C); > + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, > IntegerType::getInt8Ty(C), > + val_mem, NULL, "arr"); > + BB->getInstList().push_back(cast(ptr_arr)); Not sure if this has been covered, but why not update CreateMalloc in the builder interface? This is a bit more unwieldy and moves people away from using the builder in as many cases as possible. -eric From mrs at apple.com Thu Sep 24 12:52:19 2009 From: mrs at apple.com (Mike Stump) Date: Thu, 24 Sep 2009 10:52:19 -0700 Subject: [llvm-commits] [llvm] r82591 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: <352a1fb20909231740s1fecd6ev3c0dd236824f8f37@mail.gmail.com> References: <200909230013.n8N0DVHX024647@zion.cs.uiuc.edu> <352a1fb20909231740s1fecd6ev3c0dd236824f8f37@mail.gmail.com> Message-ID: On Sep 23, 2009, at 5:40 PM, Devang Patel wrote: > On Tue, Sep 22, 2009 at 5:13 PM, Mike Stump wrote: >> >> - assert(typeName.find ("__Block_byref_") == 0 >> - && "Attempting to get Block location of non-Block >> variable!"); > > Why ? Pl. explain. The name is but an implementation detail of a compiler. It is wrong for that detail to slosh between a specific compiler (llvm-gcc) and llvm. clang is implemented differently and needs to reuse this code for __block debug information as llvm doesn't yet expose a decent way to do this. From edwintorok at gmail.com Thu Sep 24 12:56:00 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 20:56:00 +0300 Subject: [llvm-commits] [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll In-Reply-To: <4ABB93F0.9070706@free.fr> References: <200909240947.n8O9lJGj014772@zion.cs.uiuc.edu> <4ABB93F0.9070706@free.fr> Message-ID: <4ABBB2B0.6080608@gmail.com> On 2009-09-24 18:44, Duncan Sands wrote: > Hi Edwin, > >> Don't constant propagate byval pointers, since they are not really >> pointers, but >> rather structs passed by value. > > isn't this transform ok if the function is readonly? > It is, I'll fix. Best regards, --Edwin From isanbard at gmail.com Thu Sep 24 13:12:05 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 18:12:05 -0000 Subject: [llvm-commits] [llvm] r82696 - /llvm/tags/Apple/llvmCore-2207.5/ Message-ID: <200909241812.n8OIC572013512@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 13:12:04 2009 New Revision: 82696 URL: http://llvm.org/viewvc/llvm-project?rev=82696&view=rev Log: Deleting llvmCore-2207.5 for retagging. Removed: llvm/tags/Apple/llvmCore-2207.5/ From isanbard at gmail.com Thu Sep 24 13:12:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 18:12:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82697 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.5/ Message-ID: <200909241812.n8OIC8cC013527@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 13:12:08 2009 New Revision: 82697 URL: http://llvm.org/viewvc/llvm-project?rev=82697&view=rev Log: Deleting llvmgcc42-2207.5 for retagging. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.5/ From isanbard at gmail.com Thu Sep 24 13:12:16 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 18:12:16 -0000 Subject: [llvm-commits] [llvm] r82698 - /llvm/tags/Apple/llvmCore-2207.5/ Message-ID: <200909241812.n8OICGLY013556@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 13:12:16 2009 New Revision: 82698 URL: http://llvm.org/viewvc/llvm-project?rev=82698&view=rev Log: Creating llvmCore-2207.5 from Bender-SWB. Added: llvm/tags/Apple/llvmCore-2207.5/ - copied from r82697, llvm/branches/Apple/Bender-SWB/ From isanbard at gmail.com Thu Sep 24 13:12:24 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 18:12:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82699 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.5/ Message-ID: <200909241812.n8OICPVc013581@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 13:12:24 2009 New Revision: 82699 URL: http://llvm.org/viewvc/llvm-project?rev=82699&view=rev Log: Creating llvmgcc42-2207.5 from Bender-SWB. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2207.5/ - copied from r82698, llvm-gcc-4.2/branches/Apple/Bender-SWB/ From edwintorok at gmail.com Thu Sep 24 13:33:43 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Thu, 24 Sep 2009 18:33:43 -0000 Subject: [llvm-commits] [llvm] r82700 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Message-ID: <200909241833.n8OIXh7f016480@zion.cs.uiuc.edu> Author: edwin Date: Thu Sep 24 13:33:42 2009 New Revision: 82700 URL: http://llvm.org/viewvc/llvm-project?rev=82700&view=rev Log: Constant propagating byval pointer is safe if function is readonly. Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp llvm/trunk/lib/Transforms/Scalar/SCCP.cpp llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Modified: llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp?rev=82700&r1=82699&r2=82700&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/IPConstantPropagation.cpp Thu Sep 24 13:33:42 2009 @@ -130,8 +130,8 @@ Function::arg_iterator AI = F.arg_begin(); for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) { // Do we have a constant argument? - if (ArgumentConstants[i].second || AI->use_empty() || - (AI->hasByValAttr() && isa(AI->getType()))) + if (ArgumentConstants[i].second || AI->use_empty() || + (AI->hasByValAttr() && !F.onlyReadsMemory())) continue; Value *V = ArgumentConstants[i].first; Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=82700&r1=82699&r2=82700&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Thu Sep 24 13:33:42 2009 @@ -1267,7 +1267,7 @@ for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI, ++CAI) { LatticeVal &IV = ValueState[AI]; - if (AI->hasByValAttr() && isa(AI->getType())) { + if (AI->hasByValAttr() && !F->onlyReadsMemory()) { IV.markOverdefined(); continue; } Modified: llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll?rev=82700&r1=82699&r2=82700&view=diff ============================================================================== --- llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll (original) +++ llvm/trunk/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll Thu Sep 24 13:33:42 2009 @@ -16,9 +16,25 @@ return: ; preds = %entry ret void } -define void @unions() nounwind { + +define internal i32 @vfu2(%struct.MYstr* byval align 4 %u) nounwind readonly { +entry: + %0 = getelementptr %struct.MYstr* %u, i32 0, i32 1 ; [#uses=1] + %1 = load i32* %0 +; CHECK: load i32* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 1) ; [#uses=1] + %2 = getelementptr %struct.MYstr* %u, i32 0, i32 0 ; [#uses=1] + %3 = load i8* %2 +; CHECK: load i8* getelementptr inbounds (%struct.MYstr* @mystr, i32 0, i32 0) ; [#uses=1] + %4 = zext i8 %3 to i32 + %5 = add i32 %4, %1 + ret i32 %5 +} + +define i32 @unions() nounwind { entry: call void @vfu1(%struct.MYstr* byval align 4 @mystr) nounwind - ret void + %result = call i32 @vfu2(%struct.MYstr* byval align 4 @mystr) nounwind + + ret i32 %result } From edwintorok at gmail.com Thu Sep 24 13:34:05 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 21:34:05 +0300 Subject: [llvm-commits] [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll In-Reply-To: <4ABB93F0.9070706@free.fr> References: <200909240947.n8O9lJGj014772@zion.cs.uiuc.edu> <4ABB93F0.9070706@free.fr> Message-ID: <4ABBBB9D.3050303@gmail.com> On 2009-09-24 18:44, Duncan Sands wrote: > Hi Edwin, > >> Don't constant propagate byval pointers, since they are not really >> pointers, but >> rather structs passed by value. > > isn't this transform ok if the function is readonly? Fixed in r82700. Thanks, --Edwin From dalej at apple.com Thu Sep 24 13:38:21 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 24 Sep 2009 18:38:21 -0000 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html Message-ID: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> Author: johannes Date: Thu Sep 24 13:38:21 2009 New Revision: 82701 URL: http://llvm.org/viewvc/llvm-project?rev=82701&view=rev Log: Clarify that llvm attaches C language semantics to functions with names that match the C library. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=82701&r1=82700&r2=82701&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Thu Sep 24 13:38:21 2009 @@ -5045,6 +5045,13 @@ %ZZ = call zeroext i32 @bar() ; Return value is %zero extended +

llvm treats calls to some functions with names and arguments that match the +standard C library as being the C library functions, and may perform +optimizations or generate code for them under that assumption. These +functions currently include: +acos, asin, atan, atan2, ceil, cos, cosf, cosh, exp, fabs, floor, fmod, log, +log10, malloc, pow, sin, sinh, sqrt, sqrtf, sin, sinf, tan, tanh.

+ From edwintorok at gmail.com Thu Sep 24 13:47:00 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 21:47:00 +0300 Subject: [llvm-commits] [Fwd: [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll] In-Reply-To: <57D0EC55-F3B9-41A5-8B6C-D227273BC115@nondot.org> References: <4ABB44D5.2050500@gmail.com> <57D0EC55-F3B9-41A5-8B6C-D227273BC115@nondot.org> Message-ID: <4ABBBEA4.4070604@gmail.com> On 2009-09-24 18:28, Chris Lattner wrote: > > On Sep 24, 2009, at 3:07 AM, T?r?k Edwin wrote: > >> Hi Tanya, >> >> If there is still time, can you pull this into 2.6? >> >> It fixes a rather serious bug in ipsccp, see PR5038 (modifying a struct >> passed byval changed the original struct passed, because IPSCCP constant >> propagated the pointer). > > I agree that this would be nice to fix for 2.6, but it may be too > late. It depends on the fate of PR5004, which is still pending. Ok, if you do pull this patch into 2.6 please pull 82700 too (it fixes the code pessimization I mentioned, and its just a few lines again). > Tanya, what do you think? > > -Chris From clattner at apple.com Thu Sep 24 13:47:09 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Sep 2009 11:47:09 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <70AA2709-500B-4B52-A569-68D6E9ED56B9@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> <2909ED8F-1969-44A3-8018-5F033AA59ACE@apple.com> <70AA2709-500B-4B52-A569-68D6E9ED56B9@apple.com> Message-ID: On Sep 24, 2009, at 8:46 AM, Dale Johannesen wrote: > OK, I'll do all this. Thanks Dale! > May I ask what good llvm.sqrt is when defined this way? It can't be > used by any language that follows IEEE754. > And gcc produces NaN for sqrt(-3) even with -ffast-math or -ffinite- > math-only, so I don't think there is any flag setting where it would > be appropriate to use llvm.sqrt. I don't know, maybe nothing. The fact that GCC folds -3 -> NaN isn't required with -ffinite-math-only though, it may do less obvious optimizations assuming that sqrt doesn't produce a nan for example. The two reasons we have llvm.sqrt are that 1) it allows vectors, and 2) it's undefined on invalid input. I don't have a good reason to care about llvm.sqrt personally. -Chris From tonic at nondot.org Thu Sep 24 13:59:03 2009 From: tonic at nondot.org (Tanya M. Lattner) Date: Thu, 24 Sep 2009 11:59:03 -0700 (PDT) Subject: [llvm-commits] [Fwd: [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll] In-Reply-To: <4ABBBEA4.4070604@gmail.com> References: <4ABB44D5.2050500@gmail.com> <57D0EC55-F3B9-41A5-8B6C-D227273BC115@nondot.org> <4ABBBEA4.4070604@gmail.com> Message-ID: >> I agree that this would be nice to fix for 2.6, but it may be too >> late. It depends on the fate of PR5004, which is still pending. > > Ok, if you do pull this patch into 2.6 please pull 82700 too (it fixes > the code pessimization I mentioned, and its just a few lines again). I'll do this tonight when I get home from work. However, I'd like to say that normally its way too late for these sorts of patches to be merged in and it introduces risk that I personally think we should avoid at this stage in the release process. Normally, the answer would be no. If it introduces any sort of problem, it will be reverted and not fixed. -Tanya > >> Tanya, what do you think? >> >> -Chris > From edwintorok at gmail.com Thu Sep 24 14:00:59 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 22:00:59 +0300 Subject: [llvm-commits] [Fwd: [llvm] r82689 - in /llvm/trunk: lib/Transforms/IPO/IPConstantPropagation.cpp lib/Transforms/Scalar/SCCP.cpp test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll] In-Reply-To: References: <4ABB44D5.2050500@gmail.com> <57D0EC55-F3B9-41A5-8B6C-D227273BC115@nondot.org> <4ABBBEA4.4070604@gmail.com> Message-ID: <4ABBC1EB.5000205@gmail.com> On 2009-09-24 21:59, Tanya M. Lattner wrote: > >>> I agree that this would be nice to fix for 2.6, but it may be too >>> late. It depends on the fate of PR5004, which is still pending. >> >> Ok, if you do pull this patch into 2.6 please pull 82700 too (it fixes >> the code pessimization I mentioned, and its just a few lines again). > > I'll do this tonight when I get home from work. > > However, I'd like to say that normally its way too late for these > sorts of patches to be merged in and it introduces risk that I > personally think we should avoid at this stage in the release process. > Normally, the answer would be no. If it introduces any sort of > problem, it will be reverted and not fixed. > Sounds good. Thanks, --Edwin From devang.patel at gmail.com Thu Sep 24 14:44:46 2009 From: devang.patel at gmail.com (Devang Patel) Date: Thu, 24 Sep 2009 12:44:46 -0700 Subject: [llvm-commits] [llvm] r82591 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp In-Reply-To: References: <200909230013.n8N0DVHX024647@zion.cs.uiuc.edu> <352a1fb20909231740s1fecd6ev3c0dd236824f8f37@mail.gmail.com> Message-ID: <352a1fb20909241244k60fa02b6x94af0e590ebc3f32@mail.gmail.com> On Thu, Sep 24, 2009 at 10:52 AM, Mike Stump wrote: > On Sep 23, 2009, at 5:40 PM, Devang Patel wrote: >> >> On Tue, Sep 22, 2009 at 5:13 PM, Mike Stump wrote: >>> >>> - ?assert(typeName.find ("__Block_byref_") == 0 >>> - ? ? ? ? && "Attempting to get Block location of non-Block variable!"); >> >> Why ? Pl. explain. > > The name is but an implementation detail of a compiler. I thought there was some connection with runtime for these special types. If not then ok. > ?It is wrong for > that detail to slosh between a specific compiler (llvm-gcc) and llvm. ?clang > is implemented differently and needs to reuse this code for __block debug > information as llvm doesn't yet expose a decent way to do this. You're welcome to provide a patch! - Devang From clattner at apple.com Thu Sep 24 15:07:07 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 24 Sep 2009 13:07:07 -0700 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ In-Reply-To: References: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> Message-ID: <7EF342B2-F466-4020-9049-E6D6C9C5A022@apple.com> On Sep 24, 2009, at 10:51 AM, Eric Christopher wrote: > > On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote: > >> ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); >> - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), >> val_mem, "arr"); >> + BasicBlock* BB = builder->GetInsertBlock(); >> + const Type* IntPtrTy = IntegerType::getInt32Ty(C); >> + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, >> IntegerType::getInt8Ty(C), >> + val_mem, NULL, "arr"); >> + BB->getInstList().push_back(cast(ptr_arr)); > > Not sure if this has been covered, but why not update CreateMalloc in > the builder interface? This is a bit more unwieldy and moves people > away from using the builder in as many cases as possible. Because this isn't going to be a first class part of the IR anymore, we don't need IRBuilder support for it. -Chris From sabre at nondot.org Thu Sep 24 15:15:51 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 20:15:51 -0000 Subject: [llvm-commits] [llvm] r82707 - in /llvm/trunk: include/llvm/Support/Regex.h lib/Support/Regex.cpp Message-ID: <200909242015.n8OKFp8Q029566@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 15:15:51 2009 New Revision: 82707 URL: http://llvm.org/viewvc/llvm-project?rev=82707&view=rev Log: tidy up, fix a memory leak in Regex::isValid Modified: llvm/trunk/include/llvm/Support/Regex.h llvm/trunk/lib/Support/Regex.cpp Modified: llvm/trunk/include/llvm/Support/Regex.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Regex.h?rev=82707&r1=82706&r2=82707&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Regex.h (original) +++ llvm/trunk/include/llvm/Support/Regex.h Thu Sep 24 15:15:51 2009 @@ -54,7 +54,6 @@ /// Matches. /// For this feature to be enabled you must construct the regex using /// Regex("...", Regex::Sub) constructor. - bool match(const StringRef &String, SmallVectorImpl *Matches=0); private: struct llvm_regex *preg; Modified: llvm/trunk/lib/Support/Regex.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Regex.cpp?rev=82707&r1=82706&r2=82707&view=diff ============================================================================== --- llvm/trunk/lib/Support/Regex.cpp (original) +++ llvm/trunk/lib/Support/Regex.cpp Thu Sep 24 15:15:51 2009 @@ -10,15 +10,15 @@ // This file implements a POSIX regular expression matcher. // //===----------------------------------------------------------------------===// + #include "llvm/Support/Regex.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include "regex_impl.h" #include - using namespace llvm; -Regex::Regex(const StringRef ®ex, unsigned Flags) -{ + +Regex::Regex(const StringRef ®ex, unsigned Flags) { unsigned flags = 0; preg = new struct llvm_regex; preg->re_endp = regex.end(); @@ -35,26 +35,23 @@ error = llvm_regcomp(preg, regex.data(), flags|REG_EXTENDED|REG_PEND); } -bool Regex::isValid(std::string &Error) -{ +bool Regex::isValid(std::string &Error) { if (!error) return true; size_t len = llvm_regerror(error, preg, NULL, 0); - char *errbuff = new char[len]; - llvm_regerror(error, preg, errbuff, len); - Error.assign(errbuff); + + Error.resize(len); + llvm_regerror(error, preg, &Error[0], len); return false; } -Regex::~Regex() -{ +Regex::~Regex() { llvm_regfree(preg); delete preg; } -bool Regex::match(const StringRef &String, SmallVectorImpl *Matches) -{ +bool Regex::match(const StringRef &String, SmallVectorImpl *Matches){ unsigned nmatch = Matches ? preg->re_nsub+1 : 0; if (Matches) { @@ -81,7 +78,7 @@ // There was a match. if (Matches) { // match position requested - for (unsigned i=0;ipush_back(StringRef()); From gohman at apple.com Thu Sep 24 15:20:08 2009 From: gohman at apple.com (Dan Gohman) Date: Thu, 24 Sep 2009 20:20:08 -0000 Subject: [llvm-commits] [llvm] r82708 - /llvm/trunk/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll Message-ID: <200909242020.n8OKK87m030111@zion.cs.uiuc.edu> Author: djg Date: Thu Sep 24 15:20:08 2009 New Revision: 82708 URL: http://llvm.org/viewvc/llvm-project?rev=82708&view=rev Log: Add nounwind to this test. Modified: llvm/trunk/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll Modified: llvm/trunk/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll?rev=82708&r1=82707&r2=82708&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll Thu Sep 24 15:20:08 2009 @@ -1,6 +1,6 @@ ; RUN: llc < %s -march=ppc32 -define void @img2buf(i32 %symbol_size_in_bytes, i16* %ui16) { +define void @img2buf(i32 %symbol_size_in_bytes, i16* %ui16) nounwind { %tmp93 = load i16* null ; [#uses=1] %tmp99 = call i16 @llvm.bswap.i16( i16 %tmp93 ) ; [#uses=1] store i16 %tmp99, i16* %ui16 From david_goodwin at apple.com Thu Sep 24 15:22:50 2009 From: david_goodwin at apple.com (David Goodwin) Date: Thu, 24 Sep 2009 20:22:50 -0000 Subject: [llvm-commits] [llvm] r82709 - in /llvm/trunk: include/llvm/Target/TargetInstrItineraries.h lib/CodeGen/ExactHazardRecognizer.cpp lib/Target/ARM/ARMSchedule.td utils/TableGen/SubtargetEmitter.cpp Message-ID: <200909242022.n8OKMo2U030453@zion.cs.uiuc.edu> Author: david_goodwin Date: Thu Sep 24 15:22:50 2009 New Revision: 82709 URL: http://llvm.org/viewvc/llvm-project?rev=82709&view=rev Log: Make the end-of-itinerary mark explicit. Some cleanup. Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp llvm/trunk/lib/Target/ARM/ARMSchedule.td llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrItineraries.h?rev=82709&r1=82708&r2=82709&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrItineraries.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrItineraries.h Thu Sep 24 15:22:50 2009 @@ -104,6 +104,14 @@ /// bool isEmpty() const { return Itineratries == 0; } + /// isEndMarker - Returns true if the index is for the end marker + /// itinerary. + /// + bool isEndMarker(unsigned ItinClassIndx) const { + return ((Itineratries[ItinClassIndx].FirstStage == ~0U) && + (Itineratries[ItinClassIndx].LastStage == ~0U)); + } + /// beginStage - Return the first stage of the itinerary. /// const InstrStage *beginStage(unsigned ItinClassIndx) const { Modified: llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp?rev=82709&r1=82708&r2=82709&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp (original) +++ llvm/trunk/lib/CodeGen/ExactHazardRecognizer.cpp Thu Sep 24 15:22:50 2009 @@ -31,13 +31,11 @@ ScoreboardDepth = 1; if (!ItinData.isEmpty()) { for (unsigned idx = 0; ; ++idx) { - // If the begin stage of an itinerary has 0 cycles and units, - // then we have reached the end of the itineraries. - const InstrStage *IS = ItinData.beginStage(idx); - const InstrStage *E = ItinData.endStage(idx); - if ((IS->getCycles() == 0) && (IS->getUnits() == 0)) + if (ItinData.isEndMarker(idx)) break; + const InstrStage *IS = ItinData.beginStage(idx); + const InstrStage *E = ItinData.endStage(idx); unsigned ItinDepth = 0; for (; IS != E; ++IS) ItinDepth += IS->getCycles(); Modified: llvm/trunk/lib/Target/ARM/ARMSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSchedule.td?rev=82709&r1=82708&r2=82709&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSchedule.td (original) +++ llvm/trunk/lib/Target/ARM/ARMSchedule.td Thu Sep 24 15:22:50 2009 @@ -127,90 +127,7 @@ //===----------------------------------------------------------------------===// // Processor instruction itineraries. -def GenericItineraries : ProcessorItineraries<[ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<2, [FU_LdSt0]>]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData, - InstrStage<1, [FU_LdSt0]>]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]> -]>; +def GenericItineraries : ProcessorItineraries<[]>; include "ARMScheduleV6.td" Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=82709&r1=82708&r2=82709&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Thu Sep 24 15:22:50 2009 @@ -413,7 +413,7 @@ // For each itinerary class std::vector &ItinList = *ProcListIter++; - for (unsigned j = 0, M = ItinList.size(); j < M;) { + for (unsigned j = 0, M = ItinList.size(); j < M; ++j) { InstrItinerary &Intinerary = ItinList[j]; // Emit in the form of @@ -427,13 +427,11 @@ Intinerary.LastOperandCycle << " }"; } - // If more in list add comma - if (++j < M) OS << ","; - - OS << " // " << (j - 1) << "\n"; + OS << ", // " << j << "\n"; } // End processor itinerary table + OS << " { ~0U, ~0U, ~0U, ~0U } // end marker\n"; OS << "};\n"; } } From bob.wilson at apple.com Thu Sep 24 15:23:02 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 24 Sep 2009 20:23:02 -0000 Subject: [llvm-commits] [llvm] r82710 - /llvm/trunk/test/CodeGen/ARM/vargs_align.ll Message-ID: <200909242023.n8OKN2ZL030490@zion.cs.uiuc.edu> Author: bwilson Date: Thu Sep 24 15:23:02 2009 New Revision: 82710 URL: http://llvm.org/viewvc/llvm-project?rev=82710&view=rev Log: Convert to FileCheck. Modified: llvm/trunk/test/CodeGen/ARM/vargs_align.ll Modified: llvm/trunk/test/CodeGen/ARM/vargs_align.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vargs_align.ll?rev=82710&r1=82709&r2=82710&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/vargs_align.ll (original) +++ llvm/trunk/test/CodeGen/ARM/vargs_align.ll Thu Sep 24 15:23:02 2009 @@ -1,7 +1,5 @@ -; RUN: llc < %s -march=arm -mtriple=arm-linux-gnueabi | \ -; RUN: grep {add sp, sp, #16} | count 1 -; RUN: llc < %s -march=arm -mtriple=arm-linux-gnu | \ -; RUN: grep {add sp, sp, #12} | count 2 +; RUN: llc < %s -march=arm -mtriple=arm-linux-gnueabi | FileCheck %s -check-prefix=EABI +; RUN: llc < %s -march=arm -mtriple=arm-linux-gnu | FileCheck %s -check-prefix=OABI define i32 @f(i32 %a, ...) { entry: @@ -18,4 +16,8 @@ return: ; preds = %entry %retval2 = load i32* %retval ; [#uses=1] ret i32 %retval2 +; EABI: add sp, sp, #12 +; EABI: add sp, sp, #16 +; OABI: add sp, sp, #12 +; OABI: add sp, sp, #12 } From sabre at nondot.org Thu Sep 24 15:25:55 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 20:25:55 -0000 Subject: [llvm-commits] [llvm] r82711 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909242025.n8OKPtpL030853@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 15:25:55 2009 New Revision: 82711 URL: http://llvm.org/viewvc/llvm-project?rev=82711&view=rev Log: refactor out the match string into its own Pattern class. Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82711&r1=82710&r2=82711&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Thu Sep 24 15:25:55 2009 @@ -39,10 +39,50 @@ NoCanonicalizeWhiteSpace("strict-whitespace", cl::desc("Do not treat all horizontal whitespace as equivalent")); -/// CheckString - This is a check that we found in the input file. -struct CheckString { +class Pattern { /// Str - The string to match. std::string Str; +public: + + Pattern(StringRef S) : Str(S.str()) { + // Remove duplicate spaces in the check strings if requested. + if (!NoCanonicalizeWhiteSpace) + CanonicalizeCheckString(); + } + + /// Match - Match the pattern string against the input buffer Buffer. This + /// returns the position that is matched or npos if there is no match. If + /// there is a match, the size of the matched string is returned in MatchLen. + size_t Match(StringRef Buffer, size_t &MatchLen) const { + MatchLen = Str.size(); + return Buffer.find(Str); + } + +private: + /// CanonicalizeCheckString - Replace all sequences of horizontal whitespace + /// in the check strings with a single space. + void CanonicalizeCheckString() { + for (unsigned C = 0; C != Str.size(); ++C) { + // If C is not a horizontal whitespace, skip it. + if (Str[C] != ' ' && Str[C] != '\t') + continue; + + // Replace the character with space, then remove any other space + // characters after it. + Str[C] = ' '; + + while (C+1 != Str.size() && + (Str[C+1] == ' ' || Str[C+1] == '\t')) + Str.erase(Str.begin()+C+1); + } + } +}; + + +/// CheckString - This is a check that we found in the input file. +struct CheckString { + /// Pat - The pattern to match. + Pattern Pat; /// Loc - The location in the match file that the check string was specified. SMLoc Loc; @@ -56,8 +96,8 @@ /// file). std::vector > NotStrings; - CheckString(const std::string &S, SMLoc L, bool isCheckNext) - : Str(S), Loc(L), IsCheckNext(isCheckNext) {} + CheckString(const Pattern &P, SMLoc L, bool isCheckNext) + : Pat(P), Loc(L), IsCheckNext(isCheckNext) {} }; @@ -149,8 +189,10 @@ return true; } + Pattern P(PatternStr); + // Okay, add the string we captured to the output vector and move on. - CheckStrings.push_back(CheckString(PatternStr.str(), + CheckStrings.push_back(CheckString(P, SMLoc::getFromPointer(Buffer.data()), IsCheckNext)); std::swap(NotMatches, CheckStrings.back().NotStrings); @@ -173,28 +215,6 @@ return false; } -// CanonicalizeCheckStrings - Replace all sequences of horizontal whitespace in -// the check strings with a single space. -static void CanonicalizeCheckStrings(std::vector &CheckStrings) { - for (unsigned i = 0, e = CheckStrings.size(); i != e; ++i) { - std::string &Str = CheckStrings[i].Str; - - for (unsigned C = 0; C != Str.size(); ++C) { - // If C is not a horizontal whitespace, skip it. - if (Str[C] != ' ' && Str[C] != '\t') - continue; - - // Replace the character with space, then remove any other space - // characters after it. - Str[C] = ' '; - - while (C+1 != Str.size() && - (Str[C+1] == ' ' || Str[C+1] == '\t')) - Str.erase(Str.begin()+C+1); - } - } -} - /// CanonicalizeInputFile - Remove duplicate horizontal space from the specified /// memory buffer, free it, and return a new one. static MemoryBuffer *CanonicalizeInputFile(MemoryBuffer *MB) { @@ -273,10 +293,6 @@ if (ReadCheckFile(SM, CheckStrings)) return 2; - // Remove duplicate spaces in the check strings if requested. - if (!NoCanonicalizeWhiteSpace) - CanonicalizeCheckStrings(CheckStrings); - // Open the file to check and add it to SourceMgr. std::string ErrorStr; MemoryBuffer *F = @@ -305,7 +321,8 @@ StringRef SearchFrom = Buffer; // Find StrNo in the file. - Buffer = Buffer.substr(Buffer.find(CheckStr.Str)); + size_t MatchLen = 0; + Buffer = Buffer.substr(CheckStr.Pat.Match(Buffer, MatchLen)); // If we didn't find a match, reject the input. if (Buffer.empty()) { @@ -363,7 +380,7 @@ // Otherwise, everything is good. Step over the matched text and remember // the position after the match as the end of the last match. - Buffer = Buffer.substr(CheckStr.Str.size()); + Buffer = Buffer.substr(MatchLen); LastMatch = Buffer.data(); } From vhernandez at apple.com Thu Sep 24 15:36:10 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Thu, 24 Sep 2009 13:36:10 -0700 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ In-Reply-To: <7EF342B2-F466-4020-9049-E6D6C9C5A022@apple.com> References: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> <7EF342B2-F466-4020-9049-E6D6C9C5A022@apple.com> Message-ID: <5C95A094-93FB-473D-93E5-CE17AA024D2A@apple.com> On Sep 24, 2009, at 1:07 PM, Chris Lattner wrote: > > On Sep 24, 2009, at 10:51 AM, Eric Christopher wrote: > >> >> On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote: >> >>> ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); >>> - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), >>> val_mem, "arr"); >>> + BasicBlock* BB = builder->GetInsertBlock(); >>> + const Type* IntPtrTy = IntegerType::getInt32Ty(C); >>> + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, >>> IntegerType::getInt8Ty(C), >>> + val_mem, NULL, "arr"); >>> + BB->getInstList().push_back(cast(ptr_arr)); >> >> Not sure if this has been covered, but why not update CreateMalloc in >> the builder interface? This is a bit more unwieldy and moves people >> away from using the builder in as many cases as possible. > > Because this isn't going to be a first class part of the IR anymore, > we don't need IRBuilder support for it. Exactly. IRBuilder->CreateMalloc() currently returns a MallocInst, so that function is going away, and won't be replaced. Victor From sabre at nondot.org Thu Sep 24 15:39:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 20:39:13 -0000 Subject: [llvm-commits] [llvm] r82712 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909242039.n8OKdDIj032639@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 15:39:13 2009 New Revision: 82712 URL: http://llvm.org/viewvc/llvm-project?rev=82712&view=rev Log: change 'not' matching to use Pattern, move pattern parsing logic into the Pattern class. Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82712&r1=82711&r2=82712&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Thu Sep 24 15:39:13 2009 @@ -39,16 +39,18 @@ NoCanonicalizeWhiteSpace("strict-whitespace", cl::desc("Do not treat all horizontal whitespace as equivalent")); +//===----------------------------------------------------------------------===// +// Pattern Handling Code. +//===----------------------------------------------------------------------===// + class Pattern { /// Str - The string to match. std::string Str; public: - Pattern(StringRef S) : Str(S.str()) { - // Remove duplicate spaces in the check strings if requested. - if (!NoCanonicalizeWhiteSpace) - CanonicalizeCheckString(); - } + Pattern() { } + + bool ParsePattern(StringRef PatternStr, SourceMgr &SM); /// Match - Match the pattern string against the input buffer Buffer. This /// returns the position that is matched or npos if there is no match. If @@ -78,6 +80,33 @@ } }; +bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { + // Ignore trailing whitespace. + while (!PatternStr.empty() && + (PatternStr.back() == ' ' || PatternStr.back() == '\t')) + PatternStr = PatternStr.substr(0, PatternStr.size()-1); + + // Check that there is something on the line. + if (PatternStr.empty()) { + SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()), + "found empty check string with prefix '"+CheckPrefix+":'", + "error"); + return true; + } + + Str = PatternStr.str(); + + // Remove duplicate spaces in the check strings if requested. + if (!NoCanonicalizeWhiteSpace) + CanonicalizeCheckString(); + + return false; +} + + +//===----------------------------------------------------------------------===// +// Check Strings. +//===----------------------------------------------------------------------===// /// CheckString - This is a check that we found in the input file. struct CheckString { @@ -94,7 +123,7 @@ /// NotStrings - These are all of the strings that are disallowed from /// occurring between this match string and the previous one (or start of /// file). - std::vector > NotStrings; + std::vector > NotStrings; CheckString(const Pattern &P, SMLoc L, bool isCheckNext) : Pat(P), Loc(L), IsCheckNext(isCheckNext) {} @@ -119,7 +148,7 @@ // Find all instances of CheckPrefix followed by : in the file. StringRef Buffer = F->getBuffer(); - std::vector > NotMatches; + std::vector > NotMatches; while (1) { // See if Prefix occurs in the memory buffer. @@ -157,29 +186,14 @@ // Scan ahead to the end of line. size_t EOL = Buffer.find_first_of("\n\r"); - if (EOL == StringRef::npos) EOL = Buffer.size(); - - // Ignore trailing whitespace. - while (EOL && (Buffer[EOL-1] == ' ' || Buffer[EOL-1] == '\t')) - --EOL; - - // Check that there is something on the line. - if (EOL == 0) { - SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), - "found empty check string with prefix '"+CheckPrefix+":'", - "error"); + + // Parse the pattern. + Pattern P; + if (P.ParsePattern(Buffer.substr(0, EOL), SM)) return true; - } - StringRef PatternStr = Buffer.substr(0, EOL); - - // Handle CHECK-NOT. - if (IsCheckNot) { - NotMatches.push_back(std::make_pair(SMLoc::getFromPointer(Buffer.data()), - PatternStr.str())); - Buffer = Buffer.substr(EOL); - continue; - } + Buffer = Buffer.substr(EOL); + // Verify that CHECK-NEXT lines have at least one CHECK line before them. if (IsCheckNext && CheckStrings.empty()) { @@ -189,15 +203,19 @@ return true; } - Pattern P(PatternStr); + // Handle CHECK-NOT. + if (IsCheckNot) { + NotMatches.push_back(std::make_pair(SMLoc::getFromPointer(Buffer.data()), + P)); + continue; + } + // Okay, add the string we captured to the output vector and move on. CheckStrings.push_back(CheckString(P, SMLoc::getFromPointer(Buffer.data()), IsCheckNext)); std::swap(NotMatches, CheckStrings.back().NotStrings); - - Buffer = Buffer.substr(EOL); } if (CheckStrings.empty()) { @@ -367,7 +385,8 @@ // If this match had "not strings", verify that they don't exist in the // skipped region. for (unsigned i = 0, e = CheckStr.NotStrings.size(); i != e; ++i) { - size_t Pos = SkippedRegion.find(CheckStr.NotStrings[i].second); + size_t MatchLen = 0; + size_t Pos = CheckStr.NotStrings[i].second.Match(SkippedRegion, MatchLen); if (Pos == StringRef::npos) continue; SM.PrintMessage(SMLoc::getFromPointer(LastMatch+Pos), From echristo at apple.com Thu Sep 24 15:39:57 2009 From: echristo at apple.com (Eric Christopher) Date: Thu, 24 Sep 2009 13:39:57 -0700 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ In-Reply-To: <7EF342B2-F466-4020-9049-E6D6C9C5A022@apple.com> References: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> <7EF342B2-F466-4020-9049-E6D6C9C5A022@apple.com> Message-ID: On Sep 24, 2009, at 1:07 PM, Chris Lattner wrote: > > On Sep 24, 2009, at 10:51 AM, Eric Christopher wrote: > >> >> On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote: >> >>> ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); >>> - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), >>> val_mem, "arr"); >>> + BasicBlock* BB = builder->GetInsertBlock(); >>> + const Type* IntPtrTy = IntegerType::getInt32Ty(C); >>> + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, >>> IntegerType::getInt8Ty(C), >>> + val_mem, NULL, "arr"); >>> + BB->getInstList().push_back(cast(ptr_arr)); >> >> Not sure if this has been covered, but why not update CreateMalloc in >> the builder interface? This is a bit more unwieldy and moves people >> away from using the builder in as many cases as possible. > > Because this isn't going to be a first class part of the IR anymore, > we don't need IRBuilder support for it. Hmm... OK. Just seemed a bit odd that we have a CallInst::CreateMalloc but no builder call for it. -eric From sabre at nondot.org Thu Sep 24 15:45:08 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 20:45:08 -0000 Subject: [llvm-commits] [llvm] r82713 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909242045.n8OKj8O6000997@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 15:45:07 2009 New Revision: 82713 URL: http://llvm.org/viewvc/llvm-project?rev=82713&view=rev Log: Use CanonicalizeInputFile to canonicalize the entire buffer containing the CHECK strings, instead of canonicalizing the patterns directly. This allows Pattern to just contain a StringRef instead of std::string. Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82713&r1=82712&r2=82713&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Thu Sep 24 15:45:07 2009 @@ -45,7 +45,7 @@ class Pattern { /// Str - The string to match. - std::string Str; + StringRef Str; public: Pattern() { } @@ -59,25 +59,6 @@ MatchLen = Str.size(); return Buffer.find(Str); } - -private: - /// CanonicalizeCheckString - Replace all sequences of horizontal whitespace - /// in the check strings with a single space. - void CanonicalizeCheckString() { - for (unsigned C = 0; C != Str.size(); ++C) { - // If C is not a horizontal whitespace, skip it. - if (Str[C] != ' ' && Str[C] != '\t') - continue; - - // Replace the character with space, then remove any other space - // characters after it. - Str[C] = ' '; - - while (C+1 != Str.size() && - (Str[C+1] == ' ' || Str[C+1] == '\t')) - Str.erase(Str.begin()+C+1); - } - } }; bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { @@ -93,13 +74,10 @@ "error"); return true; } + - Str = PatternStr.str(); - - // Remove duplicate spaces in the check strings if requested. - if (!NoCanonicalizeWhiteSpace) - CanonicalizeCheckString(); + Str = PatternStr; return false; } @@ -129,6 +107,37 @@ : Pat(P), Loc(L), IsCheckNext(isCheckNext) {} }; +/// CanonicalizeInputFile - Remove duplicate horizontal space from the specified +/// memory buffer, free it, and return a new one. +static MemoryBuffer *CanonicalizeInputFile(MemoryBuffer *MB) { + SmallVector NewFile; + NewFile.reserve(MB->getBufferSize()); + + for (const char *Ptr = MB->getBufferStart(), *End = MB->getBufferEnd(); + Ptr != End; ++Ptr) { + // If C is not a horizontal whitespace, skip it. + if (*Ptr != ' ' && *Ptr != '\t') { + NewFile.push_back(*Ptr); + continue; + } + + // Otherwise, add one space and advance over neighboring space. + NewFile.push_back(' '); + while (Ptr+1 != End && + (Ptr[1] == ' ' || Ptr[1] == '\t')) + ++Ptr; + } + + // Free the old buffer and return a new one. + MemoryBuffer *MB2 = + MemoryBuffer::getMemBufferCopy(NewFile.data(), + NewFile.data() + NewFile.size(), + MB->getBufferIdentifier()); + + delete MB; + return MB2; +} + /// ReadCheckFile - Read the check file, which specifies the sequence of /// expected strings. The strings are added to the CheckStrings vector. @@ -143,6 +152,12 @@ << ErrorStr << '\n'; return true; } + + // If we want to canonicalize whitespace, strip excess whitespace from the + // buffer containing the CHECK lines. + if (!NoCanonicalizeWhiteSpace) + F = CanonicalizeInputFile(F); + SM.AddNewSourceBuffer(F, SMLoc()); // Find all instances of CheckPrefix followed by : in the file. @@ -233,38 +248,6 @@ return false; } -/// CanonicalizeInputFile - Remove duplicate horizontal space from the specified -/// memory buffer, free it, and return a new one. -static MemoryBuffer *CanonicalizeInputFile(MemoryBuffer *MB) { - SmallVector NewFile; - NewFile.reserve(MB->getBufferSize()); - - for (const char *Ptr = MB->getBufferStart(), *End = MB->getBufferEnd(); - Ptr != End; ++Ptr) { - // If C is not a horizontal whitespace, skip it. - if (*Ptr != ' ' && *Ptr != '\t') { - NewFile.push_back(*Ptr); - continue; - } - - // Otherwise, add one space and advance over neighboring space. - NewFile.push_back(' '); - while (Ptr+1 != End && - (Ptr[1] == ' ' || Ptr[1] == '\t')) - ++Ptr; - } - - // Free the old buffer and return a new one. - MemoryBuffer *MB2 = - MemoryBuffer::getMemBufferCopy(NewFile.data(), - NewFile.data() + NewFile.size(), - MB->getBufferIdentifier()); - - delete MB; - return MB2; -} - - static void PrintCheckFailed(const SourceMgr &SM, const CheckString &CheckStr, StringRef Buffer) { // Otherwise, we have an error, emit an error message. From vhernandez at apple.com Thu Sep 24 15:46:57 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Thu, 24 Sep 2009 13:46:57 -0700 Subject: [llvm-commits] [PATCH] delete MallocInst Message-ID: After this patch, MallocInst is no more. Also included: - Fixes to the IndMemRemoval pass, which I missed updating to use malloc calls - Improved CreateMalloc(), so that it does not generate a bitcast after the malloc call if malloc's return type matches the allocation type -------------- next part -------------- A non-text attachment was scrubbed... Name: DeleteMallocInst.diff Type: application/octet-stream Size: 65679 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090924/4d28aa84/attachment.obj -------------- next part -------------- Victor From edwintorok at gmail.com Thu Sep 24 15:49:18 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Thu, 24 Sep 2009 23:49:18 +0300 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html In-Reply-To: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> References: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> Message-ID: <4ABBDB4E.8080500@gmail.com> On 2009-09-24 21:38, Dale Johannesen wrote: > Author: johannes > Date: Thu Sep 24 13:38:21 2009 > New Revision: 82701 > > URL: http://llvm.org/viewvc/llvm-project?rev=82701&view=rev > Log: > Clarify that llvm attaches C language semantics to > functions with names that match the C library. > > > Modified: > llvm/trunk/docs/LangRef.html > > Modified: llvm/trunk/docs/LangRef.html > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=82701&r1=82700&r2=82701&view=diff > > ============================================================================== > --- llvm/trunk/docs/LangRef.html (original) > +++ llvm/trunk/docs/LangRef.html Thu Sep 24 13:38:21 2009 > @@ -5045,6 +5045,13 @@ > %ZZ = call zeroext i32 @bar() ; Return value is %zero extended > > > +

llvm treats calls to some functions with names and arguments that match the > +standard C library as being the C library functions, and may perform > +optimizations or generate code for them under that assumption. These > +functions currently include: > +acos, asin, atan, atan2, ceil, cos, cosf, cosh, exp, fabs, floor, fmod, log, > +log10, malloc, pow, sin, sinh, sqrt, sqrtf, sin, sinf, tan, tanh.

> + > In fact this list is longer [1], it includes (excluding Andersens.cpp and SimplifyLibcalls) abs, absf, absl, atexit, calloc, ceil, copysign, copysignf, cosl, __dso_handle, exit, fabsf, fabsl, free, __half_powr4, __main, main, memcpy, realloc, _setjmp, setjmp, sinf, sinl. Although it is very good that LLVM handles these for C/C++, it is not necesarely good for Java/Python/some other language. Suggestion: could we have all these special function names in one place, and an enum? Then all the analysis/transforms that need special function names can call: enum SpecialFunctions KnownFunctions::classifySpecialFunction(StringRef name, Module &M); bool KnownFunctions::isKnown(StringRef name, Module &M); Function *KnownFunctions::getSpecial(StringRef name, Module &M); Function *KnownFunctions::getOrInsertSpecial(StringRef name, Module &M);//allowed to return null for failure If you don't want these special functions there could be a command-line flag and an llvm:: variable default true that could be set to false. [1] I generated this list with these, which is not entirely accurate so there may be more: cd lib git grep getFunction\(\"|grep -v Andersens|grep -v SimplifyLibCalls|grep -E -o \"[^\"]+\"|grep -v llvm|sort -u git grep getName\(\)|grep -v Andersen|grep -v SimplifyLibCalls|grep -E ==.+\"|grep -E -o \"[^\"]+\"|grep -v llvm |sort -u git grep -E Name.+==.+\"|grep -v Andersen|grep -v SimplifyLibCalls|grep -E -o \"[^\"]+\"|grep -v llvm|sort -u Best regards, --Edwin From sabre at nondot.org Thu Sep 24 16:44:20 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 21:44:20 -0000 Subject: [llvm-commits] [llvm] r82715 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200909242144.n8OLiKLJ008636@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 16:44:20 2009 New Revision: 82715 URL: http://llvm.org/viewvc/llvm-project?rev=82715&view=rev Log: wrap long lines. Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=82715&r1=82714&r2=82715&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Sep 24 16:44:20 2009 @@ -2839,7 +2839,8 @@ float APFloat::convertToFloat() const { - assert(semantics == (const llvm::fltSemantics*)&IEEEsingle && "Float semantics are not IEEEsingle"); + assert(semantics == (const llvm::fltSemantics*)&IEEEsingle && + "Float semantics are not IEEEsingle"); APInt api = bitcastToAPInt(); return api.bitsToFloat(); } @@ -2847,7 +2848,8 @@ double APFloat::convertToDouble() const { - assert(semantics == (const llvm::fltSemantics*)&IEEEdouble && "Float semantics are not IEEEdouble"); + assert(semantics == (const llvm::fltSemantics*)&IEEEdouble && + "Float semantics are not IEEEdouble"); APInt api = bitcastToAPInt(); return api.bitsToDouble(); } From sabre at nondot.org Thu Sep 24 16:45:57 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 21:45:57 -0000 Subject: [llvm-commits] [llvm] r82716 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.h Message-ID: <200909242145.n8OLjvX8008839@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 16:45:57 2009 New Revision: 82716 URL: http://llvm.org/viewvc/llvm-project?rev=82716&view=rev Log: unconditionally request MMI Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.h?rev=82716&r1=82715&r2=82716&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.h Thu Sep 24 16:45:57 2009 @@ -49,11 +49,7 @@ void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); - if (Subtarget->isTargetDarwin() || - Subtarget->isTargetELF() || - Subtarget->isTargetCygMing()) { - AU.addRequired(); - } + AU.addRequired(); AU.addRequired(); AsmPrinter::getAnalysisUsage(AU); } From sabre at nondot.org Thu Sep 24 16:47:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 21:47:32 -0000 Subject: [llvm-commits] [llvm] r82717 - in /llvm/trunk: docs/TestingGuide.html include/llvm/Support/Regex.h lib/Support/Regex.cpp unittests/Support/RegexTest.cpp utils/FileCheck/FileCheck.cpp Message-ID: <200909242147.n8OLlXM2009043@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 24 16:47:32 2009 New Revision: 82717 URL: http://llvm.org/viewvc/llvm-project?rev=82717&view=rev Log: add and document regex support for FileCheck. You can now do stuff like: ; CHECK: movl {{%e[a-z][xi]}}, %eax or whatever. Modified: llvm/trunk/docs/TestingGuide.html llvm/trunk/include/llvm/Support/Regex.h llvm/trunk/lib/Support/Regex.cpp llvm/trunk/unittests/Support/RegexTest.cpp llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/docs/TestingGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=82717&r1=82716&r2=82717&view=diff ============================================================================== --- llvm/trunk/docs/TestingGuide.html (original) +++ llvm/trunk/docs/TestingGuide.html Thu Sep 24 16:47:32 2009 @@ -625,6 +625,40 @@ + + +
+ +

The CHECK: and CHECK-NOT: directives both take a pattern to match. For most +uses of FileCheck, fixed string matching is perfectly sufficient. For some +things, a more flexible form of matching is desired. To support this, FileCheck +allows you to specify regular expressions in matching strings, surrounded by +double braces: {{yourregex}}. Because we want to use fixed string +matching for a majority of what we do, FileCheck has been designed to support +mixing and matching fixed string matching with regular expressions. This allows +you to write things like this:

+ +
+
+; CHECK: movhpd	{{[0-9]+}}(%esp), {{%xmm[0-7]}}
+
+
+ +

In this case, any offset from the ESP register will be allowed, and any xmm +register will be allowed.

+ +

Because regular expressions are enclosed with double braces, they are +visually distinct, and you don't need to use escape characters within the double +braces like you would in C. In the rare case that you want to match double +braces explicitly from the input, you can use something ugly like +{{[{][{]}} as your pattern.

+ +
+ + + + Modified: llvm/trunk/include/llvm/Support/Regex.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Regex.h?rev=82717&r1=82716&r2=82717&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Regex.h (original) +++ llvm/trunk/include/llvm/Support/Regex.h Thu Sep 24 16:47:32 2009 @@ -11,11 +11,14 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" +#include struct llvm_regex; + namespace llvm { + class StringRef; + template class SmallVectorImpl; + class Regex { public: enum { @@ -54,6 +57,8 @@ /// Matches. /// For this feature to be enabled you must construct the regex using /// Regex("...", Regex::Sub) constructor. + /// + /// This returns true on a successful match. bool match(const StringRef &String, SmallVectorImpl *Matches=0); private: struct llvm_regex *preg; Modified: llvm/trunk/lib/Support/Regex.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Regex.cpp?rev=82717&r1=82716&r2=82717&view=diff ============================================================================== --- llvm/trunk/lib/Support/Regex.cpp (original) +++ llvm/trunk/lib/Support/Regex.cpp Thu Sep 24 16:47:32 2009 @@ -14,13 +14,14 @@ #include "llvm/Support/Regex.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/SmallVector.h" #include "regex_impl.h" #include using namespace llvm; Regex::Regex(const StringRef ®ex, unsigned Flags) { unsigned flags = 0; - preg = new struct llvm_regex; + preg = new llvm_regex(); preg->re_endp = regex.end(); if (Flags & IgnoreCase) flags |= REG_ICASE; @@ -60,7 +61,7 @@ } // pmatch needs to have at least one element. - SmallVector pm; + SmallVector pm; pm.resize(nmatch > 0 ? nmatch : 1); pm[0].rm_so = 0; pm[0].rm_eo = String.size(); Modified: llvm/trunk/unittests/Support/RegexTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/RegexTest.cpp?rev=82717&r1=82716&r2=82717&view=diff ============================================================================== --- llvm/trunk/unittests/Support/RegexTest.cpp (original) +++ llvm/trunk/unittests/Support/RegexTest.cpp Thu Sep 24 16:47:32 2009 @@ -9,6 +9,7 @@ #include "gtest/gtest.h" #include "llvm/Support/Regex.h" +#include "llvm/ADT/SmallVector.h" #include using namespace llvm; Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82717&r1=82716&r2=82717&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Thu Sep 24 16:47:32 2009 @@ -19,6 +19,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" +#include "llvm/Support/Regex.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/Signals.h" @@ -44,8 +45,9 @@ //===----------------------------------------------------------------------===// class Pattern { - /// Str - The string to match. - StringRef Str; + /// Chunks - The pattern chunks to match. If the bool is false, it is a fixed + /// string match, if it is true, it is a regex match. + SmallVector, 4> Chunks; public: Pattern() { } @@ -55,10 +57,7 @@ /// Match - Match the pattern string against the input buffer Buffer. This /// returns the position that is matched or npos if there is no match. If /// there is a match, the size of the matched string is returned in MatchLen. - size_t Match(StringRef Buffer, size_t &MatchLen) const { - MatchLen = Str.size(); - return Buffer.find(Str); - } + size_t Match(StringRef Buffer, size_t &MatchLen) const; }; bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { @@ -74,13 +73,119 @@ "error"); return true; } - - - Str = PatternStr; + // Scan the pattern to break it into regex and non-regex pieces. + while (!PatternStr.empty()) { + // Handle fixed string matches. + if (PatternStr.size() < 2 || + PatternStr[0] != '{' || PatternStr[1] != '{') { + // Find the end, which is the start of the next regex. + size_t FixedMatchEnd = PatternStr.find("{{"); + + Chunks.push_back(std::make_pair(PatternStr.substr(0, FixedMatchEnd), + false)); + PatternStr = PatternStr.substr(FixedMatchEnd); + continue; + } + + // Otherwise, this is the start of a regex match. Scan for the }}. + size_t End = PatternStr.find("}}"); + if (End == StringRef::npos) { + SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()), + "found start of regex string with no end '}}'", "error"); + return true; + } + + Regex R(PatternStr.substr(2, End-2)); + std::string Error; + if (!R.isValid(Error)) { + SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()+2), + "invalid regex: " + Error, "error"); + return true; + } + + Chunks.push_back(std::make_pair(PatternStr.substr(2, End-2), true)); + PatternStr = PatternStr.substr(End+2); + } + return false; } +/// Match - Match the pattern string against the input buffer Buffer. This +/// returns the position that is matched or npos if there is no match. If +/// there is a match, the size of the matched string is returned in MatchLen. +size_t Pattern::Match(StringRef Buffer, size_t &MatchLen) const { + size_t FirstMatch = StringRef::npos; + MatchLen = 0; + + SmallVector MatchInfo; + + while (!Buffer.empty()) { + StringRef MatchAttempt = Buffer; + + unsigned ChunkNo = 0, e = Chunks.size(); + for (; ChunkNo != e; ++ChunkNo) { + StringRef PatternStr = Chunks[ChunkNo].first; + + size_t ThisMatch = StringRef::npos; + size_t ThisLength = StringRef::npos; + if (!Chunks[ChunkNo].second) { + // Fixed string match. + ThisMatch = MatchAttempt.find(Chunks[ChunkNo].first); + ThisLength = Chunks[ChunkNo].first.size(); + } else if (Regex(Chunks[ChunkNo].first, Regex::Sub).match(MatchAttempt, &MatchInfo)) { + // Successful regex match. + assert(!MatchInfo.empty() && "Didn't get any match"); + StringRef FullMatch = MatchInfo[0]; + MatchInfo.clear(); + + ThisMatch = FullMatch.data()-MatchAttempt.data(); + ThisLength = FullMatch.size(); + } + + // Otherwise, what we do depends on if this is the first match or not. If + // this is the first match, it doesn't match to match at the start of + // MatchAttempt. + if (ChunkNo == 0) { + // If the first match fails then this pattern will never match in + // Buffer. + if (ThisMatch == StringRef::npos) + return ThisMatch; + + FirstMatch = ThisMatch; + MatchAttempt = MatchAttempt.substr(FirstMatch); + ThisMatch = 0; + } + + // If this chunk didn't match, then the entire pattern didn't match from + // FirstMatch, try later in the buffer. + if (ThisMatch == StringRef::npos) + break; + + // Ok, if the match didn't match at the beginning of MatchAttempt, then we + // have something like "ABC{{DEF}} and something was in-between. Reject + // the match. + if (ThisMatch != 0) + break; + + // Otherwise, match the string and move to the next chunk. + MatchLen += ThisLength; + MatchAttempt = MatchAttempt.substr(ThisLength); + } + + // If the whole thing matched, we win. + if (ChunkNo == e) + return FirstMatch; + + // Otherwise, try matching again after FirstMatch to see if this pattern + // matches later in the buffer. + Buffer = Buffer.substr(FirstMatch+1); + } + + // If we ran out of stuff to scan, then we didn't match. + return StringRef::npos; +} + //===----------------------------------------------------------------------===// // Check Strings. @@ -367,14 +472,14 @@ // If this match had "not strings", verify that they don't exist in the // skipped region. - for (unsigned i = 0, e = CheckStr.NotStrings.size(); i != e; ++i) { + for (unsigned ChunkNo = 0, e = CheckStr.NotStrings.size(); ChunkNo != e; ++ChunkNo) { size_t MatchLen = 0; - size_t Pos = CheckStr.NotStrings[i].second.Match(SkippedRegion, MatchLen); + size_t Pos = CheckStr.NotStrings[ChunkNo].second.Match(SkippedRegion, MatchLen); if (Pos == StringRef::npos) continue; SM.PrintMessage(SMLoc::getFromPointer(LastMatch+Pos), CheckPrefix+"-NOT: string occurred!", "error"); - SM.PrintMessage(CheckStr.NotStrings[i].first, + SM.PrintMessage(CheckStr.NotStrings[ChunkNo].first, CheckPrefix+"-NOT: pattern specified here", "note"); return 1; } From isanbard at gmail.com Thu Sep 24 17:06:50 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 22:06:50 -0000 Subject: [llvm-commits] [llvm] r82719 - /llvm/tags/Apple/llvmCore-2208.2/ Message-ID: <200909242206.n8OM6o7C011682@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 17:06:49 2009 New Revision: 82719 URL: http://llvm.org/viewvc/llvm-project?rev=82719&view=rev Log: Creating llvmCore-2208.2 from top of tree. Added: llvm/tags/Apple/llvmCore-2208.2/ - copied from r82718, llvm/trunk/ From isanbard at gmail.com Thu Sep 24 17:06:58 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 22:06:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82720 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ Message-ID: <200909242206.n8OM6w51011715@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 17:06:57 2009 New Revision: 82720 URL: http://llvm.org/viewvc/llvm-project?rev=82720&view=rev Log: Creating llvmgcc42-2208.2 from top of tree. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ - copied from r82719, llvm-gcc-4.2/trunk/ From isanbard at gmail.com Thu Sep 24 17:22:09 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 22:22:09 -0000 Subject: [llvm-commits] [llvm] r82721 - /llvm/tags/Apple/llvmCore-2310/ Message-ID: <200909242222.n8OMM9Op013686@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 17:22:09 2009 New Revision: 82721 URL: http://llvm.org/viewvc/llvm-project?rev=82721&view=rev Log: Creating llvmCore-2310 from top of tree. Added: llvm/tags/Apple/llvmCore-2310/ - copied from r82720, llvm/trunk/ From isanbard at gmail.com Thu Sep 24 17:22:17 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 22:22:17 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82722 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2310/ Message-ID: <200909242222.n8OMMH1u013712@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 17:22:16 2009 New Revision: 82722 URL: http://llvm.org/viewvc/llvm-project?rev=82722&view=rev Log: Creating llvmgcc42-2310 from top of tree. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2310/ - copied from r82721, llvm-gcc-4.2/trunk/ From isanbard at gmail.com Thu Sep 24 17:22:37 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 22:22:37 -0000 Subject: [llvm-commits] [llvm] r82723 - /llvm/tags/Apple/llvmCore-2208.2/ Message-ID: <200909242222.n8OMMb72013766@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 17:22:37 2009 New Revision: 82723 URL: http://llvm.org/viewvc/llvm-project?rev=82723&view=rev Log: Remove bad tag. Removed: llvm/tags/Apple/llvmCore-2208.2/ From isanbard at gmail.com Thu Sep 24 17:22:37 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 24 Sep 2009 22:22:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82723 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ Message-ID: <200909242222.n8OMMbNs013770@zion.cs.uiuc.edu> Author: void Date: Thu Sep 24 17:22:37 2009 New Revision: 82723 URL: http://llvm.org/viewvc/llvm-project?rev=82723&view=rev Log: Remove bad tag. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2208.2/ From dalej at apple.com Thu Sep 24 17:27:07 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 24 Sep 2009 15:27:07 -0700 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html In-Reply-To: <4ABBDB4E.8080500@gmail.com> References: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> <4ABBDB4E.8080500@gmail.com> Message-ID: On Sep 24, 2009, at 1:49 PMPDT, T?r?k Edwin wrote: > On 2009-09-24 21:38, Dale Johannesen wrote: >> >> Clarify that llvm attaches C language semantics to >> functions with names that match the C library. > > In fact this list is longer [1], it includes (excluding Andersens.cpp > and SimplifyLibcalls) > abs, absf, absl, atexit, calloc, ceil, copysign, copysignf, cosl, > __dso_handle, > exit, fabsf, fabsl, free, __half_powr4, __main, main, memcpy, realloc, > _setjmp, setjmp, > sinf, sinl. Functions starting with __ are fair game, I don't think we need document those at this level. Could you add the others to my list? > Although it is very good that LLVM handles these for C/C++, it is not > necesarely good for Java/Python/some other language. I know. I'm just documenting existing behavior, partly in order to warn people interested in non-C-based languages that they have to deal with this. > Suggestion: could we have all these special function names in one > place, > and an enum? > Then all the analysis/transforms that need special function names > can call: > > enum SpecialFunctions > KnownFunctions::classifySpecialFunction(StringRef > name, Module &M); > bool KnownFunctions::isKnown(StringRef name, Module &M); > Function *KnownFunctions::getSpecial(StringRef name, Module &M); > Function *KnownFunctions::getOrInsertSpecial(StringRef name, Module > &M);//allowed to return null for failure > > If you don't want these special functions there could be a command- > line > flag and an llvm:: variable default true that could be set to false. > > [1] I generated this list with these, which is not entirely accurate > so > there may be more: > cd lib > git grep getFunction\(\"|grep -v Andersens|grep -v SimplifyLibCalls| > grep > -E -o \"[^\"]+\"|grep -v llvm|sort -u > git grep getName\(\)|grep -v Andersen|grep -v SimplifyLibCalls|grep -E > ==.+\"|grep -E -o \"[^\"]+\"|grep -v llvm |sort -u > git grep -E Name.+==.+\"|grep -v Andersen|grep -v SimplifyLibCalls| > grep > -E -o \"[^\"]+\"|grep -v llvm|sort -u > > Best regards, > --Edwin From mrs at apple.com Thu Sep 24 18:11:08 2009 From: mrs at apple.com (Mike Stump) Date: Thu, 24 Sep 2009 23:11:08 -0000 Subject: [llvm-commits] [llvm] r82727 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200909242311.n8ONB8Ru020374@zion.cs.uiuc.edu> Author: mrs Date: Thu Sep 24 18:11:08 2009 New Revision: 82727 URL: http://llvm.org/viewvc/llvm-project?rev=82727&view=rev Log: Fix spacing. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=82727&r1=82726&r2=82727&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Sep 24 18:11:08 2009 @@ -1226,7 +1226,7 @@ RI->getFrameIndexOffset(*MF, DV->getFrameIndex())); if (VD.isBlockByrefVariable()) - AddBlockByrefAddress (DV, VariableDie, dwarf::DW_AT_location, Location); + AddBlockByrefAddress(DV, VariableDie, dwarf::DW_AT_location, Location); else AddAddress(VariableDie, dwarf::DW_AT_location, Location); } From mrs at apple.com Thu Sep 24 18:21:27 2009 From: mrs at apple.com (Mike Stump) Date: Thu, 24 Sep 2009 23:21:27 -0000 Subject: [llvm-commits] [llvm] r82729 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Message-ID: <200909242321.n8ONLRQt021736@zion.cs.uiuc.edu> Author: mrs Date: Thu Sep 24 18:21:26 2009 New Revision: 82729 URL: http://llvm.org/viewvc/llvm-project?rev=82729&view=rev Log: Delete space after function name, before (, reflow a comment and delete a few blank lines. Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=82729&r1=82728&r2=82729&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Sep 24 18:21:26 2009 @@ -664,7 +664,6 @@ // Find the __forwarding field and the variable field in the __Block_byref // struct. - DIArray Fields = blockStruct.getTypeArray(); DIDescriptor varField = DIDescriptor(); DIDescriptor forwardingField = DIDescriptor(); @@ -681,20 +680,18 @@ varField = Element; } - assert (!varField.isNull() && "Can't find byref variable in Block struct"); - assert (!forwardingField.isNull() - && "Can't find forwarding field in Block struct"); + assert(!varField.isNull() && "Can't find byref variable in Block struct"); + assert(!forwardingField.isNull() + && "Can't find forwarding field in Block struct"); // Get the offsets for the forwarding field and the variable field. - unsigned int forwardingFieldOffset = DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3; unsigned int varFieldOffset = DIDerivedType(varField.getNode()).getOffsetInBits() >> 3; - // Decode the original location, and use that as the start of the - // byref variable's location. - + // Decode the original location, and use that as the start of the byref + // variable's location. unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false); DIEBlock *Block = new DIEBlock(); @@ -717,16 +714,14 @@ AddUInt(Block, 0, dwarf::DW_FORM_sdata, Location.getOffset()); } - // If we started with a pointer to the__Block_byref... struct, then + // If we started with a pointer to the __Block_byref... struct, then // the first thing we need to do is dereference the pointer (DW_OP_deref). - if (isPointer) AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); // Next add the offset for the '__forwarding' field: // DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in // adding the offset if it's 0. - if (forwardingFieldOffset > 0) { AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); AddUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset); @@ -734,20 +729,17 @@ // Now dereference the __forwarding field to get to the real __Block_byref // struct: DW_OP_deref. - AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref); // Now that we've got the real __Block_byref... struct, add the offset // for the variable's field to get to the location of the actual variable: // DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0. - if (varFieldOffset > 0) { AddUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst); AddUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset); } // Now attach the location information to the DIE. - AddBlock(Die, Attribute, 0, Block); } From dalej at apple.com Thu Sep 24 18:37:40 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 24 Sep 2009 23:37:40 -0000 Subject: [llvm-commits] [llvm] r82731 - in /llvm/trunk/test/FrontendC: 2005-07-20-SqrtNoErrno.c 2009-09-24-SqrtErrno.c Message-ID: <200909242337.n8ONbevh023692@zion.cs.uiuc.edu> Author: johannes Date: Thu Sep 24 18:37:40 2009 New Revision: 82731 URL: http://llvm.org/viewvc/llvm-project?rev=82731&view=rev Log: Reenable sqrt IR generation test. Added: llvm/trunk/test/FrontendC/2009-09-24-SqrtErrno.c Modified: llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c Modified: llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c?rev=82731&r1=82730&r2=82731&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c (original) +++ llvm/trunk/test/FrontendC/2005-07-20-SqrtNoErrno.c Thu Sep 24 18:37:40 2009 @@ -1,10 +1,11 @@ -// RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt +// RUN: %llvmgcc %s -S -o - -fno-math-errno | FileCheck %s // llvm.sqrt has undefined behavior on negative inputs, so it is // inappropriate to translate C/C++ sqrt to this. -// XFAIL: * #include float foo(float X) { - // Check that this compiles to llvm.sqrt when errno is ignored. +// CHECK: foo +// CHECK: sqrtf(float %1) nounwind readonly + // Check that this is marked readonly when errno is ignored. return sqrtf(X); } Added: llvm/trunk/test/FrontendC/2009-09-24-SqrtErrno.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-09-24-SqrtErrno.c?rev=82731&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2009-09-24-SqrtErrno.c (added) +++ llvm/trunk/test/FrontendC/2009-09-24-SqrtErrno.c Thu Sep 24 18:37:40 2009 @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o - -fmath-errno | FileCheck %s +// llvm.sqrt has undefined behavior on negative inputs, so it is +// inappropriate to translate C/C++ sqrt to this. +#include + +float foo(float X) { +// CHECK: foo +// CHECK-NOT: readonly +// CHECK: return + // Check that this is not marked readonly when errno is used. + return sqrtf(X); +} From grosbach at apple.com Thu Sep 24 18:52:18 2009 From: grosbach at apple.com (Jim Grosbach) Date: Thu, 24 Sep 2009 23:52:18 -0000 Subject: [llvm-commits] [llvm] r82734 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp CodeGen/PrologEpilogInserter.h Target/ARM/ARMBaseRegisterInfo.cpp Target/ARM/Thumb1RegisterInfo.cpp Message-ID: <200909242352.n8ONqJGh025506@zion.cs.uiuc.edu> Author: grosbach Date: Thu Sep 24 18:52:18 2009 New Revision: 82734 URL: http://llvm.org/viewvc/llvm-project?rev=82734&view=rev Log: Start of revamping the register scavenging in PEI. ARM Thumb1 is the driving interest for this, as it currently reserves a register rather than using the scavenger for matierializing constants as needed. Instead of scavenging registers on the fly while eliminating frame indices, new virtual registers are created, and then a scavenged collectively in a post-pass over the function. This isolates the bits that need to interact with the scavenger, and sets the stage for more intelligent use, and reuse, of scavenged registers. For the time being, this is disabled by default. Once the bugs are worked out, the current scavenging calls in replaceFrameIndices() will be removed and the post-pass scavenging will be the default. Until then, -enable-frame-index-scavenging enables the new code. Currently, only the Thumb1 back end is set up to use it. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/CodeGen/PrologEpilogInserter.h llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=82734&r1=82733&r2=82734&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Thu Sep 24 18:52:18 2009 @@ -31,7 +31,9 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" +#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/STLExtras.h" #include @@ -42,6 +44,16 @@ static RegisterPass X("prologepilog", "Prologue/Epilogue Insertion"); +// FIXME: For now, the frame index scavenging is off by default and only +// used by the Thumb1 target. When it's the default and replaces the current +// on-the-fly PEI scavenging for all targets, requiresRegisterScavenging() +// will replace this. +cl::opt +FrameIndexVirtualScavenging("enable-frame-index-scavenging", + cl::Hidden, + cl::desc("Enable frame index elimination with" + "virtual register scavenging")); + /// createPrologEpilogCodeInserter - This function returns a pass that inserts /// prolog and epilog code, and eliminates abstract frame references. /// @@ -104,6 +116,12 @@ // replaceFrameIndices(Fn); + // If register scavenging is needed, as we've enabled doing it as a + // post-pass, scavenge the virtual registers that frame index elimiation + // inserted. + if (TRI->requiresRegisterScavenging(Fn) && FrameIndexVirtualScavenging) + scavengeFrameVirtualRegs(Fn); + delete RS; clearAllSets(); return true; @@ -634,7 +652,7 @@ for (MachineFunction::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { int SPAdj = 0; // SP offset due to call frame setup / destroy. - if (RS) RS->enterBasicBlock(BB); + if (RS && !FrameIndexVirtualScavenging) RS->enterBasicBlock(BB); for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ) { @@ -680,7 +698,8 @@ // use that target machine register info object to eliminate // it. - TRI.eliminateFrameIndex(MI, SPAdj, RS); + TRI.eliminateFrameIndex(MI, SPAdj, FrameIndexVirtualScavenging ? + NULL : RS); // Reset the iterator if we were at the beginning of the BB. if (AtBeginning) { @@ -695,10 +714,50 @@ if (DoIncr && I != BB->end()) ++I; // Update register states. - if (RS && MI) RS->forward(MI); + if (RS && !FrameIndexVirtualScavenging && MI) RS->forward(MI); } assert(SPAdj == 0 && "Unbalanced call frame setup / destroy pairs?"); } } +void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) { + const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo(); + + // Run through the instructions and find any virtual registers. + for (MachineFunction::iterator BB = Fn.begin(), + E = Fn.end(); BB != E; ++BB) { + RS->enterBasicBlock(BB); + + // Keep a map of which scratch reg we use for each virtual reg. + // FIXME: Is a map like this the best solution? Seems like overkill, + // but to get rid of it would need some fairly strong assumptions + // that may not be valid as this gets smarter about reuse and such. + IndexedMap ScratchRegForVirtReg; + ScratchRegForVirtReg.grow(Fn.getRegInfo().getLastVirtReg()); + + for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) { + MachineInstr *MI = I; + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) + if (MI->getOperand(i).isReg()) { + unsigned Reg = MI->getOperand(i).getReg(); + if (Reg && TRI->isVirtualRegister(Reg)) { + // If we already have a scratch for this virtual register, use it + unsigned NewReg = ScratchRegForVirtReg[Reg]; + if (!NewReg) { + const TargetRegisterClass *RC = Fn.getRegInfo().getRegClass(Reg); + NewReg = RS->FindUnusedReg(RC); + if (NewReg == 0) + // No register is "free". Scavenge a register. + // FIXME: Track SPAdj. Zero won't always be right + NewReg = RS->scavengeRegister(RC, I, 0); + assert (NewReg && "unable to scavenge register!"); + ScratchRegForVirtReg[Reg] = NewReg; + } + MI->getOperand(i).setReg(NewReg); + } + } + RS->forward(MI); + } + } +} Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.h?rev=82734&r1=82733&r2=82734&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.h (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.h Thu Sep 24 18:52:18 2009 @@ -123,6 +123,7 @@ void insertCSRSpillsAndRestores(MachineFunction &Fn); void calculateFrameObjectOffsets(MachineFunction &Fn); void replaceFrameIndices(MachineFunction &Fn); + void scavengeFrameVirtualRegs(MachineFunction &Fn); void insertPrologEpilogCode(MachineFunction &Fn); // Initialize DFA sets, called before iterations. Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=82734&r1=82733&r2=82734&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Thu Sep 24 18:52:18 2009 @@ -649,10 +649,12 @@ // Estimate if we might need to scavenge a register at some point in order // to materialize a stack offset. If so, either spill one additional // callee-saved register or reserve a special spill slot to facilitate - // register scavenging. - if (RS && !ExtraCSSpill && !AFI->isThumb1OnlyFunction()) { + // register scavenging. Thumb1 needs a spill slot for stack pointer + // adjustments also, even when the frame itself is small. + if (RS && !ExtraCSSpill) { MachineFrameInfo *MFI = MF.getFrameInfo(); - if (estimateStackSize(MF, MFI) >= estimateRSStackSizeLimit(MF)) { + if (estimateStackSize(MF, MFI) >= estimateRSStackSizeLimit(MF) + || AFI->isThumb1OnlyFunction()) { // If any non-reserved CS register isn't spilled, just spill one or two // extra. That should take care of it! unsigned NumExtras = TargetAlign / 4; Modified: llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp?rev=82734&r1=82733&r2=82734&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb1RegisterInfo.cpp Thu Sep 24 18:52:18 2009 @@ -37,10 +37,10 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; -static cl::opt -ThumbRegScavenging("enable-thumb-reg-scavenging", - cl::Hidden, - cl::desc("Enable register scavenging on Thumb")); +// FIXME: This cmd line option conditionalizes the new register scavenging +// implemenation in PEI. Remove the option when scavenging works well enough +// to be the default. +extern cl::opt FrameIndexVirtualScavenging; Thumb1RegisterInfo::Thumb1RegisterInfo(const ARMBaseInstrInfo &tii, const ARMSubtarget &sti) @@ -84,7 +84,7 @@ bool Thumb1RegisterInfo::requiresRegisterScavenging(const MachineFunction &MF) const { - return ThumbRegScavenging; + return FrameIndexVirtualScavenging; } bool Thumb1RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const { @@ -113,6 +113,7 @@ const TargetInstrInfo &TII, const Thumb1RegisterInfo& MRI, DebugLoc dl) { + MachineFunction &MF = *MBB.getParent(); bool isHigh = !isARMLowRegister(DestReg) || (BaseReg != 0 && !isARMLowRegister(BaseReg)); bool isSub = false; @@ -127,9 +128,13 @@ unsigned LdReg = DestReg; if (DestReg == ARM::SP) { assert(BaseReg == ARM::SP && "Unexpected!"); - LdReg = ARM::R3; - BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R12) - .addReg(ARM::R3, RegState::Kill); + if (FrameIndexVirtualScavenging) { + LdReg = MF.getRegInfo().createVirtualRegister(ARM::tGPRRegisterClass); + } else { + LdReg = ARM::R3; + BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R12) + .addReg(ARM::R3, RegState::Kill); + } } if (NumBytes <= 255 && NumBytes >= 0) @@ -155,7 +160,7 @@ MIB.addReg(LdReg).addReg(BaseReg, RegState::Kill); AddDefaultPred(MIB); - if (DestReg == ARM::SP) + if (!FrameIndexVirtualScavenging && DestReg == ARM::SP) BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVgpr2tgpr), ARM::R3) .addReg(ARM::R12, RegState::Kill); } @@ -602,50 +607,73 @@ else // tLDR has an extra register operand. MI.addOperand(MachineOperand::CreateReg(0, false)); } else if (Desc.mayStore()) { - // FIXME! This is horrific!!! We need register scavenging. - // Our temporary workaround has marked r3 unavailable. Of course, r3 is - // also a ABI register so it's possible that is is the register that is - // being storing here. If that's the case, we do the following: - // r12 = r2 - // Use r2 to materialize sp + offset - // str r3, r2 - // r2 = r12 - unsigned ValReg = MI.getOperand(0).getReg(); - unsigned TmpReg = ARM::R3; - bool UseRR = false; - if (ValReg == ARM::R3) { - BuildMI(MBB, II, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R12) - .addReg(ARM::R2, RegState::Kill); - TmpReg = ARM::R2; - } - if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) - BuildMI(MBB, II, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R12) - .addReg(ARM::R3, RegState::Kill); - if (Opcode == ARM::tSpill) { - if (FrameReg == ARM::SP) - emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, - Offset, false, TII, *this, dl); - else { - emitLoadConstPool(MBB, II, dl, TmpReg, 0, Offset); - UseRR = true; + if (FrameIndexVirtualScavenging) { + unsigned TmpReg = + MF.getRegInfo().createVirtualRegister(ARM::tGPRRegisterClass); + bool UseRR = false; + if (Opcode == ARM::tSpill) { + if (FrameReg == ARM::SP) + emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, + Offset, false, TII, *this, dl); + else { + emitLoadConstPool(MBB, II, dl, TmpReg, 0, Offset); + UseRR = true; + } + } else + emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, + *this, dl); + MI.setDesc(TII.get(ARM::tSTR)); + MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); + if (UseRR) // Use [reg, reg] addrmode. + MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); + else // tSTR has an extra register operand. + MI.addOperand(MachineOperand::CreateReg(0, false)); + } else { + // FIXME! This is horrific!!! We need register scavenging. + // Our temporary workaround has marked r3 unavailable. Of course, r3 is + // also a ABI register so it's possible that is is the register that is + // being storing here. If that's the case, we do the following: + // r12 = r2 + // Use r2 to materialize sp + offset + // str r3, r2 + // r2 = r12 + unsigned ValReg = MI.getOperand(0).getReg(); + unsigned TmpReg = ARM::R3; + bool UseRR = false; + if (ValReg == ARM::R3) { + BuildMI(MBB, II, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R12) + .addReg(ARM::R2, RegState::Kill); + TmpReg = ARM::R2; } - } else - emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, - *this, dl); - MI.setDesc(TII.get(ARM::tSTR)); - MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); - if (UseRR) // Use [reg, reg] addrmode. - MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); - else // tSTR has an extra register operand. - MI.addOperand(MachineOperand::CreateReg(0, false)); + if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) + BuildMI(MBB, II, dl, TII.get(ARM::tMOVtgpr2gpr), ARM::R12) + .addReg(ARM::R3, RegState::Kill); + if (Opcode == ARM::tSpill) { + if (FrameReg == ARM::SP) + emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg, + Offset, false, TII, *this, dl); + else { + emitLoadConstPool(MBB, II, dl, TmpReg, 0, Offset); + UseRR = true; + } + } else + emitThumbRegPlusImmediate(MBB, II, TmpReg, FrameReg, Offset, TII, + *this, dl); + MI.setDesc(TII.get(ARM::tSTR)); + MI.getOperand(i).ChangeToRegister(TmpReg, false, false, true); + if (UseRR) // Use [reg, reg] addrmode. + MI.addOperand(MachineOperand::CreateReg(FrameReg, false)); + else // tSTR has an extra register operand. + MI.addOperand(MachineOperand::CreateReg(0, false)); - MachineBasicBlock::iterator NII = next(II); - if (ValReg == ARM::R3) - BuildMI(MBB, NII, dl, TII.get(ARM::tMOVgpr2tgpr), ARM::R2) - .addReg(ARM::R12, RegState::Kill); - if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) - BuildMI(MBB, NII, dl, TII.get(ARM::tMOVgpr2tgpr), ARM::R3) - .addReg(ARM::R12, RegState::Kill); + MachineBasicBlock::iterator NII = next(II); + if (ValReg == ARM::R3) + BuildMI(MBB, NII, dl, TII.get(ARM::tMOVgpr2tgpr), ARM::R2) + .addReg(ARM::R12, RegState::Kill); + if (TmpReg == ARM::R3 && AFI->isR3LiveIn()) + BuildMI(MBB, NII, dl, TII.get(ARM::tMOVgpr2tgpr), ARM::R3) + .addReg(ARM::R12, RegState::Kill); + } } else assert(false && "Unexpected opcode!"); @@ -834,11 +862,13 @@ if (VARegSaveSize) { // Epilogue for vararg functions: pop LR to R3 and branch off it. // FIXME: Verify this is still ok when R3 is no longer being reserved. - AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP))).addReg(ARM::R3); + AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP))) + .addReg(ARM::R3, RegState::Define); emitSPUpdate(MBB, MBBI, TII, dl, *this, VARegSaveSize); - BuildMI(MBB, MBBI, dl, TII.get(ARM::tBX_RET_vararg)).addReg(ARM::R3); + BuildMI(MBB, MBBI, dl, TII.get(ARM::tBX_RET_vararg)) + .addReg(ARM::R3, RegState::Kill); MBB.erase(MBBI); } } From kremenek at apple.com Thu Sep 24 19:22:14 2009 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 25 Sep 2009 00:22:14 -0000 Subject: [llvm-commits] [llvm] r82738 - /llvm/tags/checker/checker-0.221/ Message-ID: <200909250022.n8P0ME7H029191@zion.cs.uiuc.edu> Author: kremenek Date: Thu Sep 24 19:22:14 2009 New Revision: 82738 URL: http://llvm.org/viewvc/llvm-project?rev=82738&view=rev Log: Removing checker-0.221. Removed: llvm/tags/checker/checker-0.221/ From kremenek at apple.com Thu Sep 24 19:22:36 2009 From: kremenek at apple.com (Ted Kremenek) Date: Fri, 25 Sep 2009 00:22:36 -0000 Subject: [llvm-commits] [llvm] r82740 - /llvm/tags/checker/checker-0.221/ Message-ID: <200909250022.n8P0MaTw029256@zion.cs.uiuc.edu> Author: kremenek Date: Thu Sep 24 19:22:36 2009 New Revision: 82740 URL: http://llvm.org/viewvc/llvm-project?rev=82740&view=rev Log: Tagging checker-0.221. Added: llvm/tags/checker/checker-0.221/ - copied from r82739, llvm/trunk/ From gohman at apple.com Thu Sep 24 19:34:34 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 00:34:34 -0000 Subject: [llvm-commits] [llvm] r82742 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200909250034.n8P0YY3j030696@zion.cs.uiuc.edu> Author: djg Date: Thu Sep 24 19:34:34 2009 New Revision: 82742 URL: http://llvm.org/viewvc/llvm-project?rev=82742&view=rev Log: Add a version of dumpr() that has a SelectionDAG* argument. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=82742&r1=82741&r2=82742&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Thu Sep 24 19:34:34 2009 @@ -1295,6 +1295,7 @@ void dump() const; void dumpr() const; void dump(const SelectionDAG *G) const; + void dumpr(const SelectionDAG *G) const; static bool classof(const SDNode *) { return true; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=82742&r1=82741&r2=82742&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Sep 24 19:34:34 2009 @@ -5726,6 +5726,11 @@ DumpNodesr(errs(), this, 0, 0, once); } +void SDNode::dumpr(const SelectionDAG *G) const { + VisitedSDNodeSet once; + DumpNodesr(errs(), this, 0, G, once); +} + // getAddressSpace - Return the address space this GlobalAddress belongs to. unsigned GlobalAddressSDNode::getAddressSpace() const { From gohman at apple.com Thu Sep 24 19:57:30 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 00:57:30 -0000 Subject: [llvm-commits] [llvm] r82743 - /llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200909250057.n8P0vU8T001037@zion.cs.uiuc.edu> Author: djg Date: Thu Sep 24 19:57:30 2009 New Revision: 82743 URL: http://llvm.org/viewvc/llvm-project?rev=82743&view=rev Log: Don't try to use pre-indexed addressing with sthbrx/stwbrx instructions. This fixes a PowerPC bug exposed by some unrelated changes I'm working on. Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=82743&r1=82742&r2=82743&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Thu Sep 24 19:57:30 2009 @@ -4921,7 +4921,8 @@ } // Turn STORE (BSWAP) -> sthbrx/stwbrx. - if (N->getOperand(1).getOpcode() == ISD::BSWAP && + if (cast(N)->isUnindexed() && + N->getOperand(1).getOpcode() == ISD::BSWAP && N->getOperand(1).getNode()->hasOneUse() && (N->getOperand(1).getValueType() == MVT::i32 || N->getOperand(1).getValueType() == MVT::i16)) { From evan.cheng at apple.com Thu Sep 24 21:01:06 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 24 Sep 2009 19:01:06 -0700 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ In-Reply-To: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> References: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> Message-ID: <3024914D-354A-4E81-9A97-2EDEA66BEEBD@apple.com> Hi Victor, This is breaking tests on x86_64 / Mac OS X. I know at least of two failures under MultiSource/Applications: siod and d/make_dparser. Please revert the patch if you need time to investigate it. Thanks, Evan On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote: > Author: hernande > Date: Thu Sep 24 12:47:49 2009 > New Revision: 82694 > > URL: http://llvm.org/viewvc/llvm-project?rev=82694&view=rev > Log: > Auto-upgrade malloc instructions to malloc calls. > > Reviewed by Devang Patel. > > > Modified: > llvm/trunk/examples/BrainF/BrainF.cpp > llvm/trunk/include/llvm/Instructions.h > llvm/trunk/lib/AsmParser/LLLexer.cpp > llvm/trunk/lib/AsmParser/LLParser.cpp > llvm/trunk/lib/AsmParser/LLParser.h > llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > llvm/trunk/lib/VMCore/Core.cpp > llvm/trunk/lib/VMCore/Instructions.cpp > llvm/trunk/test/Analysis/PointerTracking/sizes.ll > llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll > llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll > llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll > llvm/trunk/test/Transforms/InstCombine/cast.ll > llvm/trunk/test/Transforms/InstCombine/getelementptr.ll > llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll > llvm/trunk/test/Transforms/InstCombine/malloc2.ll > > Modified: llvm/trunk/examples/BrainF/BrainF.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/examples/BrainF/BrainF.cpp (original) > +++ llvm/trunk/examples/BrainF/BrainF.cpp Thu Sep 24 12:47:49 2009 > @@ -25,6 +25,7 @@ > > #include "BrainF.h" > #include "llvm/Constants.h" > +#include "llvm/Instructions.h" > #include "llvm/Intrinsics.h" > #include "llvm/ADT/STLExtras.h" > #include > @@ -78,7 +79,11 @@ > > //%arr = malloc i8, i32 %d > ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); > - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), > val_mem, "arr"); > + BasicBlock* BB = builder->GetInsertBlock(); > + const Type* IntPtrTy = IntegerType::getInt32Ty(C); > + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, > IntegerType::getInt8Ty(C), > + val_mem, NULL, "arr"); > + BB->getInstList().push_back(cast(ptr_arr)); > > //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) > { > > Modified: llvm/trunk/include/llvm/Instructions.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Instructions.h (original) > +++ llvm/trunk/include/llvm/Instructions.h Thu Sep 24 12:47:49 2009 > @@ -1044,7 +1044,7 @@ > const Twine &Name = ""); > static Value *CreateMalloc(BasicBlock *InsertAtEnd, const Type > *IntPtrTy, > const Type *AllocTy, Value *ArraySize = > 0, > - const Twine &Name = ""); > + Function* MallocF = 0, const Twine > &Name = ""); > > ~CallInst(); > > @@ -1149,6 +1149,11 @@ > const Value *getCalledValue() const { return Op<0>(); } > Value *getCalledValue() { return Op<0>(); } > > + /// setCalledFunction - Set the function called > + void setCalledFunction(Value* Fn) { > + Op<0>() = Fn; > + } > + > // Methods for support type inquiry through isa, cast, and dyn_cast: > static inline bool classof(const CallInst *) { return true; } > static inline bool classof(const Instruction *I) { > > Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) > +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Thu Sep 24 12:47:49 2009 > @@ -602,6 +602,9 @@ > // Scan CurPtr ahead, seeing if there is just whitespace before > the newline. > if (JustWhitespaceNewLine(CurPtr)) > return lltok::kw_zeroext; > + } else if (Len == 6 && !memcmp(StartChar, "malloc", 6)) { > + // Autoupgrade malloc instruction > + return lltok::kw_malloc; > } > > // Keywords for instructions. > @@ -641,7 +644,6 @@ > INSTKEYWORD(unwind, Unwind); > INSTKEYWORD(unreachable, Unreachable); > > - INSTKEYWORD(malloc, Malloc); > INSTKEYWORD(alloca, Alloca); > INSTKEYWORD(free, Free); > INSTKEYWORD(load, Load); > > Modified: llvm/trunk/lib/AsmParser/LLParser.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) > +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Sep 24 12:47:49 2009 > @@ -69,6 +69,27 @@ > /// ValidateEndOfModule - Do final validity and sanity checks at the > end of the > /// module. > bool LLParser::ValidateEndOfModule() { > + // Update auto-upgraded malloc calls from "autoupgrade_malloc" to > "malloc". > + if (MallocF) { > + MallocF->setName("malloc"); > + // If setName() does not set the name to "malloc", then there > is already a > + // declaration of "malloc". In that case, iterate over all > calls to MallocF > + // and get them to call the declared "malloc" instead. > + if (MallocF->getName() != "malloc") { > + Function* realMallocF = M->getFunction("malloc"); > + for (User::use_iterator UI = MallocF->use_begin(), UE= > MallocF->use_end(); > + UI != UE; ) { > + User* user = *UI; > + UI++; > + if (CallInst *Call = dyn_cast(user)) > + Call->setCalledFunction(realMallocF); > + } > + if (!realMallocF->doesNotAlias(0)) realMallocF- > >setDoesNotAlias(0); > + MallocF->eraseFromParent(); > + MallocF = NULL; > + } > + } > + > if (!ForwardRefTypes.empty()) > return Error(ForwardRefTypes.begin()->second.second, > "use of undefined type named '" + > @@ -2776,8 +2797,8 @@ > case lltok::kw_call: return ParseCall(Inst, PFS, false); > case lltok::kw_tail: return ParseCall(Inst, PFS, true); > // Memory. > - case lltok::kw_alloca: > - case lltok::kw_malloc: return ParseAlloc(Inst, PFS, > KeywordVal); > + case lltok::kw_alloca: return ParseAlloc(Inst, PFS); > + case lltok::kw_malloc: return ParseAlloc(Inst, PFS, BB, > false); > case lltok::kw_free: return ParseFree(Inst, PFS); > case lltok::kw_load: return ParseLoad(Inst, PFS, false); > case lltok::kw_store: return ParseStore(Inst, PFS, false); > @@ -3286,7 +3307,7 @@ > } > > /// ParsePHI > -/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' > Value?? ']')* > +/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' > Value????? ']')* > bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) { > PATypeHolder Ty(Type::getVoidTy(Context)); > Value *Op0, *Op1; > @@ -3431,7 +3452,7 @@ > /// ::= 'malloc' Type (',' TypeAndValue)? (',' OptionalInfo)? > /// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalInfo)? > bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, > - unsigned Opc) { > + BasicBlock* BB, bool isAlloca) { > PATypeHolder Ty(Type::getVoidTy(Context)); > Value *Size = 0; > LocTy SizeLoc; > @@ -3451,10 +3472,21 @@ > if (Size && Size->getType() != Type::getInt32Ty(Context)) > return Error(SizeLoc, "element count must be i32"); > > - if (Opc == Instruction::Malloc) > - Inst = new MallocInst(Ty, Size, Alignment); > - else > + if (isAlloca) > Inst = new AllocaInst(Ty, Size, Alignment); > + else { > + // Autoupgrade old malloc instruction to malloc call. > + const Type* IntPtrTy = Type::getInt32Ty(Context); > + const Type* Int8PtrTy = PointerType::getUnqual(Type::getInt8Ty > (Context)); > + if (!MallocF) > + // Prototype malloc as "void *autoupgrade_malloc(int32)". > + MallocF = cast(M->getOrInsertFunction > ("autoupgrade_malloc", > + Int8PtrTy, IntPtrTy, NULL)); > + // "autoupgrade_malloc" updated to "malloc" in > ValidateEndOfModule(). > + > + Inst = cast(CallInst::CreateMalloc(BB, IntPtrTy, Ty, > + Size, MallocF)); > + } > return false; > } > > > Modified: llvm/trunk/lib/AsmParser/LLParser.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/AsmParser/LLParser.h (original) > +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Sep 24 12:47:49 2009 > @@ -75,9 +75,11 @@ > std::map > > ForwardRefVals; > std::map > > ForwardRefValIDs; > std::vector NumberedVals; > + Function* MallocF; > public: > LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, > Module *m) : > - Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M > (m) {} > + Context(m->getContext()), Lex(F, SM, Err, m->getContext()), > + M(m), MallocF(NULL) {} > bool Run(); > > LLVMContext& getContext() { return Context; } > @@ -276,7 +278,8 @@ > bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS); > bool ParsePHI(Instruction *&I, PerFunctionState &PFS); > bool ParseCall(Instruction *&I, PerFunctionState &PFS, bool > isTail); > - bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, > unsigned Opc); > + bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, > + BasicBlock *BB = 0, bool isAlloca = true); > bool ParseFree(Instruction *&I, PerFunctionState &PFS); > bool ParseLoad(Instruction *&I, PerFunctionState &PFS, bool > isVolatile); > bool ParseStore(Instruction *&I, PerFunctionState &PFS, bool > isVolatile); > > Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) > +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Sep 24 > 12:47:49 2009 > @@ -2046,14 +2046,21 @@ > } > > case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align] > + // Autoupgrade malloc instruction to malloc call. > if (Record.size() < 3) > return Error("Invalid MALLOC record"); > const PointerType *Ty = > dyn_cast_or_null(getTypeByID(Record[0])); > Value *Size = getFnValueByID(Record[1], Type::getInt32Ty > (Context)); > - unsigned Align = Record[2]; > if (!Ty || !Size) return Error("Invalid MALLOC record"); > - I = new MallocInst(Ty->getElementType(), Size, (1 << Align) > >> 1); > + if (!CurBB) return Error("Invalid malloc instruction with no > BB"); > + const Type* Int32Ty = IntegerType::getInt32Ty(CurBB- > >getContext()); > + if (Size->getType() != Int32Ty) > + Size = CastInst::CreateIntegerCast(Size, Int32Ty, false / > *ZExt*/, > + "", CurBB); > + Value* Malloc = CallInst::CreateMalloc(CurBB, Int32Ty, > + Ty->getElementType(), > Size, NULL); > + I = cast(Malloc); > InstructionList.push_back(I); > break; > } > > Modified: llvm/trunk/lib/VMCore/Core.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Core.cpp (original) > +++ llvm/trunk/lib/VMCore/Core.cpp Thu Sep 24 12:47:49 2009 > @@ -1636,12 +1636,16 @@ > > LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, > const char *Name) { > - return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), 0, Name)); > + const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock > ()->getContext()); > + return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), > IntPtrT, > + unwrap(Ty), 0, 0, Twine(Name))); > } > > LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, > LLVMValueRef Val, const char > *Name) { > - return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), unwrap(Val), > Name)); > + const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock > ()->getContext()); > + return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), > IntPtrT, > + unwrap(Ty), unwrap(Val), 0, > Twine(Name))); > } > > LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, > > Modified: llvm/trunk/lib/VMCore/Instructions.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Instructions.cpp (original) > +++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Sep 24 12:47:49 2009 > @@ -462,7 +462,8 @@ > > static Value *createMalloc(Instruction *InsertBefore, BasicBlock > *InsertAtEnd, > const Type *IntPtrTy, const Type *AllocTy, > - Value *ArraySize, const Twine &NameStr) { > + Value *ArraySize, Function* MallocF, > + const Twine &NameStr) { > assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && ! > InsertAtEnd)) && > "createMalloc needs either InsertBefore or InsertAtEnd"); > > @@ -499,10 +500,11 @@ > BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : > InsertAtEnd; > Module* M = BB->getParent()->getParent(); > const Type *BPTy = PointerType::getUnqual(Type::getInt8Ty(BB- > >getContext())); > - // prototype malloc as "void *malloc(size_t)" > - Constant *MallocF = M->getOrInsertFunction("malloc", BPTy, > IntPtrTy, NULL); > - if (!cast(MallocF)->doesNotAlias(0)) > - cast(MallocF)->setDoesNotAlias(0); > + if (!MallocF) > + // prototype malloc as "void *malloc(size_t)" > + MallocF = cast(M->getOrInsertFunction("malloc", BPTy, > + IntPtrTy, NULL)); > + if (!MallocF->doesNotAlias(0)) MallocF->setDoesNotAlias(0); > const PointerType *AllocPtrType = PointerType::getUnqual(AllocTy); > CallInst *MCall = NULL; > Value *MCast = NULL; > @@ -531,7 +533,8 @@ > Value *CallInst::CreateMalloc(Instruction *InsertBefore, const Type > *IntPtrTy, > const Type *AllocTy, Value *ArraySize, > const Twine &Name) { > - return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, > ArraySize, Name); > + return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, > + ArraySize, NULL, Name); > } > > /// CreateMalloc - Generate the IR for a call to malloc: > @@ -544,8 +547,9 @@ > /// responsibility of the caller. > Value *CallInst::CreateMalloc(BasicBlock *InsertAtEnd, const Type > *IntPtrTy, > const Type *AllocTy, Value *ArraySize, > - const Twine &Name) { > - return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, > ArraySize, Name); > + Function* MallocF, const Twine &Name) { > + return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, > + ArraySize, MallocF, Name); > } > > // > = > = > = > ----------------------------------------------------------------------= > ==// > > Modified: llvm/trunk/test/Analysis/PointerTracking/sizes.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/PointerTracking/sizes.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Analysis/PointerTracking/sizes.ll (original) > +++ llvm/trunk/test/Analysis/PointerTracking/sizes.ll Thu Sep 24 > 12:47:49 2009 > @@ -63,7 +63,7 @@ > define i32 @foo2(i32 %n) nounwind { > entry: > %call = malloc i8, i32 %n ; [#uses=1] > -; CHECK: %call = > +; CHECK: %malloccall = > ; CHECK: ==> %n elements, %n bytes allocated > %call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; > [#uses=1] > ; CHECK: %call2 = > > Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll > (original) > +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll Thu Sep > 24 12:47:49 2009 > @@ -1,4 +1,6 @@ > -; RUN: opt < %s -globalopt -S | not grep malloc > +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc > +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- > i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64- > f80:128:128" > +target triple = "i686-apple-darwin8" > > @G = internal global i32* null ; [#uses=3] > > > Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll > (original) > +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll Thu Sep > 24 12:47:49 2009 > @@ -1,4 +1,6 @@ > -; RUN: opt < %s -globalopt -S | not grep malloc > +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc > +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- > i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64- > f80:128:128" > +target triple = "i686-apple-darwin8" > > @G = internal global i32* null ; [#uses=4] > > > Modified: llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll (original) > +++ llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll Thu Sep 24 > 12:47:49 2009 > @@ -1,6 +1,6 @@ > ; test that casted mallocs get converted to malloc of the right type > ; RUN: opt < %s -instcombine -S | \ > -; RUN: not grep bitcast > +; RUN: grep bitcast | count 1 > > ; The target datalayout is important for this test case. We have to > tell > ; instcombine that the ABI alignment for a long is 4-bytes, not 8, > otherwise > > Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/cast.ll (original) > +++ llvm/trunk/test/Transforms/InstCombine/cast.ll Thu Sep 24 > 12:47:49 2009 > @@ -79,9 +79,9 @@ > } > > define i32* @test12() { > - %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] > - %c = bitcast [4 x i8]* %p to i32* ; > [#uses=1] > - ret i32* %c > + %c = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] > + %p = bitcast [4 x i8]* %c to i32* ; > [#uses=1] > + ret i32* %p > } > define i8* @test13(i64 %A) { > %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf > to [0 x i8]*), i64 0, i64 %A ; [#uses=1] > > Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/getelementptr.ll (original) > +++ llvm/trunk/test/Transforms/InstCombine/getelementptr.ll Thu Sep > 24 12:47:49 2009 > @@ -58,7 +58,7 @@ > %B = getelementptr i32* %A, i64 2 > ret i32* %B > ; CHECK: @test6 > -; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 > +; CHECK: getelementptr i8* %malloccall, i64 8 > } > > define i32* @test7(i32* %I, i64 %C, i64 %D) { > > Modified: llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll > (original) > +++ llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Thu > Sep 24 12:47:49 2009 > @@ -1,5 +1,5 @@ > ; RUN: opt < %s -instcombine -S | grep {ret i32 0} > -; RUN: opt < %s -instcombine -S | not grep malloc > +; RUN: opt < %s -instcombine -globaldce -S | not grep malloc > ; PR1201 > define i32 @main(i32 %argc, i8** %argv) { > %c_19 = alloca i8* ; [#uses=2] > > Modified: llvm/trunk/test/Transforms/InstCombine/malloc2.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc2.ll?rev=82694&r1=82693&r2=82694&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/malloc2.ll (original) > +++ llvm/trunk/test/Transforms/InstCombine/malloc2.ll Thu Sep 24 > 12:47:49 2009 > @@ -1,5 +1,4 @@ > ; RUN: opt < %s -instcombine -S | grep {ret i32 0} > -; RUN: opt < %s -instcombine -S | not grep malloc > ; PR1313 > > define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From bob.wilson at apple.com Fri Sep 25 00:30:55 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Sep 2009 05:30:55 -0000 Subject: [llvm-commits] [llvm] r82750 - /llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Message-ID: <200909250530.n8P5Ut2S002869@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 25 00:30:55 2009 New Revision: 82750 URL: http://llvm.org/viewvc/llvm-project?rev=82750&view=rev Log: Update the description of MachineFrameInfo's OffsetAdjustment. The value of this adjustment does not change the direction or the signs of the object offsets, and the details of the offset calculations can be target-specific. Also mention that for most targets this value is only used to generate debug info. Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=82750&r1=82749&r2=82750&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Fri Sep 25 00:30:55 2009 @@ -133,11 +133,14 @@ uint64_t StackSize; /// OffsetAdjustment - The amount that a frame offset needs to be adjusted to - /// have the actual offset from the stack/frame pointer. The calculation is - /// MFI->getObjectOffset(Index) + StackSize - TFI.getOffsetOfLocalArea() + - /// OffsetAdjustment. If OffsetAdjustment is zero (default) then offsets are - /// away from TOS. If OffsetAdjustment == StackSize then offsets are toward - /// TOS. + /// have the actual offset from the stack/frame pointer. The exact usage of + /// this is target-dependent, but it is typically used to adjust between + /// SP-relative and FP-relative offsets. E.G., if objects are accessed via + /// SP then OffsetAdjustment is zero; if FP is used, OffsetAdjustment is set + /// to the distance between the initial SP and the value in FP. For many + /// targets, this value is only used when generating debug info (via + /// TargetRegisterInfo::getFrameIndexOffset); when generating code, the + /// corresponding adjustments are performed directly. int OffsetAdjustment; /// MaxAlignment - The prolog/epilog code inserter may process objects From natebegeman at mac.com Fri Sep 25 01:05:26 2009 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 25 Sep 2009 06:05:26 -0000 Subject: [llvm-commits] [llvm] r82753 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200909250605.n8P65QuL007146@zion.cs.uiuc.edu> Author: sampo Date: Fri Sep 25 01:05:26 2009 New Revision: 82753 URL: http://llvm.org/viewvc/llvm-project?rev=82753&view=rev Log: Fix combiner-aa issue with bases which are different, but can alias. Previously, it treated GV+28 GV+0 as different bases, and assumed they could not alias. 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=82753&r1=82752&r2=82753&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Sep 25 01:05:26 2009 @@ -6089,11 +6089,12 @@ return S; } -/// FindBaseOffset - Return true if base is known not to alias with anything -/// but itself. Provides base object and offset as results. -static bool FindBaseOffset(SDValue Ptr, SDValue &Base, int64_t &Offset) { +/// FindBaseOffset - Return true if base is a frame index, which is known not +// to alias with anything but itself. Provides base object and offset as results. +static bool FindBaseOffset(SDValue Ptr, SDValue &Base, int64_t &Offset, + GlobalValue *&GV, void *&CV) { // Assume it is a primitive operation. - Base = Ptr; Offset = 0; + Base = Ptr; Offset = 0; GV = 0; CV = 0; // If it's an adding a simple constant then integrate the offset. if (Base.getOpcode() == ISD::ADD) { @@ -6102,11 +6103,27 @@ Offset += C->getZExtValue(); } } - + + // Return the underlying GlobalValue, and update the Offset. Return false + // for GlobalAddressSDNode since the same GlobalAddress may be represented + // by multiple nodes with different offsets. + if (GlobalAddressSDNode *G = dyn_cast(Base)) { + GV = G->getGlobal(); + Offset += G->getOffset(); + return false; + } + + // Return the underlying Constant value, and update the Offset. Return false + // for ConstantSDNodes since the same constant pool entry may be represented + // by multiple nodes with different offsets. + if (ConstantPoolSDNode *C = dyn_cast(Base)) { + CV = C->isMachineConstantPoolEntry() ? (void *)C->getMachineCPVal() + : (void *)C->getConstVal(); + Offset += C->getOffset(); + return false; + } // If it's any of the following then it can't alias with anything but itself. - return isa(Base) || - isa(Base) || - isa(Base); + return isa(Base); } /// isAlias - Return true if there is any possibility that the two addresses @@ -6123,16 +6140,19 @@ // Gather base node and offset information. SDValue Base1, Base2; int64_t Offset1, Offset2; - bool KnownBase1 = FindBaseOffset(Ptr1, Base1, Offset1); - bool KnownBase2 = FindBaseOffset(Ptr2, Base2, Offset2); + GlobalValue *GV1, *GV2; + void *CV1, *CV2; + bool isFrameIndex1 = FindBaseOffset(Ptr1, Base1, Offset1, GV1, CV1); + bool isFrameIndex2 = FindBaseOffset(Ptr2, Base2, Offset2, GV2, CV2); - // If they have a same base address then... - if (Base1 == Base2) - // Check to see if the addresses overlap. + // If they have a same base address then check to see if they overlap. + if (Base1 == Base2 || (GV1 && (GV1 == GV2)) || (CV1 && (CV1 == CV2))) return !((Offset1 + Size1) <= Offset2 || (Offset2 + Size2) <= Offset1); - // If we know both bases then they can't alias. - if (KnownBase1 && KnownBase2) return false; + // If we know what the bases are, and they aren't identical, then we know they + // cannot alias. + if ((isFrameIndex1 || CV1 || GV1) && (isFrameIndex2 || CV2 || GV2)) + return false; // If we know required SrcValue1 and SrcValue2 have relatively large alignment // compared to the size and offset of the access, we may be able to prove they From sabre at nondot.org Fri Sep 25 01:32:47 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 06:32:47 -0000 Subject: [llvm-commits] [llvm] r82754 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909250632.n8P6Wls8010466@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 01:32:47 2009 New Revision: 82754 URL: http://llvm.org/viewvc/llvm-project?rev=82754&view=rev Log: turn a std::pair into a real class. Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82754&r1=82753&r2=82754&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Sep 25 01:32:47 2009 @@ -44,10 +44,39 @@ // Pattern Handling Code. //===----------------------------------------------------------------------===// +class PatternChunk { + StringRef Str; + bool isRegEx; +public: + PatternChunk(StringRef S, bool isRE) : Str(S), isRegEx(isRE) {} + + + size_t Match(StringRef Buffer, size_t &MatchLen) const { + if (!isRegEx) { + // Fixed string match. + MatchLen = Str.size(); + return Buffer.find(Str); + } + + // Regex match. + SmallVector MatchInfo; + if (!Regex(Str, Regex::Sub).match(Buffer, &MatchInfo)) + return StringRef::npos; + + // Successful regex match. + assert(!MatchInfo.empty() && "Didn't get any match"); + StringRef FullMatch = MatchInfo[0]; + + MatchLen = FullMatch.size(); + return FullMatch.data()-Buffer.data(); + } + +}; + class Pattern { /// Chunks - The pattern chunks to match. If the bool is false, it is a fixed /// string match, if it is true, it is a regex match. - SmallVector, 4> Chunks; + SmallVector Chunks; public: Pattern() { } @@ -82,8 +111,7 @@ // Find the end, which is the start of the next regex. size_t FixedMatchEnd = PatternStr.find("{{"); - Chunks.push_back(std::make_pair(PatternStr.substr(0, FixedMatchEnd), - false)); + Chunks.push_back(PatternChunk(PatternStr.substr(0, FixedMatchEnd),false)); PatternStr = PatternStr.substr(FixedMatchEnd); continue; } @@ -104,7 +132,7 @@ return true; } - Chunks.push_back(std::make_pair(PatternStr.substr(2, End-2), true)); + Chunks.push_back(PatternChunk(PatternStr.substr(2, End-2), true)); PatternStr = PatternStr.substr(End+2); } @@ -118,30 +146,13 @@ size_t FirstMatch = StringRef::npos; MatchLen = 0; - SmallVector MatchInfo; - while (!Buffer.empty()) { StringRef MatchAttempt = Buffer; unsigned ChunkNo = 0, e = Chunks.size(); for (; ChunkNo != e; ++ChunkNo) { - StringRef PatternStr = Chunks[ChunkNo].first; - - size_t ThisMatch = StringRef::npos; - size_t ThisLength = StringRef::npos; - if (!Chunks[ChunkNo].second) { - // Fixed string match. - ThisMatch = MatchAttempt.find(Chunks[ChunkNo].first); - ThisLength = Chunks[ChunkNo].first.size(); - } else if (Regex(Chunks[ChunkNo].first, Regex::Sub).match(MatchAttempt, &MatchInfo)) { - // Successful regex match. - assert(!MatchInfo.empty() && "Didn't get any match"); - StringRef FullMatch = MatchInfo[0]; - MatchInfo.clear(); - - ThisMatch = FullMatch.data()-MatchAttempt.data(); - ThisLength = FullMatch.size(); - } + size_t ThisMatch, ThisLength = StringRef::npos; + ThisMatch = Chunks[ChunkNo].Match(MatchAttempt, ThisLength); // Otherwise, what we do depends on if this is the first match or not. If // this is the first match, it doesn't match to match at the start of From sabre at nondot.org Fri Sep 25 01:37:22 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 06:37:22 -0000 Subject: [llvm-commits] [llvm] r82756 - /llvm/trunk/test/CodeGen/X86/xorl.ll Message-ID: <200909250637.n8P6bMf0011055@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 01:37:22 2009 New Revision: 82756 URL: http://llvm.org/viewvc/llvm-project?rev=82756&view=rev Log: remove a large unreduced testcase Removed: llvm/trunk/test/CodeGen/X86/xorl.ll Removed: llvm/trunk/test/CodeGen/X86/xorl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xorl.ll?rev=82755&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/xorl.ll (original) +++ llvm/trunk/test/CodeGen/X86/xorl.ll (removed) @@ -1,85 +0,0 @@ -; RUN: llc < %s -march=x86 | grep xorl | count 1 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9" - %struct.block_symbol = type { [3 x %struct.cgraph_rtl_info], %struct.object_block*, i64 } - %struct.rtx_def = type <{ i16, i8, i8, %struct.u }> - %struct.u = type { %struct.block_symbol } - %struct.cgraph_rtl_info = type { i32 } - %struct.object_block = type { %struct.section*, i32, i64, %struct.VEC_rtx_gc*, %struct.VEC_rtx_gc* } - %struct.section = type { %struct.unnamed_section } - %struct.VEC_rtx_base = type { i32, i32, [1 x %struct.rtx_def*] } - %struct.VEC_rtx_gc = type { %struct.VEC_rtx_base } - %struct.tree_common = type <{ %struct.tree_node*, %struct.tree_node*, %union.tree_ann_d*, i8, i8, i8, i8, i8, [3 x i8] }> - %struct.tree_complex = type { %struct.tree_common, %struct.tree_node*, %struct.tree_node* } - %struct.tree_node = type { %struct.tree_complex, [116 x i8] } - %struct.unnamed_section = type { %struct.cgraph_rtl_info, void (i8*)*, i8*, %struct.section* } - %union.tree_ann_d = type opaque - -define %struct.rtx_def* @expand_call() nounwind { -entry: - br i1 false, label %bb216, label %bb171 -bb171: ; preds = %entry - ret %struct.rtx_def* null -bb216: ; preds = %entry - br i1 false, label %bb336, label %bb222 -bb222: ; preds = %bb216 - ret %struct.rtx_def* null -bb336: ; preds = %bb216 - br i1 false, label %bb429, label %bb417 -bb417: ; preds = %bb336 - ret %struct.rtx_def* null -bb429: ; preds = %bb336 - br i1 false, label %bb713, label %bb493 -bb493: ; preds = %bb429 - ret %struct.rtx_def* null -bb713: ; preds = %bb429 - br i1 false, label %bb810, label %bb797 -bb797: ; preds = %bb713 - ret %struct.rtx_def* null -bb810: ; preds = %bb713 - br i1 false, label %bb822, label %bb815 -bb815: ; preds = %bb810 - ret %struct.rtx_def* null -bb822: ; preds = %bb810 - br label %bb1652.preheader -bb919: ; preds = %bb1652.preheader - ret %struct.rtx_def* null -bb1657: ; preds = %bb1652.preheader - br i1 false, label %bb1666, label %bb1652.preheader -bb1652.preheader: ; preds = %bb1657, %bb822 - br i1 false, label %bb1657, label %bb919 -bb1666: ; preds = %bb1657 - br i1 false, label %bb1815.preheader, label %bb1870 -bb1815.preheader: ; preds = %bb1666 - br i1 false, label %bb1693, label %bb1828 -bb1693: ; preds = %bb1815.preheader - br i1 false, label %bb1718, label %bb1703 -bb1703: ; preds = %bb1693 - ret %struct.rtx_def* null -bb1718: ; preds = %bb1693 - br i1 false, label %bb1741, label %bb1828 -bb1741: ; preds = %bb1718 - switch i8 0, label %bb1775 [ - i8 54, label %bb1798 - i8 58, label %bb1798 - i8 55, label %bb1798 - ] -bb1775: ; preds = %bb1741 - ret %struct.rtx_def* null -bb1798: ; preds = %bb1741, %bb1741, %bb1741 - %tmp1811 = add i32 0, 0 ; [#uses=1] - br label %bb1828 -bb1828: ; preds = %bb1798, %bb1718, %bb1815.preheader - %copy_to_evaluate_size.1.lcssa = phi i32 [ 0, %bb1815.preheader ], [ %tmp1811, %bb1798 ], [ 0, %bb1718 ] ; [#uses=1] - %tmp1830 = shl i32 %copy_to_evaluate_size.1.lcssa, 1 ; [#uses=1] - %tmp18301831 = sext i32 %tmp1830 to i64 ; [#uses=1] - %tmp1835 = icmp slt i64 %tmp18301831, 0 ; [#uses=1] - %tmp1835.not = xor i1 %tmp1835, true ; [#uses=1] - %bothcond6193 = and i1 %tmp1835.not, false ; [#uses=1] - br i1 %bothcond6193, label %bb1845, label %bb1870 -bb1845: ; preds = %bb1828 - ret %struct.rtx_def* null -bb1870: ; preds = %bb1828, %bb1666 - ret %struct.rtx_def* null -} From sabre at nondot.org Fri Sep 25 01:47:09 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 06:47:09 -0000 Subject: [llvm-commits] [llvm] r82758 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909250647.n8P6l9G8012252@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 01:47:09 2009 New Revision: 82758 URL: http://llvm.org/viewvc/llvm-project?rev=82758&view=rev Log: filecheck should not match a \n with a . Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82758&r1=82757&r2=82758&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Sep 25 01:47:09 2009 @@ -50,7 +50,6 @@ public: PatternChunk(StringRef S, bool isRE) : Str(S), isRegEx(isRE) {} - size_t Match(StringRef Buffer, size_t &MatchLen) const { if (!isRegEx) { // Fixed string match. @@ -60,7 +59,7 @@ // Regex match. SmallVector MatchInfo; - if (!Regex(Str, Regex::Sub).match(Buffer, &MatchInfo)) + if (!Regex(Str, Regex::Sub|Regex::Newline).match(Buffer, &MatchInfo)) return StringRef::npos; // Successful regex match. @@ -70,7 +69,6 @@ MatchLen = FullMatch.size(); return FullMatch.data()-Buffer.data(); } - }; class Pattern { From sabre at nondot.org Fri Sep 25 01:49:42 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 06:49:42 -0000 Subject: [llvm-commits] [llvm] r82759 - in /llvm/trunk/test/CodeGen/X86: xor-undef.ll xor.ll xor_not.ll Message-ID: <200909250649.n8P6ngEu012569@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 01:49:41 2009 New Revision: 82759 URL: http://llvm.org/viewvc/llvm-project?rev=82759&view=rev Log: convert testcases to filecheck. Added: llvm/trunk/test/CodeGen/X86/xor.ll Removed: llvm/trunk/test/CodeGen/X86/xor-undef.ll llvm/trunk/test/CodeGen/X86/xor_not.ll Removed: llvm/trunk/test/CodeGen/X86/xor-undef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor-undef.ll?rev=82758&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/xor-undef.ll (original) +++ llvm/trunk/test/CodeGen/X86/xor-undef.ll (removed) @@ -1,11 +0,0 @@ -; RUN: llc < %s -march=x86 -mattr=+sse2 | grep xor | count 2 - -define <4 x i32> @t1() { - %tmp = xor <4 x i32> undef, undef - ret <4 x i32> %tmp -} - -define i32 @t2() { - %tmp = xor i32 undef, undef - ret i32 %tmp -} Added: llvm/trunk/test/CodeGen/X86/xor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor.ll?rev=82759&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/xor.ll (added) +++ llvm/trunk/test/CodeGen/X86/xor.ll Fri Sep 25 01:49:41 2009 @@ -0,0 +1,133 @@ +; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s -check-prefix=X32 +; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64 + +; Though it is undefined, we want xor undef,undef to produce zero. +define <4 x i32> @test1() nounwind { + %tmp = xor <4 x i32> undef, undef + ret <4 x i32> %tmp + +; X32: test1: +; X32: xorps %xmm0, %xmm0 +; X32: ret +} + +; Though it is undefined, we want xor undef,undef to produce zero. +define i32 @test2() nounwind{ + %tmp = xor i32 undef, undef + ret i32 %tmp +; X32: test2: +; X32: xorl %eax, %eax +; X32: ret +} + +define i32 @test3(i32 %a, i32 %b) nounwind { +entry: + %tmp1not = xor i32 %b, -2 + %tmp3 = and i32 %tmp1not, %a + %tmp4 = lshr i32 %tmp3, 1 + ret i32 %tmp4 + +; X64: test3: +; X64: notl %esi +; X64: andl %edi, %esi +; X64: movl %esi, %eax +; X64: shrl %eax +; X64: ret + +; X32: test3: +; X32: movl 8(%esp), %eax +; X32: notl %eax +; X32: andl 4(%esp), %eax +; X32: shrl %eax +; X32: ret +} + +define i32 @test4(i32 %a, i32 %b) nounwind { +entry: + br label %bb +bb: + %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ] + %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ] + %tmp3 = xor i32 %a_addr.0, %b_addr.0 + %tmp4not = xor i32 %tmp3, 2147483647 + %tmp6 = and i32 %tmp4not, %b_addr.0 + %tmp8 = shl i32 %tmp6, 1 + %tmp10 = icmp eq i32 %tmp8, 0 + br i1 %tmp10, label %bb12, label %bb +bb12: + ret i32 %tmp3 + +; X64: test4: +; X64: notl %eax +; X64: andl {{.*%eax}} +; X32: test4: +; X32: notl %edx +; X32: andl {{.*%edx}} +} + +define i16 @test5(i16 %a, i16 %b) nounwind { +entry: + br label %bb +bb: + %b_addr.0 = phi i16 [ %b, %entry ], [ %tmp8, %bb ] + %a_addr.0 = phi i16 [ %a, %entry ], [ %tmp3, %bb ] + %tmp3 = xor i16 %a_addr.0, %b_addr.0 + %tmp4not = xor i16 %tmp3, 32767 + %tmp6 = and i16 %tmp4not, %b_addr.0 + %tmp8 = shl i16 %tmp6, 1 + %tmp10 = icmp eq i16 %tmp8, 0 + br i1 %tmp10, label %bb12, label %bb +bb12: + ret i16 %tmp3 +; X64: test5: +; X64: notw %ax +; X64: andw {{.*%ax}} +; X32: test5: +; X32: notw %dx +; X32: andw {{.*%dx}} +} + +define i8 @test6(i8 %a, i8 %b) nounwind { +entry: + br label %bb +bb: + %b_addr.0 = phi i8 [ %b, %entry ], [ %tmp8, %bb ] + %a_addr.0 = phi i8 [ %a, %entry ], [ %tmp3, %bb ] + %tmp3 = xor i8 %a_addr.0, %b_addr.0 + %tmp4not = xor i8 %tmp3, 127 + %tmp6 = and i8 %tmp4not, %b_addr.0 + %tmp8 = shl i8 %tmp6, 1 + %tmp10 = icmp eq i8 %tmp8, 0 + br i1 %tmp10, label %bb12, label %bb +bb12: + ret i8 %tmp3 +; X64: test6: +; X64: notb %al +; X64: andb {{.*%al}} +; X32: test6: +; X32: notb %dl +; X32: andb {{.*%dl}} +} + +define i32 @test7(i32 %a, i32 %b) nounwind { +entry: + br label %bb +bb: + %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ] + %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ] + %tmp3 = xor i32 %a_addr.0, %b_addr.0 + %tmp4not = xor i32 %tmp3, 2147483646 + %tmp6 = and i32 %tmp4not, %b_addr.0 + %tmp8 = shl i32 %tmp6, 1 + %tmp10 = icmp eq i32 %tmp8, 0 + br i1 %tmp10, label %bb12, label %bb +bb12: + ret i32 %tmp3 +; X64: test7: +; X64: xorl $2147483646, %eax +; X64: andl {{.*%eax}} +; X32: test7: +; X32: xorl $2147483646, %edx +; X32: andl {{.*%edx}} +} + Removed: llvm/trunk/test/CodeGen/X86/xor_not.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor_not.ll?rev=82758&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/xor_not.ll (original) +++ llvm/trunk/test/CodeGen/X86/xor_not.ll (removed) @@ -1,74 +0,0 @@ -; RUN: llc < %s -march=x86 | grep {not\[lwb\]} | count 4 -; RUN: llc < %s -march=x86-64 | grep {not\[lwb\]} | count 4 -define i32 @test(i32 %a, i32 %b) nounwind { -entry: - %tmp1not = xor i32 %b, -2 - %tmp3 = and i32 %tmp1not, %a - %tmp4 = lshr i32 %tmp3, 1 - ret i32 %tmp4 -} - -define i32 @sum32(i32 %a, i32 %b) nounwind { -entry: - br label %bb -bb: - %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ] - %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ] - %tmp3 = xor i32 %a_addr.0, %b_addr.0 - %tmp4not = xor i32 %tmp3, 2147483647 - %tmp6 = and i32 %tmp4not, %b_addr.0 - %tmp8 = shl i32 %tmp6, 1 - %tmp10 = icmp eq i32 %tmp8, 0 - br i1 %tmp10, label %bb12, label %bb -bb12: - ret i32 %tmp3 -} - -define i16 @sum16(i16 %a, i16 %b) nounwind { -entry: - br label %bb -bb: - %b_addr.0 = phi i16 [ %b, %entry ], [ %tmp8, %bb ] - %a_addr.0 = phi i16 [ %a, %entry ], [ %tmp3, %bb ] - %tmp3 = xor i16 %a_addr.0, %b_addr.0 - %tmp4not = xor i16 %tmp3, 32767 - %tmp6 = and i16 %tmp4not, %b_addr.0 - %tmp8 = shl i16 %tmp6, 1 - %tmp10 = icmp eq i16 %tmp8, 0 - br i1 %tmp10, label %bb12, label %bb -bb12: - ret i16 %tmp3 -} - -define i8 @sum8(i8 %a, i8 %b) nounwind { -entry: - br label %bb -bb: - %b_addr.0 = phi i8 [ %b, %entry ], [ %tmp8, %bb ] - %a_addr.0 = phi i8 [ %a, %entry ], [ %tmp3, %bb ] - %tmp3 = xor i8 %a_addr.0, %b_addr.0 - %tmp4not = xor i8 %tmp3, 127 - %tmp6 = and i8 %tmp4not, %b_addr.0 - %tmp8 = shl i8 %tmp6, 1 - %tmp10 = icmp eq i8 %tmp8, 0 - br i1 %tmp10, label %bb12, label %bb -bb12: - ret i8 %tmp3 -} - -define i32 @test2(i32 %a, i32 %b) nounwind { -entry: - br label %bb -bb: - %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ] - %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ] - %tmp3 = xor i32 %a_addr.0, %b_addr.0 - %tmp4not = xor i32 %tmp3, 2147483646 - %tmp6 = and i32 %tmp4not, %b_addr.0 - %tmp8 = shl i32 %tmp6, 1 - %tmp10 = icmp eq i32 %tmp8, 0 - br i1 %tmp10, label %bb12, label %bb -bb12: - ret i32 %tmp3 -} - From jyasskin at google.com Fri Sep 25 02:27:58 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 00:27:58 -0700 Subject: [llvm-commits] [PATCH] Provide debug syms in release builds Message-ID: This patch causes the --enable-debug-runtime configure flag and the DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's objects. Without this, it's very hard to debug crashes that happen in Release-Asserts mode but not Debug mode. Jeffrey -------------- next part -------------- A non-text attachment was scrubbed... Name: release_debug_syms.patch Type: application/octet-stream Size: 1488 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090925/96065301/attachment.obj From deeppatel1987 at gmail.com Fri Sep 25 02:46:14 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Fri, 25 Sep 2009 07:46:14 +0000 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp In-Reply-To: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> References: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> Message-ID: <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> CommandLineTest.cpp breaks MinGW, which lacks setenv/unsetenv. deep On Thu, Sep 24, 2009 at 1:14 AM, Jeffrey Yasskin wrote: > Author: jyasskin > Date: Wed Sep 23 20:14:07 2009 > New Revision: 82675 > > URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev > Log: > Roll back r82348, which introduced an infinite loop in ParseCStringVector() that > a trivial unittest would have caught. ?This revision also adds the trivial > unittest. > > > Added: > ? ?llvm/trunk/unittests/Support/CommandLineTest.cpp > Modified: > ? ?llvm/trunk/lib/Support/CommandLine.cpp > > Modified: llvm/trunk/lib/Support/CommandLine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff > > ============================================================================== > --- llvm/trunk/lib/Support/CommandLine.cpp (original) > +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 > @@ -351,31 +351,42 @@ > ?/// using strdup(), so it is the caller's responsibility to free() > ?/// them later. > ?/// > -static void ParseCStringVector(std::vector &OutputVector, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { > +static void ParseCStringVector(std::vector &output, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { > ? // Characters which will be treated as token separators: > - ?StringRef Delims = " \v\f\t\r\n"; > + ?static const char *const delims = " \v\f\t\r\n"; > > - ?StringRef WorkStr(Input); > - ?while (!WorkStr.empty()) { > - ? ?// If the first character is a delimiter, strip them off. > - ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { > - ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); > - ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); > - ? ? ?WorkStr = WorkStr.substr(Pos); > - ? ? ?continue; > + ?std::string work(input); > + ?// Skip past any delims at head of input string. > + ?size_t pos = work.find_first_not_of(delims); > + ?// If the string consists entirely of delims, then exit early. > + ?if (pos == std::string::npos) return; > + ?// Otherwise, jump forward to beginning of first word. > + ?work = work.substr(pos); > + ?// Find position of first delimiter. > + ?pos = work.find_first_of(delims); > + > + ?while (!work.empty() && pos != std::string::npos) { > + ? ?// Everything from 0 to POS is the next word to copy. > + ? ?output.push_back(strdup(work.substr(0,pos).c_str())); > + ? ?// Is there another word in the string? > + ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); > + ? ?if (nextpos != std::string::npos) { > + ? ? ?// Yes? Then remove delims from beginning ... > + ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); > + ? ? ?// and find the end of the word. > + ? ? ?pos = work.find_first_of(delims); > + ? ?} else { > + ? ? ?// No? (Remainder of string is delims.) End the loop. > + ? ? ?work = ""; > + ? ? ?pos = std::string::npos; > ? ? } > - > - ? ?// Find position of first delimiter. > - ? ?size_t Pos = WorkStr.find_first_of(Delims); > - ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); > - > - ? ?// Everything from 0 to Pos is the next word to copy. > - ? ?char *NewStr = (char*)malloc(Pos+1); > - ? ?memcpy(NewStr, WorkStr.data(), Pos); > - ? ?NewStr[Pos] = 0; > - ? ?OutputVector.push_back(NewStr); > ? } > + > + ?// If `input' ended with non-delim char, then we'll get here with > + ?// the last word of `input' in `work'; copy it now. > + ?if (!work.empty()) > + ? ?output.push_back(strdup(work.c_str())); > ?} > > ?/// ParseEnvironmentOptions - An alternative entry point to the > > Added: llvm/trunk/unittests/Support/CommandLineTest.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto > > ============================================================================== > --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) > +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 > @@ -0,0 +1,48 @@ > +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// > +// > +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > + > +#include "llvm/Support/CommandLine.h" > + > +#include "gtest/gtest.h" > + > +#include > +#include > + > +using namespace llvm; > + > +namespace { > + > +class TempEnvVar { > + public: > + ?TempEnvVar(const char *name, const char *value) > + ? ? ?: name(name) { > + ? ?const char *old_value = getenv(name); > + ? ?EXPECT_EQ(NULL, old_value) << old_value; > + ? ?setenv(name, value, true); > + ?} > + > + ?~TempEnvVar() { > + ? ?unsetenv(name); > + ?} > + > + private: > + ?const char *const name; > +}; > + > +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; > + > +cl::opt EnvironmentTestOption("env-test-opt"); > +TEST(CommandLineTest, ParseEnvironment) { > + ?TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); > + ?EXPECT_EQ("", EnvironmentTestOption); > + ?cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); > + ?EXPECT_EQ("hello", EnvironmentTestOption); > +} > + > +} ?// anonymous namespace > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From stoklund at 2pi.dk Fri Sep 25 02:47:57 2009 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Fri, 25 Sep 2009 09:47:57 +0200 Subject: [llvm-commits] [llvm] r82734 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp CodeGen/PrologEpilogInserter.h Target/ARM/ARMBaseRegisterInfo.cpp Target/ARM/Thumb1RegisterInfo.cpp In-Reply-To: <200909242352.n8ONqJGh025506@zion.cs.uiuc.edu> References: <200909242352.n8ONqJGh025506@zion.cs.uiuc.edu> Message-ID: <975E430D-FB46-4A03-A722-10537A055CC5@2pi.dk> On 25/09/2009, at 01.52, Jim Grosbach wrote: > Start of revamping the register scavenging in PEI. ARM Thumb1 is the > driving > interest for this, as it currently reserves a register rather than > using > the scavenger for matierializing constants as needed. Great! Please see comments below. > +void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) { ... > + // Keep a map of which scratch reg we use for each virtual reg. > + // FIXME: Is a map like this the best solution? Seems like > overkill, > + // but to get rid of it would need some fairly strong assumptions > + // that may not be valid as this gets smarter about reuse and > such. > + IndexedMap ScratchRegForVirtReg; It seems that for now, we must require that live ranges of virtual registers are disjoint. Otherwise we would need more than one emergency spill slot in the worst case. With only one virtual register live at a time, the map is indeed overkill. It would also be a good idea to enforce the one-virtual-register-at-a- time rule with asserts here. > + ScratchRegForVirtReg.grow(Fn.getRegInfo().getLastVirtReg()); > + > + for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end > (); ++I) { > + MachineInstr *MI = I; > + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) > + if (MI->getOperand(i).isReg()) { > + unsigned Reg = MI->getOperand(i).getReg(); > + if (Reg && TRI->isVirtualRegister(Reg)) { Would it perhaps be possible to reduce nesting with 'continue' here? > + // If we already have a scratch for this virtual > register, use it > + unsigned NewReg = ScratchRegForVirtReg[Reg]; > + if (!NewReg) { > + const TargetRegisterClass *RC = Fn.getRegInfo > ().getRegClass(Reg); > + NewReg = RS->FindUnusedReg(RC); > + if (NewReg == 0) > + // No register is "free". Scavenge a register. > + // FIXME: Track SPAdj. Zero won't always be right > + NewReg = RS->scavengeRegister(RC, I, 0); Ideally, I would like to get rid of FindUnusedReg(), so you could just say scavengeRegister() here. The ARMLoadStoreOptimizer is the only one to use FindUnusedReg() without immediately calling scavengerRegister() when it fails. I am no sure if that is intentional. There is another issue here. FindUnusedReg() will give you a register that is unused /at the current position/. You really need a register that is unused in the whole live range of the virtual register you are replacing. scavengeRegister() won't return a register that is used by the instruction at I, but it looks like we need a variant that can exclude from whole range of instructions. The rule should be: "NewReg must not be defined by any instruction in the range, except for the last. NewReg must not be an EarlyClobber operand on the last instruction." > + assert (NewReg && "unable to scavenge register!"); > + ScratchRegForVirtReg[Reg] = NewReg; > + } > + MI->getOperand(i).setReg(NewReg); For full generality, you need to watch out for subreg operands when replacing a virtreg with a physreg. At least you should assert (getSubReg()==0). > + } > + } > + RS->forward(MI); Yeah, I also want to get rid of forward() as a public method. Since scavengeRegister takes an iterator argument that /must/ be next(MI) anyway, there is really no point to having it. Batch forwarding over a range of instructions is going to be faster as well. > + } > + } > +} From baldrick at free.fr Fri Sep 25 07:28:37 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Sep 2009 12:28:37 -0000 Subject: [llvm-commits] [llvm] r82763 - /llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Message-ID: <200909251228.n8PCScwm004489@zion.cs.uiuc.edu> Author: baldrick Date: Fri Sep 25 07:28:37 2009 New Revision: 82763 URL: http://llvm.org/viewvc/llvm-project?rev=82763&view=rev Log: Print INST_INBOUNDS_GEP rather than UnknownCode30. Likewise for constant inbounds GEP. Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=82763&r1=82762&r2=82763&view=diff ============================================================================== --- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original) +++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Fri Sep 25 07:28:37 2009 @@ -179,61 +179,63 @@ case bitc::CONSTANTS_BLOCK_ID: switch (CodeID) { default: return 0; - case bitc::CST_CODE_SETTYPE: return "SETTYPE"; - case bitc::CST_CODE_NULL: return "NULL"; - case bitc::CST_CODE_UNDEF: return "UNDEF"; - case bitc::CST_CODE_INTEGER: return "INTEGER"; - case bitc::CST_CODE_WIDE_INTEGER: return "WIDE_INTEGER"; - case bitc::CST_CODE_FLOAT: return "FLOAT"; - case bitc::CST_CODE_AGGREGATE: return "AGGREGATE"; - case bitc::CST_CODE_STRING: return "STRING"; - case bitc::CST_CODE_CSTRING: return "CSTRING"; - case bitc::CST_CODE_CE_BINOP: return "CE_BINOP"; - case bitc::CST_CODE_CE_CAST: return "CE_CAST"; - case bitc::CST_CODE_CE_GEP: return "CE_GEP"; - case bitc::CST_CODE_CE_SELECT: return "CE_SELECT"; - case bitc::CST_CODE_CE_EXTRACTELT: return "CE_EXTRACTELT"; - case bitc::CST_CODE_CE_INSERTELT: return "CE_INSERTELT"; - case bitc::CST_CODE_CE_SHUFFLEVEC: return "CE_SHUFFLEVEC"; - case bitc::CST_CODE_CE_CMP: return "CE_CMP"; - case bitc::CST_CODE_INLINEASM: return "INLINEASM"; - case bitc::CST_CODE_CE_SHUFVEC_EX: return "CE_SHUFVEC_EX"; + case bitc::CST_CODE_SETTYPE: return "SETTYPE"; + case bitc::CST_CODE_NULL: return "NULL"; + case bitc::CST_CODE_UNDEF: return "UNDEF"; + case bitc::CST_CODE_INTEGER: return "INTEGER"; + case bitc::CST_CODE_WIDE_INTEGER: return "WIDE_INTEGER"; + case bitc::CST_CODE_FLOAT: return "FLOAT"; + case bitc::CST_CODE_AGGREGATE: return "AGGREGATE"; + case bitc::CST_CODE_STRING: return "STRING"; + case bitc::CST_CODE_CSTRING: return "CSTRING"; + case bitc::CST_CODE_CE_BINOP: return "CE_BINOP"; + case bitc::CST_CODE_CE_CAST: return "CE_CAST"; + case bitc::CST_CODE_CE_GEP: return "CE_GEP"; + case bitc::CST_CODE_CE_INBOUNDS_GEP: return "CE_INBOUNDS_GEP"; + case bitc::CST_CODE_CE_SELECT: return "CE_SELECT"; + case bitc::CST_CODE_CE_EXTRACTELT: return "CE_EXTRACTELT"; + case bitc::CST_CODE_CE_INSERTELT: return "CE_INSERTELT"; + case bitc::CST_CODE_CE_SHUFFLEVEC: return "CE_SHUFFLEVEC"; + case bitc::CST_CODE_CE_CMP: return "CE_CMP"; + case bitc::CST_CODE_INLINEASM: return "INLINEASM"; + case bitc::CST_CODE_CE_SHUFVEC_EX: return "CE_SHUFVEC_EX"; } case bitc::FUNCTION_BLOCK_ID: switch (CodeID) { default: return 0; case bitc::FUNC_CODE_DECLAREBLOCKS: return "DECLAREBLOCKS"; - case bitc::FUNC_CODE_INST_BINOP: return "INST_BINOP"; - case bitc::FUNC_CODE_INST_CAST: return "INST_CAST"; - case bitc::FUNC_CODE_INST_GEP: return "INST_GEP"; - case bitc::FUNC_CODE_INST_SELECT: return "INST_SELECT"; - case bitc::FUNC_CODE_INST_EXTRACTELT: return "INST_EXTRACTELT"; - case bitc::FUNC_CODE_INST_INSERTELT: return "INST_INSERTELT"; - case bitc::FUNC_CODE_INST_SHUFFLEVEC: return "INST_SHUFFLEVEC"; - case bitc::FUNC_CODE_INST_CMP: return "INST_CMP"; + case bitc::FUNC_CODE_INST_BINOP: return "INST_BINOP"; + case bitc::FUNC_CODE_INST_CAST: return "INST_CAST"; + case bitc::FUNC_CODE_INST_GEP: return "INST_GEP"; + case bitc::FUNC_CODE_INST_INBOUNDS_GEP: return "INST_INBOUNDS_GEP"; + case bitc::FUNC_CODE_INST_SELECT: return "INST_SELECT"; + case bitc::FUNC_CODE_INST_EXTRACTELT: return "INST_EXTRACTELT"; + case bitc::FUNC_CODE_INST_INSERTELT: return "INST_INSERTELT"; + case bitc::FUNC_CODE_INST_SHUFFLEVEC: return "INST_SHUFFLEVEC"; + case bitc::FUNC_CODE_INST_CMP: return "INST_CMP"; - case bitc::FUNC_CODE_INST_RET: return "INST_RET"; - case bitc::FUNC_CODE_INST_BR: return "INST_BR"; - case bitc::FUNC_CODE_INST_SWITCH: return "INST_SWITCH"; - case bitc::FUNC_CODE_INST_INVOKE: return "INST_INVOKE"; - case bitc::FUNC_CODE_INST_UNWIND: return "INST_UNWIND"; - case bitc::FUNC_CODE_INST_UNREACHABLE: return "INST_UNREACHABLE"; + case bitc::FUNC_CODE_INST_RET: return "INST_RET"; + case bitc::FUNC_CODE_INST_BR: return "INST_BR"; + case bitc::FUNC_CODE_INST_SWITCH: return "INST_SWITCH"; + case bitc::FUNC_CODE_INST_INVOKE: return "INST_INVOKE"; + case bitc::FUNC_CODE_INST_UNWIND: return "INST_UNWIND"; + case bitc::FUNC_CODE_INST_UNREACHABLE: return "INST_UNREACHABLE"; - case bitc::FUNC_CODE_INST_PHI: return "INST_PHI"; - case bitc::FUNC_CODE_INST_MALLOC: return "INST_MALLOC"; - case bitc::FUNC_CODE_INST_FREE: return "INST_FREE"; - case bitc::FUNC_CODE_INST_ALLOCA: return "INST_ALLOCA"; - case bitc::FUNC_CODE_INST_LOAD: return "INST_LOAD"; - case bitc::FUNC_CODE_INST_STORE: return "INST_STORE"; - case bitc::FUNC_CODE_INST_CALL: return "INST_CALL"; - case bitc::FUNC_CODE_INST_VAARG: return "INST_VAARG"; - case bitc::FUNC_CODE_INST_STORE2: return "INST_STORE2"; - case bitc::FUNC_CODE_INST_GETRESULT: return "INST_GETRESULT"; - case bitc::FUNC_CODE_INST_EXTRACTVAL: return "INST_EXTRACTVAL"; - case bitc::FUNC_CODE_INST_INSERTVAL: return "INST_INSERTVAL"; - case bitc::FUNC_CODE_INST_CMP2: return "INST_CMP2"; - case bitc::FUNC_CODE_INST_VSELECT: return "INST_VSELECT"; + case bitc::FUNC_CODE_INST_PHI: return "INST_PHI"; + case bitc::FUNC_CODE_INST_MALLOC: return "INST_MALLOC"; + case bitc::FUNC_CODE_INST_FREE: return "INST_FREE"; + case bitc::FUNC_CODE_INST_ALLOCA: return "INST_ALLOCA"; + case bitc::FUNC_CODE_INST_LOAD: return "INST_LOAD"; + case bitc::FUNC_CODE_INST_STORE: return "INST_STORE"; + case bitc::FUNC_CODE_INST_CALL: return "INST_CALL"; + case bitc::FUNC_CODE_INST_VAARG: return "INST_VAARG"; + case bitc::FUNC_CODE_INST_STORE2: return "INST_STORE2"; + case bitc::FUNC_CODE_INST_GETRESULT: return "INST_GETRESULT"; + case bitc::FUNC_CODE_INST_EXTRACTVAL: return "INST_EXTRACTVAL"; + case bitc::FUNC_CODE_INST_INSERTVAL: return "INST_INSERTVAL"; + case bitc::FUNC_CODE_INST_CMP2: return "INST_CMP2"; + case bitc::FUNC_CODE_INST_VSELECT: return "INST_VSELECT"; } case bitc::TYPE_SYMTAB_BLOCK_ID: switch (CodeID) { From baldrick at free.fr Fri Sep 25 07:50:52 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Sep 2009 12:50:52 -0000 Subject: [llvm-commits] [gcc-plugin] r82764 - in /gcc-plugin/trunk: llvm-convert.cpp llvm-internal.h Message-ID: <200909251250.n8PCoqGQ007271@zion.cs.uiuc.edu> Author: baldrick Date: Fri Sep 25 07:50:52 2009 New Revision: 82764 URL: http://llvm.org/viewvc/llvm-project?rev=82764&view=rev Log: In the plugin we convert GCC's ssa form directly to LLVM's ssa form, creating LLVM phi nodes for GCC phi nodes and so forth. Thanks to ssa form, the vast majority of GCC local variables are not used at all, but they still exist in the list of local vars. Since we convert all variables in this list into alloca's, this result in bitcode filled with unused alloca's. Instead, generate alloca's for local variables on demand, the first time we need one. This is done by having DECL_LLVM use a local cache for declarations local to the current function (this cache is thrown away once we converted the function), and having a local version of make_decl_llvm that knows how to generate alloca's for local variables (I also did it for the function result). At -O0, this results in a more than 10% decrease in the size of bitcode for sqlite3. Modified: gcc-plugin/trunk/llvm-convert.cpp gcc-plugin/trunk/llvm-internal.h Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82764&r1=82763&r2=82764&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Fri Sep 25 07:50:52 2009 @@ -200,6 +200,61 @@ TheTreeToLLVM = 0; } +//===----------------------------------------------------------------------===// +// ... Local declarations ... +//===----------------------------------------------------------------------===// + +/// isLocalDecl - Whether this declaration is local to the current function. +static bool isLocalDecl(tree decl) { + assert(HAS_RTL_P(decl) && "Expected a declaration with RTL!"); + return DECL_CONTEXT(decl) == current_function_decl && + !TREE_STATIC(decl) && // Static variables not considered local. + TREE_CODE(decl) != FUNCTION_DECL; // Nested functions not considered local. +} + +/// set_decl_local - Remember the LLVM value for a GCC declaration. +Value *TreeToLLVM::set_decl_local(tree decl, Value *V) { + if (!isLocalDecl(decl)) + return set_decl_llvm(decl, V); + if (V != NULL) + return LocalDecls[decl] = V; + LocalDecls.erase(decl); + return NULL; +} + +/// get_decl_local - Retrieve the LLVM value for a GCC declaration, or NULL. +Value *TreeToLLVM::get_decl_local(tree decl) { + if (!isLocalDecl(decl)) + return get_decl_llvm(decl); + DenseMap >::iterator I = LocalDecls.find(decl); + if (I != LocalDecls.end()) + return I->second; + return NULL; +} + +/// make_decl_local - Return the LLVM value for a GCC declaration if it exists. +/// Otherwise creates and returns an appropriate value. +Value *TreeToLLVM::make_decl_local(tree decl) { + if (!isLocalDecl(decl)) + return make_decl_llvm(decl); + + DenseMap >::iterator I = LocalDecls.find(decl); + if (I != LocalDecls.end()) + return I->second; + + switch (TREE_CODE(decl)) { + default: + llvm_unreachable("Unhandled local declaration!"); + + case RESULT_DECL: + case VAR_DECL: + EmitAutomaticVariableDecl(decl); + I = LocalDecls.find(decl); + assert(I != LocalDecls.end() && "Not a local variable?"); + return I->second; + } +} + /// llvm_store_scalar_argument - Store scalar argument ARGVAL of type /// LLVMTY at location LOC. static void llvm_store_scalar_argument(Value *Loc, Value *ArgVal, @@ -282,7 +337,7 @@ tree ResultDecl = DECL_RESULT(FunctionDecl); tree RetTy = TREE_TYPE(TREE_TYPE(FunctionDecl)); if (TREE_CODE(RetTy) == TREE_CODE(TREE_TYPE(ResultDecl))) { - SET_DECL_LLVM(ResultDecl, AI); + TheTreeToLLVM->set_decl_local(ResultDecl, AI); ++AI; return; } @@ -294,7 +349,7 @@ Value *Tmp = TheTreeToLLVM->CreateTemporary(AI->getType()); Builder.CreateStore(AI, Tmp); - SET_DECL_LLVM(ResultDecl, Tmp); + TheTreeToLLVM->set_decl_local(ResultDecl, Tmp); if (TheDebugInfo) { TheDebugInfo->EmitDeclare(ResultDecl, dwarf::DW_TAG_return_variable, @@ -309,7 +364,7 @@ "No explicit return value?"); AI->setName("scalar.result"); isShadowRet = true; - SET_DECL_LLVM(DECL_RESULT(FunctionDecl), AI); + TheTreeToLLVM->set_decl_local(DECL_RESULT(FunctionDecl), AI); ++AI; } @@ -428,9 +483,9 @@ // If we've already seen this function and created a prototype, and if the // proto has the right LLVM type, just use it. - if (DECL_LLVM_SET_P(FnDecl) && - cast(DECL_LLVM(FnDecl)->getType())->getElementType() == FTy){ - Fn = cast(DECL_LLVM(FnDecl)); + if (DECL_LOCAL_SET_P(FnDecl) && + cast(DECL_LOCAL(FnDecl)->getType())->getElementType()==FTy) { + Fn = cast(DECL_LOCAL(FnDecl)); assert(Fn->getCallingConv() == CallingConv && "Calling convention disagreement between prototype and impl!"); // The visibility can be changed from the last time we've seen this @@ -463,7 +518,7 @@ changeLLVMConstant(FnEntry, Fn); FnEntry->eraseFromParent(); } - SET_DECL_LLVM(FnDecl, Fn); + SET_DECL_LOCAL(FnDecl, Fn); } // The function should not already have a body. @@ -574,7 +629,7 @@ // If the value is passed by 'invisible reference' or 'byval reference', // the l-value for the argument IS the argument itself. AI->setName(Name); - SET_DECL_LLVM(Args, AI); + SET_DECL_LOCAL(Args, AI); if (!isInvRef && TheDebugInfo) TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable, Name, TREE_TYPE(Args), @@ -586,7 +641,7 @@ // into the alloca. Value *Tmp = CreateTemporary(ArgTy); Tmp->setName(std::string(Name)+"_addr"); - SET_DECL_LLVM(Args, Tmp); + SET_DECL_LOCAL(Args, Tmp); if (TheDebugInfo) { TheDebugInfo->EmitDeclare(Args, dwarf::DW_TAG_arg_variable, Name, TREE_TYPE(Args), Tmp, @@ -618,23 +673,12 @@ Constant::getNullValue(Type::getInt32Ty(Context)), Type::getInt32Ty(Context)), "ssa point"); - // If this is not a void-returning function, initialize the RESULT_DECL. - if (DECL_RESULT(FnDecl) && !VOID_TYPE_P(TREE_TYPE(DECL_RESULT(FnDecl))) && - !DECL_LLVM_SET_P(DECL_RESULT(FnDecl))) - EmitAutomaticVariableDecl(DECL_RESULT(FnDecl)); - // If this function has nested functions, we should handle a potential // nonlocal_goto_save_area. if (cfun->nonlocal_goto_save_area) { // Not supported yet. } - // Emit any automatic or static variables. - for (tree vars = DECL_STRUCT_FUNCTION(FnDecl)->local_decls; vars; - vars = TREE_CHAIN(vars)) - if (!DECL_LLVM_SET_P(TREE_VALUE(vars))) - EmitAutomaticVariableDecl(TREE_VALUE(vars)); - // Create a new block for the return node, but don't insert it yet. ReturnBB = BasicBlock::Create(Context, "return"); } @@ -775,14 +819,14 @@ // If the DECL_RESULT is a scalar type, just load out the return value // and return it. tree TreeRetVal = DECL_RESULT(FnDecl); - Value *RetVal = Builder.CreateLoad(DECL_LLVM(TreeRetVal), "retval"); + Value *RetVal = Builder.CreateLoad(DECL_LOCAL(TreeRetVal), "retval"); bool RetValSigned = !TYPE_UNSIGNED(TREE_TYPE(TreeRetVal)); Instruction::CastOps opcode = CastInst::getCastOpcode( RetVal, RetValSigned, Fn->getReturnType(), RetValSigned); RetVal = Builder.CreateCast(opcode, RetVal, Fn->getReturnType()); RetVals.push_back(RetVal); } else { - Value *RetVal = DECL_LLVM(DECL_RESULT(FnDecl)); + Value *RetVal = DECL_LOCAL(DECL_RESULT(FnDecl)); if (const StructType *STy = dyn_cast(Fn->getReturnType())) { Value *R1 = Builder.CreateBitCast(RetVal, PointerType::getUnqual(STy)); @@ -900,11 +944,11 @@ /// label. BasicBlock *TreeToLLVM::getLabelDeclBlock(tree LabelDecl) { assert(TREE_CODE(LabelDecl) == LABEL_DECL && "Isn't a label!?"); - if (DECL_LLVM_SET_P(LabelDecl)) - return cast(DECL_LLVM(LabelDecl)); + if (DECL_LOCAL_SET_P(LabelDecl)) + return cast(DECL_LOCAL(LabelDecl)); BasicBlock *BB = getBasicBlock(label_to_block(LabelDecl)); - SET_DECL_LLVM(LabelDecl, BB); + SET_DECL_LOCAL(LabelDecl, BB); return BB; } @@ -1623,38 +1667,14 @@ //===----------------------------------------------------------------------===// /// EmitAutomaticVariableDecl - Emit the function-local decl to the current -/// function and set DECL_LLVM for the decl to the right pointer. +/// function and set DECL_LOCAL for the decl to the right pointer. void TreeToLLVM::EmitAutomaticVariableDecl(tree decl) { - tree type = TREE_TYPE(decl); - - // An LLVM value pointer for this decl may already be set, for example, if the - // named return value optimization is being applied to this function, and - // this variable is the one being returned. - assert(!DECL_LLVM_SET_P(decl) && "Shouldn't call this on an emitted var!"); - - // For a CONST_DECL, set mode, alignment, and sizes from those of the - // type in case this node is used in a reference. - if (TREE_CODE(decl) == CONST_DECL) { - DECL_MODE(decl) = TYPE_MODE(type); - DECL_ALIGN(decl) = TYPE_ALIGN(type); - DECL_SIZE(decl) = TYPE_SIZE(type); - DECL_SIZE_UNIT(decl) = TYPE_SIZE_UNIT(type); - return; - } - - // Otherwise, only automatic (and result) variables need any expansion done. - // Static and external variables, and external functions, will be handled by - // `assemble_variable' (called from finish_decl). TYPE_DECL requires nothing. - // PARM_DECLs are handled in `llvm_expand_function_start'. - if ((TREE_CODE(decl) != VAR_DECL && TREE_CODE(decl) != RESULT_DECL) || - TREE_STATIC(decl) || DECL_EXTERNAL(decl) || type == error_mark_node) - return; - // If this is just the rotten husk of a variable that the gimplifier // eliminated all uses of, but is preserving for debug info, ignore it. if (TREE_CODE(decl) == VAR_DECL && DECL_VALUE_EXPR(decl)) return; + tree type = TREE_TYPE(decl); const Type *Ty; // Type to allocate Value *Size = 0; // Amount to alloca (null for 1) @@ -1719,7 +1739,7 @@ AI->setAlignment(Alignment); - SET_DECL_LLVM(decl, AI); + SET_DECL_LOCAL(decl, AI); // Handle annotate attributes if (DECL_ATTRIBUTES(decl)) @@ -1860,7 +1880,7 @@ abort();//FIXME //FIXME assert(llvm_eh_personality_libfunc //FIXME && "no exception handling personality function!"); -//FIXME Args.push_back(Builder.CreateBitCast(DECL_LLVM(llvm_eh_personality_libfunc), +//FIXME Args.push_back(Builder.CreateBitCast(DECL_LOCAL(llvm_eh_personality_libfunc), //FIXME PointerType::getUnqual(Type::getInt8Ty(Context)))); //FIXME //FIXME // Add selections for each handler. @@ -2074,11 +2094,11 @@ //FIXME CallingConv::ID CallingConvention = CallingConv::C; //FIXME //FIXME TARGET_ADJUST_LLVM_CC(CallingConvention, fntype); -//FIXME CallInst *Call = Builder.CreateCall(DECL_LLVM(llvm_unwind_resume_libfunc), +//FIXME CallInst *Call = Builder.CreateCall(DECL_LOCAL(llvm_unwind_resume_libfunc), //FIXME Arg); //FIXME Call->setCallingConv(CallingConvention); //FIXME#else -//FIXME Builder.CreateCall(DECL_LLVM(llvm_unwind_resume_libfunc), Arg); +//FIXME Builder.CreateCall(DECL_LOCAL(llvm_unwind_resume_libfunc), Arg); //FIXME#endif Builder.CreateUnreachable(); } @@ -2132,7 +2152,7 @@ return UndefValue::get(ConvertType(TREE_TYPE(exp))); // Read the initial value of the parameter and associate it with the ssa name. - assert(DECL_LLVM_IF_SET(var) && "Parameter not laid out?"); + assert(DECL_LOCAL_IF_SET(var) && "Parameter not laid out?"); unsigned Alignment = DECL_ALIGN(var); assert(Alignment != 0 && "Parameter with unknown alignment!"); @@ -2141,7 +2161,7 @@ DECL_NAME(var) ? IDENTIFIER_POINTER(DECL_NAME(var)) : "anon"; const Type *Ty = ConvertType(TREE_TYPE(exp)); - Value *Ptr = Builder.CreateBitCast(DECL_LLVM_IF_SET(var), + Value *Ptr = Builder.CreateBitCast(DECL_LOCAL_IF_SET(var), PointerType::getUnqual(Ty)); // Perform the load in the entry block, after all parameters have been set up @@ -6083,19 +6103,19 @@ // emit a NEW declaration for the global variable, now that it has been // laid out. We then tell the compiler to "forward" any uses of the old // global to this new one. - if (Value *Val = DECL_LLVM_IF_SET(exp)) { + if (Value *Val = DECL_LOCAL_IF_SET(exp)) { //fprintf(stderr, "***\n*** SHOULD HANDLE GLOBAL VARIABLES!\n***\n"); //assert(0 && "Reimplement this with replace all uses!"); - SET_DECL_LLVM(exp, 0); + SET_DECL_LOCAL(exp, 0); // Create a new global variable declaration llvm_assemble_external(exp); - V2GV(Val)->ForwardedGlobal = V2GV(DECL_LLVM(exp)); + V2GV(Val)->ForwardedGlobal = V2GV(DECL_LOCAL(exp)); } #endif } } - Value *Decl = DECL_LLVM(exp); + Value *Decl = DECL_LOCAL(exp); if (Decl == 0) { if (errorcount || sorrycount) { const Type *Ty = ConvertType(TREE_TYPE(exp)); @@ -6112,7 +6132,7 @@ if (!TREE_USED(exp)) { assemble_external(exp); TREE_USED(exp) = 1; - Decl = DECL_LLVM(exp); + Decl = DECL_LOCAL(exp); } if (GlobalValue *GV = dyn_cast(Decl)) { @@ -6123,7 +6143,7 @@ GV->isDeclaration() && !BOGUS_CTOR(exp)) { emit_global_to_llvm(exp); - Decl = DECL_LLVM(exp); // Decl could have change if it changed type. + Decl = DECL_LOCAL(exp); // Decl could have change if it changed type. } } else { // Otherwise, inform cgraph that we used the global. @@ -8060,12 +8080,12 @@ if (retval && retval != error_mark_node && retval != result) { // Store the return value to the function's DECL_RESULT. if (isAggregateTreeType(TREE_TYPE(result))) { - MemRef DestLoc(DECL_LLVM(result), 1, false); // FIXME: What alignment? + MemRef DestLoc(DECL_LOCAL(result), 1, false); // FIXME: What alignment? Emit(retval, &DestLoc); } else { Value *Val = Builder.CreateBitCast(Emit(retval, 0), ConvertType(TREE_TYPE(result))); - Builder.CreateStore(Val, DECL_LLVM(result)); + Builder.CreateStore(Val, DECL_LOCAL(result)); } } Modified: gcc-plugin/trunk/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=82764&r1=82763&r2=82764&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-internal.h (original) +++ gcc-plugin/trunk/llvm-internal.h Fri Sep 25 07:50:52 2009 @@ -108,7 +108,7 @@ // Mapping between GCC declarations and LLVM values. -/// DECL_LLVM - Holds the LLVM expression for the value of a variable or +/// DECL_LLVM - Holds the LLVM expression for the value of a global variable or /// function. This value can be evaluated lazily for functions and variables /// with static storage duration. extern Value *make_decl_llvm(union tree_node *); @@ -347,12 +347,41 @@ /// BasicBlocks - Map from GCC to LLVM basic blocks. DenseMap BasicBlocks; + /// LocalDecls - Map from local declarations to their associated LLVM values. + DenseMap > LocalDecls; + /// PendingPhis - Phi nodes which have not yet been populated with operands. SmallVector PendingPhis; // SSANames - Map from GCC ssa names to the defining LLVM value. DenseMap > SSANames; +public: + + //===---------------------- Local Declarations --------------------------===// + + /// DECL_LOCAL - Like DECL_LLVM, returns the LLVM expression for the value of + /// a variable or function. However DECL_LOCAL can be used with declarations + /// local to the current function as well as with global declarations. + Value *make_decl_local(union tree_node *); + #define DECL_LOCAL(NODE) make_decl_local(NODE) + + /// SET_DECL_LOCAL - Set the DECL_LOCAL for NODE to LLVM. + Value *set_decl_local(union tree_node *, Value *); + #define SET_DECL_LOCAL(NODE, LLVM) set_decl_local(NODE, LLVM) + + /// DECL_LOCAL_IF_SET - The DECL_LOCAL for NODE, if it is set, or NULL, if it + /// is not set. + Value *get_decl_local(union tree_node *); + #define DECL_LOCAL_IF_SET(NODE) (HAS_RTL_P(NODE) ? get_decl_local(NODE) : NULL) + + /// DECL_LOCAL_SET_P - Returns nonzero if the DECL_LOCAL for NODE has already + /// been set. + #define DECL_LOCAL_SET_P(NODE) (DECL_LOCAL_IF_SET(NODE) != NULL) + + +private: + //===---------------------- Exception Handling --------------------------===// /// LandingPads - The landing pad for a given EH region. From snaroff at apple.com Fri Sep 25 09:30:59 2009 From: snaroff at apple.com (Steve Naroff) Date: Fri, 25 Sep 2009 14:30:59 -0000 Subject: [llvm-commits] [llvm] r82765 - /llvm/tags/cremebrulee/cremebrulee-8/ Message-ID: <200909251430.n8PEUxfS020037@zion.cs.uiuc.edu> Author: snaroff Date: Fri Sep 25 09:30:59 2009 New Revision: 82765 URL: http://llvm.org/viewvc/llvm-project?rev=82765&view=rev Log: Tagging cremebrulee-8. Added: llvm/tags/cremebrulee/cremebrulee-8/ - copied from r82764, llvm/trunk/ From bob.wilson at apple.com Fri Sep 25 09:41:49 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Sep 2009 14:41:49 -0000 Subject: [llvm-commits] [llvm] r82767 - in /llvm/trunk: include/llvm/Target/TargetFrameInfo.h lib/CodeGen/PrologEpilogInserter.cpp lib/Target/ARM/ARMFrameInfo.h test/CodeGen/ARM/2009-09-24-spill-align.ll Message-ID: <200909251441.n8PEfoXj021395@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 25 09:41:49 2009 New Revision: 82767 URL: http://llvm.org/viewvc/llvm-project?rev=82767&view=rev Log: pr4926: ARM requires the stack pointer to be aligned, even for leaf functions. For the AAPCS ABI, SP must always be 4-byte aligned, and at any "public interface" it must be 8-byte aligned. For the older ARM APCS ABI, the stack alignment is just always 4 bytes. For X86, we currently align SP at entry to a function (e.g., to 16 bytes for Darwin), but no stack alignment is needed at other times, such as for a leaf function. After discussing this with Dan, I decided to go with the approach of adding a new "TransientStackAlignment" field to TargetFrameInfo. This value specifies the stack alignment that must be maintained even in between calls. It defaults to 1 except for ARM, where it is 4. (Some other targets may also want to set this if they have similar stack requirements. It's not currently required for PPC because it sets targetHandlesStackFrameRounding and handles the alignment in target-specific code.) The existing StackAlignment value specifies the alignment upon entry to a function, which is how we've been using it anyway. Added: llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll Modified: llvm/trunk/include/llvm/Target/TargetFrameInfo.h llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp llvm/trunk/lib/Target/ARM/ARMFrameInfo.h Modified: llvm/trunk/include/llvm/Target/TargetFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetFrameInfo.h?rev=82767&r1=82766&r2=82767&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetFrameInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetFrameInfo.h Fri Sep 25 09:41:49 2009 @@ -34,10 +34,13 @@ private: StackDirection StackDir; unsigned StackAlignment; + unsigned TransientStackAlignment; int LocalAreaOffset; public: - TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO) - : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {} + TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO, + unsigned TransAl = 1) + : StackDir(D), StackAlignment(StackAl), TransientStackAlignment(TransAl), + LocalAreaOffset(LAO) {} virtual ~TargetFrameInfo(); @@ -48,12 +51,20 @@ /// StackDirection getStackGrowthDirection() const { return StackDir; } - /// getStackAlignment - This method returns the number of bytes that the stack - /// pointer must be aligned to. Typically, this is the largest alignment for - /// any data object in the target. + /// getStackAlignment - This method returns the number of bytes to which the + /// stack pointer must be aligned on entry to a function. Typically, this + /// is the largest alignment for any data object in the target. /// unsigned getStackAlignment() const { return StackAlignment; } + /// getTransientStackAlignment - This method returns the number of bytes to + /// which the stack pointer must be aligned at all times, even between + /// calls. + /// + unsigned getTransientStackAlignment() const { + return TransientStackAlignment; + } + /// getOffsetOfLocalArea - This method returns the offset of the local area /// from the stack pointer on entrance to a function. /// Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=82767&r1=82766&r2=82767&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Fri Sep 25 09:41:49 2009 @@ -484,7 +484,7 @@ // Loop over all of the stack objects, assigning sequential addresses... MachineFrameInfo *FFI = Fn.getFrameInfo(); - unsigned MaxAlign = FFI->getMaxAlignment(); + unsigned MaxAlign = 1; // Start at the beginning of the local area. // The Offset is the distance from the stack top in the direction @@ -586,23 +586,28 @@ AdjustStackOffset(FFI, SFI, StackGrowsDown, Offset, MaxAlign); } - // Round up the size to a multiple of the alignment, but only if there are - // calls or alloca's in the function. This ensures that any calls to - // subroutines have their stack frames suitably aligned. - // Also do this if we need runtime alignment of the stack. In this case - // offsets will be relative to SP not FP; round up the stack size so this - // works. - if (!RegInfo->targetHandlesStackFrameRounding() && - (FFI->hasCalls() || FFI->hasVarSizedObjects() || - (RegInfo->needsStackRealignment(Fn) && - FFI->getObjectIndexEnd() != 0))) { + if (!RegInfo->targetHandlesStackFrameRounding()) { // If we have reserved argument space for call sites in the function // immediately on entry to the current function, count it as part of the // overall stack size. - if (RegInfo->hasReservedCallFrame(Fn)) + if (FFI->hasCalls() && RegInfo->hasReservedCallFrame(Fn)) Offset += FFI->getMaxCallFrameSize(); - unsigned AlignMask = std::max(TFI.getStackAlignment(), MaxAlign) - 1; + // Round up the size to a multiple of the alignment. If the function has + // any calls or alloca's, align to the target's StackAlignment value to + // ensure that the callee's frame or the alloca data is suitably aligned; + // otherwise, for leaf functions, align to the TransientStackAlignment + // value. + unsigned StackAlign; + if (FFI->hasCalls() || FFI->hasVarSizedObjects() || + (RegInfo->needsStackRealignment(Fn) && FFI->getObjectIndexEnd() != 0)) + StackAlign = TFI.getStackAlignment(); + else + StackAlign = TFI.getTransientStackAlignment(); + // If the frame pointer is eliminated, all frame offsets will be relative + // to SP not FP; align to MaxAlign so this works. + StackAlign = std::max(StackAlign, MaxAlign); + unsigned AlignMask = StackAlign - 1; Offset = (Offset + AlignMask) & ~uint64_t(AlignMask); } @@ -611,7 +616,8 @@ // Remember the required stack alignment in case targets need it to perform // dynamic stack alignment. - FFI->setMaxAlignment(MaxAlign); + if (MaxAlign > FFI->getMaxAlignment()) + FFI->setMaxAlignment(MaxAlign); } Modified: llvm/trunk/lib/Target/ARM/ARMFrameInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameInfo.h?rev=82767&r1=82766&r2=82767&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMFrameInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMFrameInfo.h Fri Sep 25 09:41:49 2009 @@ -23,7 +23,7 @@ class ARMFrameInfo : public TargetFrameInfo { public: explicit ARMFrameInfo(const ARMSubtarget &ST) - : TargetFrameInfo(StackGrowsDown, ST.getStackAlignment(), 0) { + : TargetFrameInfo(StackGrowsDown, ST.getStackAlignment(), 0, 4) { } }; Added: llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll?rev=82767&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll Fri Sep 25 09:41:49 2009 @@ -0,0 +1,17 @@ +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s +; pr4926 + +define arm_apcscc void @test_vget_lanep16() nounwind { +entry: + %arg0_poly16x4_t = alloca <4 x i16> ; <<4 x i16>*> [#uses=1] + %out_poly16_t = alloca i16 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] +; CHECK: fldd + %0 = load <4 x i16>* %arg0_poly16x4_t, align 8 ; <<4 x i16>> [#uses=1] + %1 = extractelement <4 x i16> %0, i32 1 ; [#uses=1] + store i16 %1, i16* %out_poly16_t, align 2 + br label %return + +return: ; preds = %entry + ret void +} From baldrick at free.fr Fri Sep 25 10:20:21 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Sep 2009 15:20:21 -0000 Subject: [llvm-commits] [gcc-plugin] r82768 - /gcc-plugin/trunk/TODO Message-ID: <200909251520.n8PFKLCn026619@zion.cs.uiuc.edu> Author: baldrick Date: Fri Sep 25 10:20:21 2009 New Revision: 82768 URL: http://llvm.org/viewvc/llvm-project?rev=82768&view=rev Log: Update the TODO list. Modified: gcc-plugin/trunk/TODO Modified: gcc-plugin/trunk/TODO URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/TODO?rev=82768&r1=82767&r2=82768&view=diff ============================================================================== --- gcc-plugin/trunk/TODO (original) +++ gcc-plugin/trunk/TODO Fri Sep 25 10:20:21 2009 @@ -15,18 +15,12 @@ that there's only one source file and that it's called llvm-target.cpp. Currently the target directory (eg: i386) is calculated from the target triple -(eg: x86_64-unknown-linux-gnu) using gcc's config.gcc script. This should be -done from a configure script, rather from the Makefile using the get_arch_dir -wrapper. - -The Makefile needs to know the LLVM target name (eg: x86) in order to pass it -to llvm-config so as to get the libraries to link with for target codegen. -This should be calculated in a configure script (presumably by a small program -that uses the LLVM triple facilities to calculate it). If we know this, then -we might as well rename target directories like i386/ to x86/ instead, and -eliminate use of gcc's config.gcc script. This also means that LLVM_TARGET_NAME -could be defined from the Makefile rather than being specified in llvm-target.h. -Maybe LLVM_TARGET_INTRINSIC_PREFIX could go too. +(eg: x86_64-unknown-linux-gnu) using the "target" tool. This should be done +from a configure script, rather from the Makefile. + +Define LLVM_TARGET_NAME from the Makefile rather than being specified in +llvm-target.h. Maybe LLVM_TARGET_INTRINSIC_PREFIX could go too. An annoyance +is that the target tool returns "x86" while what is needed is "X86". Teach the build system that the plugin needs to be rebuilt if any of the bits of LLVM/gcc it depends on changes. @@ -40,34 +34,19 @@ to /dev/null, but it would be more efficient to teach GCC to not produce any in the first place). Investigate. -Consider having DECL_LLVM and friends store values for trees local to a -function in a separate map that can be cleared once the function has been -emitted. Determining which trees are local (LABEL_DECL, VAR_DECL but not -static etc) should be pretty quick, so the cost of routing to the right map -should be insignificant, while having a much smaller map for globals could -be a win. - Consider using separate caches for types and globals. -Thanks to gimple being in SSA form, many local variables are not used. -However they are still in the local_decls list, so we output them all, -pointlessly, wasting time and memory. Consider emitting local variables -on demand instead. - Correctness ----------- -If an ssa name refers to a global (can this happen), the SSANames map might +If an ssa name refers to a global (can this happen?), the SSANames map might need to be updated if the target is altered by changeLLVMConstant. An ssa name can be a complex number, causing the plugin to crash. Maybe should consider complex numbers to be scalars rather than aggregates. Would this get in the way of sroa? -If the initializer for a static variable contains the address of a label then -we crash. - Features -------- From baldrick at free.fr Fri Sep 25 10:21:35 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 25 Sep 2009 15:21:35 -0000 Subject: [llvm-commits] [gcc-plugin] r82769 - /gcc-plugin/trunk/llvm-convert.cpp Message-ID: <200909251521.n8PFLZbx026797@zion.cs.uiuc.edu> Author: baldrick Date: Fri Sep 25 10:21:35 2009 New Revision: 82769 URL: http://llvm.org/viewvc/llvm-project?rev=82769&view=rev Log: Make sure we don't get any warnings when assertions are turned off. Modified: gcc-plugin/trunk/llvm-convert.cpp Modified: gcc-plugin/trunk/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82769&r1=82768&r2=82769&view=diff ============================================================================== --- gcc-plugin/trunk/llvm-convert.cpp (original) +++ gcc-plugin/trunk/llvm-convert.cpp Fri Sep 25 10:21:35 2009 @@ -2908,6 +2908,7 @@ MemRef NewLoc = *DestLoc; NewLoc.Ptr = Builder.CreateBitCast(DestLoc->Ptr,PointerType::getUnqual(Ty)); Value *OpVal = Emit(op, &NewLoc); + (void)OpVal; assert(OpVal == 0 && "Shouldn't cast scalar to aggregate!"); return 0; } @@ -2947,6 +2948,7 @@ switch (TREE_CODE(Op)) { default: { Value *OpVal = Emit(Op, &Target); + (void)OpVal; assert(OpVal == 0 && "Expected an aggregate operand!"); break; } @@ -6301,6 +6303,7 @@ if (!ConvertType(TREE_TYPE(tree_purpose))->isSingleValueType()) { Value *V = Emit(tree_value, DestLoc); + (void)V; assert(V == 0 && "Aggregate value returned in a register?"); } else { // Scalar value. Evaluate to a register, then do the store. @@ -7338,14 +7341,14 @@ Constant *TreeConstantToLLVM::EmitLV_ARRAY_REF(tree exp) { tree Array = TREE_OPERAND(exp, 0); - tree ArrayType = TREE_TYPE(Array); tree Index = TREE_OPERAND(exp, 1); tree IndexType = TREE_TYPE(Index); - assert(TREE_CODE(ArrayType) == ARRAY_TYPE && "Unknown ARRAY_REF!"); + assert(TREE_CODE(TREE_TYPE(Array)) == ARRAY_TYPE && "Unknown ARRAY_REF!"); // Check for variable sized reference. // FIXME: add support for array types where the size doesn't fit into 64 bits - assert(isSequentialCompatible(ArrayType) && "Global with variable size?"); + assert(isSequentialCompatible(TREE_TYPE(Array)) && + "Global with variable size?"); Constant *ArrayAddr; // First subtract the lower bound, if any, in the type of the index. From jyasskin at google.com Fri Sep 25 10:39:49 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 08:39:49 -0700 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp In-Reply-To: <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> References: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> Message-ID: Oops. :( Patch coming up. It appears MinGW intends us to use putenv, but I may just skip the test when setenv isn't available. On Fri, Sep 25, 2009 at 12:46 AM, Sandeep Patel wrote: > CommandLineTest.cpp breaks MinGW, which lacks setenv/unsetenv. > > deep > > On Thu, Sep 24, 2009 at 1:14 AM, Jeffrey Yasskin wrote: >> Author: jyasskin >> Date: Wed Sep 23 20:14:07 2009 >> New Revision: 82675 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev >> Log: >> Roll back r82348, which introduced an infinite loop in ParseCStringVector() that >> a trivial unittest would have caught. ?This revision also adds the trivial >> unittest. >> >> >> Added: >> ? ?llvm/trunk/unittests/Support/CommandLineTest.cpp >> Modified: >> ? ?llvm/trunk/lib/Support/CommandLine.cpp >> >> Modified: llvm/trunk/lib/Support/CommandLine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff >> >> ============================================================================== >> --- llvm/trunk/lib/Support/CommandLine.cpp (original) >> +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 >> @@ -351,31 +351,42 @@ >> ?/// using strdup(), so it is the caller's responsibility to free() >> ?/// them later. >> ?/// >> -static void ParseCStringVector(std::vector &OutputVector, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { >> +static void ParseCStringVector(std::vector &output, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { >> ? // Characters which will be treated as token separators: >> - ?StringRef Delims = " \v\f\t\r\n"; >> + ?static const char *const delims = " \v\f\t\r\n"; >> >> - ?StringRef WorkStr(Input); >> - ?while (!WorkStr.empty()) { >> - ? ?// If the first character is a delimiter, strip them off. >> - ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { >> - ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); >> - ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >> - ? ? ?WorkStr = WorkStr.substr(Pos); >> - ? ? ?continue; >> + ?std::string work(input); >> + ?// Skip past any delims at head of input string. >> + ?size_t pos = work.find_first_not_of(delims); >> + ?// If the string consists entirely of delims, then exit early. >> + ?if (pos == std::string::npos) return; >> + ?// Otherwise, jump forward to beginning of first word. >> + ?work = work.substr(pos); >> + ?// Find position of first delimiter. >> + ?pos = work.find_first_of(delims); >> + >> + ?while (!work.empty() && pos != std::string::npos) { >> + ? ?// Everything from 0 to POS is the next word to copy. >> + ? ?output.push_back(strdup(work.substr(0,pos).c_str())); >> + ? ?// Is there another word in the string? >> + ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); >> + ? ?if (nextpos != std::string::npos) { >> + ? ? ?// Yes? Then remove delims from beginning ... >> + ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); >> + ? ? ?// and find the end of the word. >> + ? ? ?pos = work.find_first_of(delims); >> + ? ?} else { >> + ? ? ?// No? (Remainder of string is delims.) End the loop. >> + ? ? ?work = ""; >> + ? ? ?pos = std::string::npos; >> ? ? } >> - >> - ? ?// Find position of first delimiter. >> - ? ?size_t Pos = WorkStr.find_first_of(Delims); >> - ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >> - >> - ? ?// Everything from 0 to Pos is the next word to copy. >> - ? ?char *NewStr = (char*)malloc(Pos+1); >> - ? ?memcpy(NewStr, WorkStr.data(), Pos); >> - ? ?NewStr[Pos] = 0; >> - ? ?OutputVector.push_back(NewStr); >> ? } >> + >> + ?// If `input' ended with non-delim char, then we'll get here with >> + ?// the last word of `input' in `work'; copy it now. >> + ?if (!work.empty()) >> + ? ?output.push_back(strdup(work.c_str())); >> ?} >> >> ?/// ParseEnvironmentOptions - An alternative entry point to the >> >> Added: llvm/trunk/unittests/Support/CommandLineTest.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto >> >> ============================================================================== >> --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) >> +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 >> @@ -0,0 +1,48 @@ >> +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// >> +// >> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >> +// >> +// This file is distributed under the University of Illinois Open Source >> +// License. See LICENSE.TXT for details. >> +// >> +//===----------------------------------------------------------------------===// >> + >> +#include "llvm/Support/CommandLine.h" >> + >> +#include "gtest/gtest.h" >> + >> +#include >> +#include >> + >> +using namespace llvm; >> + >> +namespace { >> + >> +class TempEnvVar { >> + public: >> + ?TempEnvVar(const char *name, const char *value) >> + ? ? ?: name(name) { >> + ? ?const char *old_value = getenv(name); >> + ? ?EXPECT_EQ(NULL, old_value) << old_value; >> + ? ?setenv(name, value, true); >> + ?} >> + >> + ?~TempEnvVar() { >> + ? ?unsetenv(name); >> + ?} >> + >> + private: >> + ?const char *const name; >> +}; >> + >> +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; >> + >> +cl::opt EnvironmentTestOption("env-test-opt"); >> +TEST(CommandLineTest, ParseEnvironment) { >> + ?TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); >> + ?EXPECT_EQ("", EnvironmentTestOption); >> + ?cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); >> + ?EXPECT_EQ("hello", EnvironmentTestOption); >> +} >> + >> +} ?// anonymous namespace >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > From daniel at zuster.org Fri Sep 25 11:03:58 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Sep 2009 16:03:58 -0000 Subject: [llvm-commits] [llvm] r82771 - /llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Message-ID: <200909251603.n8PG3wf8032165@zion.cs.uiuc.edu> Author: ddunbar Date: Fri Sep 25 11:03:57 2009 New Revision: 82771 URL: http://llvm.org/viewvc/llvm-project?rev=82771&view=rev Log: Strip trailing whitespace. Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=82771&r1=82770&r2=82771&view=diff ============================================================================== --- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original) +++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Fri Sep 25 11:03:57 2009 @@ -20,7 +20,7 @@ // produces on std::out a summary of the bitcode file that shows various // statistics about the contents of the file. By default this information is // detailed and contains information about individual bitcode blocks and the -// functions in the module. +// functions in the module. // The tool is also able to print a bitcode file in a straight forward text // format that shows the containment and relationships of the information in // the bitcode file (-dump option). @@ -62,7 +62,7 @@ cl::desc("Emit numberic info in dump even if" " symbolic info is available")); -/// CurStreamType - If we can sniff the flavor of this stream, we can produce +/// CurStreamType - If we can sniff the flavor of this stream, we can produce /// better dump info. static enum { UnknownBitstream, @@ -80,17 +80,17 @@ return "BLOCKINFO_BLOCK"; return 0; } - + // Check to see if we have a blockinfo record for this block, with a name. if (const BitstreamReader::BlockInfo *Info = StreamFile.getBlockInfo(BlockID)) { if (!Info->Name.empty()) return Info->Name.c_str(); } - - + + if (CurStreamType != LLVMIRBitstream) return 0; - + switch (BlockID) { default: return 0; case bitc::MODULE_BLOCK_ID: return "MODULE_BLOCK"; @@ -121,7 +121,7 @@ } return 0; } - + // Check to see if we have a blockinfo record for this record, with a name. if (const BitstreamReader::BlockInfo *Info = StreamFile.getBlockInfo(BlockID)) { @@ -129,10 +129,10 @@ if (Info->RecordNames[i].first == CodeID) return Info->RecordNames[i].second.c_str(); } - - + + if (CurStreamType != LLVMIRBitstream) return 0; - + switch (BlockID) { default: return 0; case bitc::MODULE_BLOCK_ID: @@ -175,7 +175,7 @@ case bitc::TYPE_CODE_PPC_FP128: return "PPC_FP128"; case bitc::TYPE_CODE_METADATA: return "METADATA"; } - + case bitc::CONSTANTS_BLOCK_ID: switch (CodeID) { default: return 0; @@ -199,12 +199,12 @@ case bitc::CST_CODE_CE_CMP: return "CE_CMP"; case bitc::CST_CODE_INLINEASM: return "INLINEASM"; case bitc::CST_CODE_CE_SHUFVEC_EX: return "CE_SHUFVEC_EX"; - } + } case bitc::FUNCTION_BLOCK_ID: switch (CodeID) { default: return 0; case bitc::FUNC_CODE_DECLAREBLOCKS: return "DECLAREBLOCKS"; - + case bitc::FUNC_CODE_INST_BINOP: return "INST_BINOP"; case bitc::FUNC_CODE_INST_CAST: return "INST_CAST"; case bitc::FUNC_CODE_INST_GEP: return "INST_GEP"; @@ -214,14 +214,14 @@ case bitc::FUNC_CODE_INST_INSERTELT: return "INST_INSERTELT"; case bitc::FUNC_CODE_INST_SHUFFLEVEC: return "INST_SHUFFLEVEC"; case bitc::FUNC_CODE_INST_CMP: return "INST_CMP"; - + case bitc::FUNC_CODE_INST_RET: return "INST_RET"; case bitc::FUNC_CODE_INST_BR: return "INST_BR"; case bitc::FUNC_CODE_INST_SWITCH: return "INST_SWITCH"; case bitc::FUNC_CODE_INST_INVOKE: return "INST_INVOKE"; case bitc::FUNC_CODE_INST_UNWIND: return "INST_UNWIND"; case bitc::FUNC_CODE_INST_UNREACHABLE: return "INST_UNREACHABLE"; - + case bitc::FUNC_CODE_INST_PHI: return "INST_PHI"; case bitc::FUNC_CODE_INST_MALLOC: return "INST_MALLOC"; case bitc::FUNC_CODE_INST_FREE: return "INST_FREE"; @@ -269,30 +269,30 @@ unsigned NumInstances; unsigned NumAbbrev; uint64_t TotalBits; - + PerRecordStats() : NumInstances(0), NumAbbrev(0), TotalBits(0) {} }; struct PerBlockIDStats { /// NumInstances - This the number of times this block ID has been seen. unsigned NumInstances; - + /// NumBits - The total size in bits of all of these blocks. uint64_t NumBits; - + /// NumSubBlocks - The total number of blocks these blocks contain. unsigned NumSubBlocks; - + /// NumAbbrevs - The total number of abbreviations. unsigned NumAbbrevs; - - /// NumRecords - The total number of records these blocks contain, and the + + /// NumRecords - The total number of records these blocks contain, and the /// number that are abbreviated. unsigned NumRecords, NumAbbreviatedRecords; - + /// CodeFreq - Keep track of the number of times we see each code. std::vector CodeFreq; - + PerBlockIDStats() : NumInstances(0), NumBits(0), NumSubBlocks(0), NumAbbrevs(0), NumRecords(0), NumAbbreviatedRecords(0) {} @@ -317,9 +317,9 @@ // Get the statistics for this BlockID. PerBlockIDStats &BlockStats = BlockIDStats[BlockID]; - + BlockStats.NumInstances++; - + // BLOCKINFO is a special part of the stream. if (BlockID == bitc::BLOCKINFO_BLOCK_ID) { if (Dump) errs() << Indent << "\n"; @@ -329,7 +329,7 @@ BlockStats.NumBits += BlockBitEnd-BlockBitStart; return false; } - + unsigned NumWords = 0; if (Stream.EnterSubBlock(BlockID, &NumWords)) return Error("Malformed block record"); @@ -341,14 +341,14 @@ errs() << BlockName; else errs() << "UnknownBlock" << BlockID; - + if (NonSymbolic && BlockName) errs() << " BlockID=" << BlockID; - + errs() << " NumWords=" << NumWords << " BlockCodeSize=" << Stream.GetAbbrevIDWidth() << ">\n"; } - + SmallVector Record; // Read all the records for this block. @@ -357,7 +357,7 @@ return Error("Premature end of bitstream"); uint64_t RecordStartBit = Stream.GetCurrentBitNo(); - + // Read the code for this record. unsigned AbbrevID = Stream.ReadCode(); switch (AbbrevID) { @@ -374,14 +374,14 @@ errs() << "UnknownBlock" << BlockID << ">\n"; } return false; - } + } case bitc::ENTER_SUBBLOCK: { uint64_t SubBlockBitStart = Stream.GetCurrentBitNo(); if (ParseBlock(Stream, IndentLevel+1)) return true; ++BlockStats.NumSubBlocks; uint64_t SubBlockBitEnd = Stream.GetCurrentBitNo(); - + // Don't include subblock sizes in the size of this block. BlockBitStart += SubBlockBitEnd-SubBlockBitStart; break; @@ -396,13 +396,13 @@ ++BlockStats.NumRecords; if (AbbrevID != bitc::UNABBREV_RECORD) ++BlockStats.NumAbbreviatedRecords; - + const char *BlobStart = 0; unsigned BlobLen = 0; unsigned Code = Stream.ReadRecord(AbbrevID, Record, BlobStart, BlobLen); - - + + // Increment the # occurrences of this code. if (BlockStats.CodeFreq.size() <= Code) BlockStats.CodeFreq.resize(Code+1); @@ -411,7 +411,7 @@ Stream.GetCurrentBitNo()-RecordStartBit; if (AbbrevID != bitc::UNABBREV_RECORD) BlockStats.CodeFreq[Code].NumAbbrev++; - + if (Dump) { errs() << Indent << " <"; if (const char *CodeName = @@ -427,9 +427,9 @@ for (unsigned i = 0, e = Record.size(); i != e; ++i) errs() << " op" << i << "=" << (int64_t)Record[i]; - + errs() << "/>"; - + if (BlobStart) { errs() << " blob data = "; bool BlobIsPrintable = true; @@ -438,16 +438,16 @@ BlobIsPrintable = false; break; } - + if (BlobIsPrintable) errs() << "'" << std::string(BlobStart, BlobStart+BlobLen) <<"'"; else errs() << "unprintable, " << BlobLen << " bytes."; } - + errs() << "\n"; } - + break; } } @@ -469,23 +469,23 @@ if (MemBuf == 0) return Error("Error reading '" + InputFilename + "'."); - + if (MemBuf->getBufferSize() & 3) return Error("Bitcode stream should be a multiple of 4 bytes in length"); - + unsigned char *BufPtr = (unsigned char *)MemBuf->getBufferStart(); unsigned char *EndBufPtr = BufPtr+MemBuf->getBufferSize(); - + // If we have a wrapper header, parse it and ignore the non-bc file contents. // The magic number is 0x0B17C0DE stored in little endian. if (isBitcodeWrapper(BufPtr, EndBufPtr)) if (SkipBitcodeWrapperHeader(BufPtr, EndBufPtr)) return Error("Invalid bitcode wrapper header"); - + BitstreamReader StreamFile(BufPtr, EndBufPtr); BitstreamCursor Stream(StreamFile); StreamFile.CollectBlockInfoNames(); - + // Read the stream signature. char Signature[6]; Signature[0] = Stream.Read(8); @@ -494,7 +494,7 @@ Signature[3] = Stream.Read(4); Signature[4] = Stream.Read(4); Signature[5] = Stream.Read(4); - + // Autodetect the file contents, if it is one we know. CurStreamType = UnknownBitstream; if (Signature[0] == 'B' && Signature[1] == 'C' && @@ -503,20 +503,20 @@ CurStreamType = LLVMIRBitstream; unsigned NumTopBlocks = 0; - + // Parse the top-level structure. We only allow blocks at the top-level. while (!Stream.AtEndOfStream()) { unsigned Code = Stream.ReadCode(); if (Code != bitc::ENTER_SUBBLOCK) return Error("Invalid record at top-level"); - + if (ParseBlock(Stream, 0)) return true; ++NumTopBlocks; } - + if (Dump) errs() << "\n\n"; - + uint64_t BufferSizeBits = (EndBufPtr-BufPtr)*CHAR_BIT; // Print a summary of the read file. errs() << "Summary of " << InputFilename << ":\n"; @@ -540,7 +540,7 @@ if (const char *BlockName = GetBlockName(I->first, StreamFile)) errs() << " (" << BlockName << ")"; errs() << ":\n"; - + const PerBlockIDStats &Stats = I->second; errs() << " Num Instances: " << Stats.NumInstances << "\n"; errs() << " Total Size: "; @@ -567,7 +567,7 @@ errs() << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/ (double)Stats.NumRecords)*100 << "\n"; errs() << "\n"; - + // Print a histogram of the codes we see. if (!NoHistogram && !Stats.CodeFreq.empty()) { std::vector > FreqPairs; // @@ -576,29 +576,29 @@ FreqPairs.push_back(std::make_pair(Freq, i)); std::stable_sort(FreqPairs.begin(), FreqPairs.end()); std::reverse(FreqPairs.begin(), FreqPairs.end()); - + errs() << "\tRecord Histogram:\n"; fprintf(stderr, "\t\t Count # Bits %% Abv Record Kind\n"); for (unsigned i = 0, e = FreqPairs.size(); i != e; ++i) { const PerRecordStats &RecStats = Stats.CodeFreq[FreqPairs[i].second]; - + fprintf(stderr, "\t\t%7d %9llu ", RecStats.NumInstances, (unsigned long long)RecStats.TotalBits); - + if (RecStats.NumAbbrev) fprintf(stderr, "%7.2f ", (double)RecStats.NumAbbrev/RecStats.NumInstances*100); else fprintf(stderr, " "); - - if (const char *CodeName = + + if (const char *CodeName = GetCodeName(FreqPairs[i].second, I->first, StreamFile)) fprintf(stderr, "%s\n", CodeName); else fprintf(stderr, "UnknownCode%d\n", FreqPairs[i].second); } errs() << "\n"; - + } } return 0; @@ -611,6 +611,6 @@ PrettyStackTraceProgram X(argc, argv); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, "llvm-bcanalyzer file analyzer\n"); - + return AnalyzeBitcode(); } From daniel at zuster.org Fri Sep 25 11:04:21 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Sep 2009 16:04:21 -0000 Subject: [llvm-commits] [llvm] r82772 - /llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Message-ID: <200909251604.n8PG4LqM032221@zion.cs.uiuc.edu> Author: ddunbar Date: Fri Sep 25 11:04:21 2009 New Revision: 82772 URL: http://llvm.org/viewvc/llvm-project?rev=82772&view=rev Log: Make llvm-bcanalyzer percentages more readable. Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=82772&r1=82771&r2=82772&view=diff ============================================================================== --- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original) +++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Fri Sep 25 11:04:21 2009 @@ -32,6 +32,7 @@ #include "llvm/Bitcode/LLVMBitCodes.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Format.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" @@ -546,8 +547,8 @@ errs() << " Total Size: "; PrintSize(Stats.NumBits); errs() << "\n"; - errs() << " % of file: " - << Stats.NumBits/(double)BufferSizeBits*100 << "\n"; + double pct = (Stats.NumBits * 100.0) / BufferSizeBits; + errs() << " Percent of file: " << format("%2.4f%%", pct) << "\n"; if (Stats.NumInstances > 1) { errs() << " Average Size: "; PrintSize(Stats.NumBits/(double)Stats.NumInstances); @@ -563,9 +564,10 @@ errs() << " Num Abbrevs: " << Stats.NumAbbrevs << "\n"; errs() << " Num Records: " << Stats.NumRecords << "\n"; } - if (Stats.NumRecords) - errs() << " % Abbrev Recs: " << (Stats.NumAbbreviatedRecords/ - (double)Stats.NumRecords)*100 << "\n"; + if (Stats.NumRecords) { + double pct = (Stats.NumAbbreviatedRecords * 100.0) / Stats.NumRecords; + errs() << " Percent Abbrevs: " << format("%2.4f%%", pct) << "\n"; + } errs() << "\n"; // Print a histogram of the codes we see. From vhernandez at apple.com Fri Sep 25 11:14:26 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Fri, 25 Sep 2009 09:14:26 -0700 Subject: [llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ In-Reply-To: <3024914D-354A-4E81-9A97-2EDEA66BEEBD@apple.com> References: <200909241747.n8OHlrdQ010313@zion.cs.uiuc.edu> <3024914D-354A-4E81-9A97-2EDEA66BEEBD@apple.com> Message-ID: <7488FD51-8AF0-48A9-BCF1-2BC2F2C0D9A2@apple.com> I am taking a look at it now, will probably revert if investigation does not show something immediately obvious. Victor On Sep 24, 2009, at 7:01 PM, Evan Cheng wrote: > Hi Victor, > > This is breaking tests on x86_64 / Mac OS X. I know at least of two > failures under MultiSource/Applications: > siod and d/make_dparser. > > Please revert the patch if you need time to investigate it. > > Thanks, > > Evan > > On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote: > >> Author: hernande >> Date: Thu Sep 24 12:47:49 2009 >> New Revision: 82694 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82694&view=rev >> Log: >> Auto-upgrade malloc instructions to malloc calls. >> >> Reviewed by Devang Patel. >> >> >> Modified: >> llvm/trunk/examples/BrainF/BrainF.cpp >> llvm/trunk/include/llvm/Instructions.h >> llvm/trunk/lib/AsmParser/LLLexer.cpp >> llvm/trunk/lib/AsmParser/LLParser.cpp >> llvm/trunk/lib/AsmParser/LLParser.h >> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp >> llvm/trunk/lib/VMCore/Core.cpp >> llvm/trunk/lib/VMCore/Instructions.cpp >> llvm/trunk/test/Analysis/PointerTracking/sizes.ll >> llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll >> llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll >> llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll >> llvm/trunk/test/Transforms/InstCombine/cast.ll >> llvm/trunk/test/Transforms/InstCombine/getelementptr.ll >> llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll >> llvm/trunk/test/Transforms/InstCombine/malloc2.ll >> >> Modified: llvm/trunk/examples/BrainF/BrainF.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/examples/BrainF/BrainF.cpp (original) >> +++ llvm/trunk/examples/BrainF/BrainF.cpp Thu Sep 24 12:47:49 2009 >> @@ -25,6 +25,7 @@ >> >> #include "BrainF.h" >> #include "llvm/Constants.h" >> +#include "llvm/Instructions.h" >> #include "llvm/Intrinsics.h" >> #include "llvm/ADT/STLExtras.h" >> #include >> @@ -78,7 +79,11 @@ >> >> //%arr = malloc i8, i32 %d >> ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); >> - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), >> val_mem, "arr"); >> + BasicBlock* BB = builder->GetInsertBlock(); >> + const Type* IntPtrTy = IntegerType::getInt32Ty(C); >> + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, >> IntegerType::getInt8Ty(C), >> + val_mem, NULL, "arr"); >> + BB->getInstList().push_back(cast(ptr_arr)); >> >> //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) >> { >> >> Modified: llvm/trunk/include/llvm/Instructions.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/Instructions.h (original) >> +++ llvm/trunk/include/llvm/Instructions.h Thu Sep 24 12:47:49 2009 >> @@ -1044,7 +1044,7 @@ >> const Twine &Name = ""); >> static Value *CreateMalloc(BasicBlock *InsertAtEnd, const Type >> *IntPtrTy, >> const Type *AllocTy, Value *ArraySize = >> 0, >> - const Twine &Name = ""); >> + Function* MallocF = 0, const Twine >> &Name = ""); >> >> ~CallInst(); >> >> @@ -1149,6 +1149,11 @@ >> const Value *getCalledValue() const { return Op<0>(); } >> Value *getCalledValue() { return Op<0>(); } >> >> + /// setCalledFunction - Set the function called >> + void setCalledFunction(Value* Fn) { >> + Op<0>() = Fn; >> + } >> + >> // Methods for support type inquiry through isa, cast, and dyn_cast: >> static inline bool classof(const CallInst *) { return true; } >> static inline bool classof(const Instruction *I) { >> >> Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) >> +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Thu Sep 24 12:47:49 2009 >> @@ -602,6 +602,9 @@ >> // Scan CurPtr ahead, seeing if there is just whitespace before >> the newline. >> if (JustWhitespaceNewLine(CurPtr)) >> return lltok::kw_zeroext; >> + } else if (Len == 6 && !memcmp(StartChar, "malloc", 6)) { >> + // Autoupgrade malloc instruction >> + return lltok::kw_malloc; >> } >> >> // Keywords for instructions. >> @@ -641,7 +644,6 @@ >> INSTKEYWORD(unwind, Unwind); >> INSTKEYWORD(unreachable, Unreachable); >> >> - INSTKEYWORD(malloc, Malloc); >> INSTKEYWORD(alloca, Alloca); >> INSTKEYWORD(free, Free); >> INSTKEYWORD(load, Load); >> >> Modified: llvm/trunk/lib/AsmParser/LLParser.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) >> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Sep 24 12:47:49 2009 >> @@ -69,6 +69,27 @@ >> /// ValidateEndOfModule - Do final validity and sanity checks at >> the end of the >> /// module. >> bool LLParser::ValidateEndOfModule() { >> + // Update auto-upgraded malloc calls from "autoupgrade_malloc" >> to "malloc". >> + if (MallocF) { >> + MallocF->setName("malloc"); >> + // If setName() does not set the name to "malloc", then there >> is already a >> + // declaration of "malloc". In that case, iterate over all >> calls to MallocF >> + // and get them to call the declared "malloc" instead. >> + if (MallocF->getName() != "malloc") { >> + Function* realMallocF = M->getFunction("malloc"); >> + for (User::use_iterator UI = MallocF->use_begin(), UE= >> MallocF->use_end(); >> + UI != UE; ) { >> + User* user = *UI; >> + UI++; >> + if (CallInst *Call = dyn_cast(user)) >> + Call->setCalledFunction(realMallocF); >> + } >> + if (!realMallocF->doesNotAlias(0)) realMallocF- >> >setDoesNotAlias(0); >> + MallocF->eraseFromParent(); >> + MallocF = NULL; >> + } >> + } >> + >> if (!ForwardRefTypes.empty()) >> return Error(ForwardRefTypes.begin()->second.second, >> "use of undefined type named '" + >> @@ -2776,8 +2797,8 @@ >> case lltok::kw_call: return ParseCall(Inst, PFS, false); >> case lltok::kw_tail: return ParseCall(Inst, PFS, true); >> // Memory. >> - case lltok::kw_alloca: >> - case lltok::kw_malloc: return ParseAlloc(Inst, PFS, >> KeywordVal); >> + case lltok::kw_alloca: return ParseAlloc(Inst, PFS); >> + case lltok::kw_malloc: return ParseAlloc(Inst, PFS, BB, >> false); >> case lltok::kw_free: return ParseFree(Inst, PFS); >> case lltok::kw_load: return ParseLoad(Inst, PFS, false); >> case lltok::kw_store: return ParseStore(Inst, PFS, false); >> @@ -3286,7 +3307,7 @@ >> } >> >> /// ParsePHI >> -/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' >> Value?? ']')* >> +/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' >> Value????? ']')* >> bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) { >> PATypeHolder Ty(Type::getVoidTy(Context)); >> Value *Op0, *Op1; >> @@ -3431,7 +3452,7 @@ >> /// ::= 'malloc' Type (',' TypeAndValue)? (',' OptionalInfo)? >> /// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalInfo)? >> bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, >> - unsigned Opc) { >> + BasicBlock* BB, bool isAlloca) { >> PATypeHolder Ty(Type::getVoidTy(Context)); >> Value *Size = 0; >> LocTy SizeLoc; >> @@ -3451,10 +3472,21 @@ >> if (Size && Size->getType() != Type::getInt32Ty(Context)) >> return Error(SizeLoc, "element count must be i32"); >> >> - if (Opc == Instruction::Malloc) >> - Inst = new MallocInst(Ty, Size, Alignment); >> - else >> + if (isAlloca) >> Inst = new AllocaInst(Ty, Size, Alignment); >> + else { >> + // Autoupgrade old malloc instruction to malloc call. >> + const Type* IntPtrTy = Type::getInt32Ty(Context); >> + const Type* Int8PtrTy = PointerType::getUnqual(Type::getInt8Ty >> (Context)); >> + if (!MallocF) >> + // Prototype malloc as "void *autoupgrade_malloc(int32)". >> + MallocF = cast(M->getOrInsertFunction >> ("autoupgrade_malloc", >> + Int8PtrTy, IntPtrTy, NULL)); >> + // "autoupgrade_malloc" updated to "malloc" in >> ValidateEndOfModule(). >> + >> + Inst = cast(CallInst::CreateMalloc(BB, IntPtrTy, >> Ty, >> + Size, MallocF)); >> + } >> return false; >> } >> >> >> Modified: llvm/trunk/lib/AsmParser/LLParser.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/AsmParser/LLParser.h (original) >> +++ llvm/trunk/lib/AsmParser/LLParser.h Thu Sep 24 12:47:49 2009 >> @@ -75,9 +75,11 @@ >> std::map > >> ForwardRefVals; >> std::map > >> ForwardRefValIDs; >> std::vector NumberedVals; >> + Function* MallocF; >> public: >> LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, >> Module *m) : >> - Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M >> (m) {} >> + Context(m->getContext()), Lex(F, SM, Err, m->getContext()), >> + M(m), MallocF(NULL) {} >> bool Run(); >> >> LLVMContext& getContext() { return Context; } >> @@ -276,7 +278,8 @@ >> bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS); >> bool ParsePHI(Instruction *&I, PerFunctionState &PFS); >> bool ParseCall(Instruction *&I, PerFunctionState &PFS, bool >> isTail); >> - bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, >> unsigned Opc); >> + bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, >> + BasicBlock *BB = 0, bool isAlloca = true); >> bool ParseFree(Instruction *&I, PerFunctionState &PFS); >> bool ParseLoad(Instruction *&I, PerFunctionState &PFS, bool >> isVolatile); >> bool ParseStore(Instruction *&I, PerFunctionState &PFS, bool >> isVolatile); >> >> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) >> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Sep 24 >> 12:47:49 2009 >> @@ -2046,14 +2046,21 @@ >> } >> >> case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align] >> + // Autoupgrade malloc instruction to malloc call. >> if (Record.size() < 3) >> return Error("Invalid MALLOC record"); >> const PointerType *Ty = >> dyn_cast_or_null(getTypeByID(Record[0])); >> Value *Size = getFnValueByID(Record[1], Type::getInt32Ty >> (Context)); >> - unsigned Align = Record[2]; >> if (!Ty || !Size) return Error("Invalid MALLOC record"); >> - I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> >> 1); >> + if (!CurBB) return Error("Invalid malloc instruction with no >> BB"); >> + const Type* Int32Ty = IntegerType::getInt32Ty(CurBB- >> >getContext()); >> + if (Size->getType() != Int32Ty) >> + Size = CastInst::CreateIntegerCast(Size, Int32Ty, false / >> *ZExt*/, >> + "", CurBB); >> + Value* Malloc = CallInst::CreateMalloc(CurBB, Int32Ty, >> + Ty->getElementType(), >> Size, NULL); >> + I = cast(Malloc); >> InstructionList.push_back(I); >> break; >> } >> >> Modified: llvm/trunk/lib/VMCore/Core.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/Core.cpp (original) >> +++ llvm/trunk/lib/VMCore/Core.cpp Thu Sep 24 12:47:49 2009 >> @@ -1636,12 +1636,16 @@ >> >> LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, >> const char *Name) { >> - return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), 0, Name)); >> + const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock >> ()->getContext()); >> + return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), >> IntPtrT, >> + unwrap(Ty), 0, 0, Twine >> (Name))); >> } >> >> LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, >> LLVMValueRef Val, const char >> *Name) { >> - return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), unwrap(Val), >> Name)); >> + const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock >> ()->getContext()); >> + return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), >> IntPtrT, >> + unwrap(Ty), unwrap(Val), 0, >> Twine(Name))); >> } >> >> LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, >> >> Modified: llvm/trunk/lib/VMCore/Instructions.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/VMCore/Instructions.cpp (original) >> +++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Sep 24 12:47:49 2009 >> @@ -462,7 +462,8 @@ >> >> static Value *createMalloc(Instruction *InsertBefore, BasicBlock >> *InsertAtEnd, >> const Type *IntPtrTy, const Type *AllocTy, >> - Value *ArraySize, const Twine &NameStr) { >> + Value *ArraySize, Function* MallocF, >> + const Twine &NameStr) { >> assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && ! >> InsertAtEnd)) && >> "createMalloc needs either InsertBefore or InsertAtEnd"); >> >> @@ -499,10 +500,11 @@ >> BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : >> InsertAtEnd; >> Module* M = BB->getParent()->getParent(); >> const Type *BPTy = PointerType::getUnqual(Type::getInt8Ty(BB- >> >getContext())); >> - // prototype malloc as "void *malloc(size_t)" >> - Constant *MallocF = M->getOrInsertFunction("malloc", BPTy, >> IntPtrTy, NULL); >> - if (!cast(MallocF)->doesNotAlias(0)) >> - cast(MallocF)->setDoesNotAlias(0); >> + if (!MallocF) >> + // prototype malloc as "void *malloc(size_t)" >> + MallocF = cast(M->getOrInsertFunction("malloc", BPTy, >> + IntPtrTy, >> NULL)); >> + if (!MallocF->doesNotAlias(0)) MallocF->setDoesNotAlias(0); >> const PointerType *AllocPtrType = PointerType::getUnqual(AllocTy); >> CallInst *MCall = NULL; >> Value *MCast = NULL; >> @@ -531,7 +533,8 @@ >> Value *CallInst::CreateMalloc(Instruction *InsertBefore, const Type >> *IntPtrTy, >> const Type *AllocTy, Value *ArraySize, >> const Twine &Name) { >> - return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, >> ArraySize, Name); >> + return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, >> + ArraySize, NULL, Name); >> } >> >> /// CreateMalloc - Generate the IR for a call to malloc: >> @@ -544,8 +547,9 @@ >> /// responsibility of the caller. >> Value *CallInst::CreateMalloc(BasicBlock *InsertAtEnd, const Type >> *IntPtrTy, >> const Type *AllocTy, Value *ArraySize, >> - const Twine &Name) { >> - return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, >> ArraySize, Name); >> + Function* MallocF, const Twine >> &Name) { >> + return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, >> + ArraySize, MallocF, Name); >> } >> >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> >> Modified: llvm/trunk/test/Analysis/PointerTracking/sizes.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/PointerTracking/sizes.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Analysis/PointerTracking/sizes.ll (original) >> +++ llvm/trunk/test/Analysis/PointerTracking/sizes.ll Thu Sep 24 >> 12:47:49 2009 >> @@ -63,7 +63,7 @@ >> define i32 @foo2(i32 %n) nounwind { >> entry: >> %call = malloc i8, i32 %n ; [#uses=1] >> -; CHECK: %call = >> +; CHECK: %malloccall = >> ; CHECK: ==> %n elements, %n bytes allocated >> %call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; >> [#uses=1] >> ; CHECK: %call2 = >> >> Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll >> (original) >> +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll Thu >> Sep 24 12:47:49 2009 >> @@ -1,4 +1,6 @@ >> -; RUN: opt < %s -globalopt -S | not grep malloc >> +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc >> +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16- >> i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128- >> a0:0:64-f80:128:128" >> +target triple = "i686-apple-darwin8" >> >> @G = internal global i32* null ; [#uses=3] >> >> >> Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll >> (original) >> +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll Thu >> Sep 24 12:47:49 2009 >> @@ -1,4 +1,6 @@ >> -; RUN: opt < %s -globalopt -S | not grep malloc >> +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc >> +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16- >> i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128- >> a0:0:64-f80:128:128" >> +target triple = "i686-apple-darwin8" >> >> @G = internal global i32* null ; [#uses=4] >> >> >> Modified: llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll (original) >> +++ llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll Thu Sep >> 24 12:47:49 2009 >> @@ -1,6 +1,6 @@ >> ; test that casted mallocs get converted to malloc of the right type >> ; RUN: opt < %s -instcombine -S | \ >> -; RUN: not grep bitcast >> +; RUN: grep bitcast | count 1 >> >> ; The target datalayout is important for this test case. We have to >> tell >> ; instcombine that the ABI alignment for a long is 4-bytes, not 8, >> otherwise >> >> Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/InstCombine/cast.ll (original) >> +++ llvm/trunk/test/Transforms/InstCombine/cast.ll Thu Sep 24 >> 12:47:49 2009 >> @@ -79,9 +79,9 @@ >> } >> >> define i32* @test12() { >> - %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] >> - %c = bitcast [4 x i8]* %p to i32* ; >> [#uses=1] >> - ret i32* %c >> + %c = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] >> + %p = bitcast [4 x i8]* %c to i32* ; >> [#uses=1] >> + ret i32* %p >> } >> define i8* @test13(i64 %A) { >> %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf >> to [0 x i8]*), i64 0, i64 %A ; [#uses=1] >> >> Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/InstCombine/getelementptr.ll >> (original) >> +++ llvm/trunk/test/Transforms/InstCombine/getelementptr.ll Thu Sep >> 24 12:47:49 2009 >> @@ -58,7 +58,7 @@ >> %B = getelementptr i32* %A, i64 2 >> ret i32* %B >> ; CHECK: @test6 >> -; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 >> +; CHECK: getelementptr i8* %malloccall, i64 8 >> } >> >> define i32* @test7(i32* %I, i64 %C, i64 %D) { >> >> Modified: llvm/trunk/test/Transforms/InstCombine/malloc-free- >> delete.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll >> (original) >> +++ llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll >> Thu Sep 24 12:47:49 2009 >> @@ -1,5 +1,5 @@ >> ; RUN: opt < %s -instcombine -S | grep {ret i32 0} >> -; RUN: opt < %s -instcombine -S | not grep malloc >> +; RUN: opt < %s -instcombine -globaldce -S | not grep malloc >> ; PR1201 >> define i32 @main(i32 %argc, i8** %argv) { >> %c_19 = alloca i8* ; [#uses=2] >> >> Modified: llvm/trunk/test/Transforms/InstCombine/malloc2.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc2.ll?rev=82694&r1=82693&r2=82694&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/test/Transforms/InstCombine/malloc2.ll (original) >> +++ llvm/trunk/test/Transforms/InstCombine/malloc2.ll Thu Sep 24 >> 12:47:49 2009 >> @@ -1,5 +1,4 @@ >> ; RUN: opt < %s -instcombine -S | grep {ret i32 0} >> -; RUN: opt < %s -instcombine -S | not grep malloc >> ; PR1313 >> >> define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From bob.wilson at apple.com Fri Sep 25 11:34:46 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Sep 2009 16:34:46 -0000 Subject: [llvm-commits] [llvm] r82773 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Message-ID: <200909251634.n8PGYkMw003633@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 25 11:34:46 2009 New Revision: 82773 URL: http://llvm.org/viewvc/llvm-project?rev=82773&view=rev Log: Add some comments to clarify things that I discovered this week. Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=82773&r1=82772&r2=82773&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Sep 25 11:34:46 2009 @@ -1151,6 +1151,7 @@ unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0; int FramePtrSpillFI = 0; + // Allocate the vararg register save area. This is not counted in NumBytes. if (VARegSaveSize) emitSPUpdate(isARM, MBB, MBBI, dl, TII, -VARegSaveSize); @@ -1198,8 +1199,11 @@ emitSPUpdate(isARM, MBB, MBBI, dl, TII, -GPRCS1Size); movePastCSLoadStoreOps(MBB, MBBI, ARM::STR, ARM::t2STRi12, 1, STI); - // Darwin ABI requires FP to point to the stack slot that contains the - // previous FP. + // Set FP to point to the stack slot that contains the previous FP. + // For Darwin, FP is R7, which has now been stored in spill area 1. + // Otherwise, if this is not Darwin, all the callee-saved registers go + // into spill area 1, including the FP in R11. In either case, it is + // now safe to emit this assignment. if (STI.isTargetDarwin() || hasFP(MF)) { unsigned ADDriOpc = !AFI->isThumbFunction() ? ARM::ADDri : ARM::t2ADDri; MachineInstrBuilder MIB = From clattner at apple.com Fri Sep 25 11:38:28 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Sep 2009 09:38:28 -0700 Subject: [llvm-commits] [PATCH] Provide debug syms in release builds In-Reply-To: References: Message-ID: On Sep 25, 2009, at 12:27 AM, Jeffrey Yasskin wrote: > This patch causes the --enable-debug-runtime configure flag and the > DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's > objects. Without this, it's very hard to debug crashes that happen in > Release-Asserts mode but not Debug mode. Works for me, -Chris From clattner at apple.com Fri Sep 25 11:43:36 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Sep 2009 09:43:36 -0700 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html In-Reply-To: References: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> <4ABBDB4E.8080500@gmail.com> Message-ID: On Sep 24, 2009, at 3:27 PM, Dale Johannesen wrote: > > On Sep 24, 2009, at 1:49 PMPDT, T?r?k Edwin wrote: > >> On 2009-09-24 21:38, Dale Johannesen wrote: >>> >>> Clarify that llvm attaches C language semantics to >>> functions with names that match the C library. >> >> In fact this list is longer [1], it includes (excluding Andersens.cpp >> and SimplifyLibcalls) >> abs, absf, absl, atexit, calloc, ceil, copysign, copysignf, cosl, >> __dso_handle, >> exit, fabsf, fabsl, free, __half_powr4, __main, main, memcpy, >> realloc, >> _setjmp, setjmp, >> sinf, sinl. > > Functions starting with __ are fair game, I don't think we need > document those at this level. Could you add the others to my list? Is there any reason to have an explicit list? Why not just say "llvm assumes that functions defined in libc and libm are well known, this is something we'd like to fix in the future to better support freestanding environments." and leave it at that? -Chris From jyasskin at google.com Fri Sep 25 11:46:09 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 16:46:09 -0000 Subject: [llvm-commits] [llvm] r82775 - in /llvm/trunk: Makefile.rules docs/MakefileGuide.html Message-ID: <200909251646.n8PGkANW005051@zion.cs.uiuc.edu> Author: jyasskin Date: Fri Sep 25 11:46:09 2009 New Revision: 82775 URL: http://llvm.org/viewvc/llvm-project?rev=82775&view=rev Log: This patch causes the --enable-debug-runtime configure flag and the DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's objects. Without this, it's very hard to debug crashes that happen in Release-Asserts mode but not Debug mode. Modified: llvm/trunk/Makefile.rules llvm/trunk/docs/MakefileGuide.html Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=82775&r1=82774&r2=82775&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Fri Sep 25 11:46:09 2009 @@ -313,6 +313,13 @@ CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) LD.Flags += $(OPTIMIZE_OPTION) + ifdef DEBUG_RUNTIME + BuildMode := $(BuildMode)+Debug + CXX.Flags += -g + C.Flags += -g + LD.Flags += -g + KEEP_SYMBOLS := 1 + endif else BuildMode := Debug CXX.Flags += -g Modified: llvm/trunk/docs/MakefileGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/MakefileGuide.html?rev=82775&r1=82774&r2=82775&view=diff ============================================================================== --- llvm/trunk/docs/MakefileGuide.html (original) +++ llvm/trunk/docs/MakefileGuide.html Fri Sep 25 11:46:09 2009 @@ -626,6 +626,11 @@
If set to any value, causes a bitcode library (.bc) to be built.
CONFIG_FILES
Specifies a set of configuration files to be installed.
+
DEBUG_RUNTIME
+
If set to any value, causes the build to include debugging + symbols even in optimized objects, libraries and executables. This + alters the flags specified to the compilers and linkers. Debugging + isn't fun in an optimized build, but it is possible.
DIRS
Specifies a set of directories, usually children of the current directory, that should also be made using the same goal. These directories From dalej at apple.com Fri Sep 25 11:48:05 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 09:48:05 -0700 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html In-Reply-To: References: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> <4ABBDB4E.8080500@gmail.com> Message-ID: <5D782D37-2340-428D-85B2-803C24AE2F97@apple.com> On Sep 25, 2009, at 9:43 AM, Chris Lattner wrote: >> >> On Sep 24, 2009, at 1:49 PMPDT, T?r?k Edwin wrote: >> >>> On 2009-09-24 21:38, Dale Johannesen wrote: >>>> >>>> Clarify that llvm attaches C language semantics to >>>> functions with names that match the C library. >>> >>> In fact this list is longer [1], it includes (excluding >>> Andersens.cpp >>> and SimplifyLibcalls) >>> abs, absf, absl, atexit, calloc, ceil, copysign, copysignf, cosl, >>> __dso_handle, >>> exit, fabsf, fabsl, free, __half_powr4, __main, main, memcpy, >>> realloc, >>> _setjmp, setjmp, >>> sinf, sinl. >> >> Functions starting with __ are fair game, I don't think we need >> document those at this level. Could you add the others to my list? > > Is there any reason to have an explicit list? Why not just say > "llvm assumes that functions defined in libc and libm are well > known, this is something we'd like to fix in the future to better > support freestanding environments." and leave it at that? What's in libc and libm varies from target to target, but I'm OK with pointing to one of the standards (probably C99) if you want to do that. From clattner at apple.com Fri Sep 25 11:50:03 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Sep 2009 09:50:03 -0700 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html In-Reply-To: <5D782D37-2340-428D-85B2-803C24AE2F97@apple.com> References: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> <4ABBDB4E.8080500@gmail.com> <5D782D37-2340-428D-85B2-803C24AE2F97@apple.com> Message-ID: <088578EB-F047-47EC-A294-39C98939C1A7@apple.com> On Sep 25, 2009, at 9:48 AM, Dale Johannesen wrote: >>> >>> Functions starting with __ are fair game, I don't think we need >>> document those at this level. Could you add the others to my list? >> >> Is there any reason to have an explicit list? Why not just say >> "llvm assumes that functions defined in libc and libm are well >> known, this is something we'd like to fix in the future to better >> support freestanding environments." and leave it at that? > > What's in libc and libm varies from target to target, but I'm OK > with pointing to one of the standards (probably C99) if you want to > do that. I'm arguing that the statement be fuzzy, so we don't have to keep it up to date. Pointing to c99 is fine if you to do that. -Chris From dalej at apple.com Fri Sep 25 12:04:42 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 17:04:42 -0000 Subject: [llvm-commits] [llvm] r82776 - /llvm/trunk/docs/LangRef.html Message-ID: <200909251704.n8PH4gEW007387@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 25 12:04:42 2009 New Revision: 82776 URL: http://llvm.org/viewvc/llvm-project?rev=82776&view=rev Log: Revise C library functions description to be vaguer, per Chris. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=82776&r1=82775&r2=82776&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 25 12:04:42 2009 @@ -5046,11 +5046,10 @@

llvm treats calls to some functions with names and arguments that match the -standard C library as being the C library functions, and may perform -optimizations or generate code for them under that assumption. These -functions currently include: -acos, asin, atan, atan2, ceil, cos, cosf, cosh, exp, fabs, floor, fmod, log, -log10, malloc, pow, sin, sinh, sqrt, sqrtf, sin, sinf, tan, tanh.

+standard C99 library as being the C99 library functions, and may perform +optimizations or generate code for them under that assumption. This is +something we'd like to change in the future to provide better support for +freestanding environments and non-C-based langauges.

From sabre at nondot.org Fri Sep 25 12:09:13 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 17:09:13 -0000 Subject: [llvm-commits] [llvm] r82777 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909251709.n8PH9DHB007953@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 12:09:12 2009 New Revision: 82777 URL: http://llvm.org/viewvc/llvm-project?rev=82777&view=rev Log: special case Patterns that are a single fixed string. This is a microscopic perf win and is needed for future changes. Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82777&r1=82776&r2=82777&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Sep 25 12:09:12 2009 @@ -75,6 +75,8 @@ /// Chunks - The pattern chunks to match. If the bool is false, it is a fixed /// string match, if it is true, it is a regex match. SmallVector Chunks; + + StringRef FixedStr; public: Pattern() { } @@ -101,6 +103,14 @@ return true; } + // Check to see if this is a fixed string, or if it has regex pieces. + if (PatternStr.size() < 2 || PatternStr.find("{{") == StringRef::npos) { + FixedStr = PatternStr; + return false; + } + + // Otherwise, there is at least one regex piece. + // Scan the pattern to break it into regex and non-regex pieces. while (!PatternStr.empty()) { // Handle fixed string matches. @@ -141,6 +151,12 @@ /// returns the position that is matched or npos if there is no match. If /// there is a match, the size of the matched string is returned in MatchLen. size_t Pattern::Match(StringRef Buffer, size_t &MatchLen) const { + // If this is a fixed string pattern, just match it now. + if (!FixedStr.empty()) { + MatchLen = FixedStr.size(); + return Buffer.find(FixedStr); + } + size_t FirstMatch = StringRef::npos; MatchLen = 0; From dalej at apple.com Fri Sep 25 12:23:23 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 17:23:23 -0000 Subject: [llvm-commits] [llvm] r82778 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200909251723.n8PHNNl3009740@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 25 12:23:22 2009 New Revision: 82778 URL: http://llvm.org/viewvc/llvm-project?rev=82778&view=rev Log: Generate FSQRT from calls to the sqrt function, which allows appropriate backends to generate a sqrt instruction. On x86, this isn't done at -O0 because we go through FastISel instead. This is a behavior change from before this series of sqrt patches started. I think this is OK considering that compile speed is most important at -O0, but could be convinced otherwise. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=82778&r1=82777&r2=82778&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri Sep 25 12:23:22 2009 @@ -4576,6 +4576,15 @@ Tmp.getValueType(), Tmp)); return; } + } else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") { + if (I.getNumOperands() == 2 && // Basic sanity checks. + I.getOperand(1)->getType()->isFloatingPoint() && + I.getType() == I.getOperand(1)->getType()) { + SDValue Tmp = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), + Tmp.getValueType(), Tmp)); + return; + } } } } else if (isa(I.getOperand(0))) { From sabre at nondot.org Fri Sep 25 12:23:43 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 17:23:43 -0000 Subject: [llvm-commits] [llvm] r82779 - in /llvm/trunk: test/CodeGen/X86/xor.ll utils/FileCheck/FileCheck.cpp Message-ID: <200909251723.n8PHNhww009791@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 12:23:43 2009 New Revision: 82779 URL: http://llvm.org/viewvc/llvm-project?rev=82779&view=rev Log: reimplement the regex matching strategy by building a single regex and matching it instead of trying to match chunks at a time. Matching chunks at a time broke with check lines like CHECK: foo {{.*}}bar because the .* would eat the entire rest of the line and bar would never match. Now we just escape the fixed strings for the user, so that something like: CHECK: a() {{.*}}??? is matched as: CHECK: {{a\(\) .*\?\?\?}} transparently "under the covers". Modified: llvm/trunk/test/CodeGen/X86/xor.ll llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/test/CodeGen/X86/xor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor.ll?rev=82779&r1=82778&r2=82779&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/xor.ll (original) +++ llvm/trunk/test/CodeGen/X86/xor.ll Fri Sep 25 12:23:43 2009 @@ -59,10 +59,10 @@ ; X64: test4: ; X64: notl %eax -; X64: andl {{.*%eax}} +; X64: andl {{.*}}%eax ; X32: test4: ; X32: notl %edx -; X32: andl {{.*%edx}} +; X32: andl {{.*}}%edx } define i16 @test5(i16 %a, i16 %b) nounwind { @@ -81,10 +81,10 @@ ret i16 %tmp3 ; X64: test5: ; X64: notw %ax -; X64: andw {{.*%ax}} +; X64: andw {{.*}}%ax ; X32: test5: ; X32: notw %dx -; X32: andw {{.*%dx}} +; X32: andw {{.*}}%dx } define i8 @test6(i8 %a, i8 %b) nounwind { @@ -103,10 +103,10 @@ ret i8 %tmp3 ; X64: test6: ; X64: notb %al -; X64: andb {{.*%al}} +; X64: andb {{.*}}%al ; X32: test6: ; X32: notb %dl -; X32: andb {{.*%dl}} +; X32: andb {{.*}}%dl } define i32 @test7(i32 %a, i32 %b) nounwind { @@ -125,9 +125,9 @@ ret i32 %tmp3 ; X64: test7: ; X64: xorl $2147483646, %eax -; X64: andl {{.*%eax}} +; X64: andl {{.*}}%eax ; X32: test7: ; X32: xorl $2147483646, %edx -; X32: andl {{.*%edx}} +; X32: andl {{.*}}%edx } Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82779&r1=82778&r2=82779&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Sep 25 12:23:43 2009 @@ -44,39 +44,13 @@ // Pattern Handling Code. //===----------------------------------------------------------------------===// -class PatternChunk { - StringRef Str; - bool isRegEx; -public: - PatternChunk(StringRef S, bool isRE) : Str(S), isRegEx(isRE) {} - - size_t Match(StringRef Buffer, size_t &MatchLen) const { - if (!isRegEx) { - // Fixed string match. - MatchLen = Str.size(); - return Buffer.find(Str); - } - - // Regex match. - SmallVector MatchInfo; - if (!Regex(Str, Regex::Sub|Regex::Newline).match(Buffer, &MatchInfo)) - return StringRef::npos; - - // Successful regex match. - assert(!MatchInfo.empty() && "Didn't get any match"); - StringRef FullMatch = MatchInfo[0]; - - MatchLen = FullMatch.size(); - return FullMatch.data()-Buffer.data(); - } -}; - class Pattern { - /// Chunks - The pattern chunks to match. If the bool is false, it is a fixed - /// string match, if it is true, it is a regex match. - SmallVector Chunks; - + /// FixedStr - If non-empty, this pattern is a fixed string match with the + /// specified fixed string. StringRef FixedStr; + + /// RegEx - If non-empty, this is a regex pattern. + std::string RegExStr; public: Pattern() { } @@ -87,6 +61,9 @@ /// returns the position that is matched or npos if there is no match. If /// there is a match, the size of the matched string is returned in MatchLen. size_t Match(StringRef Buffer, size_t &MatchLen) const; + +private: + void AddFixedStringToRegEx(StringRef FixedStr); }; bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { @@ -109,17 +86,15 @@ return false; } - // Otherwise, there is at least one regex piece. - - // Scan the pattern to break it into regex and non-regex pieces. + // Otherwise, there is at least one regex piece. Build up the regex pattern + // by escaping scary characters in fixed strings, building up one big regex. while (!PatternStr.empty()) { // Handle fixed string matches. if (PatternStr.size() < 2 || PatternStr[0] != '{' || PatternStr[1] != '{') { // Find the end, which is the start of the next regex. size_t FixedMatchEnd = PatternStr.find("{{"); - - Chunks.push_back(PatternChunk(PatternStr.substr(0, FixedMatchEnd),false)); + AddFixedStringToRegEx(PatternStr.substr(0, FixedMatchEnd)); PatternStr = PatternStr.substr(FixedMatchEnd); continue; } @@ -132,7 +107,8 @@ return true; } - Regex R(PatternStr.substr(2, End-2)); + StringRef RegexStr = PatternStr.substr(2, End-2); + Regex R(RegexStr); std::string Error; if (!R.isValid(Error)) { SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()+2), @@ -140,13 +116,41 @@ return true; } - Chunks.push_back(PatternChunk(PatternStr.substr(2, End-2), true)); + RegExStr += RegexStr.str(); PatternStr = PatternStr.substr(End+2); } return false; } +void Pattern::AddFixedStringToRegEx(StringRef FixedStr) { + // Add the characters from FixedStr to the regex, escaping as needed. This + // avoids "leaning toothpicks" in common patterns. + for (unsigned i = 0, e = FixedStr.size(); i != e; ++i) { + switch (FixedStr[i]) { + // These are the special characters matched in "p_ere_exp". + case '(': + case ')': + case '^': + case '$': + case '|': + case '*': + case '+': + case '?': + case '.': + case '[': + case '\\': + case '{': + RegExStr += '\\'; + // FALL THROUGH. + default: + RegExStr += FixedStr[i]; + break; + } + } +} + + /// Match - Match the pattern string against the input buffer Buffer. This /// returns the position that is matched or npos if there is no match. If /// there is a match, the size of the matched string is returned in MatchLen. @@ -157,58 +161,17 @@ return Buffer.find(FixedStr); } - size_t FirstMatch = StringRef::npos; - MatchLen = 0; - - while (!Buffer.empty()) { - StringRef MatchAttempt = Buffer; - - unsigned ChunkNo = 0, e = Chunks.size(); - for (; ChunkNo != e; ++ChunkNo) { - size_t ThisMatch, ThisLength = StringRef::npos; - ThisMatch = Chunks[ChunkNo].Match(MatchAttempt, ThisLength); - - // Otherwise, what we do depends on if this is the first match or not. If - // this is the first match, it doesn't match to match at the start of - // MatchAttempt. - if (ChunkNo == 0) { - // If the first match fails then this pattern will never match in - // Buffer. - if (ThisMatch == StringRef::npos) - return ThisMatch; - - FirstMatch = ThisMatch; - MatchAttempt = MatchAttempt.substr(FirstMatch); - ThisMatch = 0; - } - - // If this chunk didn't match, then the entire pattern didn't match from - // FirstMatch, try later in the buffer. - if (ThisMatch == StringRef::npos) - break; - - // Ok, if the match didn't match at the beginning of MatchAttempt, then we - // have something like "ABC{{DEF}} and something was in-between. Reject - // the match. - if (ThisMatch != 0) - break; - - // Otherwise, match the string and move to the next chunk. - MatchLen += ThisLength; - MatchAttempt = MatchAttempt.substr(ThisLength); - } - - // If the whole thing matched, we win. - if (ChunkNo == e) - return FirstMatch; - - // Otherwise, try matching again after FirstMatch to see if this pattern - // matches later in the buffer. - Buffer = Buffer.substr(FirstMatch+1); - } + // Regex match. + SmallVector MatchInfo; + if (!Regex(RegExStr, Regex::Sub|Regex::Newline).match(Buffer, &MatchInfo)) + return StringRef::npos; + + // Successful regex match. + assert(!MatchInfo.empty() && "Didn't get any match"); + StringRef FullMatch = MatchInfo[0]; - // If we ran out of stuff to scan, then we didn't match. - return StringRef::npos; + MatchLen = FullMatch.size(); + return FullMatch.data()-Buffer.data(); } From jyasskin at google.com Fri Sep 25 12:28:27 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 10:28:27 -0700 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp In-Reply-To: References: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> Message-ID: Could you check if the attached patch fixes things for you? And if it looks sensible? It includes the new generated configure script so you don't have to regenerate it. On Fri, Sep 25, 2009 at 8:39 AM, Jeffrey Yasskin wrote: > Oops. :( Patch coming up. It appears MinGW intends us to use putenv, > but I may just skip the test when setenv isn't available. > > On Fri, Sep 25, 2009 at 12:46 AM, Sandeep Patel wrote: >> CommandLineTest.cpp breaks MinGW, which lacks setenv/unsetenv. >> >> deep >> >> On Thu, Sep 24, 2009 at 1:14 AM, Jeffrey Yasskin wrote: >>> Author: jyasskin >>> Date: Wed Sep 23 20:14:07 2009 >>> New Revision: 82675 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev >>> Log: >>> Roll back r82348, which introduced an infinite loop in ParseCStringVector() that >>> a trivial unittest would have caught. ?This revision also adds the trivial >>> unittest. >>> >>> >>> Added: >>> ? ?llvm/trunk/unittests/Support/CommandLineTest.cpp >>> Modified: >>> ? ?llvm/trunk/lib/Support/CommandLine.cpp >>> >>> Modified: llvm/trunk/lib/Support/CommandLine.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff >>> >>> ============================================================================== >>> --- llvm/trunk/lib/Support/CommandLine.cpp (original) >>> +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 >>> @@ -351,31 +351,42 @@ >>> ?/// using strdup(), so it is the caller's responsibility to free() >>> ?/// them later. >>> ?/// >>> -static void ParseCStringVector(std::vector &OutputVector, >>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { >>> +static void ParseCStringVector(std::vector &output, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { >>> ? // Characters which will be treated as token separators: >>> - ?StringRef Delims = " \v\f\t\r\n"; >>> + ?static const char *const delims = " \v\f\t\r\n"; >>> >>> - ?StringRef WorkStr(Input); >>> - ?while (!WorkStr.empty()) { >>> - ? ?// If the first character is a delimiter, strip them off. >>> - ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { >>> - ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); >>> - ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>> - ? ? ?WorkStr = WorkStr.substr(Pos); >>> - ? ? ?continue; >>> + ?std::string work(input); >>> + ?// Skip past any delims at head of input string. >>> + ?size_t pos = work.find_first_not_of(delims); >>> + ?// If the string consists entirely of delims, then exit early. >>> + ?if (pos == std::string::npos) return; >>> + ?// Otherwise, jump forward to beginning of first word. >>> + ?work = work.substr(pos); >>> + ?// Find position of first delimiter. >>> + ?pos = work.find_first_of(delims); >>> + >>> + ?while (!work.empty() && pos != std::string::npos) { >>> + ? ?// Everything from 0 to POS is the next word to copy. >>> + ? ?output.push_back(strdup(work.substr(0,pos).c_str())); >>> + ? ?// Is there another word in the string? >>> + ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); >>> + ? ?if (nextpos != std::string::npos) { >>> + ? ? ?// Yes? Then remove delims from beginning ... >>> + ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); >>> + ? ? ?// and find the end of the word. >>> + ? ? ?pos = work.find_first_of(delims); >>> + ? ?} else { >>> + ? ? ?// No? (Remainder of string is delims.) End the loop. >>> + ? ? ?work = ""; >>> + ? ? ?pos = std::string::npos; >>> ? ? } >>> - >>> - ? ?// Find position of first delimiter. >>> - ? ?size_t Pos = WorkStr.find_first_of(Delims); >>> - ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>> - >>> - ? ?// Everything from 0 to Pos is the next word to copy. >>> - ? ?char *NewStr = (char*)malloc(Pos+1); >>> - ? ?memcpy(NewStr, WorkStr.data(), Pos); >>> - ? ?NewStr[Pos] = 0; >>> - ? ?OutputVector.push_back(NewStr); >>> ? } >>> + >>> + ?// If `input' ended with non-delim char, then we'll get here with >>> + ?// the last word of `input' in `work'; copy it now. >>> + ?if (!work.empty()) >>> + ? ?output.push_back(strdup(work.c_str())); >>> ?} >>> >>> ?/// ParseEnvironmentOptions - An alternative entry point to the >>> >>> Added: llvm/trunk/unittests/Support/CommandLineTest.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto >>> >>> ============================================================================== >>> --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) >>> +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 >>> @@ -0,0 +1,48 @@ >>> +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// >>> +// >>> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >>> +// >>> +// This file is distributed under the University of Illinois Open Source >>> +// License. See LICENSE.TXT for details. >>> +// >>> +//===----------------------------------------------------------------------===// >>> + >>> +#include "llvm/Support/CommandLine.h" >>> + >>> +#include "gtest/gtest.h" >>> + >>> +#include >>> +#include >>> + >>> +using namespace llvm; >>> + >>> +namespace { >>> + >>> +class TempEnvVar { >>> + public: >>> + ?TempEnvVar(const char *name, const char *value) >>> + ? ? ?: name(name) { >>> + ? ?const char *old_value = getenv(name); >>> + ? ?EXPECT_EQ(NULL, old_value) << old_value; >>> + ? ?setenv(name, value, true); >>> + ?} >>> + >>> + ?~TempEnvVar() { >>> + ? ?unsetenv(name); >>> + ?} >>> + >>> + private: >>> + ?const char *const name; >>> +}; >>> + >>> +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; >>> + >>> +cl::opt EnvironmentTestOption("env-test-opt"); >>> +TEST(CommandLineTest, ParseEnvironment) { >>> + ?TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); >>> + ?EXPECT_EQ("", EnvironmentTestOption); >>> + ?cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); >>> + ?EXPECT_EQ("hello", EnvironmentTestOption); >>> +} >>> + >>> +} ?// anonymous namespace >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: fix_setenv.patch Type: application/octet-stream Size: 7353 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090925/2f002f8c/attachment.obj From sabre at nondot.org Fri Sep 25 12:29:36 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 25 Sep 2009 17:29:36 -0000 Subject: [llvm-commits] [llvm] r82780 - /llvm/trunk/utils/FileCheck/FileCheck.cpp Message-ID: <200909251729.n8PHTasm010642@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 25 12:29:36 2009 New Revision: 82780 URL: http://llvm.org/viewvc/llvm-project?rev=82780&view=rev Log: reject attempts to use ()'s in patterns, these are reserved for filecheck. Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82780&r1=82779&r2=82780&view=diff ============================================================================== --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Sep 25 12:29:36 2009 @@ -45,6 +45,9 @@ //===----------------------------------------------------------------------===// class Pattern { + SourceMgr *SM; + SMLoc PatternLoc; + /// FixedStr - If non-empty, this pattern is a fixed string match with the /// specified fixed string. StringRef FixedStr; @@ -67,6 +70,9 @@ }; bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { + this->SM = &SM; + PatternLoc = SMLoc::getFromPointer(PatternStr.data()); + // Ignore trailing whitespace. while (!PatternStr.empty() && (PatternStr.back() == ' ' || PatternStr.back() == '\t')) @@ -74,9 +80,8 @@ // Check that there is something on the line. if (PatternStr.empty()) { - SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()), - "found empty check string with prefix '"+CheckPrefix+":'", - "error"); + SM.PrintMessage(PatternLoc, "found empty check string with prefix '" + + CheckPrefix+":'", "error"); return true; } @@ -170,6 +175,13 @@ assert(!MatchInfo.empty() && "Didn't get any match"); StringRef FullMatch = MatchInfo[0]; + + if (MatchInfo.size() != 1) { + SM->PrintMessage(PatternLoc, "regex cannot use grouping parens", "error"); + exit(1); + } + + MatchLen = FullMatch.size(); return FullMatch.data()-Buffer.data(); } From clattner at apple.com Fri Sep 25 12:31:32 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 25 Sep 2009 10:31:32 -0700 Subject: [llvm-commits] [llvm] r82778 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <200909251723.n8PHNNl3009740@zion.cs.uiuc.edu> References: <200909251723.n8PHNNl3009740@zion.cs.uiuc.edu> Message-ID: On Sep 25, 2009, at 10:23 AM, Dale Johannesen wrote: > Author: johannes > Date: Fri Sep 25 12:23:22 2009 > New Revision: 82778 > > URL: http://llvm.org/viewvc/llvm-project?rev=82778&view=rev > Log: > Generate FSQRT from calls to the sqrt function, which > allows appropriate backends to generate a sqrt instruction. > > On x86, this isn't done at -O0 because we go through > FastISel instead. This is a behavior change from before > this series of sqrt patches started. I think this is OK > considering that compile speed is most important at -O0, but > could be convinced otherwise. I'm fine with fastisel not doing this, but it should only happen if the sqrt function is readonly, otherwise the errno update is lost. -Chris > > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=82778&r1=82777&r2=82778&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri > Sep 25 12:23:22 2009 > @@ -4576,6 +4576,15 @@ > Tmp.getValueType(), Tmp)); > return; > } > + } else if (Name == "sqrt" || Name == "sqrtf" || Name == > "sqrtl") { > + if (I.getNumOperands() == 2 && // Basic sanity checks. > + I.getOperand(1)->getType()->isFloatingPoint() && > + I.getType() == I.getOperand(1)->getType()) { > + SDValue Tmp = getValue(I.getOperand(1)); > + setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), > + Tmp.getValueType(), Tmp)); > + return; > + } > } > } > } else if (isa(I.getOperand(0))) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Fri Sep 25 13:00:35 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 18:00:35 -0000 Subject: [llvm-commits] [llvm] r82781 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200909251800.n8PI0ZuS014902@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 25 13:00:35 2009 New Revision: 82781 URL: http://llvm.org/viewvc/llvm-project?rev=82781&view=rev Log: Make sure sin, cos, sqrt calls are marked readonly before producing FSIN, FCOS, FSQRT. If they aren't so marked we have to assume they might set errno. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=82781&r1=82780&r2=82781&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri Sep 25 13:00:35 2009 @@ -4561,7 +4561,8 @@ } else if (Name == "sin" || Name == "sinf" || Name == "sinl") { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { + I.getType() == I.getOperand(1)->getType() && + I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FSIN, getCurDebugLoc(), Tmp.getValueType(), Tmp)); @@ -4570,7 +4571,8 @@ } else if (Name == "cos" || Name == "cosf" || Name == "cosl") { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { + I.getType() == I.getOperand(1)->getType() && + I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FCOS, getCurDebugLoc(), Tmp.getValueType(), Tmp)); @@ -4579,7 +4581,8 @@ } else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { + I.getType() == I.getOperand(1)->getType() && + I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), Tmp.getValueType(), Tmp)); From vhernandez at apple.com Fri Sep 25 13:11:52 2009 From: vhernandez at apple.com (Victor Hernandez) Date: Fri, 25 Sep 2009 18:11:52 -0000 Subject: [llvm-commits] [llvm] r82784 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/ Message-ID: <200909251811.n8PIBrUY016457@zion.cs.uiuc.edu> Author: hernande Date: Fri Sep 25 13:11:52 2009 New Revision: 82784 URL: http://llvm.org/viewvc/llvm-project?rev=82784&view=rev Log: Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/AsmParser/LLLexer.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/AsmParser/LLParser.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/test/Analysis/PointerTracking/sizes.ll llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll llvm/trunk/test/Transforms/InstCombine/cast.ll llvm/trunk/test/Transforms/InstCombine/getelementptr.ll llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll llvm/trunk/test/Transforms/InstCombine/malloc2.ll Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Fri Sep 25 13:11:52 2009 @@ -25,7 +25,6 @@ #include "BrainF.h" #include "llvm/Constants.h" -#include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/ADT/STLExtras.h" #include @@ -79,11 +78,7 @@ //%arr = malloc i8, i32 %d ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); - BasicBlock* BB = builder->GetInsertBlock(); - const Type* IntPtrTy = IntegerType::getInt32Ty(C); - ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, IntegerType::getInt8Ty(C), - val_mem, NULL, "arr"); - BB->getInstList().push_back(cast(ptr_arr)); + ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), val_mem, "arr"); //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) { Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Fri Sep 25 13:11:52 2009 @@ -1044,7 +1044,7 @@ const Twine &Name = ""); static Value *CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, Value *ArraySize = 0, - Function* MallocF = 0, const Twine &Name = ""); + const Twine &Name = ""); ~CallInst(); @@ -1149,11 +1149,6 @@ const Value *getCalledValue() const { return Op<0>(); } Value *getCalledValue() { return Op<0>(); } - /// setCalledFunction - Set the function called - void setCalledFunction(Value* Fn) { - Op<0>() = Fn; - } - // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const CallInst *) { return true; } static inline bool classof(const Instruction *I) { Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Fri Sep 25 13:11:52 2009 @@ -602,9 +602,6 @@ // Scan CurPtr ahead, seeing if there is just whitespace before the newline. if (JustWhitespaceNewLine(CurPtr)) return lltok::kw_zeroext; - } else if (Len == 6 && !memcmp(StartChar, "malloc", 6)) { - // Autoupgrade malloc instruction - return lltok::kw_malloc; } // Keywords for instructions. @@ -644,6 +641,7 @@ INSTKEYWORD(unwind, Unwind); INSTKEYWORD(unreachable, Unreachable); + INSTKEYWORD(malloc, Malloc); INSTKEYWORD(alloca, Alloca); INSTKEYWORD(free, Free); INSTKEYWORD(load, Load); Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Sep 25 13:11:52 2009 @@ -69,27 +69,6 @@ /// ValidateEndOfModule - Do final validity and sanity checks at the end of the /// module. bool LLParser::ValidateEndOfModule() { - // Update auto-upgraded malloc calls from "autoupgrade_malloc" to "malloc". - if (MallocF) { - MallocF->setName("malloc"); - // If setName() does not set the name to "malloc", then there is already a - // declaration of "malloc". In that case, iterate over all calls to MallocF - // and get them to call the declared "malloc" instead. - if (MallocF->getName() != "malloc") { - Function* realMallocF = M->getFunction("malloc"); - for (User::use_iterator UI = MallocF->use_begin(), UE= MallocF->use_end(); - UI != UE; ) { - User* user = *UI; - UI++; - if (CallInst *Call = dyn_cast(user)) - Call->setCalledFunction(realMallocF); - } - if (!realMallocF->doesNotAlias(0)) realMallocF->setDoesNotAlias(0); - MallocF->eraseFromParent(); - MallocF = NULL; - } - } - if (!ForwardRefTypes.empty()) return Error(ForwardRefTypes.begin()->second.second, "use of undefined type named '" + @@ -2797,8 +2776,8 @@ case lltok::kw_call: return ParseCall(Inst, PFS, false); case lltok::kw_tail: return ParseCall(Inst, PFS, true); // Memory. - case lltok::kw_alloca: return ParseAlloc(Inst, PFS); - case lltok::kw_malloc: return ParseAlloc(Inst, PFS, BB, false); + case lltok::kw_alloca: + case lltok::kw_malloc: return ParseAlloc(Inst, PFS, KeywordVal); case lltok::kw_free: return ParseFree(Inst, PFS); case lltok::kw_load: return ParseLoad(Inst, PFS, false); case lltok::kw_store: return ParseStore(Inst, PFS, false); @@ -3307,7 +3286,7 @@ } /// ParsePHI -/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' Value????? ']')* +/// ::= 'phi' Type '[' Value ',' Value ']' (',' '[' Value ',' Value?? ']')* bool LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) { PATypeHolder Ty(Type::getVoidTy(Context)); Value *Op0, *Op1; @@ -3452,7 +3431,7 @@ /// ::= 'malloc' Type (',' TypeAndValue)? (',' OptionalInfo)? /// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalInfo)? bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, - BasicBlock* BB, bool isAlloca) { + unsigned Opc) { PATypeHolder Ty(Type::getVoidTy(Context)); Value *Size = 0; LocTy SizeLoc; @@ -3472,21 +3451,10 @@ if (Size && Size->getType() != Type::getInt32Ty(Context)) return Error(SizeLoc, "element count must be i32"); - if (isAlloca) + if (Opc == Instruction::Malloc) + Inst = new MallocInst(Ty, Size, Alignment); + else Inst = new AllocaInst(Ty, Size, Alignment); - else { - // Autoupgrade old malloc instruction to malloc call. - const Type* IntPtrTy = Type::getInt32Ty(Context); - const Type* Int8PtrTy = PointerType::getUnqual(Type::getInt8Ty(Context)); - if (!MallocF) - // Prototype malloc as "void *autoupgrade_malloc(int32)". - MallocF = cast(M->getOrInsertFunction("autoupgrade_malloc", - Int8PtrTy, IntPtrTy, NULL)); - // "autoupgrade_malloc" updated to "malloc" in ValidateEndOfModule(). - - Inst = cast(CallInst::CreateMalloc(BB, IntPtrTy, Ty, - Size, MallocF)); - } return false; } Modified: llvm/trunk/lib/AsmParser/LLParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.h (original) +++ llvm/trunk/lib/AsmParser/LLParser.h Fri Sep 25 13:11:52 2009 @@ -75,11 +75,9 @@ std::map > ForwardRefVals; std::map > ForwardRefValIDs; std::vector NumberedVals; - Function* MallocF; public: LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) : - Context(m->getContext()), Lex(F, SM, Err, m->getContext()), - M(m), MallocF(NULL) {} + Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M(m) {} bool Run(); LLVMContext& getContext() { return Context; } @@ -278,8 +276,7 @@ bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS); bool ParsePHI(Instruction *&I, PerFunctionState &PFS); bool ParseCall(Instruction *&I, PerFunctionState &PFS, bool isTail); - bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, - BasicBlock *BB = 0, bool isAlloca = true); + bool ParseAlloc(Instruction *&I, PerFunctionState &PFS, unsigned Opc); bool ParseFree(Instruction *&I, PerFunctionState &PFS); bool ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile); bool ParseStore(Instruction *&I, PerFunctionState &PFS, bool isVolatile); Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Sep 25 13:11:52 2009 @@ -2046,21 +2046,14 @@ } case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align] - // Autoupgrade malloc instruction to malloc call. if (Record.size() < 3) return Error("Invalid MALLOC record"); const PointerType *Ty = dyn_cast_or_null(getTypeByID(Record[0])); Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context)); + unsigned Align = Record[2]; if (!Ty || !Size) return Error("Invalid MALLOC record"); - if (!CurBB) return Error("Invalid malloc instruction with no BB"); - const Type* Int32Ty = IntegerType::getInt32Ty(CurBB->getContext()); - if (Size->getType() != Int32Ty) - Size = CastInst::CreateIntegerCast(Size, Int32Ty, false /*ZExt*/, - "", CurBB); - Value* Malloc = CallInst::CreateMalloc(CurBB, Int32Ty, - Ty->getElementType(), Size, NULL); - I = cast(Malloc); + I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> 1); InstructionList.push_back(I); break; } Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Fri Sep 25 13:11:52 2009 @@ -1636,16 +1636,12 @@ LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name) { - const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); - return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), IntPtrT, - unwrap(Ty), 0, 0, Twine(Name))); + return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), 0, Name)); } LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name) { - const Type* IntPtrT = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); - return wrap(CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), IntPtrT, - unwrap(Ty), unwrap(Val), 0, Twine(Name))); + return wrap(unwrap(B)->CreateMalloc(unwrap(Ty), unwrap(Val), Name)); } LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty, Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Fri Sep 25 13:11:52 2009 @@ -462,8 +462,7 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, - Value *ArraySize, Function* MallocF, - const Twine &NameStr) { + Value *ArraySize, const Twine &NameStr) { assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) && "createMalloc needs either InsertBefore or InsertAtEnd"); @@ -500,11 +499,10 @@ BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd; Module* M = BB->getParent()->getParent(); const Type *BPTy = PointerType::getUnqual(Type::getInt8Ty(BB->getContext())); - if (!MallocF) - // prototype malloc as "void *malloc(size_t)" - MallocF = cast(M->getOrInsertFunction("malloc", BPTy, - IntPtrTy, NULL)); - if (!MallocF->doesNotAlias(0)) MallocF->setDoesNotAlias(0); + // prototype malloc as "void *malloc(size_t)" + Constant *MallocF = M->getOrInsertFunction("malloc", BPTy, IntPtrTy, NULL); + if (!cast(MallocF)->doesNotAlias(0)) + cast(MallocF)->setDoesNotAlias(0); const PointerType *AllocPtrType = PointerType::getUnqual(AllocTy); CallInst *MCall = NULL; Value *MCast = NULL; @@ -533,8 +531,7 @@ Value *CallInst::CreateMalloc(Instruction *InsertBefore, const Type *IntPtrTy, const Type *AllocTy, Value *ArraySize, const Twine &Name) { - return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, - ArraySize, NULL, Name); + return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, ArraySize, Name); } /// CreateMalloc - Generate the IR for a call to malloc: @@ -547,9 +544,8 @@ /// responsibility of the caller. Value *CallInst::CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy, const Type *AllocTy, Value *ArraySize, - Function* MallocF, const Twine &Name) { - return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, - ArraySize, MallocF, Name); + const Twine &Name) { + return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, ArraySize, Name); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/test/Analysis/PointerTracking/sizes.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/PointerTracking/sizes.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Analysis/PointerTracking/sizes.ll (original) +++ llvm/trunk/test/Analysis/PointerTracking/sizes.ll Fri Sep 25 13:11:52 2009 @@ -63,7 +63,7 @@ define i32 @foo2(i32 %n) nounwind { entry: %call = malloc i8, i32 %n ; [#uses=1] -; CHECK: %malloccall = +; CHECK: %call = ; CHECK: ==> %n elements, %n bytes allocated %call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; [#uses=1] ; CHECK: %call2 = Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll (original) +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-2.ll Fri Sep 25 13:11:52 2009 @@ -1,6 +1,4 @@ -; RUN: opt < %s -globalopt -globaldce -S | not grep malloc -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin8" +; RUN: opt < %s -globalopt -S | not grep malloc @G = internal global i32* null ; [#uses=3] Modified: llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll (original) +++ llvm/trunk/test/Transforms/GlobalOpt/malloc-promote-3.ll Fri Sep 25 13:11:52 2009 @@ -1,6 +1,4 @@ -; RUN: opt < %s -globalopt -globaldce -S | not grep malloc -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin8" +; RUN: opt < %s -globalopt -S | not grep malloc @G = internal global i32* null ; [#uses=4] Modified: llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/cast-malloc.ll Fri Sep 25 13:11:52 2009 @@ -1,6 +1,6 @@ ; test that casted mallocs get converted to malloc of the right type ; RUN: opt < %s -instcombine -S | \ -; RUN: grep bitcast | count 1 +; RUN: not grep bitcast ; The target datalayout is important for this test case. We have to tell ; instcombine that the ABI alignment for a long is 4-bytes, not 8, otherwise Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/cast.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/cast.ll Fri Sep 25 13:11:52 2009 @@ -79,9 +79,9 @@ } define i32* @test12() { - %c = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] - %p = bitcast [4 x i8]* %c to i32* ; [#uses=1] - ret i32* %p + %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] + %c = bitcast [4 x i8]* %p to i32* ; [#uses=1] + ret i32* %c } define i8* @test13(i64 %A) { %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; [#uses=1] Modified: llvm/trunk/test/Transforms/InstCombine/getelementptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/getelementptr.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/getelementptr.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/getelementptr.ll Fri Sep 25 13:11:52 2009 @@ -58,7 +58,7 @@ %B = getelementptr i32* %A, i64 2 ret i32* %B ; CHECK: @test6 -; CHECK: getelementptr i8* %malloccall, i64 8 +; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 } define i32* @test7(i32* %I, i64 %C, i64 %D) { Modified: llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/malloc-free-delete.ll Fri Sep 25 13:11:52 2009 @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 0} -; RUN: opt < %s -instcombine -globaldce -S | not grep malloc +; RUN: opt < %s -instcombine -S | not grep malloc ; PR1201 define i32 @main(i32 %argc, i8** %argv) { %c_19 = alloca i8* ; [#uses=2] Modified: llvm/trunk/test/Transforms/InstCombine/malloc2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/malloc2.ll?rev=82784&r1=82783&r2=82784&view=diff ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/malloc2.ll (original) +++ llvm/trunk/test/Transforms/InstCombine/malloc2.ll Fri Sep 25 13:11:52 2009 @@ -1,4 +1,5 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -instcombine -S | not grep malloc ; PR1313 define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { From stuart at apple.com Fri Sep 25 13:12:07 2009 From: stuart at apple.com (Stuart Hastings) Date: Fri, 25 Sep 2009 18:12:07 -0000 Subject: [llvm-commits] [llvm] r82785 - /llvm/tags/Apple/llvmCore-2310.1/ Message-ID: <200909251812.n8PIC7lV016510@zion.cs.uiuc.edu> Author: stuart Date: Fri Sep 25 13:12:07 2009 New Revision: 82785 URL: http://llvm.org/viewvc/llvm-project?rev=82785&view=rev Log: Tagging llvmCore-2310.1 Added: llvm/tags/Apple/llvmCore-2310.1/ - copied from r82693, llvm/trunk/ From dalej at apple.com Fri Sep 25 13:15:29 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 18:15:29 -0000 Subject: [llvm-commits] [llvm] r82786 - in /llvm/trunk/test/CodeGen/X86: negative-sin.ll sincos.ll Message-ID: <200909251815.n8PIFTO4017094@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 25 13:15:29 2009 New Revision: 82786 URL: http://llvm.org/viewvc/llvm-project?rev=82786&view=rev Log: Add readonly to some sin and cos calls; transformations being checked aren't valid without it. Modified: llvm/trunk/test/CodeGen/X86/negative-sin.ll llvm/trunk/test/CodeGen/X86/sincos.ll Modified: llvm/trunk/test/CodeGen/X86/negative-sin.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/negative-sin.ll?rev=82786&r1=82785&r2=82786&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/negative-sin.ll (original) +++ llvm/trunk/test/CodeGen/X86/negative-sin.ll Fri Sep 25 13:15:29 2009 @@ -6,7 +6,7 @@ define double @foo(double %e) { %f = fsub double 0.0, %e - %g = call double @sin(double %f) + %g = call double @sin(double %f) readonly %h = fsub double 0.0, %g ret double %h } Modified: llvm/trunk/test/CodeGen/X86/sincos.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sincos.ll?rev=82786&r1=82785&r2=82786&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/sincos.ll (original) +++ llvm/trunk/test/CodeGen/X86/sincos.ll Fri Sep 25 13:15:29 2009 @@ -4,45 +4,45 @@ ; RUN: llc < %s -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | \ ; RUN: grep cos\$ | count 3 -declare float @sinf(float) +declare float @sinf(float) readonly -declare double @sin(double) +declare double @sin(double) readonly -declare x86_fp80 @sinl(x86_fp80) +declare x86_fp80 @sinl(x86_fp80) readonly define float @test1(float %X) { - %Y = call float @sinf(float %X) + %Y = call float @sinf(float %X) readonly ret float %Y } define double @test2(double %X) { - %Y = call double @sin(double %X) + %Y = call double @sin(double %X) readonly ret double %Y } define x86_fp80 @test3(x86_fp80 %X) { - %Y = call x86_fp80 @sinl(x86_fp80 %X) + %Y = call x86_fp80 @sinl(x86_fp80 %X) readonly ret x86_fp80 %Y } -declare float @cosf(float) +declare float @cosf(float) readonly -declare double @cos(double) +declare double @cos(double) readonly -declare x86_fp80 @cosl(x86_fp80) +declare x86_fp80 @cosl(x86_fp80) readonly define float @test4(float %X) { - %Y = call float @cosf(float %X) + %Y = call float @cosf(float %X) readonly ret float %Y } define double @test5(double %X) { - %Y = call double @cos(double %X) + %Y = call double @cos(double %X) readonly ret double %Y } define x86_fp80 @test6(x86_fp80 %X) { - %Y = call x86_fp80 @cosl(x86_fp80 %X) + %Y = call x86_fp80 @cosl(x86_fp80 %X) readonly ret x86_fp80 %Y } From bob.wilson at apple.com Fri Sep 25 13:31:21 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Sep 2009 18:31:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82787 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Message-ID: <200909251831.n8PIVLDW019111@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 25 13:31:20 2009 New Revision: 82787 URL: http://llvm.org/viewvc/llvm-project?rev=82787&view=rev Log: pr5037: Make neon_float_type a variant of the standard float type to avoid warnings. Patch by Sandeep Patel. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=82787&r1=82786&r2=82787&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Fri Sep 25 13:31:20 2009 @@ -16734,17 +16734,6 @@ return VALID_NEON_DREG_MODE (mode) || VALID_NEON_QREG_MODE (mode); } -/* APPLE LOCAL begin 7083296 Build without warnings. */ -static tree -make_neon_float_type (void) -{ - tree neon_float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (neon_float_type_node) = FLOAT_TYPE_SIZE; - layout_type (neon_float_type_node); - return neon_float_type_node; -} -/* APPLE LOCAL end 7083296 Build without warnings. */ - /* LLVM LOCAL begin multi-vector types */ #ifdef ENABLE_LLVM /* Create a new builtin struct type containing NUMVECS fields (where NUMVECS @@ -16880,7 +16869,8 @@ tree neon_intSI_type_node = make_signed_type (GET_MODE_PRECISION (SImode)); tree neon_intDI_type_node = make_signed_type (GET_MODE_PRECISION (DImode)); /* APPLE LOCAL begin 7083296 Build without warnings. */ - tree neon_float_type_node = make_neon_float_type (); + /* LLVM LOCAL pr5037 */ + tree neon_float_type_node = build_variant_type_copy (float_type_node); /* APPLE LOCAL end 7083296 Build without warnings. */ tree intQI_pointer_node = build_pointer_type (neon_intQI_type_node); From evan.cheng at apple.com Fri Sep 25 13:34:26 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Sep 2009 11:34:26 -0700 Subject: [llvm-commits] [llvm] r82734 - in /llvm/trunk/lib: CodeGen/PrologEpilogInserter.cpp CodeGen/PrologEpilogInserter.h Target/ARM/ARMBaseRegisterInfo.cpp Target/ARM/Thumb1RegisterInfo.cpp In-Reply-To: <975E430D-FB46-4A03-A722-10537A055CC5@2pi.dk> References: <200909242352.n8ONqJGh025506@zion.cs.uiuc.edu> <975E430D-FB46-4A03-A722-10537A055CC5@2pi.dk> Message-ID: <8C40A0A1-B5B4-4F2E-A4A0-299F97DCA5B1@apple.com> On Sep 25, 2009, at 12:47 AM, Jakob Stoklund Olesen wrote: > > On 25/09/2009, at 01.52, Jim Grosbach wrote: >> Start of revamping the register scavenging in PEI. ARM Thumb1 is the >> driving >> interest for this, as it currently reserves a register rather than >> using >> the scavenger for matierializing constants as needed. > > Great! Please see comments below. > >> +void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) { > ... >> + // Keep a map of which scratch reg we use for each virtual reg. >> + // FIXME: Is a map like this the best solution? Seems like >> overkill, >> + // but to get rid of it would need some fairly strong >> assumptions >> + // that may not be valid as this gets smarter about reuse and >> such. >> + IndexedMap ScratchRegForVirtReg; > > It seems that for now, we must require that live ranges of virtual > registers are disjoint. Otherwise we would need more than one > emergency spill slot in the worst case. > > With only one virtual register live at a time, the map is indeed > overkill. > > It would also be a good idea to enforce the one-virtual-register-at-a- > time rule with asserts here. Yes, this makes sense. RS cannot handle scavenging more than one register at a time. That means you just have to keep track the virtual register def that is live and look for a free physical register when it's killed (which should be the next instruction or else this violates the short live range assumption). Evan > >> + ScratchRegForVirtReg.grow(Fn.getRegInfo().getLastVirtReg()); >> + >> + for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end >> (); ++I) { >> + MachineInstr *MI = I; >> + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) >> + if (MI->getOperand(i).isReg()) { >> + unsigned Reg = MI->getOperand(i).getReg(); >> + if (Reg && TRI->isVirtualRegister(Reg)) { > > Would it perhaps be possible to reduce nesting with 'continue' here? > >> + // If we already have a scratch for this virtual >> register, use it >> + unsigned NewReg = ScratchRegForVirtReg[Reg]; >> + if (!NewReg) { >> + const TargetRegisterClass *RC = Fn.getRegInfo >> ().getRegClass(Reg); >> + NewReg = RS->FindUnusedReg(RC); >> + if (NewReg == 0) >> + // No register is "free". Scavenge a register. >> + // FIXME: Track SPAdj. Zero won't always be right >> + NewReg = RS->scavengeRegister(RC, I, 0); > > Ideally, I would like to get rid of FindUnusedReg(), so you could just > say scavengeRegister() here. The ARMLoadStoreOptimizer is the only one > to use FindUnusedReg() without immediately calling scavengerRegister() > when it fails. I am no sure if that is intentional. > > There is another issue here. FindUnusedReg() will give you a register > that is unused /at the current position/. You really need a register > that is unused in the whole live range of the virtual register you are > replacing. scavengeRegister() won't return a register that is used by > the instruction at I, but it looks like we need a variant that can > exclude from whole range of instructions. > > The rule should be: "NewReg must not be defined by any instruction in > the range, except for the last. NewReg must not be an EarlyClobber > operand on the last instruction." > >> + assert (NewReg && "unable to scavenge register!"); >> + ScratchRegForVirtReg[Reg] = NewReg; >> + } >> + MI->getOperand(i).setReg(NewReg); > > For full generality, you need to watch out for subreg operands when > replacing a virtreg with a physreg. At least you should assert > (getSubReg()==0). > >> + } >> + } >> + RS->forward(MI); > > Yeah, I also want to get rid of forward() as a public method. Since > scavengeRegister takes an iterator argument that /must/ be next(MI) > anyway, there is really no point to having it. > > Batch forwarding over a range of instructions is going to be faster as > well. > >> + } >> + } >> +} > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From deeppatel1987 at gmail.com Fri Sep 25 13:34:57 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Fri, 25 Sep 2009 18:34:57 +0000 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp In-Reply-To: References: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> Message-ID: <305d6f60909251134v60abaa17r2291c28f3f8cea29@mail.gmail.com> This won't work for me. I build our Windows-hosted tools using MinGW. I'm not building using native Windows headers. mingwrt-3.15.2 lacks _putenv_s in it's headers. It may just be easier to skip this test on Windows. deep On Fri, Sep 25, 2009 at 5:28 PM, Jeffrey Yasskin wrote: > Could you check if the attached patch fixes things for you? And if it > looks sensible? It includes the new generated configure script so you > don't have to regenerate it. > > On Fri, Sep 25, 2009 at 8:39 AM, Jeffrey Yasskin wrote: >> Oops. :( Patch coming up. It appears MinGW intends us to use putenv, >> but I may just skip the test when setenv isn't available. >> >> On Fri, Sep 25, 2009 at 12:46 AM, Sandeep Patel wrote: >>> CommandLineTest.cpp breaks MinGW, which lacks setenv/unsetenv. >>> >>> deep >>> >>> On Thu, Sep 24, 2009 at 1:14 AM, Jeffrey Yasskin wrote: >>>> Author: jyasskin >>>> Date: Wed Sep 23 20:14:07 2009 >>>> New Revision: 82675 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev >>>> Log: >>>> Roll back r82348, which introduced an infinite loop in ParseCStringVector() that >>>> a trivial unittest would have caught. ?This revision also adds the trivial >>>> unittest. >>>> >>>> >>>> Added: >>>> ? ?llvm/trunk/unittests/Support/CommandLineTest.cpp >>>> Modified: >>>> ? ?llvm/trunk/lib/Support/CommandLine.cpp >>>> >>>> Modified: llvm/trunk/lib/Support/CommandLine.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff >>>> >>>> ============================================================================== >>>> --- llvm/trunk/lib/Support/CommandLine.cpp (original) >>>> +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 >>>> @@ -351,31 +351,42 @@ >>>> ?/// using strdup(), so it is the caller's responsibility to free() >>>> ?/// them later. >>>> ?/// >>>> -static void ParseCStringVector(std::vector &OutputVector, >>>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { >>>> +static void ParseCStringVector(std::vector &output, >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { >>>> ? // Characters which will be treated as token separators: >>>> - ?StringRef Delims = " \v\f\t\r\n"; >>>> + ?static const char *const delims = " \v\f\t\r\n"; >>>> >>>> - ?StringRef WorkStr(Input); >>>> - ?while (!WorkStr.empty()) { >>>> - ? ?// If the first character is a delimiter, strip them off. >>>> - ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { >>>> - ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); >>>> - ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>>> - ? ? ?WorkStr = WorkStr.substr(Pos); >>>> - ? ? ?continue; >>>> + ?std::string work(input); >>>> + ?// Skip past any delims at head of input string. >>>> + ?size_t pos = work.find_first_not_of(delims); >>>> + ?// If the string consists entirely of delims, then exit early. >>>> + ?if (pos == std::string::npos) return; >>>> + ?// Otherwise, jump forward to beginning of first word. >>>> + ?work = work.substr(pos); >>>> + ?// Find position of first delimiter. >>>> + ?pos = work.find_first_of(delims); >>>> + >>>> + ?while (!work.empty() && pos != std::string::npos) { >>>> + ? ?// Everything from 0 to POS is the next word to copy. >>>> + ? ?output.push_back(strdup(work.substr(0,pos).c_str())); >>>> + ? ?// Is there another word in the string? >>>> + ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); >>>> + ? ?if (nextpos != std::string::npos) { >>>> + ? ? ?// Yes? Then remove delims from beginning ... >>>> + ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); >>>> + ? ? ?// and find the end of the word. >>>> + ? ? ?pos = work.find_first_of(delims); >>>> + ? ?} else { >>>> + ? ? ?// No? (Remainder of string is delims.) End the loop. >>>> + ? ? ?work = ""; >>>> + ? ? ?pos = std::string::npos; >>>> ? ? } >>>> - >>>> - ? ?// Find position of first delimiter. >>>> - ? ?size_t Pos = WorkStr.find_first_of(Delims); >>>> - ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>>> - >>>> - ? ?// Everything from 0 to Pos is the next word to copy. >>>> - ? ?char *NewStr = (char*)malloc(Pos+1); >>>> - ? ?memcpy(NewStr, WorkStr.data(), Pos); >>>> - ? ?NewStr[Pos] = 0; >>>> - ? ?OutputVector.push_back(NewStr); >>>> ? } >>>> + >>>> + ?// If `input' ended with non-delim char, then we'll get here with >>>> + ?// the last word of `input' in `work'; copy it now. >>>> + ?if (!work.empty()) >>>> + ? ?output.push_back(strdup(work.c_str())); >>>> ?} >>>> >>>> ?/// ParseEnvironmentOptions - An alternative entry point to the >>>> >>>> Added: llvm/trunk/unittests/Support/CommandLineTest.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto >>>> >>>> ============================================================================== >>>> --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) >>>> +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 >>>> @@ -0,0 +1,48 @@ >>>> +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// >>>> +// >>>> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >>>> +// >>>> +// This file is distributed under the University of Illinois Open Source >>>> +// License. See LICENSE.TXT for details. >>>> +// >>>> +//===----------------------------------------------------------------------===// >>>> + >>>> +#include "llvm/Support/CommandLine.h" >>>> + >>>> +#include "gtest/gtest.h" >>>> + >>>> +#include >>>> +#include >>>> + >>>> +using namespace llvm; >>>> + >>>> +namespace { >>>> + >>>> +class TempEnvVar { >>>> + public: >>>> + ?TempEnvVar(const char *name, const char *value) >>>> + ? ? ?: name(name) { >>>> + ? ?const char *old_value = getenv(name); >>>> + ? ?EXPECT_EQ(NULL, old_value) << old_value; >>>> + ? ?setenv(name, value, true); >>>> + ?} >>>> + >>>> + ?~TempEnvVar() { >>>> + ? ?unsetenv(name); >>>> + ?} >>>> + >>>> + private: >>>> + ?const char *const name; >>>> +}; >>>> + >>>> +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; >>>> + >>>> +cl::opt EnvironmentTestOption("env-test-opt"); >>>> +TEST(CommandLineTest, ParseEnvironment) { >>>> + ?TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); >>>> + ?EXPECT_EQ("", EnvironmentTestOption); >>>> + ?cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); >>>> + ?EXPECT_EQ("hello", EnvironmentTestOption); >>>> +} >>>> + >>>> +} ?// anonymous namespace >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> >> > From deeppatel1987 at gmail.com Fri Sep 25 13:37:32 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Fri, 25 Sep 2009 18:37:32 +0000 Subject: [llvm-commits] [llvm] r82778 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: References: <200909251723.n8PHNNl3009740@zion.cs.uiuc.edu> Message-ID: <305d6f60909251137w41e535ck4fc8adb9e2f96bf9@mail.gmail.com> Why aren't the front-ends responsible for selecting the intrinsics again? deep On Fri, Sep 25, 2009 at 5:31 PM, Chris Lattner wrote: > > On Sep 25, 2009, at 10:23 AM, Dale Johannesen wrote: > >> Author: johannes >> Date: Fri Sep 25 12:23:22 2009 >> New Revision: 82778 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82778&view=rev >> Log: >> Generate FSQRT from calls to the sqrt function, which >> allows appropriate backends to generate a sqrt instruction. >> >> On x86, this isn't done at -O0 because we go through >> FastISel instead. ?This is a behavior change from before >> this series of sqrt patches started. ?I think this is OK >> considering that compile speed is most important at -O0, but >> could be convinced otherwise. > > I'm fine with fastisel not doing this, but it should only happen if > the sqrt function is readonly, otherwise the errno update is lost. > > -Chris > >> >> >> Modified: >> ? ?llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp >> >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=82778&r1=82777&r2=82778&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp >> (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri >> Sep 25 12:23:22 2009 >> @@ -4576,6 +4576,15 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Tmp.getValueType(), Tmp)); >> ? ? ? ? ? return; >> ? ? ? ? } >> + ? ? ?} else if (Name == "sqrt" || Name == "sqrtf" || Name == >> "sqrtl") { >> + ? ? ? ?if (I.getNumOperands() == 2 && ? // Basic sanity checks. >> + ? ? ? ? ? ?I.getOperand(1)->getType()->isFloatingPoint() && >> + ? ? ? ? ? ?I.getType() == I.getOperand(1)->getType()) { >> + ? ? ? ? ?SDValue Tmp = getValue(I.getOperand(1)); >> + ? ? ? ? ?setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Tmp.getValueType(), Tmp)); >> + ? ? ? ? ?return; >> + ? ? ? ?} >> ? ? ? } >> ? ? } >> ? } else if (isa(I.getOperand(0))) { >> >> >> _______________________________________________ >> 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 david_goodwin at apple.com Fri Sep 25 13:38:29 2009 From: david_goodwin at apple.com (David Goodwin) Date: Fri, 25 Sep 2009 18:38:29 -0000 Subject: [llvm-commits] [llvm] r82788 - in /llvm/trunk/lib/Target/ARM: ARMInstrNEON.td ARMInstrVFP.td ARMSchedule.td ARMScheduleV7.td Message-ID: <200909251838.n8PIcTVi020061@zion.cs.uiuc.edu> Author: david_goodwin Date: Fri Sep 25 13:38:29 2009 New Revision: 82788 URL: http://llvm.org/viewvc/llvm-project?rev=82788&view=rev Log: Finish scheduling itineraries for NEON. Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/lib/Target/ARM/ARMInstrVFP.td llvm/trunk/lib/Target/ARM/ARMSchedule.td llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=82788&r1=82787&r2=82788&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Fri Sep 25 13:38:29 2009 @@ -481,11 +481,10 @@ let isCommutable = Commutable; } class N3VDSL op21_20, bits<4> op11_8, - string OpcodeStr, ValueType Ty, SDNode ShOp> + InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode ShOp> : N3V<0, 1, op21_20, op11_8, 1, 0, (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", + itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (Ty DPR:$dst), (Ty (ShOp (Ty DPR:$src1), (Ty (NEONvduplane (Ty DPR_VFP2:$src2), @@ -496,7 +495,7 @@ string OpcodeStr, ValueType Ty, SDNode ShOp> : N3V<0, 1, op21_20, op11_8, 1, 0, (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane), - NoItinerary, + IIC_VMULi16D, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (Ty DPR:$dst), (Ty (ShOp (Ty DPR:$src1), @@ -515,11 +514,11 @@ let isCommutable = Commutable; } class N3VQSL op21_20, bits<4> op11_8, - string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp> + InstrItinClass itin, string OpcodeStr, + ValueType ResTy, ValueType OpTy, SDNode ShOp> : N3V<1, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", + itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (ResTy QPR:$dst), (ResTy (ShOp (ResTy QPR:$src1), (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2), @@ -530,7 +529,7 @@ string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode ShOp> : N3V<1, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane), - NoItinerary, + IIC_VMULi16Q, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (ResTy QPR:$dst), (ResTy (ShOp (ResTy QPR:$src1), @@ -544,7 +543,7 @@ string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable> : N3V { let isCommutable = Commutable; } @@ -557,32 +556,30 @@ // Basic 3-register intrinsics, both double- and quad-register. class N3VDInt op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType ResTy, ValueType OpTy, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable> : N3V { let isCommutable = Commutable; } -class N3VDIntSL op21_20, bits<4> op11_8, +class N3VDIntSL op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType Ty, Intrinsic IntOp> : N3V<0, 1, op21_20, op11_8, 1, 0, (outs DPR:$dst), (ins DPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", + itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (Ty DPR:$dst), (Ty (IntOp (Ty DPR:$src1), (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]> { let isCommutable = 0; } -class N3VDIntSL16 op21_20, bits<4> op11_8, +class N3VDIntSL16 op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType Ty, Intrinsic IntOp> : N3V<0, 1, op21_20, op11_8, 1, 0, (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", + itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (Ty DPR:$dst), (Ty (IntOp (Ty DPR:$src1), (Ty (NEONvduplane (Ty DPR_8:$src2), @@ -591,32 +588,30 @@ } class N3VQInt op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType ResTy, ValueType OpTy, + InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable> : N3V { let isCommutable = Commutable; } -class N3VQIntSL op21_20, bits<4> op11_8, +class N3VQIntSL op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V<1, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst), (ins QPR:$src1, DPR_VFP2:$src2, nohash_imm:$lane), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", + itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (ResTy QPR:$dst), (ResTy (IntOp (ResTy QPR:$src1), (ResTy (NEONvduplane (OpTy DPR_VFP2:$src2), imm:$lane)))))]> { let isCommutable = 0; } -class N3VQIntSL16 op21_20, bits<4> op11_8, +class N3VQIntSL16 op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V<1, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", + itin, !strconcat(OpcodeStr, "\t$dst, $src1, $src2[$lane]"), "", [(set (ResTy QPR:$dst), (ResTy (IntOp (ResTy QPR:$src1), (ResTy (NEONvduplane (OpTy DPR_8:$src2), @@ -626,30 +621,29 @@ // Multiply-Add/Sub operations, both double- and quad-register. class N3VDMulOp op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode OpNode> + InstrItinClass itin, string OpcodeStr, + ValueType Ty, SDNode MulOp, SDNode OpNode> : N3V; -class N3VDMulOpSL op21_20, bits<4> op11_8, +class N3VDMulOpSL op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp> : N3V<0, 1, op21_20, op11_8, 1, 0, (outs DPR:$dst), - (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), - NoItinerary, + (ins DPR:$src1, DPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin, !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst", [(set (Ty DPR:$dst), (Ty (ShOp (Ty DPR:$src1), (Ty (MulOp DPR:$src2, (Ty (NEONvduplane (Ty DPR_VFP2:$src3), imm:$lane)))))))]>; -class N3VDMulOpSL16 op21_20, bits<4> op11_8, +class N3VDMulOpSL16 op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode ShOp> : N3V<0, 1, op21_20, op11_8, 1, 0, (outs DPR:$dst), - (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), - NoItinerary, + (ins DPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin, !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst", [(set (Ty DPR:$dst), (Ty (ShOp (Ty DPR:$src1), @@ -658,32 +652,31 @@ imm:$lane)))))))]>; class N3VQMulOp op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode OpNode> + InstrItinClass itin, string OpcodeStr, ValueType Ty, + SDNode MulOp, SDNode OpNode> : N3V; -class N3VQMulOpSL op21_20, bits<4> op11_8, +class N3VQMulOpSL op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode MulOp, SDNode ShOp> : N3V<1, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst), - (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), - NoItinerary, + (ins QPR:$src1, QPR:$src2, DPR_VFP2:$src3, nohash_imm:$lane), itin, !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst", [(set (ResTy QPR:$dst), (ResTy (ShOp (ResTy QPR:$src1), (ResTy (MulOp QPR:$src2, (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3), imm:$lane)))))))]>; -class N3VQMulOpSL16 op21_20, bits<4> op11_8, +class N3VQMulOpSL16 op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode MulOp, SDNode ShOp> : N3V<1, 1, op21_20, op11_8, 1, 0, (outs QPR:$dst), - (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), - NoItinerary, + (ins QPR:$src1, QPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin, !strconcat(OpcodeStr, "\t$dst, $src2, $src3[$lane]"), "$src1 = $dst", [(set (ResTy QPR:$dst), (ResTy (ShOp (ResTy QPR:$src1), @@ -693,10 +686,11 @@ // Multiply-Add/Sub operations, scalar single-precision class N3VDMulOps op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType Ty, SDNode MulOp, SDNode OpNode> + InstrItinClass itin, string OpcodeStr, + ValueType Ty, SDNode MulOp, SDNode OpNode> : N3V; class N3VDMulOpsPat @@ -710,18 +704,18 @@ // Neon 3-argument intrinsics, both double- and quad-register. // The destination register is also used as the first source operand register. class N3VDInt3 op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType ResTy, ValueType OpTy, - Intrinsic IntOp> + InstrItinClass itin, string OpcodeStr, + ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V; class N3VQInt3 op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType ResTy, ValueType OpTy, - Intrinsic IntOp> + InstrItinClass itin, string OpcodeStr, + ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V; @@ -729,31 +723,30 @@ // Neon Long 3-argument intrinsic. The destination register is // a quad-register and is also used as the first source operand register. class N3VLInt3 op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType TyQ, ValueType TyD, Intrinsic IntOp> + InstrItinClass itin, string OpcodeStr, + ValueType TyQ, ValueType TyD, Intrinsic IntOp> : N3V; -class N3VLInt3SL op21_20, bits<4> op11_8, +class N3VLInt3SL op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V; -class N3VLInt3SL16 op21_20, bits<4> op11_8, +class N3VLInt3SL16 op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V : N3V { let isCommutable = Commutable; @@ -775,31 +768,29 @@ // Long 3-register intrinsics. class N3VLInt op21_20, bits<4> op11_8, bit op4, - string OpcodeStr, ValueType TyQ, ValueType TyD, + InstrItinClass itin, string OpcodeStr, ValueType TyQ, ValueType TyD, Intrinsic IntOp, bit Commutable> : N3V { let isCommutable = Commutable; } -class N3VLIntSL op21_20, bits<4> op11_8, +class N3VLIntSL op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V; -class N3VLIntSL16 op21_20, bits<4> op11_8, +class N3VLIntSL16 op21_20, bits<4> op11_8, InstrItinClass itin, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N3V : N3V { let isCommutable = Commutable; @@ -821,13 +812,13 @@ bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; class N2VQPLInt op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; // Pairwise long 2-register accumulate intrinsics, @@ -837,29 +828,31 @@ bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; class N2VQPLInt2 op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2V; // Shift by immediate, // both double- and quad-register. class N2VDSh op21_16, bits<4> op11_8, bit op7, - bit op4, string OpcodeStr, ValueType Ty, SDNode OpNode> + bit op4, InstrItinClass itin, string OpcodeStr, + ValueType Ty, SDNode OpNode> : N2VImm; class N2VQSh op21_16, bits<4> op11_8, bit op7, - bit op4, string OpcodeStr, ValueType Ty, SDNode OpNode> + bit op4, InstrItinClass itin, string OpcodeStr, + ValueType Ty, SDNode OpNode> : N2VImm; @@ -868,17 +861,17 @@ bit op6, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, SDNode OpNode> : N2VImm; // Narrow shift by immediate. class N2VNSh op21_16, bits<4> op11_8, bit op7, - bit op6, bit op4, string OpcodeStr, ValueType ResTy, - ValueType OpTy, SDNode OpNode> + bit op6, bit op4, InstrItinClass itin, string OpcodeStr, + ValueType ResTy, ValueType OpTy, SDNode OpNode> : N2VImm; @@ -889,7 +882,7 @@ bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp> : N2VImm; @@ -897,7 +890,7 @@ bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp> : N2VImm; @@ -908,14 +901,14 @@ bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp> : N2VImm; class N2VQShIns op21_16, bits<4> op11_8, bit op7, bit op4, string OpcodeStr, ValueType Ty, SDNode ShOp> : N2VImm; @@ -925,14 +918,14 @@ bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2VImm; class N2VCvtQ op21_16, bits<4> op11_8, bit op7, bit op4, string OpcodeStr, ValueType ResTy, ValueType OpTy, Intrinsic IntOp> : N2VImm; @@ -966,9 +959,9 @@ multiclass N3VSL_HS op11_8, string OpcodeStr, SDNode ShOp> { def v4i16 : N3VDSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, ShOp>; - def v2i32 : N3VDSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v2i32, ShOp>; + def v2i32 : N3VDSL<0b10, op11_8, IIC_VMULi32D, !strconcat(OpcodeStr, "32"), v2i32, ShOp>; def v8i16 : N3VQSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, ShOp>; - def v4i32 : N3VQSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>; + def v4i32 : N3VQSL<0b10, op11_8, IIC_VMULi32Q, !strconcat(OpcodeStr, "32"), v4i32, v2i32, ShOp>; } // ....then also with element size 64 bits: @@ -1016,45 +1009,56 @@ // First with only element sizes of 16 and 32 bits: multiclass N3VInt_HS op11_8, bit op4, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> { // 64-bit vector types. - def v4i16 : N3VDInt; - def v2i32 : N3VDInt; // 128-bit vector types. - def v8i16 : N3VQInt; - def v4i32 : N3VQInt; } -multiclass N3VIntSL_HS op11_8, string OpcodeStr, Intrinsic IntOp> { - def v4i16 : N3VDIntSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v4i16, IntOp>; - def v2i32 : N3VDIntSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v2i32, IntOp>; - def v8i16 : N3VQIntSL16<0b01, op11_8, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>; - def v4i32 : N3VQIntSL<0b10, op11_8, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>; +multiclass N3VIntSL_HS op11_8, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, + string OpcodeStr, Intrinsic IntOp> { + def v4i16 : N3VDIntSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, IntOp>; + def v2i32 : N3VDIntSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, IntOp>; + def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, IntOp>; + def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, IntOp>; } // ....then also with element size of 8 bits: multiclass N3VInt_QHS op11_8, bit op4, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> - : N3VInt_HS { - def v8i8 : N3VDInt; - def v16i8 : N3VQInt; + : N3VInt_HS { + def v8i8 : N3VDInt; + def v16i8 : N3VQInt; } // ....then also with element size of 64 bits: multiclass N3VInt_QHSD op11_8, bit op4, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> - : N3VInt_QHS { - def v1i64 : N3VDInt; - def v2i64 : N3VQInt; + : N3VInt_QHS { + def v1i64 : N3VDInt; + def v2i64 : N3VQInt; } @@ -1075,27 +1079,29 @@ // First with only element sizes of 16 and 32 bits: multiclass N3VLInt_HS op11_8, bit op4, - string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> { - def v4i32 : N3VLInt; - def v2i64 : N3VLInt; + InstrItinClass itin, string OpcodeStr, + Intrinsic IntOp, bit Commutable = 0> { + def v4i32 : N3VLInt; + def v2i64 : N3VLInt; } multiclass N3VLIntSL_HS op11_8, - string OpcodeStr, Intrinsic IntOp> { - def v4i16 : N3VLIntSL16 { + def v4i16 : N3VLIntSL16; - def v2i32 : N3VLIntSL; } // ....then also with element size of 8 bits: multiclass N3VLInt_QHS op11_8, bit op4, - string OpcodeStr, Intrinsic IntOp, bit Commutable = 0> - : N3VLInt_HS { - def v8i16 : N3VLInt; + InstrItinClass itin, string OpcodeStr, + Intrinsic IntOp, bit Commutable = 0> + : N3VLInt_HS { + def v8i16 : N3VLInt; } @@ -1115,32 +1121,37 @@ // Neon Multiply-Op vector operations, // element sizes of 8, 16 and 32 bits: multiclass N3VMulOp_QHS op11_8, bit op4, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, string OpcodeStr, SDNode OpNode> { // 64-bit vector types. - def v8i8 : N3VDMulOp; - def v4i16 : N3VDMulOp; - def v2i32 : N3VDMulOp; // 128-bit vector types. - def v16i8 : N3VQMulOp; - def v8i16 : N3VQMulOp; - def v4i32 : N3VQMulOp; } -multiclass N3VMulOpSL_HS op11_8, string OpcodeStr, SDNode ShOp> { - def v4i16 : N3VDMulOpSL16<0b01, op11_8, +multiclass N3VMulOpSL_HS op11_8, + InstrItinClass itinD16, InstrItinClass itinD32, + InstrItinClass itinQ16, InstrItinClass itinQ32, + string OpcodeStr, SDNode ShOp> { + def v4i16 : N3VDMulOpSL16<0b01, op11_8, itinD16, !strconcat(OpcodeStr, "16"), v4i16, mul, ShOp>; - def v2i32 : N3VDMulOpSL<0b10, op11_8, + def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32, !strconcat(OpcodeStr, "32"), v2i32, mul, ShOp>; - def v8i16 : N3VQMulOpSL16<0b01, op11_8, + def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16, !strconcat(OpcodeStr, "16"), v8i16, v4i16, mul, ShOp>; - def v4i32 : N3VQMulOpSL<0b10, op11_8, + def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32, !strconcat(OpcodeStr, "32"), v4i32, v2i32, mul, ShOp>; } @@ -1149,19 +1160,19 @@ multiclass N3VInt3_QHS op11_8, bit op4, string OpcodeStr, Intrinsic IntOp> { // 64-bit vector types. - def v8i8 : N3VDInt3; - def v4i16 : N3VDInt3; - def v2i32 : N3VDInt3; // 128-bit vector types. - def v16i8 : N3VQInt3; - def v8i16 : N3VQInt3; - def v4i32 : N3VQInt3; } @@ -1171,17 +1182,17 @@ // First with only element sizes of 16 and 32 bits: multiclass N3VLInt3_HS op11_8, bit op4, string OpcodeStr, Intrinsic IntOp> { - def v4i32 : N3VLInt3; - def v2i64 : N3VLInt3; } multiclass N3VLInt3SL_HS op11_8, string OpcodeStr, Intrinsic IntOp> { - def v4i16 : N3VLInt3SL16; - def v2i32 : N3VLInt3SL; } @@ -1189,7 +1200,7 @@ multiclass N3VLInt3_QHS op11_8, bit op4, string OpcodeStr, Intrinsic IntOp> : N3VLInt3_HS { - def v8i16 : N3VLInt3; } @@ -1267,25 +1278,25 @@ // Neon 2-register vector shift by immediate, // element sizes of 8, 16, 32 and 64 bits: multiclass N2VSh_QHSD op11_8, bit op4, - string OpcodeStr, SDNode OpNode> { + InstrItinClass itin, string OpcodeStr, SDNode OpNode> { // 64-bit vector types. - def v8i8 : N2VDSh; - def v4i16 : N2VDSh; - def v2i32 : N2VDSh; - def v1i64 : N2VDSh; // 128-bit vector types. - def v16i8 : N2VQSh; - def v8i16 : N2VQSh; - def v4i32 : N2VQSh; - def v2i64 : N2VQSh; } @@ -1352,20 +1363,26 @@ def VADDfd : N3VD<0, 0, 0b00, 0b1101, 0, IIC_VBIND, "vadd.f32", v2f32, v2f32, fadd, 1>; def VADDfq : N3VQ<0, 0, 0b00, 0b1101, 0, IIC_VBINQ, "vadd.f32", v4f32, v4f32, fadd, 1>; // VADDL : Vector Add Long (Q = D + D) -defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, "vaddl.s", int_arm_neon_vaddls, 1>; -defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, "vaddl.u", int_arm_neon_vaddlu, 1>; +defm VADDLs : N3VLInt_QHS<0,1,0b0000,0, IIC_VSHLiD, "vaddl.s", int_arm_neon_vaddls, 1>; +defm VADDLu : N3VLInt_QHS<1,1,0b0000,0, IIC_VSHLiD, "vaddl.u", int_arm_neon_vaddlu, 1>; // VADDW : Vector Add Wide (Q = Q + D) defm VADDWs : N3VWInt_QHS<0,1,0b0001,0, "vaddw.s", int_arm_neon_vaddws, 0>; defm VADDWu : N3VWInt_QHS<1,1,0b0001,0, "vaddw.u", int_arm_neon_vaddwu, 0>; // VHADD : Vector Halving Add -defm VHADDs : N3VInt_QHS<0,0,0b0000,0, "vhadd.s", int_arm_neon_vhadds, 1>; -defm VHADDu : N3VInt_QHS<1,0,0b0000,0, "vhadd.u", int_arm_neon_vhaddu, 1>; +defm VHADDs : N3VInt_QHS<0,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vhadd.s", int_arm_neon_vhadds, 1>; +defm VHADDu : N3VInt_QHS<1,0,0b0000,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vhadd.u", int_arm_neon_vhaddu, 1>; // VRHADD : Vector Rounding Halving Add -defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, "vrhadd.s", int_arm_neon_vrhadds, 1>; -defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, "vrhadd.u", int_arm_neon_vrhaddu, 1>; +defm VRHADDs : N3VInt_QHS<0,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vrhadd.s", int_arm_neon_vrhadds, 1>; +defm VRHADDu : N3VInt_QHS<1,0,0b0001,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vrhadd.u", int_arm_neon_vrhaddu, 1>; // VQADD : Vector Saturating Add -defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, "vqadd.s", int_arm_neon_vqadds, 1>; -defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, "vqadd.u", int_arm_neon_vqaddu, 1>; +defm VQADDs : N3VInt_QHSD<0,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vqadd.s", int_arm_neon_vqadds, 1>; +defm VQADDu : N3VInt_QHSD<1,0,0b0000,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vqadd.u", int_arm_neon_vqaddu, 1>; // VADDHN : Vector Add and Narrow Returning High Half (D = Q + Q) defm VADDHN : N3VNInt_HSD<0,1,0b0100,0, "vaddhn.i", int_arm_neon_vaddhn, 1>; // VRADDHN : Vector Rounding Add and Narrow Returning High Half (D = Q + Q) @@ -1376,15 +1393,15 @@ // VMUL : Vector Multiply (integer, polynomial and floating-point) defm VMUL : N3V_QHS<0, 0, 0b1001, 1, IIC_VMULi16D, IIC_VMULi32D, IIC_VMULi16Q, IIC_VMULi32Q, "vmul.i", mul, 1>; -def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, "vmul.p8", v8i8, v8i8, +def VMULpd : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul.p8", v8i8, v8i8, int_arm_neon_vmulp, 1>; -def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, "vmul.p8", v16i8, v16i8, +def VMULpq : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul.p8", v16i8, v16i8, int_arm_neon_vmulp, 1>; def VMULfd : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul.f32", v2f32, v2f32, fmul, 1>; def VMULfq : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul.f32", v4f32, v4f32, fmul, 1>; defm VMULsl : N3VSL_HS<0b1000, "vmul.i", mul>; -def VMULslfd : N3VDSL<0b10, 0b1001, "vmul.f32", v2f32, fmul>; -def VMULslfq : N3VQSL<0b10, 0b1001, "vmul.f32", v4f32, v2f32, fmul>; +def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul.f32", v2f32, fmul>; +def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul.f32", v4f32, v2f32, fmul>; def : Pat<(v8i16 (mul (v8i16 QPR:$src1), (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))), (v8i16 (VMULslv8i16 (v8i16 QPR:$src1), @@ -1405,8 +1422,12 @@ (SubReg_i32_lane imm:$lane)))>; // VQDMULH : Vector Saturating Doubling Multiply Returning High Half -defm VQDMULH : N3VInt_HS<0,0,0b1011,0, "vqdmulh.s", int_arm_neon_vqdmulh, 1>; -defm VQDMULHsl: N3VIntSL_HS<0b1100, "vqdmulh.s", int_arm_neon_vqdmulh>; +defm VQDMULH : N3VInt_HS<0, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D, + IIC_VMULi16Q, IIC_VMULi32Q, + "vqdmulh.s", int_arm_neon_vqdmulh, 1>; +defm VQDMULHsl: N3VIntSL_HS<0b1100, IIC_VMULi16D, IIC_VMULi32D, + IIC_VMULi16Q, IIC_VMULi32Q, + "vqdmulh.s", int_arm_neon_vqdmulh>; def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1), (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))), (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1), @@ -1421,8 +1442,12 @@ (SubReg_i32_lane imm:$lane)))>; // VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half -defm VQRDMULH : N3VInt_HS<1,0,0b1011,0, "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>; -defm VQRDMULHsl : N3VIntSL_HS<0b1101, "vqrdmulh.s", int_arm_neon_vqrdmulh>; +defm VQRDMULH : N3VInt_HS<1, 0, 0b1011, 0, IIC_VMULi16D, IIC_VMULi32D, + IIC_VMULi16Q, IIC_VMULi32Q, + "vqrdmulh.s", int_arm_neon_vqrdmulh, 1>; +defm VQRDMULHsl : N3VIntSL_HS<0b1101, IIC_VMULi16D, IIC_VMULi32D, + IIC_VMULi16Q, IIC_VMULi32Q, + "vqrdmulh.s", int_arm_neon_vqrdmulh>; def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1), (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))), (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1), @@ -1437,26 +1462,28 @@ (SubReg_i32_lane imm:$lane)))>; // VMULL : Vector Multiply Long (integer and polynomial) (Q = D * D) -defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, "vmull.s", int_arm_neon_vmulls, 1>; -defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, "vmull.u", int_arm_neon_vmullu, 1>; -def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, "vmull.p8", v8i16, v8i8, +defm VMULLs : N3VLInt_QHS<0,1,0b1100,0, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls, 1>; +defm VMULLu : N3VLInt_QHS<1,1,0b1100,0, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu, 1>; +def VMULLp : N3VLInt<0, 1, 0b00, 0b1110, 0, IIC_VMULi16D, "vmull.p8", v8i16, v8i8, int_arm_neon_vmullp, 1>; -defm VMULLsls : N3VLIntSL_HS<0, 0b1010, "vmull.s", int_arm_neon_vmulls>; -defm VMULLslu : N3VLIntSL_HS<1, 0b1010, "vmull.u", int_arm_neon_vmullu>; +defm VMULLsls : N3VLIntSL_HS<0, 0b1010, IIC_VMULi16D, "vmull.s", int_arm_neon_vmulls>; +defm VMULLslu : N3VLIntSL_HS<1, 0b1010, IIC_VMULi16D, "vmull.u", int_arm_neon_vmullu>; // VQDMULL : Vector Saturating Doubling Multiply Long (Q = D * D) -defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, "vqdmull.s", int_arm_neon_vqdmull, 1>; -defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, "vqdmull.s", int_arm_neon_vqdmull>; +defm VQDMULL : N3VLInt_HS<0,1,0b1101,0, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull, 1>; +defm VQDMULLsl: N3VLIntSL_HS<0, 0b1011, IIC_VMULi16D, "vqdmull.s", int_arm_neon_vqdmull>; // Vector Multiply-Accumulate and Multiply-Subtract Operations. // VMLA : Vector Multiply Accumulate (integer and floating-point) -defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, "vmla.i", add>; -def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, "vmla.f32", v2f32, fmul, fadd>; -def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, "vmla.f32", v4f32, fmul, fadd>; -defm VMLAsl : N3VMulOpSL_HS<0b0000, "vmla.i", add>; -def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, "vmla.f32", v2f32, fmul, fadd>; -def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, "vmla.f32", v4f32, v2f32, fmul, fadd>; +defm VMLA : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D, + IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>; +def VMLAfd : N3VDMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>; +def VMLAfq : N3VQMulOp<0, 0, 0b00, 0b1101, 1, IIC_VMACQ, "vmla.f32", v4f32, fmul, fadd>; +defm VMLAsl : N3VMulOpSL_HS<0b0000, IIC_VMACi16D, IIC_VMACi32D, + IIC_VMACi16Q, IIC_VMACi32Q, "vmla.i", add>; +def VMLAslfd : N3VDMulOpSL<0b10, 0b0001, IIC_VMACD, "vmla.f32", v2f32, fmul, fadd>; +def VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla.f32", v4f32, v2f32, fmul, fadd>; def : Pat<(v8i16 (add (v8i16 QPR:$src1), (mul (v8i16 QPR:$src2), @@ -1497,12 +1524,14 @@ defm VQDMLALsl: N3VLInt3SL_HS<0, 0b0011, "vqdmlal.s", int_arm_neon_vqdmlal>; // VMLS : Vector Multiply Subtract (integer and floating-point) -defm VMLS : N3VMulOp_QHS<0, 0, 0b1001, 0, "vmls.i", sub>; -def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, "vmls.f32", v2f32, fmul, fsub>; -def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, "vmls.f32", v4f32, fmul, fsub>; -defm VMLSsl : N3VMulOpSL_HS<0b0100, "vmls.i", sub>; -def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, "vmls.f32", v2f32, fmul, fsub>; -def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, "vmls.f32", v4f32, v2f32, fmul, fsub>; +defm VMLS : N3VMulOp_QHS<0, 0, 0b1001, 0, IIC_VMACi16D, IIC_VMACi32D, + IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>; +def VMLSfd : N3VDMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>; +def VMLSfq : N3VQMulOp<0, 0, 0b10, 0b1101, 1, IIC_VMACQ, "vmls.f32", v4f32, fmul, fsub>; +defm VMLSsl : N3VMulOpSL_HS<0b0100, IIC_VMACi16D, IIC_VMACi32D, + IIC_VMACi16Q, IIC_VMACi32Q, "vmls.i", sub>; +def VMLSslfd : N3VDMulOpSL<0b10, 0b0101, IIC_VMACD, "vmls.f32", v2f32, fmul, fsub>; +def VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls.f32", v4f32, v2f32, fmul, fsub>; def : Pat<(v8i16 (sub (v8i16 QPR:$src1), (mul (v8i16 QPR:$src2), @@ -1549,17 +1578,21 @@ def VSUBfd : N3VD<0, 0, 0b10, 0b1101, 0, IIC_VBIND, "vsub.f32", v2f32, v2f32, fsub, 0>; def VSUBfq : N3VQ<0, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vsub.f32", v4f32, v4f32, fsub, 0>; // VSUBL : Vector Subtract Long (Q = D - D) -defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, "vsubl.s", int_arm_neon_vsubls, 1>; -defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, "vsubl.u", int_arm_neon_vsublu, 1>; +defm VSUBLs : N3VLInt_QHS<0,1,0b0010,0, IIC_VSHLiD, "vsubl.s", int_arm_neon_vsubls, 1>; +defm VSUBLu : N3VLInt_QHS<1,1,0b0010,0, IIC_VSHLiD, "vsubl.u", int_arm_neon_vsublu, 1>; // VSUBW : Vector Subtract Wide (Q = Q - D) defm VSUBWs : N3VWInt_QHS<0,1,0b0011,0, "vsubw.s", int_arm_neon_vsubws, 0>; defm VSUBWu : N3VWInt_QHS<1,1,0b0011,0, "vsubw.u", int_arm_neon_vsubwu, 0>; // VHSUB : Vector Halving Subtract -defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, "vhsub.s", int_arm_neon_vhsubs, 0>; -defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, "vhsub.u", int_arm_neon_vhsubu, 0>; +defm VHSUBs : N3VInt_QHS<0, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vhsub.s", int_arm_neon_vhsubs, 0>; +defm VHSUBu : N3VInt_QHS<1, 0, 0b0010, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vhsub.u", int_arm_neon_vhsubu, 0>; // VQSUB : Vector Saturing Subtract -defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, "vqsub.s", int_arm_neon_vqsubs, 0>; -defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, "vqsub.u", int_arm_neon_vqsubu, 0>; +defm VQSUBs : N3VInt_QHSD<0, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vqsub.s", int_arm_neon_vqsubs, 0>; +defm VQSUBu : N3VInt_QHSD<1, 0, 0b0010, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vqsub.u", int_arm_neon_vqsubu, 0>; // VSUBHN : Vector Subtract and Narrow Returning High Half (D = Q - Q) defm VSUBHN : N3VNInt_HSD<0,1,0b0110,0, "vsubhn.i", int_arm_neon_vsubhn, 0>; // VRSUBHN : Vector Rounding Subtract and Narrow Returning High Half (D=Q-Q) @@ -1587,14 +1620,14 @@ def VCGTfd : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt.f32", v2i32, v2f32, NEONvcgt, 0>; def VCGTfq : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt.f32", v4i32, v4f32, NEONvcgt, 0>; // VACGE : Vector Absolute Compare Greater Than or Equal (aka VCAGE) -def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, "vacge.f32", v2i32, v2f32, +def VACGEd : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge.f32", v2i32, v2f32, int_arm_neon_vacged, 0>; -def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, "vacge.f32", v4i32, v4f32, +def VACGEq : N3VQInt<1, 0, 0b00, 0b1110, 1, IIC_VBINQ, "vacge.f32", v4i32, v4f32, int_arm_neon_vacgeq, 0>; // VACGT : Vector Absolute Compare Greater Than (aka VCAGT) -def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, "vacgt.f32", v2i32, v2f32, +def VACGTd : N3VDInt<1, 0, 0b10, 0b1110, 1, IIC_VBIND, "vacgt.f32", v2i32, v2f32, int_arm_neon_vacgtd, 0>; -def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, "vacgt.f32", v4i32, v4f32, +def VACGTq : N3VQInt<1, 0, 0b10, 0b1110, 1, IIC_VBINQ, "vacgt.f32", v4i32, v4f32, int_arm_neon_vacgtq, 0>; // VTST : Vector Test Bits defm VTST : N3V_QHS<0, 0, 0b1000, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, @@ -1621,7 +1654,7 @@ [(set DPR:$dst, (v2i32 (and DPR:$src1, (vnot_conv DPR:$src2))))]>; def VBICq : N3V<0, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst), - (ins QPR:$src1, QPR:$src2), NoItinerary, + (ins QPR:$src1, QPR:$src2), IIC_VBINiQ, "vbic\t$dst, $src1, $src2", "", [(set QPR:$dst, (v4i32 (and QPR:$src1, (vnot_conv QPR:$src2))))]>; @@ -1633,18 +1666,18 @@ [(set DPR:$dst, (v2i32 (or DPR:$src1, (vnot_conv DPR:$src2))))]>; def VORNq : N3V<0, 0, 0b11, 0b0001, 1, 1, (outs QPR:$dst), - (ins QPR:$src1, QPR:$src2), NoItinerary, + (ins QPR:$src1, QPR:$src2), IIC_VBINiQ, "vorn\t$dst, $src1, $src2", "", [(set QPR:$dst, (v4i32 (or QPR:$src1, (vnot_conv QPR:$src2))))]>; // VMVN : Vector Bitwise NOT def VMVNd : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 0, 0, - (outs DPR:$dst), (ins DPR:$src), NoItinerary, + (outs DPR:$dst), (ins DPR:$src), IIC_VSHLiD, "vmvn\t$dst, $src", "", [(set DPR:$dst, (v2i32 (vnot DPR:$src)))]>; def VMVNq : N2V<0b11, 0b11, 0b00, 0b00, 0b01011, 1, 0, - (outs QPR:$dst), (ins QPR:$src), NoItinerary, + (outs QPR:$dst), (ins QPR:$src), IIC_VSHLiD, "vmvn\t$dst, $src", "", [(set QPR:$dst, (v4i32 (vnot QPR:$src)))]>; def : Pat<(v2i32 (vnot_conv DPR:$src)), (VMVNd DPR:$src)>; @@ -1652,13 +1685,13 @@ // VBSL : Vector Bitwise Select def VBSLd : N3V<1, 0, 0b01, 0b0001, 0, 1, (outs DPR:$dst), - (ins DPR:$src1, DPR:$src2, DPR:$src3), NoItinerary, + (ins DPR:$src1, DPR:$src2, DPR:$src3), IIC_VCNTiD, "vbsl\t$dst, $src2, $src3", "$src1 = $dst", [(set DPR:$dst, (v2i32 (or (and DPR:$src2, DPR:$src1), (and DPR:$src3, (vnot_conv DPR:$src1)))))]>; def VBSLq : N3V<1, 0, 0b01, 0b0001, 1, 1, (outs QPR:$dst), - (ins QPR:$src1, QPR:$src2, QPR:$src3), NoItinerary, + (ins QPR:$src1, QPR:$src2, QPR:$src3), IIC_VCNTiQ, "vbsl\t$dst, $src2, $src3", "$src1 = $dst", [(set QPR:$dst, (v4i32 (or (and QPR:$src2, QPR:$src1), @@ -1675,16 +1708,18 @@ // Vector Absolute Differences. // VABD : Vector Absolute Difference -defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, "vabd.s", int_arm_neon_vabds, 0>; -defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, "vabd.u", int_arm_neon_vabdu, 0>; -def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, "vabd.f32", v2f32, v2f32, +defm VABDs : N3VInt_QHS<0, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vabd.s", int_arm_neon_vabds, 0>; +defm VABDu : N3VInt_QHS<1, 0, 0b0111, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vabd.u", int_arm_neon_vabdu, 0>; +def VABDfd : N3VDInt<1, 0, 0b10, 0b1101, 0, IIC_VBIND, "vabd.f32", v2f32, v2f32, int_arm_neon_vabds, 0>; -def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, "vabd.f32", v4f32, v4f32, +def VABDfq : N3VQInt<1, 0, 0b10, 0b1101, 0, IIC_VBINQ, "vabd.f32", v4f32, v4f32, int_arm_neon_vabds, 0>; // VABDL : Vector Absolute Difference Long (Q = | D - D |) -defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, "vabdl.s", int_arm_neon_vabdls, 0>; -defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, "vabdl.u", int_arm_neon_vabdlu, 0>; +defm VABDLs : N3VLInt_QHS<0,1,0b0111,0, IIC_VBINi4Q, "vabdl.s", int_arm_neon_vabdls, 0>; +defm VABDLu : N3VLInt_QHS<1,1,0b0111,0, IIC_VBINi4Q, "vabdl.u", int_arm_neon_vabdlu, 0>; // VABA : Vector Absolute Difference and Accumulate defm VABAs : N3VInt3_QHS<0,1,0b0101,0, "vaba.s", int_arm_neon_vabas>; @@ -1697,31 +1732,35 @@ // Vector Maximum and Minimum. // VMAX : Vector Maximum -defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, "vmax.s", int_arm_neon_vmaxs, 1>; -defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, "vmax.u", int_arm_neon_vmaxu, 1>; -def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, "vmax.f32", v2f32, v2f32, +defm VMAXs : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vmax.s", int_arm_neon_vmaxs, 1>; +defm VMAXu : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vmax.u", int_arm_neon_vmaxu, 1>; +def VMAXfd : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax.f32", v2f32, v2f32, int_arm_neon_vmaxs, 1>; -def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, "vmax.f32", v4f32, v4f32, +def VMAXfq : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax.f32", v4f32, v4f32, int_arm_neon_vmaxs, 1>; // VMIN : Vector Minimum -defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, "vmin.s", int_arm_neon_vmins, 1>; -defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, "vmin.u", int_arm_neon_vminu, 1>; -def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, "vmin.f32", v2f32, v2f32, +defm VMINs : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vmin.s", int_arm_neon_vmins, 1>; +defm VMINu : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, + IIC_VBINi4Q, "vmin.u", int_arm_neon_vminu, 1>; +def VMINfd : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin.f32", v2f32, v2f32, int_arm_neon_vmins, 1>; -def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, "vmin.f32", v4f32, v4f32, +def VMINfq : N3VQInt<0, 0, 0b10, 0b1111, 0, IIC_VBINQ, "vmin.f32", v4f32, v4f32, int_arm_neon_vmins, 1>; // Vector Pairwise Operations. // VPADD : Vector Pairwise Add -def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, "vpadd.i8", v8i8, v8i8, +def VPADDi8 : N3VDInt<0, 0, 0b00, 0b1011, 1, IIC_VBINiD, "vpadd.i8", v8i8, v8i8, int_arm_neon_vpadd, 0>; -def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, "vpadd.i16", v4i16, v4i16, +def VPADDi16 : N3VDInt<0, 0, 0b01, 0b1011, 1, IIC_VBINiD, "vpadd.i16", v4i16, v4i16, int_arm_neon_vpadd, 0>; -def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, "vpadd.i32", v2i32, v2i32, +def VPADDi32 : N3VDInt<0, 0, 0b10, 0b1011, 1, IIC_VBINiD, "vpadd.i32", v2i32, v2i32, int_arm_neon_vpadd, 0>; -def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, "vpadd.f32", v2f32, v2f32, +def VPADDf : N3VDInt<1, 0, 0b00, 0b1101, 0, IIC_VBIND, "vpadd.f32", v2f32, v2f32, int_arm_neon_vpadd, 0>; // VPADDL : Vector Pairwise Add Long @@ -1737,35 +1776,35 @@ int_arm_neon_vpadalu>; // VPMAX : Vector Pairwise Maximum -def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, "vpmax.s8", v8i8, v8i8, +def VPMAXs8 : N3VDInt<0, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.s8", v8i8, v8i8, int_arm_neon_vpmaxs, 0>; -def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, "vpmax.s16", v4i16, v4i16, +def VPMAXs16 : N3VDInt<0, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.s16", v4i16, v4i16, int_arm_neon_vpmaxs, 0>; -def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, "vpmax.s32", v2i32, v2i32, +def VPMAXs32 : N3VDInt<0, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.s32", v2i32, v2i32, int_arm_neon_vpmaxs, 0>; -def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, "vpmax.u8", v8i8, v8i8, +def VPMAXu8 : N3VDInt<1, 0, 0b00, 0b1010, 0, IIC_VBINi4D, "vpmax.u8", v8i8, v8i8, int_arm_neon_vpmaxu, 0>; -def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, "vpmax.u16", v4i16, v4i16, +def VPMAXu16 : N3VDInt<1, 0, 0b01, 0b1010, 0, IIC_VBINi4D, "vpmax.u16", v4i16, v4i16, int_arm_neon_vpmaxu, 0>; -def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, "vpmax.u32", v2i32, v2i32, +def VPMAXu32 : N3VDInt<1, 0, 0b10, 0b1010, 0, IIC_VBINi4D, "vpmax.u32", v2i32, v2i32, int_arm_neon_vpmaxu, 0>; -def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, "vpmax.f32", v2f32, v2f32, +def VPMAXf : N3VDInt<1, 0, 0b00, 0b1111, 0, IIC_VBINi4D, "vpmax.f32", v2f32, v2f32, int_arm_neon_vpmaxs, 0>; // VPMIN : Vector Pairwise Minimum -def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, "vpmin.s8", v8i8, v8i8, +def VPMINs8 : N3VDInt<0, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.s8", v8i8, v8i8, int_arm_neon_vpmins, 0>; -def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, "vpmin.s16", v4i16, v4i16, +def VPMINs16 : N3VDInt<0, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.s16", v4i16, v4i16, int_arm_neon_vpmins, 0>; -def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, "vpmin.s32", v2i32, v2i32, +def VPMINs32 : N3VDInt<0, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.s32", v2i32, v2i32, int_arm_neon_vpmins, 0>; -def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, "vpmin.u8", v8i8, v8i8, +def VPMINu8 : N3VDInt<1, 0, 0b00, 0b1010, 1, IIC_VBINi4D, "vpmin.u8", v8i8, v8i8, int_arm_neon_vpminu, 0>; -def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, "vpmin.u16", v4i16, v4i16, +def VPMINu16 : N3VDInt<1, 0, 0b01, 0b1010, 1, IIC_VBINi4D, "vpmin.u16", v4i16, v4i16, int_arm_neon_vpminu, 0>; -def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, "vpmin.u32", v2i32, v2i32, +def VPMINu32 : N3VDInt<1, 0, 0b10, 0b1010, 1, IIC_VBINi4D, "vpmin.u32", v2i32, v2i32, int_arm_neon_vpminu, 0>; -def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, "vpmin.f32", v2f32, v2f32, +def VPMINf : N3VDInt<1, 0, 0b10, 0b1111, 0, IIC_VBINi4D, "vpmin.f32", v2f32, v2f32, int_arm_neon_vpmins, 0>; // Vector Reciprocal and Reciprocal Square Root Estimate and Step. @@ -1785,9 +1824,9 @@ v4f32, v4f32, int_arm_neon_vrecpe>; // VRECPS : Vector Reciprocal Step -def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, "vrecps.f32", v2f32, v2f32, +def VRECPSfd : N3VDInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSD, "vrecps.f32", v2f32, v2f32, int_arm_neon_vrecps, 1>; -def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, "vrecps.f32", v4f32, v4f32, +def VRECPSfq : N3VQInt<0, 0, 0b00, 0b1111, 1, IIC_VRECSQ, "vrecps.f32", v4f32, v4f32, int_arm_neon_vrecps, 1>; // VRSQRTE : Vector Reciprocal Square Root Estimate @@ -1805,21 +1844,23 @@ v4f32, v4f32, int_arm_neon_vrsqrte>; // VRSQRTS : Vector Reciprocal Square Root Step -def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, "vrsqrts.f32", v2f32, v2f32, +def VRSQRTSfd : N3VDInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSD, "vrsqrts.f32", v2f32, v2f32, int_arm_neon_vrsqrts, 1>; -def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, "vrsqrts.f32", v4f32, v4f32, +def VRSQRTSfq : N3VQInt<0, 0, 0b10, 0b1111, 1, IIC_VRECSQ, "vrsqrts.f32", v4f32, v4f32, int_arm_neon_vrsqrts, 1>; // Vector Shifts. // VSHL : Vector Shift -defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, "vshl.s", int_arm_neon_vshifts, 0>; -defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, "vshl.u", int_arm_neon_vshiftu, 0>; +defm VSHLs : N3VInt_QHSD<0, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ, + IIC_VSHLiQ, "vshl.s", int_arm_neon_vshifts, 0>; +defm VSHLu : N3VInt_QHSD<1, 0, 0b0100, 0, IIC_VSHLiD, IIC_VSHLiD, IIC_VSHLiQ, + IIC_VSHLiQ, "vshl.u", int_arm_neon_vshiftu, 0>; // VSHL : Vector Shift Left (Immediate) -defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, "vshl.i", NEONvshl>; +defm VSHLi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLiD, "vshl.i", NEONvshl>; // VSHR : Vector Shift Right (Immediate) -defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, "vshr.s", NEONvshrs>; -defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, "vshr.u", NEONvshru>; +defm VSHRs : N2VSh_QHSD<0, 1, 0b0000, 1, IIC_VSHLiD, "vshr.s", NEONvshrs>; +defm VSHRu : N2VSh_QHSD<1, 1, 0b0000, 1, IIC_VSHLiD, "vshr.u", NEONvshru>; // VSHLL : Vector Shift Left Long def VSHLLs8 : N2VLSh<0, 1, 0b001000, 0b1010, 0, 0, 1, "vshll.s8", @@ -1844,86 +1885,90 @@ v2i64, v2i32, NEONvshlli>; // VSHRN : Vector Shift Right and Narrow -def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1, "vshrn.i16", - v8i8, v8i16, NEONvshrn>; -def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1, "vshrn.i32", - v4i16, v4i32, NEONvshrn>; -def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1, "vshrn.i64", - v2i32, v2i64, NEONvshrn>; +def VSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 0, 1, + IIC_VSHLiD, "vshrn.i16", v8i8, v8i16, NEONvshrn>; +def VSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 0, 1, + IIC_VSHLiD, "vshrn.i32", v4i16, v4i32, NEONvshrn>; +def VSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 0, 1, + IIC_VSHLiD, "vshrn.i64", v2i32, v2i64, NEONvshrn>; // VRSHL : Vector Rounding Shift -defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, "vrshl.s", int_arm_neon_vrshifts, 0>; -defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, "vrshl.u", int_arm_neon_vrshiftu, 0>; +defm VRSHLs : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, + IIC_VSHLi4Q, "vrshl.s", int_arm_neon_vrshifts, 0>; +defm VRSHLu : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, + IIC_VSHLi4Q, "vrshl.u", int_arm_neon_vrshiftu, 0>; // VRSHR : Vector Rounding Shift Right -defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, "vrshr.s", NEONvrshrs>; -defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, "vrshr.u", NEONvrshru>; +defm VRSHRs : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.s", NEONvrshrs>; +defm VRSHRu : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr.u", NEONvrshru>; // VRSHRN : Vector Rounding Shift Right and Narrow -def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1, "vrshrn.i16", - v8i8, v8i16, NEONvrshrn>; -def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1, "vrshrn.i32", - v4i16, v4i32, NEONvrshrn>; -def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1, "vrshrn.i64", - v2i32, v2i64, NEONvrshrn>; +def VRSHRN16 : N2VNSh<0, 1, 0b001000, 0b1000, 0, 1, 1, + IIC_VSHLi4D, "vrshrn.i16", v8i8, v8i16, NEONvrshrn>; +def VRSHRN32 : N2VNSh<0, 1, 0b010000, 0b1000, 0, 1, 1, + IIC_VSHLi4D, "vrshrn.i32", v4i16, v4i32, NEONvrshrn>; +def VRSHRN64 : N2VNSh<0, 1, 0b100000, 0b1000, 0, 1, 1, + IIC_VSHLi4D, "vrshrn.i64", v2i32, v2i64, NEONvrshrn>; // VQSHL : Vector Saturating Shift -defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, "vqshl.s", int_arm_neon_vqshifts, 0>; -defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, "vqshl.u", int_arm_neon_vqshiftu, 0>; +defm VQSHLs : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, + IIC_VSHLi4Q, "vqshl.s", int_arm_neon_vqshifts, 0>; +defm VQSHLu : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, + IIC_VSHLi4Q, "vqshl.u", int_arm_neon_vqshiftu, 0>; // VQSHL : Vector Saturating Shift Left (Immediate) -defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, "vqshl.s", NEONvqshls>; -defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, "vqshl.u", NEONvqshlu>; +defm VQSHLsi : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.s", NEONvqshls>; +defm VQSHLui : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl.u", NEONvqshlu>; // VQSHLU : Vector Saturating Shift Left (Immediate, Unsigned) -defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, "vqshlu.s", NEONvqshlsu>; +defm VQSHLsu : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu.s", NEONvqshlsu>; // VQSHRN : Vector Saturating Shift Right and Narrow -def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1, "vqshrn.s16", - v8i8, v8i16, NEONvqshrns>; -def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1, "vqshrn.s32", - v4i16, v4i32, NEONvqshrns>; -def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1, "vqshrn.s64", - v2i32, v2i64, NEONvqshrns>; -def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1, "vqshrn.u16", - v8i8, v8i16, NEONvqshrnu>; -def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1, "vqshrn.u32", - v4i16, v4i32, NEONvqshrnu>; -def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1, "vqshrn.u64", - v2i32, v2i64, NEONvqshrnu>; +def VQSHRNs16 : N2VNSh<0, 1, 0b001000, 0b1001, 0, 0, 1, + IIC_VSHLi4D, "vqshrn.s16", v8i8, v8i16, NEONvqshrns>; +def VQSHRNs32 : N2VNSh<0, 1, 0b010000, 0b1001, 0, 0, 1, + IIC_VSHLi4D, "vqshrn.s32", v4i16, v4i32, NEONvqshrns>; +def VQSHRNs64 : N2VNSh<0, 1, 0b100000, 0b1001, 0, 0, 1, + IIC_VSHLi4D, "vqshrn.s64", v2i32, v2i64, NEONvqshrns>; +def VQSHRNu16 : N2VNSh<1, 1, 0b001000, 0b1001, 0, 0, 1, + IIC_VSHLi4D, "vqshrn.u16", v8i8, v8i16, NEONvqshrnu>; +def VQSHRNu32 : N2VNSh<1, 1, 0b010000, 0b1001, 0, 0, 1, + IIC_VSHLi4D, "vqshrn.u32", v4i16, v4i32, NEONvqshrnu>; +def VQSHRNu64 : N2VNSh<1, 1, 0b100000, 0b1001, 0, 0, 1, + IIC_VSHLi4D, "vqshrn.u64", v2i32, v2i64, NEONvqshrnu>; // VQSHRUN : Vector Saturating Shift Right and Narrow (Unsigned) -def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1, "vqshrun.s16", - v8i8, v8i16, NEONvqshrnsu>; -def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1, "vqshrun.s32", - v4i16, v4i32, NEONvqshrnsu>; -def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1, "vqshrun.s64", - v2i32, v2i64, NEONvqshrnsu>; +def VQSHRUN16 : N2VNSh<1, 1, 0b001000, 0b1000, 0, 0, 1, + IIC_VSHLi4D, "vqshrun.s16", v8i8, v8i16, NEONvqshrnsu>; +def VQSHRUN32 : N2VNSh<1, 1, 0b010000, 0b1000, 0, 0, 1, + IIC_VSHLi4D, "vqshrun.s32", v4i16, v4i32, NEONvqshrnsu>; +def VQSHRUN64 : N2VNSh<1, 1, 0b100000, 0b1000, 0, 0, 1, + IIC_VSHLi4D, "vqshrun.s64", v2i32, v2i64, NEONvqshrnsu>; // VQRSHL : Vector Saturating Rounding Shift -defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, "vqrshl.s", - int_arm_neon_vqrshifts, 0>; -defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, "vqrshl.u", - int_arm_neon_vqrshiftu, 0>; +defm VQRSHLs : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, + IIC_VSHLi4Q, "vqrshl.s", int_arm_neon_vqrshifts, 0>; +defm VQRSHLu : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q, + IIC_VSHLi4Q, "vqrshl.u", int_arm_neon_vqrshiftu, 0>; // VQRSHRN : Vector Saturating Rounding Shift Right and Narrow -def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1, "vqrshrn.s16", - v8i8, v8i16, NEONvqrshrns>; -def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1, "vqrshrn.s32", - v4i16, v4i32, NEONvqrshrns>; -def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1, "vqrshrn.s64", - v2i32, v2i64, NEONvqrshrns>; -def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1, "vqrshrn.u16", - v8i8, v8i16, NEONvqrshrnu>; -def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1, "vqrshrn.u32", - v4i16, v4i32, NEONvqrshrnu>; -def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1, "vqrshrn.u64", - v2i32, v2i64, NEONvqrshrnu>; +def VQRSHRNs16: N2VNSh<0, 1, 0b001000, 0b1001, 0, 1, 1, + IIC_VSHLi4D, "vqrshrn.s16", v8i8, v8i16, NEONvqrshrns>; +def VQRSHRNs32: N2VNSh<0, 1, 0b010000, 0b1001, 0, 1, 1, + IIC_VSHLi4D, "vqrshrn.s32", v4i16, v4i32, NEONvqrshrns>; +def VQRSHRNs64: N2VNSh<0, 1, 0b100000, 0b1001, 0, 1, 1, + IIC_VSHLi4D, "vqrshrn.s64", v2i32, v2i64, NEONvqrshrns>; +def VQRSHRNu16: N2VNSh<1, 1, 0b001000, 0b1001, 0, 1, 1, + IIC_VSHLi4D, "vqrshrn.u16", v8i8, v8i16, NEONvqrshrnu>; +def VQRSHRNu32: N2VNSh<1, 1, 0b010000, 0b1001, 0, 1, 1, + IIC_VSHLi4D, "vqrshrn.u32", v4i16, v4i32, NEONvqrshrnu>; +def VQRSHRNu64: N2VNSh<1, 1, 0b100000, 0b1001, 0, 1, 1, + IIC_VSHLi4D, "vqrshrn.u64", v2i32, v2i64, NEONvqrshrnu>; // VQRSHRUN : Vector Saturating Rounding Shift Right and Narrow (Unsigned) -def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1, "vqrshrun.s16", - v8i8, v8i16, NEONvqrshrnsu>; -def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1, "vqrshrun.s32", - v4i16, v4i32, NEONvqrshrnsu>; -def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1, "vqrshrun.s64", - v2i32, v2i64, NEONvqrshrnsu>; +def VQRSHRUN16: N2VNSh<1, 1, 0b001000, 0b1000, 0, 1, 1, + IIC_VSHLi4D, "vqrshrun.s16", v8i8, v8i16, NEONvqrshrnsu>; +def VQRSHRUN32: N2VNSh<1, 1, 0b010000, 0b1000, 0, 1, 1, + IIC_VSHLi4D, "vqrshrun.s32", v4i16, v4i32, NEONvqrshrnsu>; +def VQRSHRUN64: N2VNSh<1, 1, 0b100000, 0b1000, 0, 1, 1, + IIC_VSHLi4D, "vqrshrun.s64", v2i32, v2i64, NEONvqrshrnsu>; // VSRA : Vector Shift Right and Accumulate defm VSRAs : N2VShAdd_QHSD<0, 1, 0b0001, 1, "vsra.s", NEONvshrs>; @@ -1962,13 +2007,11 @@ class VNEGD size, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, size, 0b01, 0b00111, 0, 0, (outs DPR:$dst), (ins DPR:$src), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src"), "", + IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set DPR:$dst, (Ty (vneg DPR:$src)))]>; class VNEGQ size, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, size, 0b01, 0b00111, 1, 0, (outs QPR:$dst), (ins QPR:$src), - NoItinerary, - !strconcat(OpcodeStr, "\t$dst, $src"), "", + IIC_VSHLiD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set QPR:$dst, (Ty (vneg QPR:$src)))]>; // VNEG : Vector Negate @@ -1981,11 +2024,11 @@ // VNEG : Vector Negate (floating-point) def VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0, - (outs DPR:$dst), (ins DPR:$src), NoItinerary, + (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD, "vneg.f32\t$dst, $src", "", [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>; def VNEGf32q : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 1, 0, - (outs QPR:$dst), (ins QPR:$src), NoItinerary, + (outs QPR:$dst), (ins QPR:$src), IIC_VUNAQ, "vneg.f32\t$dst, $src", "", [(set QPR:$dst, (v4f32 (fneg QPR:$src)))]>; @@ -2024,9 +2067,9 @@ // VMOV : Vector Move (Register) def VMOVD : N3V<0, 0, 0b10, 0b0001, 0, 1, (outs DPR:$dst), (ins DPR:$src), - NoItinerary, "vmov\t$dst, $src", "", []>; + IIC_VMOVD, "vmov\t$dst, $src", "", []>; def VMOVQ : N3V<0, 0, 0b10, 0b0001, 1, 1, (outs QPR:$dst), (ins QPR:$src), - NoItinerary, "vmov\t$dst, $src", "", []>; + IIC_VMOVD, "vmov\t$dst, $src", "", []>; // VMOV : Vector Move (Immediate) @@ -2066,38 +2109,38 @@ // be encoded based on the immed values. def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst), - (ins i8imm:$SIMM), NoItinerary, + (ins i8imm:$SIMM), IIC_VMOVImm, "vmov.i8\t$dst, $SIMM", "", [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>; def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst), - (ins i8imm:$SIMM), NoItinerary, + (ins i8imm:$SIMM), IIC_VMOVImm, "vmov.i8\t$dst, $SIMM", "", [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>; def VMOVv4i16 : N1ModImm<1, 0b000, 0b1000, 0, 0, 0, 1, (outs DPR:$dst), - (ins i16imm:$SIMM), NoItinerary, + (ins i16imm:$SIMM), IIC_VMOVImm, "vmov.i16\t$dst, $SIMM", "", [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>; def VMOVv8i16 : N1ModImm<1, 0b000, 0b1000, 0, 1, 0, 1, (outs QPR:$dst), - (ins i16imm:$SIMM), NoItinerary, + (ins i16imm:$SIMM), IIC_VMOVImm, "vmov.i16\t$dst, $SIMM", "", [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>; def VMOVv2i32 : N1ModImm<1, 0b000, 0b0000, 0, 0, 0, 1, (outs DPR:$dst), - (ins i32imm:$SIMM), NoItinerary, + (ins i32imm:$SIMM), IIC_VMOVImm, "vmov.i32\t$dst, $SIMM", "", [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>; def VMOVv4i32 : N1ModImm<1, 0b000, 0b0000, 0, 1, 0, 1, (outs QPR:$dst), - (ins i32imm:$SIMM), NoItinerary, + (ins i32imm:$SIMM), IIC_VMOVImm, "vmov.i32\t$dst, $SIMM", "", [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>; def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst), - (ins i64imm:$SIMM), NoItinerary, + (ins i64imm:$SIMM), IIC_VMOVImm, "vmov.i64\t$dst, $SIMM", "", [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>; def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst), - (ins i64imm:$SIMM), NoItinerary, + (ins i64imm:$SIMM), IIC_VMOVImm, "vmov.i64\t$dst, $SIMM", "", [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>; @@ -2105,27 +2148,27 @@ def VGETLNs8 : NVGetLane<0b11100101, 0b1011, 0b00, (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane), - NoItinerary, "vmov", ".s8\t$dst, $src[$lane]", + IIC_VMOVSI, "vmov", ".s8\t$dst, $src[$lane]", [(set GPR:$dst, (NEONvgetlanes (v8i8 DPR:$src), imm:$lane))]>; def VGETLNs16 : NVGetLane<0b11100001, 0b1011, 0b01, (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane), - NoItinerary, "vmov", ".s16\t$dst, $src[$lane]", + IIC_VMOVSI, "vmov", ".s16\t$dst, $src[$lane]", [(set GPR:$dst, (NEONvgetlanes (v4i16 DPR:$src), imm:$lane))]>; def VGETLNu8 : NVGetLane<0b11101101, 0b1011, 0b00, (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane), - NoItinerary, "vmov", ".u8\t$dst, $src[$lane]", + IIC_VMOVSI, "vmov", ".u8\t$dst, $src[$lane]", [(set GPR:$dst, (NEONvgetlaneu (v8i8 DPR:$src), imm:$lane))]>; def VGETLNu16 : NVGetLane<0b11101001, 0b1011, 0b01, (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane), - NoItinerary, "vmov", ".u16\t$dst, $src[$lane]", + IIC_VMOVSI, "vmov", ".u16\t$dst, $src[$lane]", [(set GPR:$dst, (NEONvgetlaneu (v4i16 DPR:$src), imm:$lane))]>; def VGETLNi32 : NVGetLane<0b11100001, 0b1011, 0b00, (outs GPR:$dst), (ins DPR:$src, nohash_imm:$lane), - NoItinerary, "vmov", ".32\t$dst, $src[$lane]", + IIC_VMOVSI, "vmov", ".32\t$dst, $src[$lane]", [(set GPR:$dst, (extractelt (v2i32 DPR:$src), imm:$lane))]>; // def VGETLNf32: see FMRDH and FMRDL in ARMInstrVFP.td @@ -2166,17 +2209,17 @@ let Constraints = "$src1 = $dst" in { def VSETLNi8 : NVSetLane<0b11100100, 0b1011, 0b00, (outs DPR:$dst), (ins DPR:$src1, GPR:$src2, nohash_imm:$lane), - NoItinerary, "vmov", ".8\t$dst[$lane], $src2", + IIC_VMOVISL, "vmov", ".8\t$dst[$lane], $src2", [(set DPR:$dst, (vector_insert (v8i8 DPR:$src1), GPR:$src2, imm:$lane))]>; def VSETLNi16 : NVSetLane<0b11100000, 0b1011, 0b01, (outs DPR:$dst), (ins DPR:$src1, GPR:$src2, nohash_imm:$lane), - NoItinerary, "vmov", ".16\t$dst[$lane], $src2", + IIC_VMOVISL, "vmov", ".16\t$dst[$lane], $src2", [(set DPR:$dst, (vector_insert (v4i16 DPR:$src1), GPR:$src2, imm:$lane))]>; def VSETLNi32 : NVSetLane<0b11100000, 0b1011, 0b00, (outs DPR:$dst), (ins DPR:$src1, GPR:$src2, nohash_imm:$lane), - NoItinerary, "vmov", ".32\t$dst[$lane], $src2", + IIC_VMOVISL, "vmov", ".32\t$dst[$lane], $src2", [(set DPR:$dst, (insertelt (v2i32 DPR:$src1), GPR:$src2, imm:$lane))]>; } @@ -2242,11 +2285,11 @@ class VDUPD opcod1, bits<2> opcod3, string asmSize, ValueType Ty> : NVDup; class VDUPQ opcod1, bits<2> opcod3, string asmSize, ValueType Ty> : NVDup; def VDUP8d : VDUPD<0b11101100, 0b00, ".8", v8i8>; @@ -2257,11 +2300,11 @@ def VDUP32q : VDUPQ<0b11101010, 0b00, ".32", v4i32>; def VDUPfd : NVDup<0b11101000, 0b1011, 0b00, (outs DPR:$dst), (ins GPR:$src), - NoItinerary, "vdup", ".32\t$dst, $src", + IIC_VMOVIS, "vdup", ".32\t$dst, $src", [(set DPR:$dst, (v2f32 (NEONvdup (f32 (bitconvert GPR:$src)))))]>; def VDUPfq : NVDup<0b11101010, 0b1011, 0b00, (outs QPR:$dst), (ins GPR:$src), - NoItinerary, "vdup", ".32\t$dst, $src", + IIC_VMOVIS, "vdup", ".32\t$dst, $src", [(set QPR:$dst, (v4f32 (NEONvdup (f32 (bitconvert GPR:$src)))))]>; @@ -2269,14 +2312,14 @@ class VDUPLND op19_18, bits<2> op17_16, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 0, 0, - (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), NoItinerary, + (outs DPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "", [(set DPR:$dst, (Ty (NEONvduplane (Ty DPR:$src), imm:$lane)))]>; class VDUPLNQ op19_18, bits<2> op17_16, string OpcodeStr, ValueType ResTy, ValueType OpTy> : N2V<0b11, 0b11, op19_18, op17_16, 0b11000, 1, 0, - (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), NoItinerary, + (outs QPR:$dst), (ins DPR:$src, nohash_imm:$lane), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src[$lane]"), "", [(set QPR:$dst, (ResTy (NEONvduplane (OpTy DPR:$src), imm:$lane)))]>; @@ -2308,12 +2351,12 @@ def VDUPfdf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 0, 0, (outs DPR:$dst), (ins SPR:$src), - NoItinerary, "vdup.32\t$dst, ${src:lane}", "", + IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "", [(set DPR:$dst, (v2f32 (NEONvdup (f32 SPR:$src))))]>; def VDUPfqf : N2V<0b11, 0b11, 0b01, 0b00, 0b11000, 1, 0, (outs QPR:$dst), (ins SPR:$src), - NoItinerary, "vdup.32\t$dst, ${src:lane}", "", + IIC_VMOVD, "vdup.32\t$dst, ${src:lane}", "", [(set QPR:$dst, (v4f32 (NEONvdup (f32 SPR:$src))))]>; def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)), @@ -2387,12 +2430,12 @@ class VREV64D op19_18, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 0, 0, (outs DPR:$dst), - (ins DPR:$src), NoItinerary, + (ins DPR:$src), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set DPR:$dst, (Ty (NEONvrev64 (Ty DPR:$src))))]>; class VREV64Q op19_18, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, 0b00, 0b00000, 1, 0, (outs QPR:$dst), - (ins QPR:$src), NoItinerary, + (ins QPR:$src), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set QPR:$dst, (Ty (NEONvrev64 (Ty QPR:$src))))]>; @@ -2410,12 +2453,12 @@ class VREV32D op19_18, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 0, 0, (outs DPR:$dst), - (ins DPR:$src), NoItinerary, + (ins DPR:$src), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set DPR:$dst, (Ty (NEONvrev32 (Ty DPR:$src))))]>; class VREV32Q op19_18, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, 0b00, 0b00001, 1, 0, (outs QPR:$dst), - (ins QPR:$src), NoItinerary, + (ins QPR:$src), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set QPR:$dst, (Ty (NEONvrev32 (Ty QPR:$src))))]>; @@ -2429,12 +2472,12 @@ class VREV16D op19_18, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 0, 0, (outs DPR:$dst), - (ins DPR:$src), NoItinerary, + (ins DPR:$src), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set DPR:$dst, (Ty (NEONvrev16 (Ty DPR:$src))))]>; class VREV16Q op19_18, string OpcodeStr, ValueType Ty> : N2V<0b11, 0b11, op19_18, 0b00, 0b00010, 1, 0, (outs QPR:$dst), - (ins QPR:$src), NoItinerary, + (ins QPR:$src), IIC_VMOVD, !strconcat(OpcodeStr, "\t$dst, $src"), "", [(set QPR:$dst, (Ty (NEONvrev16 (Ty QPR:$src))))]>; @@ -2447,14 +2490,14 @@ class VEXTd : N3V<0,1,0b11,0b0000,0,0, (outs DPR:$dst), - (ins DPR:$lhs, DPR:$rhs, i32imm:$index), NoItinerary, + (ins DPR:$lhs, DPR:$rhs, i32imm:$index), IIC_VEXTD, !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "", [(set DPR:$dst, (Ty (NEONvext (Ty DPR:$lhs), (Ty DPR:$rhs), imm:$index)))]>; class VEXTq : N3V<0,1,0b11,0b0000,1,0, (outs QPR:$dst), - (ins QPR:$lhs, QPR:$rhs, i32imm:$index), NoItinerary, + (ins QPR:$lhs, QPR:$rhs, i32imm:$index), IIC_VEXTQ, !strconcat(OpcodeStr, "\t$dst, $lhs, $rhs, $index"), "", [(set QPR:$dst, (Ty (NEONvext (Ty QPR:$lhs), (Ty QPR:$rhs), imm:$index)))]>; @@ -2504,24 +2547,24 @@ // VTBL : Vector Table Lookup def VTBL1 : N3V<1,1,0b11,0b1000,0,0, (outs DPR:$dst), - (ins DPR:$tbl1, DPR:$src), NoItinerary, + (ins DPR:$tbl1, DPR:$src), IIC_VTB1, "vtbl.8\t$dst, \\{$tbl1\\}, $src", "", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl1 DPR:$tbl1, DPR:$src)))]>; def VTBL2 : N3V<1,1,0b11,0b1001,0,0, (outs DPR:$dst), - (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), NoItinerary, + (ins DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTB2, "vtbl.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl2 DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>; def VTBL3 : N3V<1,1,0b11,0b1010,0,0, (outs DPR:$dst), - (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), NoItinerary, + (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTB3, "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl3 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>; def VTBL4 : N3V<1,1,0b11,0b1011,0,0, (outs DPR:$dst), - (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), NoItinerary, + (ins DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTB4, "vtbl.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbl4 DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>; @@ -2529,25 +2572,25 @@ // VTBX : Vector Table Extension def VTBX1 : N3V<1,1,0b11,0b1000,1,0, (outs DPR:$dst), - (ins DPR:$orig, DPR:$tbl1, DPR:$src), NoItinerary, + (ins DPR:$orig, DPR:$tbl1, DPR:$src), IIC_VTBX1, "vtbx.8\t$dst, \\{$tbl1\\}, $src", "$orig = $dst", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx1 DPR:$orig, DPR:$tbl1, DPR:$src)))]>; def VTBX2 : N3V<1,1,0b11,0b1001,1,0, (outs DPR:$dst), - (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), NoItinerary, + (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src), IIC_VTBX2, "vtbx.8\t$dst, \\{$tbl1,$tbl2\\}, $src", "$orig = $dst", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx2 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$src)))]>; def VTBX3 : N3V<1,1,0b11,0b1010,1,0, (outs DPR:$dst), - (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), NoItinerary, + (ins DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src), IIC_VTBX3, "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3\\}, $src", "$orig = $dst", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx3 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$src)))]>; def VTBX4 : N3V<1,1,0b11,0b1011,1,0, (outs DPR:$dst), (ins DPR:$orig, DPR:$tbl1, - DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), NoItinerary, + DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src), IIC_VTBX4, "vtbx.8\t$dst, \\{$tbl1,$tbl2,$tbl3,$tbl4\\}, $src", "$orig = $dst", [(set DPR:$dst, (v8i8 (int_arm_neon_vtbx4 DPR:$orig, DPR:$tbl1, DPR:$tbl2, DPR:$tbl3, DPR:$tbl4, DPR:$src)))]>; @@ -2576,11 +2619,11 @@ // Vector Multiply-Accumulate/Subtract used for single-precision FP let neverHasSideEffects = 1 in -def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, "vmla.f32", v2f32,fmul,fadd>; +def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla.f32", v2f32,fmul,fadd>; def : N3VDMulOpsPat; let neverHasSideEffects = 1 in -def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, "vmls.f32", v2f32,fmul,fsub>; +def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls.f32", v2f32,fmul,fsub>; def : N3VDMulOpsPat; // Vector Absolute used for single-precision FP Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=82788&r1=82787&r2=82788&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Fri Sep 25 13:38:29 2009 @@ -225,16 +225,16 @@ // def FMRS : AVConv2I<0b11100001, 0b1010, (outs GPR:$dst), (ins SPR:$src), - IIC_fpMOVSI, "fmrs", " $dst, $src", + IIC_VMOVSI, "fmrs", " $dst, $src", [(set GPR:$dst, (bitconvert SPR:$src))]>; def FMSR : AVConv4I<0b11100000, 0b1010, (outs SPR:$dst), (ins GPR:$src), - IIC_fpMOVIS, "fmsr", " $dst, $src", + IIC_VMOVIS, "fmsr", " $dst, $src", [(set SPR:$dst, (bitconvert GPR:$src))]>; def FMRRD : AVConv3I<0b11000101, 0b1011, (outs GPR:$dst1, GPR:$dst2), (ins DPR:$src), - IIC_fpMOVDI, "fmrrd", " $dst1, $dst2, $src", + IIC_VMOVDI, "fmrrd", " $dst1, $dst2, $src", [/* FIXME: Can't write pattern for multiple result instr*/]>; // FMDHR: GPR -> SPR @@ -242,7 +242,7 @@ def FMDRR : AVConv5I<0b11000100, 0b1011, (outs DPR:$dst), (ins GPR:$src1, GPR:$src2), - IIC_fpMOVID, "fmdrr", " $dst, $src1, $src2", + IIC_VMOVID, "fmdrr", " $dst, $src1, $src2", [(set DPR:$dst, (arm_fmdrr GPR:$src1, GPR:$src2))]>; // FMRDH: SPR -> GPR Modified: llvm/trunk/lib/Target/ARM/ARMSchedule.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSchedule.td?rev=82788&r1=82787&r2=82788&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSchedule.td (original) +++ llvm/trunk/lib/Target/ARM/ARMSchedule.td Fri Sep 25 13:38:29 2009 @@ -63,10 +63,6 @@ def IIC_iStorem : InstrItinClass; def IIC_Br : InstrItinClass; def IIC_fpSTAT : InstrItinClass; -def IIC_fpMOVIS : InstrItinClass; -def IIC_fpMOVID : InstrItinClass; -def IIC_fpMOVSI : InstrItinClass; -def IIC_fpMOVDI : InstrItinClass; def IIC_fpUNA32 : InstrItinClass; def IIC_fpUNA64 : InstrItinClass; def IIC_fpCMP32 : InstrItinClass; @@ -102,11 +98,21 @@ def IIC_VUNAQ : InstrItinClass; def IIC_VBIND : InstrItinClass; def IIC_VBINQ : InstrItinClass; +def IIC_VMOVImm : InstrItinClass; def IIC_VMOVD : InstrItinClass; def IIC_VMOVQ : InstrItinClass; +def IIC_VMOVIS : InstrItinClass; +def IIC_VMOVID : InstrItinClass; +def IIC_VMOVISL : InstrItinClass; +def IIC_VMOVSI : InstrItinClass; +def IIC_VMOVDI : InstrItinClass; def IIC_VPERMD : InstrItinClass; def IIC_VPERMQ : InstrItinClass; def IIC_VPERMQ3 : InstrItinClass; +def IIC_VMACD : InstrItinClass; +def IIC_VMACQ : InstrItinClass; +def IIC_VRECSD : InstrItinClass; +def IIC_VRECSQ : InstrItinClass; def IIC_VCNTiD : InstrItinClass; def IIC_VCNTiQ : InstrItinClass; def IIC_VUNAiD : InstrItinClass; @@ -119,10 +125,30 @@ def IIC_VSUBiQ : InstrItinClass; def IIC_VBINi4D : InstrItinClass; def IIC_VBINi4Q : InstrItinClass; +def IIC_VSHLiD : InstrItinClass; +def IIC_VSHLiQ : InstrItinClass; +def IIC_VSHLi4D : InstrItinClass; +def IIC_VSHLi4Q : InstrItinClass; +def IIC_VPALiD : InstrItinClass; +def IIC_VPALiQ : InstrItinClass; def IIC_VMULi16D : InstrItinClass; def IIC_VMULi32D : InstrItinClass; def IIC_VMULi16Q : InstrItinClass; def IIC_VMULi32Q : InstrItinClass; +def IIC_VMACi16D : InstrItinClass; +def IIC_VMACi32D : InstrItinClass; +def IIC_VMACi16Q : InstrItinClass; +def IIC_VMACi32Q : InstrItinClass; +def IIC_VEXTD : InstrItinClass; +def IIC_VEXTQ : InstrItinClass; +def IIC_VTB1 : InstrItinClass; +def IIC_VTB2 : InstrItinClass; +def IIC_VTB3 : InstrItinClass; +def IIC_VTB4 : InstrItinClass; +def IIC_VTBX1 : InstrItinClass; +def IIC_VTBX2 : InstrItinClass; +def IIC_VTBX3 : InstrItinClass; +def IIC_VTBX4 : InstrItinClass; //===----------------------------------------------------------------------===// // Processor instruction itineraries. Modified: llvm/trunk/lib/Target/ARM/ARMScheduleV7.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMScheduleV7.td?rev=82788&r1=82787&r2=82788&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMScheduleV7.td (original) +++ llvm/trunk/lib/Target/ARM/ARMScheduleV7.td Fri Sep 25 13:38:29 2009 @@ -171,23 +171,7 @@ // // FP Special Register to Integer Register File Move InstrItinData, - InstrStage<1, [FU_NLSPipe], 1>]>, - // - // Integer to Single-Precision FP Register File Move - InstrItinData, - InstrStage<1, [FU_NLSPipe], 1>]>, - // - // Integer to Double-Precision FP Register File Move - InstrItinData, - InstrStage<1, [FU_NLSPipe], 1>]>, - // - // Single-Precision FP to Integer Register File Move - InstrItinData, - InstrStage<1, [FU_NLSPipe], 1>], [20, 1]>, - // - // Double-Precision FP to Integer Register File Move - InstrItinData, - InstrStage<1, [FU_NLSPipe], 1>], [20, 20, 1]>, + InstrStage<1, [FU_NLSPipe]>]>, // // Single-precision FP Unary InstrItinData, @@ -385,6 +369,10 @@ InstrItinData, InstrStage<2, [FU_NPipe]>], [6, 2, 2]>, // + // Move Immediate + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3]>, + // // Double-register Permute Move InstrItinData, InstrStage<1, [FU_NLSPipe]>], [2, 1]>, @@ -395,6 +383,26 @@ InstrItinData, InstrStage<2, [FU_NLSPipe]>], [3, 1]>, // + // Integer to Single-precision Move + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [2, 1]>, + // + // Integer to Double-precision Move + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [2, 1, 1]>, + // + // Single-precision to Integer Move + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [20, 1]>, + // + // Double-precision to Integer Move + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [20, 20, 1]>, + // + // Integer to Lane Move + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 1, 1]>, + // // Double-register Permute InstrItinData, InstrStage<1, [FU_NLSPipe]>], [2, 2, 1, 1]>, @@ -413,15 +421,33 @@ InstrStage<1, [FU_NPipe], 0>, InstrStage<2, [FU_NLSPipe]>], [4, 4, 1, 1]>, // + // Double-register FP Multiple-Accumulate + InstrItinData, + InstrStage<1, [FU_NPipe]>], [9, 2, 2, 3]>, + // + // Quad-register FP Multiple-Accumulate + // Result written in N9, but that is relative to the last cycle of multicycle, + // so we use 10 for those cases + InstrItinData, + InstrStage<2, [FU_NPipe]>], [10, 2, 2, 3]>, + // + // Double-register Reciprical Step + InstrItinData, + InstrStage<1, [FU_NPipe]>], [9, 2, 2]>, + // + // Quad-register Reciprical Step + InstrItinData, + InstrStage<2, [FU_NPipe]>], [10, 2, 2]>, + // // Double-register Integer Count InstrItinData, - InstrStage<1, [FU_NPipe]>], [3, 2]>, + InstrStage<1, [FU_NPipe]>], [3, 2, 2]>, // // Quad-register Integer Count // Result written in N3, but that is relative to the last cycle of multicycle, // so we use 4 for those cases InstrItinData, - InstrStage<2, [FU_NPipe]>], [4, 2]>, + InstrStage<2, [FU_NPipe]>], [4, 2, 2]>, // // Double-register Integer Unary InstrItinData, @@ -463,6 +489,30 @@ InstrItinData, InstrStage<1, [FU_NPipe]>], [3, 2, 1]>, // + // Double-register Integer Shift + InstrItinData, + InstrStage<1, [FU_NPipe]>], [3, 1, 1]>, + // + // Quad-register Integer Shift + InstrItinData, + InstrStage<2, [FU_NPipe]>], [4, 1, 1]>, + // + // Double-register Integer Shift (4 cycle) + InstrItinData, + InstrStage<1, [FU_NPipe]>], [4, 1, 1]>, + // + // Quad-register Integer Shift (4 cycle) + InstrItinData, + InstrStage<2, [FU_NPipe]>], [5, 1, 1]>, + // + // Double-register Integer Pair Add Long + InstrItinData, + InstrStage<1, [FU_NPipe]>], [6, 3, 2, 1]>, + // + // Quad-register Integer Pair Add Long + InstrItinData, + InstrStage<2, [FU_NPipe]>], [7, 3, 2, 1]>, + // // Double-register Integer Multiply (.8, .16) InstrItinData, InstrStage<1, [FU_NPipe]>], [6, 2, 2]>, @@ -479,7 +529,59 @@ InstrItinData, InstrStage<1, [FU_NPipe]>, InstrStage<2, [FU_NLSPipe], 0>, - InstrStage<3, [FU_NPipe]>], [9, 2, 1]> - - + InstrStage<3, [FU_NPipe]>], [9, 2, 1]>, + // + // Double-register Integer Multiply-Accumulate (.8, .16) + InstrItinData, + InstrStage<1, [FU_NPipe]>], [6, 2, 2, 3]>, + // + // Double-register Integer Multiply-Accumulate (.32) + InstrItinData, + InstrStage<2, [FU_NPipe]>], [7, 2, 1, 3]>, + // + // Quad-register Integer Multiply-Accumulate (.8, .16) + InstrItinData, + InstrStage<2, [FU_NPipe]>], [7, 2, 2, 3]>, + // + // Quad-register Integer Multiply-Accumulate (.32) + InstrItinData, + InstrStage<1, [FU_NPipe]>, + InstrStage<2, [FU_NLSPipe], 0>, + InstrStage<3, [FU_NPipe]>], [9, 2, 1, 3]>, + // + // Double-register VEXT + InstrItinData, + InstrStage<1, [FU_NLSPipe]>], [2, 1, 1]>, + // + // Quad-register VEXT + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 1, 1]>, + // + // VTB + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 2, 1]>, + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 2, 2, 1]>, + InstrItinData, + InstrStage<1, [FU_NLSPipe]>, + InstrStage<1, [FU_NPipe], 0>, + InstrStage<2, [FU_NLSPipe]>], [4, 2, 2, 3, 1]>, + InstrItinData, + InstrStage<1, [FU_NLSPipe]>, + InstrStage<1, [FU_NPipe], 0>, + InstrStage<2, [FU_NLSPipe]>], [4, 2, 2, 3, 3, 1]>, + // + // VTBX + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 1, 2, 1]>, + InstrItinData, + InstrStage<2, [FU_NLSPipe]>], [3, 1, 2, 2, 1]>, + InstrItinData, + InstrStage<1, [FU_NLSPipe]>, + InstrStage<1, [FU_NPipe], 0>, + InstrStage<2, [FU_NLSPipe]>], [4, 1, 2, 2, 3, 1]>, + InstrItinData, + InstrStage<1, [FU_NLSPipe]>, + InstrStage<1, [FU_NPipe], 0>, + InstrStage<2, [FU_NLSPipe]>], [4, 1, 2, 2, 3, 3, 1]> ]>; From daniel at zuster.org Fri Sep 25 13:43:00 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Sep 2009 11:43:00 -0700 Subject: [llvm-commits] [PATCH] Provide debug syms in release builds In-Reply-To: References: Message-ID: <6a8523d60909251143y1e2fa69dp3f0b168dbd4c1738@mail.gmail.com> DEBUG_RUNTIME is something else entirely, and should not be conflated with the behavior you want (it is about RUNTIME pieces, which are conceptually part of the target, whereas you are wanting something for the host). I think this should come in under a different Makefile variable and configure option. - Daniel On Fri, Sep 25, 2009 at 12:27 AM, Jeffrey Yasskin wrote: > This patch causes the --enable-debug-runtime configure flag and the > DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's > objects. Without this, it's very hard to debug crashes that happen in > Release-Asserts mode but not Debug mode. > > Jeffrey > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From daniel at zuster.org Fri Sep 25 13:46:34 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Sep 2009 11:46:34 -0700 Subject: [llvm-commits] [llvm] r82701 - /llvm/trunk/docs/LangRef.html In-Reply-To: References: <200909241838.n8OIcLPe017060@zion.cs.uiuc.edu> <4ABBDB4E.8080500@gmail.com> Message-ID: <6a8523d60909251146m114e6db8o2aef78e72d2a7e7b@mail.gmail.com> On Fri, Sep 25, 2009 at 9:43 AM, Chris Lattner wrote: > On Sep 24, 2009, at 3:27 PM, Dale Johannesen wrote: >> On Sep 24, 2009, at 1:49 PMPDT, T?r?k Edwin wrote: >>> On 2009-09-24 21:38, Dale Johannesen wrote: >>>> Clarify that llvm attaches C language semantics to >>>> functions with names that match the C library. >>> >>> In fact this list is longer [1], it includes (excluding Andersens.cpp >>> and SimplifyLibcalls) >>> abs, absf, absl, atexit, calloc, ceil, copysign, copysignf, cosl, >>> __dso_handle, >>> exit, fabsf, fabsl, free, __half_powr4, __main, main, memcpy, >>> realloc, >>> _setjmp, setjmp, >>> sinf, sinl. >> >> Functions starting with __ are fair game, I don't think we need >> document those at this level. ?Could you add the others to my list? > > Is there any reason to have an explicit list? ?Why not just say "llvm > assumes that functions defined in libc and libm are well known, this > is something we'd like to fix in the future to better support > freestanding environments." and leave it at that? Do we have an eventual plan for dealing with this? I think it is something like annotating functions with a "nobuiltin" attribute? Or perhaps a "c_builtin" attribute as a positive? Do we have any better bugzilla for this than: http://llvm.org/bugs/show_bug.cgi?id=4941 - Daniel From jyasskin at google.com Fri Sep 25 13:48:21 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 11:48:21 -0700 Subject: [llvm-commits] [PATCH] Provide debug syms in release builds In-Reply-To: <6a8523d60909251143y1e2fa69dp3f0b168dbd4c1738@mail.gmail.com> References: <6a8523d60909251143y1e2fa69dp3f0b168dbd4c1738@mail.gmail.com> Message-ID: It looked like DEBUG_RUNTIME only affected .bc files, which can only be used if the compiler is part of the runtime. But I can change it. Do DEBUG_SYMBOLS and --enable-debug-symbols work for you? On Fri, Sep 25, 2009 at 11:43 AM, Daniel Dunbar wrote: > DEBUG_RUNTIME is something else entirely, and should not be conflated > with the behavior you want (it is about RUNTIME pieces, which are > conceptually part of the target, whereas you are wanting something for > the host). > > I think this should come in under a different Makefile variable and > configure option. > > ?- Daniel > > On Fri, Sep 25, 2009 at 12:27 AM, Jeffrey Yasskin wrote: >> This patch causes the --enable-debug-runtime configure flag and the >> DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's >> objects. Without this, it's very hard to debug crashes that happen in >> Release-Asserts mode but not Debug mode. >> >> Jeffrey >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> > From daniel at zuster.org Fri Sep 25 13:48:51 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Sep 2009 11:48:51 -0700 Subject: [llvm-commits] [llvm] r82779 - in /llvm/trunk: test/CodeGen/X86/xor.ll utils/FileCheck/FileCheck.cpp In-Reply-To: <200909251723.n8PHNhww009791@zion.cs.uiuc.edu> References: <200909251723.n8PHNhww009791@zion.cs.uiuc.edu> Message-ID: <6a8523d60909251148v7b553ce1qf89fc692c51a3575@mail.gmail.com> Nice -/+ ratio! :) - Daniel On Fri, Sep 25, 2009 at 10:23 AM, Chris Lattner wrote: > Author: lattner > Date: Fri Sep 25 12:23:43 2009 > New Revision: 82779 > > URL: http://llvm.org/viewvc/llvm-project?rev=82779&view=rev > Log: > reimplement the regex matching strategy by building a single > regex and matching it instead of trying to match chunks at a time. > Matching chunks at a time broke with check lines like > ?CHECK: foo {{.*}}bar > because the .* would eat the entire rest of the line and bar would > never match. > > Now we just escape the fixed strings for the user, so that something > like: > ?CHECK: a() {{.*}}??? > is matched as: > ?CHECK: {{a\(\) .*\?\?\?}} > transparently "under the covers". > > > Modified: > ? ?llvm/trunk/test/CodeGen/X86/xor.ll > ? ?llvm/trunk/utils/FileCheck/FileCheck.cpp > > Modified: llvm/trunk/test/CodeGen/X86/xor.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor.ll?rev=82779&r1=82778&r2=82779&view=diff > > ============================================================================== > --- llvm/trunk/test/CodeGen/X86/xor.ll (original) > +++ llvm/trunk/test/CodeGen/X86/xor.ll Fri Sep 25 12:23:43 2009 > @@ -59,10 +59,10 @@ > > ?; X64: test4: > ?; X64: ? ?notl %eax > -; X64: ? ?andl {{.*%eax}} > +; X64: ? ?andl {{.*}}%eax > ?; X32: test4: > ?; X32: ? ?notl %edx > -; X32: ? ?andl {{.*%edx}} > +; X32: ? ?andl {{.*}}%edx > ?} > > ?define i16 @test5(i16 %a, i16 %b) nounwind ?{ > @@ -81,10 +81,10 @@ > ? ? ? ?ret i16 %tmp3 > ?; X64: test5: > ?; X64: ? ?notw %ax > -; X64: ? ?andw {{.*%ax}} > +; X64: ? ?andw {{.*}}%ax > ?; X32: test5: > ?; X32: ? ?notw %dx > -; X32: ? ?andw {{.*%dx}} > +; X32: ? ?andw {{.*}}%dx > ?} > > ?define i8 @test6(i8 %a, i8 %b) nounwind ?{ > @@ -103,10 +103,10 @@ > ? ? ? ?ret i8 %tmp3 > ?; X64: test6: > ?; X64: ? ?notb %al > -; X64: ? ?andb {{.*%al}} > +; X64: ? ?andb {{.*}}%al > ?; X32: test6: > ?; X32: ? ?notb %dl > -; X32: ? ?andb {{.*%dl}} > +; X32: ? ?andb {{.*}}%dl > ?} > > ?define i32 @test7(i32 %a, i32 %b) nounwind ?{ > @@ -125,9 +125,9 @@ > ? ? ? ?ret i32 %tmp3 > ?; X64: test7: > ?; X64: ? ?xorl $2147483646, %eax > -; X64: ? ?andl {{.*%eax}} > +; X64: ? ?andl {{.*}}%eax > ?; X32: test7: > ?; X32: ? ?xorl $2147483646, %edx > -; X32: ? ?andl {{.*%edx}} > +; X32: ? ?andl {{.*}}%edx > ?} > > > Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=82779&r1=82778&r2=82779&view=diff > > ============================================================================== > --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original) > +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Sep 25 12:23:43 2009 > @@ -44,39 +44,13 @@ > ?// Pattern Handling Code. > ?//===----------------------------------------------------------------------===// > > -class PatternChunk { > - ?StringRef Str; > - ?bool isRegEx; > -public: > - ?PatternChunk(StringRef S, bool isRE) : Str(S), isRegEx(isRE) {} > - > - ?size_t Match(StringRef Buffer, size_t &MatchLen) const { > - ? ?if (!isRegEx) { > - ? ? ?// Fixed string match. > - ? ? ?MatchLen = Str.size(); > - ? ? ?return Buffer.find(Str); > - ? ?} > - > - ? ?// Regex match. > - ? ?SmallVector MatchInfo; > - ? ?if (!Regex(Str, Regex::Sub|Regex::Newline).match(Buffer, &MatchInfo)) > - ? ? ?return StringRef::npos; > - > - ? ?// Successful regex match. > - ? ?assert(!MatchInfo.empty() && "Didn't get any match"); > - ? ?StringRef FullMatch = MatchInfo[0]; > - > - ? ?MatchLen = FullMatch.size(); > - ? ?return FullMatch.data()-Buffer.data(); > - ?} > -}; > - > ?class Pattern { > - ?/// Chunks - The pattern chunks to match. ?If the bool is false, it is a fixed > - ?/// string match, if it is true, it is a regex match. > - ?SmallVector Chunks; > - > + ?/// FixedStr - If non-empty, this pattern is a fixed string match with the > + ?/// specified fixed string. > ? StringRef FixedStr; > + > + ?/// RegEx - If non-empty, this is a regex pattern. > + ?std::string RegExStr; > ?public: > > ? Pattern() { } > @@ -87,6 +61,9 @@ > ? /// returns the position that is matched or npos if there is no match. ?If > ? /// there is a match, the size of the matched string is returned in MatchLen. > ? size_t Match(StringRef Buffer, size_t &MatchLen) const; > + > +private: > + ?void AddFixedStringToRegEx(StringRef FixedStr); > ?}; > > ?bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) { > @@ -109,17 +86,15 @@ > ? ? return false; > ? } > > - ?// Otherwise, there is at least one regex piece. > - > - ?// Scan the pattern to break it into regex and non-regex pieces. > + ?// Otherwise, there is at least one regex piece. ?Build up the regex pattern > + ?// by escaping scary characters in fixed strings, building up one big regex. > ? while (!PatternStr.empty()) { > ? ? // Handle fixed string matches. > ? ? if (PatternStr.size() < 2 || > ? ? ? ? PatternStr[0] != '{' || PatternStr[1] != '{') { > ? ? ? // Find the end, which is the start of the next regex. > ? ? ? size_t FixedMatchEnd = PatternStr.find("{{"); > - > - ? ? ?Chunks.push_back(PatternChunk(PatternStr.substr(0, FixedMatchEnd),false)); > + ? ? ?AddFixedStringToRegEx(PatternStr.substr(0, FixedMatchEnd)); > ? ? ? PatternStr = PatternStr.substr(FixedMatchEnd); > ? ? ? continue; > ? ? } > @@ -132,7 +107,8 @@ > ? ? ? return true; > ? ? } > > - ? ?Regex R(PatternStr.substr(2, End-2)); > + ? ?StringRef RegexStr = PatternStr.substr(2, End-2); > + ? ?Regex R(RegexStr); > ? ? std::string Error; > ? ? if (!R.isValid(Error)) { > ? ? ? SM.PrintMessage(SMLoc::getFromPointer(PatternStr.data()+2), > @@ -140,13 +116,41 @@ > ? ? ? return true; > ? ? } > > - ? ?Chunks.push_back(PatternChunk(PatternStr.substr(2, End-2), true)); > + ? ?RegExStr += RegexStr.str(); > ? ? PatternStr = PatternStr.substr(End+2); > ? } > > ? return false; > ?} > > +void Pattern::AddFixedStringToRegEx(StringRef FixedStr) { > + ?// Add the characters from FixedStr to the regex, escaping as needed. ?This > + ?// avoids "leaning toothpicks" in common patterns. > + ?for (unsigned i = 0, e = FixedStr.size(); i != e; ++i) { > + ? ?switch (FixedStr[i]) { > + ? ?// These are the special characters matched in "p_ere_exp". > + ? ?case '(': > + ? ?case ')': > + ? ?case '^': > + ? ?case '$': > + ? ?case '|': > + ? ?case '*': > + ? ?case '+': > + ? ?case '?': > + ? ?case '.': > + ? ?case '[': > + ? ?case '\\': > + ? ?case '{': > + ? ? ?RegExStr += '\\'; > + ? ? ?// FALL THROUGH. > + ? ?default: > + ? ? ?RegExStr += FixedStr[i]; > + ? ? ?break; > + ? ?} > + ?} > +} > + > + > ?/// Match - Match the pattern string against the input buffer Buffer. ?This > ?/// returns the position that is matched or npos if there is no match. ?If > ?/// there is a match, the size of the matched string is returned in MatchLen. > @@ -157,58 +161,17 @@ > ? ? return Buffer.find(FixedStr); > ? } > > - ?size_t FirstMatch = StringRef::npos; > - ?MatchLen = 0; > - > - ?while (!Buffer.empty()) { > - ? ?StringRef MatchAttempt = Buffer; > - > - ? ?unsigned ChunkNo = 0, e = Chunks.size(); > - ? ?for (; ChunkNo != e; ++ChunkNo) { > - ? ? ?size_t ThisMatch, ThisLength = StringRef::npos; > - ? ? ?ThisMatch = Chunks[ChunkNo].Match(MatchAttempt, ThisLength); > - > - ? ? ?// Otherwise, what we do depends on if this is the first match or not. ?If > - ? ? ?// this is the first match, it doesn't match to match at the start of > - ? ? ?// MatchAttempt. > - ? ? ?if (ChunkNo == 0) { > - ? ? ? ?// If the first match fails then this pattern will never match in > - ? ? ? ?// Buffer. > - ? ? ? ?if (ThisMatch == StringRef::npos) > - ? ? ? ? ?return ThisMatch; > - > - ? ? ? ?FirstMatch = ThisMatch; > - ? ? ? ?MatchAttempt = MatchAttempt.substr(FirstMatch); > - ? ? ? ?ThisMatch = 0; > - ? ? ?} > - > - ? ? ?// If this chunk didn't match, then the entire pattern didn't match from > - ? ? ?// FirstMatch, try later in the buffer. > - ? ? ?if (ThisMatch == StringRef::npos) > - ? ? ? ?break; > - > - ? ? ?// Ok, if the match didn't match at the beginning of MatchAttempt, then we > - ? ? ?// have something like "ABC{{DEF}} and something was in-between. ?Reject > - ? ? ?// the match. > - ? ? ?if (ThisMatch != 0) > - ? ? ? ?break; > - > - ? ? ?// Otherwise, match the string and move to the next chunk. > - ? ? ?MatchLen += ThisLength; > - ? ? ?MatchAttempt = MatchAttempt.substr(ThisLength); > - ? ?} > - > - ? ?// If the whole thing matched, we win. > - ? ?if (ChunkNo == e) > - ? ? ?return FirstMatch; > - > - ? ?// Otherwise, try matching again after FirstMatch to see if this pattern > - ? ?// matches later in the buffer. > - ? ?Buffer = Buffer.substr(FirstMatch+1); > - ?} > + ?// Regex match. > + ?SmallVector MatchInfo; > + ?if (!Regex(RegExStr, Regex::Sub|Regex::Newline).match(Buffer, &MatchInfo)) > + ? ?return StringRef::npos; > + > + ?// Successful regex match. > + ?assert(!MatchInfo.empty() && "Didn't get any match"); > + ?StringRef FullMatch = MatchInfo[0]; > > - ?// If we ran out of stuff to scan, then we didn't match. > - ?return StringRef::npos; > + ?MatchLen = FullMatch.size(); > + ?return FullMatch.data()-Buffer.data(); > ?} > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From jyasskin at google.com Fri Sep 25 13:51:19 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 11:51:19 -0700 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp In-Reply-To: <305d6f60909251134v60abaa17r2291c28f3f8cea29@mail.gmail.com> References: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> <305d6f60909251134v60abaa17r2291c28f3f8cea29@mail.gmail.com> Message-ID: The patch I sent should skip the test if you have neither setenv or _putenv_s, but since _putenv_s doesn't help you run the test, I'll remove it and send another patch. On Fri, Sep 25, 2009 at 11:34 AM, Sandeep Patel wrote: > This won't work for me. I build our Windows-hosted tools using MinGW. > I'm not building using native Windows headers. mingwrt-3.15.2 lacks > _putenv_s in it's headers. > > It may just be easier to skip this test on Windows. > > deep > > On Fri, Sep 25, 2009 at 5:28 PM, Jeffrey Yasskin wrote: >> Could you check if the attached patch fixes things for you? And if it >> looks sensible? It includes the new generated configure script so you >> don't have to regenerate it. >> >> On Fri, Sep 25, 2009 at 8:39 AM, Jeffrey Yasskin wrote: >>> Oops. :( Patch coming up. It appears MinGW intends us to use putenv, >>> but I may just skip the test when setenv isn't available. >>> >>> On Fri, Sep 25, 2009 at 12:46 AM, Sandeep Patel wrote: >>>> CommandLineTest.cpp breaks MinGW, which lacks setenv/unsetenv. >>>> >>>> deep >>>> >>>> On Thu, Sep 24, 2009 at 1:14 AM, Jeffrey Yasskin wrote: >>>>> Author: jyasskin >>>>> Date: Wed Sep 23 20:14:07 2009 >>>>> New Revision: 82675 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev >>>>> Log: >>>>> Roll back r82348, which introduced an infinite loop in ParseCStringVector() that >>>>> a trivial unittest would have caught. ?This revision also adds the trivial >>>>> unittest. >>>>> >>>>> >>>>> Added: >>>>> ? ?llvm/trunk/unittests/Support/CommandLineTest.cpp >>>>> Modified: >>>>> ? ?llvm/trunk/lib/Support/CommandLine.cpp >>>>> >>>>> Modified: llvm/trunk/lib/Support/CommandLine.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff >>>>> >>>>> ============================================================================== >>>>> --- llvm/trunk/lib/Support/CommandLine.cpp (original) >>>>> +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 >>>>> @@ -351,31 +351,42 @@ >>>>> ?/// using strdup(), so it is the caller's responsibility to free() >>>>> ?/// them later. >>>>> ?/// >>>>> -static void ParseCStringVector(std::vector &OutputVector, >>>>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { >>>>> +static void ParseCStringVector(std::vector &output, >>>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { >>>>> ? // Characters which will be treated as token separators: >>>>> - ?StringRef Delims = " \v\f\t\r\n"; >>>>> + ?static const char *const delims = " \v\f\t\r\n"; >>>>> >>>>> - ?StringRef WorkStr(Input); >>>>> - ?while (!WorkStr.empty()) { >>>>> - ? ?// If the first character is a delimiter, strip them off. >>>>> - ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { >>>>> - ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); >>>>> - ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>>>> - ? ? ?WorkStr = WorkStr.substr(Pos); >>>>> - ? ? ?continue; >>>>> + ?std::string work(input); >>>>> + ?// Skip past any delims at head of input string. >>>>> + ?size_t pos = work.find_first_not_of(delims); >>>>> + ?// If the string consists entirely of delims, then exit early. >>>>> + ?if (pos == std::string::npos) return; >>>>> + ?// Otherwise, jump forward to beginning of first word. >>>>> + ?work = work.substr(pos); >>>>> + ?// Find position of first delimiter. >>>>> + ?pos = work.find_first_of(delims); >>>>> + >>>>> + ?while (!work.empty() && pos != std::string::npos) { >>>>> + ? ?// Everything from 0 to POS is the next word to copy. >>>>> + ? ?output.push_back(strdup(work.substr(0,pos).c_str())); >>>>> + ? ?// Is there another word in the string? >>>>> + ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); >>>>> + ? ?if (nextpos != std::string::npos) { >>>>> + ? ? ?// Yes? Then remove delims from beginning ... >>>>> + ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); >>>>> + ? ? ?// and find the end of the word. >>>>> + ? ? ?pos = work.find_first_of(delims); >>>>> + ? ?} else { >>>>> + ? ? ?// No? (Remainder of string is delims.) End the loop. >>>>> + ? ? ?work = ""; >>>>> + ? ? ?pos = std::string::npos; >>>>> ? ? } >>>>> - >>>>> - ? ?// Find position of first delimiter. >>>>> - ? ?size_t Pos = WorkStr.find_first_of(Delims); >>>>> - ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>>>> - >>>>> - ? ?// Everything from 0 to Pos is the next word to copy. >>>>> - ? ?char *NewStr = (char*)malloc(Pos+1); >>>>> - ? ?memcpy(NewStr, WorkStr.data(), Pos); >>>>> - ? ?NewStr[Pos] = 0; >>>>> - ? ?OutputVector.push_back(NewStr); >>>>> ? } >>>>> + >>>>> + ?// If `input' ended with non-delim char, then we'll get here with >>>>> + ?// the last word of `input' in `work'; copy it now. >>>>> + ?if (!work.empty()) >>>>> + ? ?output.push_back(strdup(work.c_str())); >>>>> ?} >>>>> >>>>> ?/// ParseEnvironmentOptions - An alternative entry point to the >>>>> >>>>> Added: llvm/trunk/unittests/Support/CommandLineTest.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto >>>>> >>>>> ============================================================================== >>>>> --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) >>>>> +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 >>>>> @@ -0,0 +1,48 @@ >>>>> +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// >>>>> +// >>>>> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >>>>> +// >>>>> +// This file is distributed under the University of Illinois Open Source >>>>> +// License. See LICENSE.TXT for details. >>>>> +// >>>>> +//===----------------------------------------------------------------------===// >>>>> + >>>>> +#include "llvm/Support/CommandLine.h" >>>>> + >>>>> +#include "gtest/gtest.h" >>>>> + >>>>> +#include >>>>> +#include >>>>> + >>>>> +using namespace llvm; >>>>> + >>>>> +namespace { >>>>> + >>>>> +class TempEnvVar { >>>>> + public: >>>>> + ?TempEnvVar(const char *name, const char *value) >>>>> + ? ? ?: name(name) { >>>>> + ? ?const char *old_value = getenv(name); >>>>> + ? ?EXPECT_EQ(NULL, old_value) << old_value; >>>>> + ? ?setenv(name, value, true); >>>>> + ?} >>>>> + >>>>> + ?~TempEnvVar() { >>>>> + ? ?unsetenv(name); >>>>> + ?} >>>>> + >>>>> + private: >>>>> + ?const char *const name; >>>>> +}; >>>>> + >>>>> +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; >>>>> + >>>>> +cl::opt EnvironmentTestOption("env-test-opt"); >>>>> +TEST(CommandLineTest, ParseEnvironment) { >>>>> + ?TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); >>>>> + ?EXPECT_EQ("", EnvironmentTestOption); >>>>> + ?cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); >>>>> + ?EXPECT_EQ("hello", EnvironmentTestOption); >>>>> +} >>>>> + >>>>> +} ?// anonymous namespace >>>>> >>>>> >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>> >>>> >>> >> > From gohman at apple.com Fri Sep 25 13:55:00 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 18:55:00 -0000 Subject: [llvm-commits] [llvm] r82790 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ utils/TableGen/ Message-ID: <200909251855.n8PIt1mb022106@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 25 13:54:59 2009 New Revision: 82790 URL: http://llvm.org/viewvc/llvm-project?rev=82790&view=rev Log: Rename getTargetNode to getMachineNode, for consistency with the naming scheme used in SelectionDAG, where there are multiple kinds of "target" nodes, but "machine" nodes are nodes which represent a MachineInstr. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Sep 25 13:54:59 2009 @@ -650,38 +650,38 @@ SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs, const SDValue *Ops, unsigned NumOps); - /// getTargetNode - These are used for target selectors to create a new node - /// with specified return type(s), target opcode, and operands. + /// getMachineNode - These are used for target selectors to create a new node + /// with specified return type(s), MachineInstr opcode, and operands. /// - /// Note that getTargetNode returns the resultant node. If there is already a - /// node of the specified opcode and operands, it returns that node instead of - /// the current one. - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1, - SDValue Op2); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, - SDValue Op1, SDValue Op2, SDValue Op3); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, - const SDValue *Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, - SDValue Op1); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, - EVT VT2, SDValue Op1, SDValue Op2); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, - EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, - const SDValue *Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, - SDValue Op1, SDValue Op2); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, - SDValue Op1, SDValue Op2, SDValue Op3); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, - const SDValue *Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, - EVT VT4, const SDValue *Ops, unsigned NumOps); - SDNode *getTargetNode(unsigned Opcode, DebugLoc dl, + /// Note that getMachineNode returns the resultant node. If there is already + /// a node of the specified opcode and operands, it returns that node instead + /// of the current one. + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1, + SDValue Op2); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, + SDValue Op1, SDValue Op2, SDValue Op3); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, + const SDValue *Ops, unsigned NumOps); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, + SDValue Op1); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, + EVT VT2, SDValue Op1, SDValue Op2); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, + EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, + const SDValue *Ops, unsigned NumOps); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, + EVT VT3, SDValue Op1, SDValue Op2); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, + EVT VT3, SDValue Op1, SDValue Op2, SDValue Op3); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, + EVT VT3, const SDValue *Ops, unsigned NumOps); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, + EVT VT3, EVT VT4, const SDValue *Ops, unsigned NumOps); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, const std::vector &ResultTys, const SDValue *Ops, unsigned NumOps); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 25 13:54:59 2009 @@ -4494,107 +4494,107 @@ } -/// getTargetNode - These are used for target selectors to create a new node -/// with specified return type(s), target opcode, and operands. +/// getMachineNode - These are used for target selectors to create a new node +/// with specified return type(s), MachineInstr opcode, and operands. /// -/// Note that getTargetNode returns the resultant node. If there is already a +/// Note that getMachineNode returns the resultant node. If there is already a /// node of the specified opcode and operands, it returns that node instead of /// the current one. -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT) { return getNode(~Opcode, dl, VT).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, - SDValue Op1) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, + SDValue Op1) { return getNode(~Opcode, dl, VT, Op1).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, - SDValue Op1, SDValue Op2) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, + SDValue Op1, SDValue Op2) { return getNode(~Opcode, dl, VT, Op1, Op2).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, - SDValue Op1, SDValue Op2, - SDValue Op3) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, + SDValue Op1, SDValue Op2, + SDValue Op3) { return getNode(~Opcode, dl, VT, Op1, Op2, Op3).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT, - const SDValue *Ops, unsigned NumOps) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, + const SDValue *Ops, unsigned NumOps) { return getNode(~Opcode, dl, VT, Ops, NumOps).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, - EVT VT1, EVT VT2) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, + EVT VT1, EVT VT2) { SDVTList VTs = getVTList(VT1, VT2); SDValue Op; return getNode(~Opcode, dl, VTs, &Op, 0).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, - EVT VT2, SDValue Op1) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, + EVT VT2, SDValue Op1) { SDVTList VTs = getVTList(VT1, VT2); return getNode(~Opcode, dl, VTs, &Op1, 1).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, - EVT VT2, SDValue Op1, - SDValue Op2) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, + EVT VT2, SDValue Op1, + SDValue Op2) { SDVTList VTs = getVTList(VT1, VT2); SDValue Ops[] = { Op1, Op2 }; return getNode(~Opcode, dl, VTs, Ops, 2).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, - EVT VT2, SDValue Op1, - SDValue Op2, SDValue Op3) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, + EVT VT2, SDValue Op1, + SDValue Op2, SDValue Op3) { SDVTList VTs = getVTList(VT1, VT2); SDValue Ops[] = { Op1, Op2, Op3 }; return getNode(~Opcode, dl, VTs, Ops, 3).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, - EVT VT1, EVT VT2, - const SDValue *Ops, unsigned NumOps) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, + EVT VT1, EVT VT2, + const SDValue *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2); return getNode(~Opcode, dl, VTs, Ops, NumOps).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, - EVT VT1, EVT VT2, EVT VT3, - SDValue Op1, SDValue Op2) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, + EVT VT1, EVT VT2, EVT VT3, + SDValue Op1, SDValue Op2) { SDVTList VTs = getVTList(VT1, VT2, VT3); SDValue Ops[] = { Op1, Op2 }; return getNode(~Opcode, dl, VTs, Ops, 2).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, - EVT VT1, EVT VT2, EVT VT3, - SDValue Op1, SDValue Op2, - SDValue Op3) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, + EVT VT1, EVT VT2, EVT VT3, + SDValue Op1, SDValue Op2, + SDValue Op3) { SDVTList VTs = getVTList(VT1, VT2, VT3); SDValue Ops[] = { Op1, Op2, Op3 }; return getNode(~Opcode, dl, VTs, Ops, 3).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, - EVT VT1, EVT VT2, EVT VT3, - const SDValue *Ops, unsigned NumOps) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, + EVT VT1, EVT VT2, EVT VT3, + const SDValue *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2, VT3); return getNode(~Opcode, dl, VTs, Ops, NumOps).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, EVT VT1, - EVT VT2, EVT VT3, EVT VT4, - const SDValue *Ops, unsigned NumOps) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, + EVT VT2, EVT VT3, EVT VT4, + const SDValue *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2, VT3, VT4); return getNode(~Opcode, dl, VTs, Ops, NumOps).getNode(); } -SDNode *SelectionDAG::getTargetNode(unsigned Opcode, DebugLoc dl, - const std::vector &ResultTys, - const SDValue *Ops, unsigned NumOps) { +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, + const std::vector &ResultTys, + const SDValue *Ops, unsigned NumOps) { return getNode(~Opcode, dl, ResultTys, Ops, NumOps).getNode(); } @@ -4604,8 +4604,8 @@ SelectionDAG::getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT, SDValue Operand) { SDValue SRIdxVal = getTargetConstant(SRIdx, MVT::i32); - SDNode *Subreg = getTargetNode(TargetInstrInfo::EXTRACT_SUBREG, DL, - VT, Operand, SRIdxVal); + SDNode *Subreg = getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, DL, + VT, Operand, SRIdxVal); return SDValue(Subreg, 0); } Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -813,8 +813,8 @@ SDValue Base = LD->getBasePtr(); SDValue Ops[]= { Base, Offset, AMOpc, getAL(CurDAG), CurDAG->getRegister(0, MVT::i32), Chain }; - return CurDAG->getTargetNode(Opcode, Op.getDebugLoc(), MVT::i32, MVT::i32, - MVT::Other, Ops, 6); + return CurDAG->getMachineNode(Opcode, Op.getDebugLoc(), MVT::i32, MVT::i32, + MVT::Other, Ops, 6); } return NULL; @@ -861,8 +861,8 @@ SDValue Base = LD->getBasePtr(); SDValue Ops[]= { Base, Offset, getAL(CurDAG), CurDAG->getRegister(0, MVT::i32), Chain }; - return CurDAG->getTargetNode(Opcode, Op.getDebugLoc(), MVT::i32, MVT::i32, - MVT::Other, Ops, 5); + return CurDAG->getMachineNode(Opcode, Op.getDebugLoc(), MVT::i32, MVT::i32, + MVT::Other, Ops, 5); } return NULL; @@ -882,7 +882,7 @@ // instruction that can read and write SP. This matches to a pseudo // instruction that has a chain to ensure the result is written back to // the stack pointer. - SP = SDValue(CurDAG->getTargetNode(ARM::tANDsp, dl, VT, SP, Align), 0); + SP = SDValue(CurDAG->getMachineNode(ARM::tANDsp, dl, VT, SP, Align), 0); bool isC = isa(Size); uint32_t C = isC ? cast(Size)->getZExtValue() : ~0UL; @@ -958,8 +958,8 @@ SDValue Pred = CurDAG->getTargetConstant(0xEULL, MVT::i32); SDValue PredReg = CurDAG->getRegister(0, MVT::i32); SDValue Ops[] = { CPIdx, Pred, PredReg, CurDAG->getEntryNode() }; - ResNode = CurDAG->getTargetNode(ARM::tLDRcp, dl, MVT::i32, MVT::Other, - Ops, 4); + ResNode = CurDAG->getMachineNode(ARM::tLDRcp, dl, MVT::i32, MVT::Other, + Ops, 4); } else { SDValue Ops[] = { CPIdx, @@ -969,8 +969,8 @@ CurDAG->getRegister(0, MVT::i32), CurDAG->getEntryNode() }; - ResNode=CurDAG->getTargetNode(ARM::LDRcp, dl, MVT::i32, MVT::Other, - Ops, 6); + ResNode=CurDAG->getMachineNode(ARM::LDRcp, dl, MVT::i32, MVT::Other, + Ops, 6); } ReplaceUses(Op, SDValue(ResNode, 0)); return NULL; @@ -1038,9 +1038,9 @@ } break; case ARMISD::FMRRD: - return CurDAG->getTargetNode(ARM::FMRRD, dl, MVT::i32, MVT::i32, - Op.getOperand(0), getAL(CurDAG), - CurDAG->getRegister(0, MVT::i32)); + return CurDAG->getMachineNode(ARM::FMRRD, dl, MVT::i32, MVT::i32, + Op.getOperand(0), getAL(CurDAG), + CurDAG->getRegister(0, MVT::i32)); case ISD::UMUL_LOHI: { if (Subtarget->isThumb1Only()) break; @@ -1048,12 +1048,12 @@ SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), getAL(CurDAG), CurDAG->getRegister(0, MVT::i32), CurDAG->getRegister(0, MVT::i32) }; - return CurDAG->getTargetNode(ARM::t2UMULL, dl, MVT::i32, MVT::i32, Ops,4); + return CurDAG->getMachineNode(ARM::t2UMULL, dl, MVT::i32, MVT::i32, Ops,4); } else { SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), getAL(CurDAG), CurDAG->getRegister(0, MVT::i32), CurDAG->getRegister(0, MVT::i32) }; - return CurDAG->getTargetNode(ARM::UMULL, dl, MVT::i32, MVT::i32, Ops, 5); + return CurDAG->getMachineNode(ARM::UMULL, dl, MVT::i32, MVT::i32, Ops, 5); } } case ISD::SMUL_LOHI: { @@ -1062,12 +1062,12 @@ if (Subtarget->isThumb()) { SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), getAL(CurDAG), CurDAG->getRegister(0, MVT::i32) }; - return CurDAG->getTargetNode(ARM::t2SMULL, dl, MVT::i32, MVT::i32, Ops,4); + return CurDAG->getMachineNode(ARM::t2SMULL, dl, MVT::i32, MVT::i32, Ops,4); } else { SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), getAL(CurDAG), CurDAG->getRegister(0, MVT::i32), CurDAG->getRegister(0, MVT::i32) }; - return CurDAG->getTargetNode(ARM::SMULL, dl, MVT::i32, MVT::i32, Ops, 5); + return CurDAG->getMachineNode(ARM::SMULL, dl, MVT::i32, MVT::i32, Ops, 5); } } case ISD::LOAD: { @@ -1109,8 +1109,8 @@ cast(N2)->getZExtValue()), MVT::i32); SDValue Ops[] = { N1, Tmp2, N3, Chain, InFlag }; - SDNode *ResNode = CurDAG->getTargetNode(Opc, dl, MVT::Other, - MVT::Flag, Ops, 5); + SDNode *ResNode = CurDAG->getMachineNode(Opc, dl, MVT::Other, + MVT::Flag, Ops, 5); Chain = SDValue(ResNode, 0); if (Op.getNode()->getNumValues() == 2) { InFlag = SDValue(ResNode, 1); @@ -1277,8 +1277,8 @@ case MVT::v4f32: case MVT::v4i32: Opc = ARM::VZIPq32; break; } - return CurDAG->getTargetNode(Opc, dl, VT, VT, - N->getOperand(0), N->getOperand(1)); + return CurDAG->getMachineNode(Opc, dl, VT, VT, + N->getOperand(0), N->getOperand(1)); } case ARMISD::VUZP: { unsigned Opc = 0; @@ -1294,8 +1294,8 @@ case MVT::v4f32: case MVT::v4i32: Opc = ARM::VUZPq32; break; } - return CurDAG->getTargetNode(Opc, dl, VT, VT, - N->getOperand(0), N->getOperand(1)); + return CurDAG->getMachineNode(Opc, dl, VT, VT, + N->getOperand(0), N->getOperand(1)); } case ARMISD::VTRN: { unsigned Opc = 0; @@ -1311,8 +1311,8 @@ case MVT::v4f32: case MVT::v4i32: Opc = ARM::VTRNq32; break; } - return CurDAG->getTargetNode(Opc, dl, VT, VT, - N->getOperand(0), N->getOperand(1)); + return CurDAG->getMachineNode(Opc, dl, VT, VT, + N->getOperand(0), N->getOperand(1)); } case ISD::INTRINSIC_VOID: @@ -1338,7 +1338,7 @@ } SDValue Chain = N->getOperand(0); const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; - return CurDAG->getTargetNode(Opc, dl, VT, VT, MVT::Other, Ops, 4); + return CurDAG->getMachineNode(Opc, dl, VT, VT, MVT::Other, Ops, 4); } case Intrinsic::arm_neon_vld3: { @@ -1354,7 +1354,7 @@ } SDValue Chain = N->getOperand(0); const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; - return CurDAG->getTargetNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 4); + return CurDAG->getMachineNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 4); } case Intrinsic::arm_neon_vld4: { @@ -1372,7 +1372,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; std::vector ResTys(4, VT); ResTys.push_back(MVT::Other); - return CurDAG->getTargetNode(Opc, dl, ResTys, Ops, 4); + return CurDAG->getMachineNode(Opc, dl, ResTys, Ops, 4); } case Intrinsic::arm_neon_vld2lane: { @@ -1390,7 +1390,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), N->getOperand(5), Chain }; - return CurDAG->getTargetNode(Opc, dl, VT, VT, MVT::Other, Ops, 7); + return CurDAG->getMachineNode(Opc, dl, VT, VT, MVT::Other, Ops, 7); } case Intrinsic::arm_neon_vld3lane: { @@ -1408,7 +1408,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), N->getOperand(5), N->getOperand(6), Chain }; - return CurDAG->getTargetNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 8); + return CurDAG->getMachineNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 8); } case Intrinsic::arm_neon_vld4lane: { @@ -1429,7 +1429,7 @@ N->getOperand(7), Chain }; std::vector ResTys(4, VT); ResTys.push_back(MVT::Other); - return CurDAG->getTargetNode(Opc, dl, ResTys, Ops, 9); + return CurDAG->getMachineNode(Opc, dl, ResTys, Ops, 9); } case Intrinsic::arm_neon_vst2: { @@ -1446,7 +1446,7 @@ SDValue Chain = N->getOperand(0); const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 6); + return CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 6); } case Intrinsic::arm_neon_vst3: { @@ -1464,7 +1464,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), N->getOperand(5), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 7); + return CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 7); } case Intrinsic::arm_neon_vst4: { @@ -1482,7 +1482,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), N->getOperand(5), N->getOperand(6), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8); + return CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 8); } case Intrinsic::arm_neon_vst2lane: { @@ -1500,7 +1500,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), N->getOperand(5), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 7); + return CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 7); } case Intrinsic::arm_neon_vst3lane: { @@ -1518,7 +1518,7 @@ const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, N->getOperand(3), N->getOperand(4), N->getOperand(5), N->getOperand(6), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8); + return CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 8); } case Intrinsic::arm_neon_vst4lane: { @@ -1537,7 +1537,7 @@ N->getOperand(3), N->getOperand(4), N->getOperand(5), N->getOperand(6), N->getOperand(7), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 9); + return CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 9); } } } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -270,8 +270,8 @@ Chain = CurDAG->getCopyToReg(Chain, dl, Alpha::R27, N0, Chain.getValue(1)); SDNode *CNode = - CurDAG->getTargetNode(Alpha::JSRs, dl, MVT::Other, MVT::Flag, - Chain, Chain.getValue(1)); + CurDAG->getMachineNode(Alpha::JSRs, dl, MVT::Other, MVT::Flag, + Chain, Chain.getValue(1)); Chain = CurDAG->getCopyFromReg(Chain, dl, Alpha::R27, MVT::i64, SDValue(CNode, 1)); return CurDAG->SelectNodeTo(N, Alpha::BISr, MVT::i64, Chain, Chain); @@ -279,8 +279,8 @@ case ISD::READCYCLECOUNTER: { SDValue Chain = N->getOperand(0); - return CurDAG->getTargetNode(Alpha::RPCC, dl, MVT::i64, MVT::Other, - Chain); + return CurDAG->getMachineNode(Alpha::RPCC, dl, MVT::i64, MVT::Other, + Chain); } case ISD::Constant: { @@ -306,8 +306,8 @@ ConstantInt *C = ConstantInt::get( Type::getInt64Ty(*CurDAG->getContext()), uval); SDValue CPI = CurDAG->getTargetConstantPool(C, MVT::i64); - SDNode *Tmp = CurDAG->getTargetNode(Alpha::LDAHr, dl, MVT::i64, CPI, - SDValue(getGlobalBaseReg(), 0)); + SDNode *Tmp = CurDAG->getMachineNode(Alpha::LDAHr, dl, MVT::i64, CPI, + SDValue(getGlobalBaseReg(), 0)); return CurDAG->SelectNodeTo(N, Alpha::LDQr, MVT::i64, MVT::Other, CPI, SDValue(Tmp, 0), CurDAG->getEntryNode()); } @@ -358,29 +358,29 @@ }; SDValue tmp1 = N->getOperand(rev?1:0); SDValue tmp2 = N->getOperand(rev?0:1); - SDNode *cmp = CurDAG->getTargetNode(Opc, dl, MVT::f64, tmp1, tmp2); + SDNode *cmp = CurDAG->getMachineNode(Opc, dl, MVT::f64, tmp1, tmp2); if (inv) - cmp = CurDAG->getTargetNode(Alpha::CMPTEQ, dl, - MVT::f64, SDValue(cmp, 0), - CurDAG->getRegister(Alpha::F31, MVT::f64)); + cmp = CurDAG->getMachineNode(Alpha::CMPTEQ, dl, + MVT::f64, SDValue(cmp, 0), + CurDAG->getRegister(Alpha::F31, MVT::f64)); switch(CC) { case ISD::SETUEQ: case ISD::SETULT: case ISD::SETULE: case ISD::SETUNE: case ISD::SETUGT: case ISD::SETUGE: { - SDNode* cmp2 = CurDAG->getTargetNode(Alpha::CMPTUN, dl, MVT::f64, - tmp1, tmp2); - cmp = CurDAG->getTargetNode(Alpha::ADDT, dl, MVT::f64, - SDValue(cmp2, 0), SDValue(cmp, 0)); + SDNode* cmp2 = CurDAG->getMachineNode(Alpha::CMPTUN, dl, MVT::f64, + tmp1, tmp2); + cmp = CurDAG->getMachineNode(Alpha::ADDT, dl, MVT::f64, + SDValue(cmp2, 0), SDValue(cmp, 0)); break; } default: break; } - SDNode* LD = CurDAG->getTargetNode(Alpha::FTOIT, dl, - MVT::i64, SDValue(cmp, 0)); - return CurDAG->getTargetNode(Alpha::CMPULT, dl, MVT::i64, - CurDAG->getRegister(Alpha::R31, MVT::i64), - SDValue(LD,0)); + SDNode* LD = CurDAG->getMachineNode(Alpha::FTOIT, dl, + MVT::i64, SDValue(cmp, 0)); + return CurDAG->getMachineNode(Alpha::CMPULT, dl, MVT::i64, + CurDAG->getRegister(Alpha::R31, MVT::i64), + SDValue(LD,0)); } break; @@ -405,11 +405,11 @@ if (get_zapImm(mask)) { SDValue Z = - SDValue(CurDAG->getTargetNode(Alpha::ZAPNOTi, dl, MVT::i64, - N->getOperand(0).getOperand(0), - getI64Imm(get_zapImm(mask))), 0); - return CurDAG->getTargetNode(Alpha::SRLr, dl, MVT::i64, Z, - getI64Imm(sval)); + SDValue(CurDAG->getMachineNode(Alpha::ZAPNOTi, dl, MVT::i64, + N->getOperand(0).getOperand(0), + getI64Imm(get_zapImm(mask))), 0); + return CurDAG->getMachineNode(Alpha::SRLr, dl, MVT::i64, Z, + getI64Imm(sval)); } } break; @@ -433,14 +433,14 @@ SDValue GOT = SDValue(getGlobalBaseReg(), 0); Chain = CurDAG->getCopyToReg(Chain, dl, Alpha::R29, GOT, InFlag); InFlag = Chain.getValue(1); - Chain = SDValue(CurDAG->getTargetNode(Alpha::BSR, dl, MVT::Other, - MVT::Flag, Addr.getOperand(0), - Chain, InFlag), 0); + Chain = SDValue(CurDAG->getMachineNode(Alpha::BSR, dl, MVT::Other, + MVT::Flag, Addr.getOperand(0), + Chain, InFlag), 0); } else { Chain = CurDAG->getCopyToReg(Chain, dl, Alpha::R27, Addr, InFlag); InFlag = Chain.getValue(1); - Chain = SDValue(CurDAG->getTargetNode(Alpha::JSR, dl, MVT::Other, - MVT::Flag, Chain, InFlag), 0); + Chain = SDValue(CurDAG->getMachineNode(Alpha::JSR, dl, MVT::Other, + MVT::Flag, Chain, InFlag), 0); } InFlag = Chain.getValue(1); Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -177,11 +177,11 @@ // We cannot copy CC <-> !(CC/D) if ((isCC(DefRC) && !isDCC(UseRC)) || (isCC(UseRC) && !isDCC(DefRC))) { SDNode *Copy = - DAG.getTargetNode(TargetInstrInfo::COPY_TO_REGCLASS, - NI->getDebugLoc(), - MVT::i32, - UI.getUse().get(), - DAG.getTargetConstant(BF::DRegClassID, MVT::i32)); + DAG.getMachineNode(TargetInstrInfo::COPY_TO_REGCLASS, + NI->getDebugLoc(), + MVT::i32, + UI.getUse().get(), + DAG.getTargetConstant(BF::DRegClassID, MVT::i32)); UpdateNodeOperand(DAG, *UI, UI.getOperandNo(), SDValue(Copy, 0)); } } Modified: llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Blackfin/BlackfinISelLowering.cpp Fri Sep 25 13:54:59 2009 @@ -422,26 +422,26 @@ unsigned Opcode = Op.getOpcode()==ISD::ADDE ? BF::ADD : BF::SUB; // zext incoming carry flag in AC0 to 32 bits - SDNode* CarryIn = DAG.getTargetNode(BF::MOVE_cc_ac0, dl, MVT::i32, - /* flag= */ Op.getOperand(2)); - CarryIn = DAG.getTargetNode(BF::MOVECC_zext, dl, MVT::i32, - SDValue(CarryIn, 0)); + SDNode* CarryIn = DAG.getMachineNode(BF::MOVE_cc_ac0, dl, MVT::i32, + /* flag= */ Op.getOperand(2)); + CarryIn = DAG.getMachineNode(BF::MOVECC_zext, dl, MVT::i32, + SDValue(CarryIn, 0)); // Add operands, produce sum and carry flag - SDNode *Sum = DAG.getTargetNode(Opcode, dl, MVT::i32, MVT::Flag, - Op.getOperand(0), Op.getOperand(1)); + SDNode *Sum = DAG.getMachineNode(Opcode, dl, MVT::i32, MVT::Flag, + Op.getOperand(0), Op.getOperand(1)); // Store intermediate carry from Sum - SDNode* Carry1 = DAG.getTargetNode(BF::MOVE_cc_ac0, dl, MVT::i32, - /* flag= */ SDValue(Sum, 1)); + SDNode* Carry1 = DAG.getMachineNode(BF::MOVE_cc_ac0, dl, MVT::i32, + /* flag= */ SDValue(Sum, 1)); // Add incoming carry, again producing an output flag - Sum = DAG.getTargetNode(Opcode, dl, MVT::i32, MVT::Flag, - SDValue(Sum, 0), SDValue(CarryIn, 0)); + Sum = DAG.getMachineNode(Opcode, dl, MVT::i32, MVT::Flag, + SDValue(Sum, 0), SDValue(CarryIn, 0)); // Update AC0 with the intermediate carry, producing a flag. - SDNode *CarryOut = DAG.getTargetNode(BF::OR_ac0_cc, dl, MVT::Flag, - SDValue(Carry1, 0)); + SDNode *CarryOut = DAG.getMachineNode(BF::OR_ac0_cc, dl, MVT::Flag, + SDValue(Carry1, 0)); // Compose (i32, flag) pair SDValue ops[2] = { SDValue(Sum, 0), SDValue(CarryOut, 0) }; Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -713,8 +713,9 @@ } else { NewOpc = SPU::Ar32; Ops[0] = CurDAG->getRegister(SPU::R1, Op.getValueType()); - Ops[1] = SDValue(CurDAG->getTargetNode(SPU::ILAr32, dl, Op.getValueType(), - TFI, Imm0), 0); + Ops[1] = SDValue(CurDAG->getMachineNode(SPU::ILAr32, dl, + Op.getValueType(), TFI, Imm0), + 0); n_ops = 2; } } else if (Opc == ISD::Constant && OpVT == MVT::i64) { @@ -813,8 +814,8 @@ if (shift_amt >= 32) { SDNode *hi32 = - CurDAG->getTargetNode(SPU::ORr32_r64, dl, OpVT, - Op0.getOperand(0)); + CurDAG->getMachineNode(SPU::ORr32_r64, dl, OpVT, + Op0.getOperand(0)); shift_amt -= 32; if (shift_amt > 0) { @@ -825,8 +826,8 @@ if (Op0.getOpcode() == ISD::SRL) Opc = SPU::ROTMr32; - hi32 = CurDAG->getTargetNode(Opc, dl, OpVT, SDValue(hi32, 0), - shift); + hi32 = CurDAG->getMachineNode(Opc, dl, OpVT, SDValue(hi32, 0), + shift); } return hi32; @@ -858,10 +859,10 @@ if (OpVT == MVT::v2f64) Opc = SPU::DFNMSv2f64; - return CurDAG->getTargetNode(Opc, dl, OpVT, - Op00.getOperand(0), - Op00.getOperand(1), - Op0.getOperand(1)); + return CurDAG->getMachineNode(Opc, dl, OpVT, + Op00.getOperand(0), + Op00.getOperand(1), + Op0.getOperand(1)); } } @@ -878,20 +879,20 @@ negConst, negConst)); } - return CurDAG->getTargetNode(Opc, dl, OpVT, - Op.getOperand(0), SDValue(signMask, 0)); + return CurDAG->getMachineNode(Opc, dl, OpVT, + Op.getOperand(0), SDValue(signMask, 0)); } else if (Opc == ISD::FABS) { if (OpVT == MVT::f64) { SDNode *signMask = SelectI64Constant(0x7fffffffffffffffULL, MVT::i64, dl); - return CurDAG->getTargetNode(SPU::ANDfabs64, dl, OpVT, - Op.getOperand(0), SDValue(signMask, 0)); + return CurDAG->getMachineNode(SPU::ANDfabs64, dl, OpVT, + Op.getOperand(0), SDValue(signMask, 0)); } else if (OpVT == MVT::v2f64) { SDValue absConst = CurDAG->getConstant(0x7fffffffffffffffULL, MVT::i64); SDValue absVec = CurDAG->getNode(ISD::BUILD_VECTOR, dl, MVT::v2i64, absConst, absConst); SDNode *signMask = emitBuildVector(absVec); - return CurDAG->getTargetNode(SPU::ANDfabsvec, dl, OpVT, - Op.getOperand(0), SDValue(signMask, 0)); + return CurDAG->getMachineNode(SPU::ANDfabsvec, dl, OpVT, + Op.getOperand(0), SDValue(signMask, 0)); } } else if (Opc == SPUISD::LDRESULT) { // Custom select instructions for LDRESULT @@ -913,9 +914,9 @@ if (vtm->ldresult_imm) { SDValue Zero = CurDAG->getTargetConstant(0, VT); - Result = CurDAG->getTargetNode(Opc, dl, VT, MVT::Other, Arg, Zero, Chain); + Result = CurDAG->getMachineNode(Opc, dl, VT, MVT::Other, Arg, Zero, Chain); } else { - Result = CurDAG->getTargetNode(Opc, dl, VT, MVT::Other, Arg, Arg, Chain); + Result = CurDAG->getMachineNode(Opc, dl, VT, MVT::Other, Arg, Arg, Chain); } return Result; @@ -951,7 +952,7 @@ if (N->hasOneUse()) return CurDAG->SelectNodeTo(N, NewOpc, OpVT, Ops, n_ops); else - return CurDAG->getTargetNode(NewOpc, dl, OpVT, Ops, n_ops); + return CurDAG->getMachineNode(NewOpc, dl, OpVT, Ops, n_ops); } else return SelectCode(Op); } @@ -979,15 +980,15 @@ SDValue SelMaskVal; DebugLoc dl = Op.getDebugLoc(); - VecOp0 = CurDAG->getTargetNode(SPU::ORv2i64_i64, dl, VecVT, Op0); + VecOp0 = CurDAG->getMachineNode(SPU::ORv2i64_i64, dl, VecVT, Op0); SelMaskVal = CurDAG->getTargetConstant(0xff00ULL, MVT::i16); - SelMask = CurDAG->getTargetNode(SPU::FSMBIv2i64, dl, VecVT, SelMaskVal); - ZeroFill = CurDAG->getTargetNode(SPU::ILv2i64, dl, VecVT, - CurDAG->getTargetConstant(0, OpVT)); - VecOp0 = CurDAG->getTargetNode(SPU::SELBv2i64, dl, VecVT, - SDValue(ZeroFill, 0), - SDValue(VecOp0, 0), - SDValue(SelMask, 0)); + SelMask = CurDAG->getMachineNode(SPU::FSMBIv2i64, dl, VecVT, SelMaskVal); + ZeroFill = CurDAG->getMachineNode(SPU::ILv2i64, dl, VecVT, + CurDAG->getTargetConstant(0, OpVT)); + VecOp0 = CurDAG->getMachineNode(SPU::SELBv2i64, dl, VecVT, + SDValue(ZeroFill, 0), + SDValue(VecOp0, 0), + SDValue(SelMask, 0)); if (ConstantSDNode *CN = dyn_cast(ShiftAmt)) { unsigned bytes = unsigned(CN->getZExtValue()) >> 3; @@ -995,35 +996,35 @@ if (bytes > 0) { Shift = - CurDAG->getTargetNode(SPU::SHLQBYIv2i64, dl, VecVT, - SDValue(VecOp0, 0), - CurDAG->getTargetConstant(bytes, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::SHLQBYIv2i64, dl, VecVT, + SDValue(VecOp0, 0), + CurDAG->getTargetConstant(bytes, ShiftAmtVT)); } if (bits > 0) { Shift = - CurDAG->getTargetNode(SPU::SHLQBIIv2i64, dl, VecVT, - SDValue((Shift != 0 ? Shift : VecOp0), 0), - CurDAG->getTargetConstant(bits, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::SHLQBIIv2i64, dl, VecVT, + SDValue((Shift != 0 ? Shift : VecOp0), 0), + CurDAG->getTargetConstant(bits, ShiftAmtVT)); } } else { SDNode *Bytes = - CurDAG->getTargetNode(SPU::ROTMIr32, dl, ShiftAmtVT, - ShiftAmt, - CurDAG->getTargetConstant(3, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ROTMIr32, dl, ShiftAmtVT, + ShiftAmt, + CurDAG->getTargetConstant(3, ShiftAmtVT)); SDNode *Bits = - CurDAG->getTargetNode(SPU::ANDIr32, dl, ShiftAmtVT, - ShiftAmt, - CurDAG->getTargetConstant(7, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ANDIr32, dl, ShiftAmtVT, + ShiftAmt, + CurDAG->getTargetConstant(7, ShiftAmtVT)); Shift = - CurDAG->getTargetNode(SPU::SHLQBYv2i64, dl, VecVT, - SDValue(VecOp0, 0), SDValue(Bytes, 0)); + CurDAG->getMachineNode(SPU::SHLQBYv2i64, dl, VecVT, + SDValue(VecOp0, 0), SDValue(Bytes, 0)); Shift = - CurDAG->getTargetNode(SPU::SHLQBIv2i64, dl, VecVT, - SDValue(Shift, 0), SDValue(Bits, 0)); + CurDAG->getMachineNode(SPU::SHLQBIv2i64, dl, VecVT, + SDValue(Shift, 0), SDValue(Bits, 0)); } - return CurDAG->getTargetNode(SPU::ORi64_v2i64, dl, OpVT, SDValue(Shift, 0)); + return CurDAG->getMachineNode(SPU::ORi64_v2i64, dl, OpVT, SDValue(Shift, 0)); } /*! @@ -1044,7 +1045,7 @@ SDNode *VecOp0, *Shift = 0; DebugLoc dl = Op.getDebugLoc(); - VecOp0 = CurDAG->getTargetNode(SPU::ORv2i64_i64, dl, VecVT, Op0); + VecOp0 = CurDAG->getMachineNode(SPU::ORv2i64_i64, dl, VecVT, Op0); if (ConstantSDNode *CN = dyn_cast(ShiftAmt)) { unsigned bytes = unsigned(CN->getZExtValue()) >> 3; @@ -1052,45 +1053,45 @@ if (bytes > 0) { Shift = - CurDAG->getTargetNode(SPU::ROTQMBYIv2i64, dl, VecVT, - SDValue(VecOp0, 0), - CurDAG->getTargetConstant(bytes, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ROTQMBYIv2i64, dl, VecVT, + SDValue(VecOp0, 0), + CurDAG->getTargetConstant(bytes, ShiftAmtVT)); } if (bits > 0) { Shift = - CurDAG->getTargetNode(SPU::ROTQMBIIv2i64, dl, VecVT, - SDValue((Shift != 0 ? Shift : VecOp0), 0), - CurDAG->getTargetConstant(bits, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ROTQMBIIv2i64, dl, VecVT, + SDValue((Shift != 0 ? Shift : VecOp0), 0), + CurDAG->getTargetConstant(bits, ShiftAmtVT)); } } else { SDNode *Bytes = - CurDAG->getTargetNode(SPU::ROTMIr32, dl, ShiftAmtVT, - ShiftAmt, - CurDAG->getTargetConstant(3, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ROTMIr32, dl, ShiftAmtVT, + ShiftAmt, + CurDAG->getTargetConstant(3, ShiftAmtVT)); SDNode *Bits = - CurDAG->getTargetNode(SPU::ANDIr32, dl, ShiftAmtVT, - ShiftAmt, - CurDAG->getTargetConstant(7, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ANDIr32, dl, ShiftAmtVT, + ShiftAmt, + CurDAG->getTargetConstant(7, ShiftAmtVT)); // Ensure that the shift amounts are negated! - Bytes = CurDAG->getTargetNode(SPU::SFIr32, dl, ShiftAmtVT, - SDValue(Bytes, 0), - CurDAG->getTargetConstant(0, ShiftAmtVT)); + Bytes = CurDAG->getMachineNode(SPU::SFIr32, dl, ShiftAmtVT, + SDValue(Bytes, 0), + CurDAG->getTargetConstant(0, ShiftAmtVT)); - Bits = CurDAG->getTargetNode(SPU::SFIr32, dl, ShiftAmtVT, - SDValue(Bits, 0), - CurDAG->getTargetConstant(0, ShiftAmtVT)); + Bits = CurDAG->getMachineNode(SPU::SFIr32, dl, ShiftAmtVT, + SDValue(Bits, 0), + CurDAG->getTargetConstant(0, ShiftAmtVT)); Shift = - CurDAG->getTargetNode(SPU::ROTQMBYv2i64, dl, VecVT, - SDValue(VecOp0, 0), SDValue(Bytes, 0)); + CurDAG->getMachineNode(SPU::ROTQMBYv2i64, dl, VecVT, + SDValue(VecOp0, 0), SDValue(Bytes, 0)); Shift = - CurDAG->getTargetNode(SPU::ROTQMBIv2i64, dl, VecVT, - SDValue(Shift, 0), SDValue(Bits, 0)); + CurDAG->getMachineNode(SPU::ROTQMBIv2i64, dl, VecVT, + SDValue(Shift, 0), SDValue(Bits, 0)); } - return CurDAG->getTargetNode(SPU::ORi64_v2i64, dl, OpVT, SDValue(Shift, 0)); + return CurDAG->getMachineNode(SPU::ORi64_v2i64, dl, OpVT, SDValue(Shift, 0)); } /*! @@ -1111,25 +1112,25 @@ DebugLoc dl = Op.getDebugLoc(); SDNode *VecOp0 = - CurDAG->getTargetNode(SPU::ORv2i64_i64, dl, VecVT, Op.getOperand(0)); + CurDAG->getMachineNode(SPU::ORv2i64_i64, dl, VecVT, Op.getOperand(0)); SDValue SignRotAmt = CurDAG->getTargetConstant(31, ShiftAmtVT); SDNode *SignRot = - CurDAG->getTargetNode(SPU::ROTMAIv2i64_i32, dl, MVT::v2i64, - SDValue(VecOp0, 0), SignRotAmt); + CurDAG->getMachineNode(SPU::ROTMAIv2i64_i32, dl, MVT::v2i64, + SDValue(VecOp0, 0), SignRotAmt); SDNode *UpperHalfSign = - CurDAG->getTargetNode(SPU::ORi32_v4i32, dl, MVT::i32, SDValue(SignRot, 0)); + CurDAG->getMachineNode(SPU::ORi32_v4i32, dl, MVT::i32, SDValue(SignRot, 0)); SDNode *UpperHalfSignMask = - CurDAG->getTargetNode(SPU::FSM64r32, dl, VecVT, SDValue(UpperHalfSign, 0)); + CurDAG->getMachineNode(SPU::FSM64r32, dl, VecVT, SDValue(UpperHalfSign, 0)); SDNode *UpperLowerMask = - CurDAG->getTargetNode(SPU::FSMBIv2i64, dl, VecVT, - CurDAG->getTargetConstant(0xff00ULL, MVT::i16)); + CurDAG->getMachineNode(SPU::FSMBIv2i64, dl, VecVT, + CurDAG->getTargetConstant(0xff00ULL, MVT::i16)); SDNode *UpperLowerSelect = - CurDAG->getTargetNode(SPU::SELBv2i64, dl, VecVT, - SDValue(UpperHalfSignMask, 0), - SDValue(VecOp0, 0), - SDValue(UpperLowerMask, 0)); + CurDAG->getMachineNode(SPU::SELBv2i64, dl, VecVT, + SDValue(UpperHalfSignMask, 0), + SDValue(VecOp0, 0), + SDValue(UpperLowerMask, 0)); SDNode *Shift = 0; @@ -1140,32 +1141,32 @@ if (bytes > 0) { bytes = 31 - bytes; Shift = - CurDAG->getTargetNode(SPU::ROTQBYIv2i64, dl, VecVT, - SDValue(UpperLowerSelect, 0), - CurDAG->getTargetConstant(bytes, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ROTQBYIv2i64, dl, VecVT, + SDValue(UpperLowerSelect, 0), + CurDAG->getTargetConstant(bytes, ShiftAmtVT)); } if (bits > 0) { bits = 8 - bits; Shift = - CurDAG->getTargetNode(SPU::ROTQBIIv2i64, dl, VecVT, - SDValue((Shift != 0 ? Shift : UpperLowerSelect), 0), - CurDAG->getTargetConstant(bits, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::ROTQBIIv2i64, dl, VecVT, + SDValue((Shift != 0 ? Shift : UpperLowerSelect), 0), + CurDAG->getTargetConstant(bits, ShiftAmtVT)); } } else { SDNode *NegShift = - CurDAG->getTargetNode(SPU::SFIr32, dl, ShiftAmtVT, - ShiftAmt, CurDAG->getTargetConstant(0, ShiftAmtVT)); + CurDAG->getMachineNode(SPU::SFIr32, dl, ShiftAmtVT, + ShiftAmt, CurDAG->getTargetConstant(0, ShiftAmtVT)); Shift = - CurDAG->getTargetNode(SPU::ROTQBYBIv2i64_r32, dl, VecVT, - SDValue(UpperLowerSelect, 0), SDValue(NegShift, 0)); + CurDAG->getMachineNode(SPU::ROTQBYBIv2i64_r32, dl, VecVT, + SDValue(UpperLowerSelect, 0), SDValue(NegShift, 0)); Shift = - CurDAG->getTargetNode(SPU::ROTQBIv2i64, dl, VecVT, - SDValue(Shift, 0), SDValue(NegShift, 0)); + CurDAG->getMachineNode(SPU::ROTQBIv2i64, dl, VecVT, + SDValue(Shift, 0), SDValue(NegShift, 0)); } - return CurDAG->getTargetNode(SPU::ORi64_v2i64, dl, OpVT, SDValue(Shift, 0)); + return CurDAG->getMachineNode(SPU::ORi64_v2i64, dl, OpVT, SDValue(Shift, 0)); } /*! @@ -1192,8 +1193,8 @@ SDValue Op0 = i64vec.getOperand(0); ReplaceUses(i64vec, Op0); - return CurDAG->getTargetNode(SPU::ORi64_v2i64, dl, OpVT, - SDValue(emitBuildVector(Op0), 0)); + return CurDAG->getMachineNode(SPU::ORi64_v2i64, dl, OpVT, + SDValue(emitBuildVector(Op0), 0)); } else if (i64vec.getOpcode() == SPUISD::SHUFB) { SDValue lhs = i64vec.getOperand(0); SDValue rhs = i64vec.getOperand(1); @@ -1231,11 +1232,11 @@ SDValue(lhsNode, 0), SDValue(rhsNode, 0), SDValue(shufMaskNode, 0))); - return CurDAG->getTargetNode(SPU::ORi64_v2i64, dl, OpVT, - SDValue(shufNode, 0)); + return CurDAG->getMachineNode(SPU::ORi64_v2i64, dl, OpVT, + SDValue(shufNode, 0)); } else if (i64vec.getOpcode() == ISD::BUILD_VECTOR) { - return CurDAG->getTargetNode(SPU::ORi64_v2i64, dl, OpVT, - SDValue(emitBuildVector(i64vec), 0)); + return CurDAG->getMachineNode(SPU::ORi64_v2i64, dl, OpVT, + SDValue(emitBuildVector(i64vec), 0)); } else { llvm_report_error("SPUDAGToDAGISel::SelectI64Constant: Unhandled i64vec" "condition"); Modified: llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -166,8 +166,8 @@ if (Node->hasOneUse()) return CurDAG->SelectNodeTo(Node, MSP430::ADD16ri, MVT::i16, TFI, CurDAG->getTargetConstant(0, MVT::i16)); - return CurDAG->getTargetNode(MSP430::ADD16ri, dl, MVT::i16, - TFI, CurDAG->getTargetConstant(0, MVT::i16)); + return CurDAG->getMachineNode(MSP430::ADD16ri, dl, MVT::i16, + TFI, CurDAG->getTargetConstant(0, MVT::i16)); } } Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -232,9 +232,9 @@ SDValue RHS = Node->getOperand(1); EVT VT = LHS.getValueType(); - SDNode *Carry = CurDAG->getTargetNode(Mips::SLTu, dl, VT, Ops, 2); - SDNode *AddCarry = CurDAG->getTargetNode(Mips::ADDu, dl, VT, - SDValue(Carry,0), RHS); + SDNode *Carry = CurDAG->getMachineNode(Mips::SLTu, dl, VT, Ops, 2); + SDNode *AddCarry = CurDAG->getMachineNode(Mips::ADDu, dl, VT, + SDValue(Carry,0), RHS); return CurDAG->SelectNodeTo(N.getNode(), MOp, VT, MVT::Flag, LHS, SDValue(AddCarry,0)); @@ -254,13 +254,13 @@ else Op = (Opcode == ISD::UDIVREM ? Mips::DIVu : Mips::DIV); - SDNode *Node = CurDAG->getTargetNode(Op, dl, MVT::Flag, Op1, Op2); + SDNode *Node = CurDAG->getMachineNode(Op, dl, MVT::Flag, Op1, Op2); SDValue InFlag = SDValue(Node, 0); - SDNode *Lo = CurDAG->getTargetNode(Mips::MFLO, dl, MVT::i32, - MVT::Flag, InFlag); + SDNode *Lo = CurDAG->getMachineNode(Mips::MFLO, dl, MVT::i32, + MVT::Flag, InFlag); InFlag = SDValue(Lo,1); - SDNode *Hi = CurDAG->getTargetNode(Mips::MFHI, dl, MVT::i32, InFlag); + SDNode *Hi = CurDAG->getMachineNode(Mips::MFHI, dl, MVT::i32, InFlag); if (!N.getValue(0).use_empty()) ReplaceUses(N.getValue(0), SDValue(Lo,0)); @@ -279,15 +279,15 @@ SDValue MulOp2 = Node->getOperand(1); unsigned MulOp = (Opcode == ISD::MULHU ? Mips::MULTu : Mips::MULT); - SDNode *MulNode = CurDAG->getTargetNode(MulOp, dl, - MVT::Flag, MulOp1, MulOp2); + SDNode *MulNode = CurDAG->getMachineNode(MulOp, dl, + MVT::Flag, MulOp1, MulOp2); SDValue InFlag = SDValue(MulNode, 0); if (MulOp == ISD::MUL) - return CurDAG->getTargetNode(Mips::MFLO, dl, MVT::i32, InFlag); + return CurDAG->getMachineNode(Mips::MFLO, dl, MVT::i32, InFlag); else - return CurDAG->getTargetNode(Mips::MFHI, dl, MVT::i32, InFlag); + return CurDAG->getMachineNode(Mips::MFHI, dl, MVT::i32, InFlag); } /// Div/Rem operations @@ -306,10 +306,10 @@ Op = (Opcode == ISD::SREM ? Mips::DIV : Mips::DIVu); MOp = Mips::MFHI; } - SDNode *Node = CurDAG->getTargetNode(Op, dl, MVT::Flag, Op1, Op2); + SDNode *Node = CurDAG->getMachineNode(Op, dl, MVT::Flag, Op1, Op2); SDValue InFlag = SDValue(Node, 0); - return CurDAG->getTargetNode(MOp, dl, MVT::i32, InFlag); + return CurDAG->getMachineNode(MOp, dl, MVT::i32, InFlag); } // Get target GOT address. @@ -335,7 +335,7 @@ // Use load to get GOT target SDValue Ops[] = { Callee, GPReg, Chain }; - SDValue Load = SDValue(CurDAG->getTargetNode(Mips::LW, dl, MVT::i32, + SDValue Load = SDValue(CurDAG->getMachineNode(Mips::LW, dl, MVT::i32, MVT::Other, Ops, 3), 0); Chain = Load.getValue(1); @@ -346,7 +346,7 @@ Chain = CurDAG->getCopyToReg(Chain, dl, T9Reg, Callee, InFlag); // Emit Jump and Link Register - SDNode *ResNode = CurDAG->getTargetNode(Mips::JALR, dl, MVT::Other, + SDNode *ResNode = CurDAG->getMachineNode(Mips::JALR, dl, MVT::Other, MVT::Flag, T9Reg, Chain); Chain = SDValue(ResNode, 0); InFlag = SDValue(ResNode, 1); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -469,7 +469,7 @@ SH &= 31; SDValue Ops[] = { Tmp3, Op1, getI32Imm(SH), getI32Imm(MB), getI32Imm(ME) }; - return CurDAG->getTargetNode(PPC::RLWIMI, dl, MVT::i32, Ops, 5); + return CurDAG->getMachineNode(PPC::RLWIMI, dl, MVT::i32, Ops, 5); } } return 0; @@ -488,12 +488,12 @@ if (isInt32Immediate(RHS, Imm)) { // SETEQ/SETNE comparison with 16-bit immediate, fold it. if (isUInt16(Imm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPLWI, dl, MVT::i32, LHS, - getI32Imm(Imm & 0xFFFF)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPLWI, dl, MVT::i32, LHS, + getI32Imm(Imm & 0xFFFF)), 0); // If this is a 16-bit signed immediate, fold it. if (isInt16((int)Imm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPWI, dl, MVT::i32, LHS, - getI32Imm(Imm & 0xFFFF)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPWI, dl, MVT::i32, LHS, + getI32Imm(Imm & 0xFFFF)), 0); // For non-equality comparisons, the default code would materialize the // constant, then compare against it, like this: @@ -504,22 +504,22 @@ // xoris r0,r3,0x1234 // cmplwi cr0,r0,0x5678 // beq cr0,L6 - SDValue Xor(CurDAG->getTargetNode(PPC::XORIS, dl, MVT::i32, LHS, - getI32Imm(Imm >> 16)), 0); - return SDValue(CurDAG->getTargetNode(PPC::CMPLWI, dl, MVT::i32, Xor, - getI32Imm(Imm & 0xFFFF)), 0); + SDValue Xor(CurDAG->getMachineNode(PPC::XORIS, dl, MVT::i32, LHS, + getI32Imm(Imm >> 16)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPLWI, dl, MVT::i32, Xor, + getI32Imm(Imm & 0xFFFF)), 0); } Opc = PPC::CMPLW; } else if (ISD::isUnsignedIntSetCC(CC)) { if (isInt32Immediate(RHS, Imm) && isUInt16(Imm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPLWI, dl, MVT::i32, LHS, - getI32Imm(Imm & 0xFFFF)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPLWI, dl, MVT::i32, LHS, + getI32Imm(Imm & 0xFFFF)), 0); Opc = PPC::CMPLW; } else { short SImm; if (isIntS16Immediate(RHS, SImm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPWI, dl, MVT::i32, LHS, - getI32Imm((int)SImm & 0xFFFF)), + return SDValue(CurDAG->getMachineNode(PPC::CMPWI, dl, MVT::i32, LHS, + getI32Imm((int)SImm & 0xFFFF)), 0); Opc = PPC::CMPW; } @@ -529,12 +529,12 @@ if (isInt64Immediate(RHS.getNode(), Imm)) { // SETEQ/SETNE comparison with 16-bit immediate, fold it. if (isUInt16(Imm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPLDI, dl, MVT::i64, LHS, - getI32Imm(Imm & 0xFFFF)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPLDI, dl, MVT::i64, LHS, + getI32Imm(Imm & 0xFFFF)), 0); // If this is a 16-bit signed immediate, fold it. if (isInt16(Imm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPDI, dl, MVT::i64, LHS, - getI32Imm(Imm & 0xFFFF)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPDI, dl, MVT::i64, LHS, + getI32Imm(Imm & 0xFFFF)), 0); // For non-equality comparisons, the default code would materialize the // constant, then compare against it, like this: @@ -546,23 +546,23 @@ // cmpldi cr0,r0,0x5678 // beq cr0,L6 if (isUInt32(Imm)) { - SDValue Xor(CurDAG->getTargetNode(PPC::XORIS8, dl, MVT::i64, LHS, - getI64Imm(Imm >> 16)), 0); - return SDValue(CurDAG->getTargetNode(PPC::CMPLDI, dl, MVT::i64, Xor, - getI64Imm(Imm & 0xFFFF)), 0); + SDValue Xor(CurDAG->getMachineNode(PPC::XORIS8, dl, MVT::i64, LHS, + getI64Imm(Imm >> 16)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPLDI, dl, MVT::i64, Xor, + getI64Imm(Imm & 0xFFFF)), 0); } } Opc = PPC::CMPLD; } else if (ISD::isUnsignedIntSetCC(CC)) { if (isInt64Immediate(RHS.getNode(), Imm) && isUInt16(Imm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPLDI, dl, MVT::i64, LHS, - getI64Imm(Imm & 0xFFFF)), 0); + return SDValue(CurDAG->getMachineNode(PPC::CMPLDI, dl, MVT::i64, LHS, + getI64Imm(Imm & 0xFFFF)), 0); Opc = PPC::CMPLD; } else { short SImm; if (isIntS16Immediate(RHS, SImm)) - return SDValue(CurDAG->getTargetNode(PPC::CMPDI, dl, MVT::i64, LHS, - getI64Imm(SImm & 0xFFFF)), + return SDValue(CurDAG->getMachineNode(PPC::CMPDI, dl, MVT::i64, LHS, + getI64Imm(SImm & 0xFFFF)), 0); Opc = PPC::CMPD; } @@ -572,7 +572,7 @@ assert(LHS.getValueType() == MVT::f64 && "Unknown vt!"); Opc = PPC::FCMPUD; } - return SDValue(CurDAG->getTargetNode(Opc, dl, MVT::i32, LHS, RHS), 0); + return SDValue(CurDAG->getMachineNode(Opc, dl, MVT::i32, LHS, RHS), 0); } static PPC::Predicate getPredicateForSetCC(ISD::CondCode CC) { @@ -654,14 +654,14 @@ switch (CC) { default: break; case ISD::SETEQ: { - Op = SDValue(CurDAG->getTargetNode(PPC::CNTLZW, dl, MVT::i32, Op), 0); + Op = SDValue(CurDAG->getMachineNode(PPC::CNTLZW, dl, MVT::i32, Op), 0); SDValue Ops[] = { Op, getI32Imm(27), getI32Imm(5), getI32Imm(31) }; return CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, Ops, 4); } case ISD::SETNE: { SDValue AD = - SDValue(CurDAG->getTargetNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, - Op, getI32Imm(~0U)), 0); + SDValue(CurDAG->getMachineNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, + Op, getI32Imm(~0U)), 0); return CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32, AD, Op, AD.getValue(1)); } @@ -671,8 +671,8 @@ } case ISD::SETGT: { SDValue T = - SDValue(CurDAG->getTargetNode(PPC::NEG, dl, MVT::i32, Op), 0); - T = SDValue(CurDAG->getTargetNode(PPC::ANDC, dl, MVT::i32, T, Op), 0); + SDValue(CurDAG->getMachineNode(PPC::NEG, dl, MVT::i32, Op), 0); + T = SDValue(CurDAG->getMachineNode(PPC::ANDC, dl, MVT::i32, T, Op), 0); SDValue Ops[] = { T, getI32Imm(1), getI32Imm(31), getI32Imm(31) }; return CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, Ops, 4); } @@ -682,31 +682,31 @@ switch (CC) { default: break; case ISD::SETEQ: - Op = SDValue(CurDAG->getTargetNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, - Op, getI32Imm(1)), 0); + Op = SDValue(CurDAG->getMachineNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, + Op, getI32Imm(1)), 0); return CurDAG->SelectNodeTo(N, PPC::ADDZE, MVT::i32, - SDValue(CurDAG->getTargetNode(PPC::LI, dl, - MVT::i32, - getI32Imm(0)), 0), + SDValue(CurDAG->getMachineNode(PPC::LI, dl, + MVT::i32, + getI32Imm(0)), 0), Op.getValue(1)); case ISD::SETNE: { - Op = SDValue(CurDAG->getTargetNode(PPC::NOR, dl, MVT::i32, Op, Op), 0); - SDNode *AD = CurDAG->getTargetNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, - Op, getI32Imm(~0U)); + Op = SDValue(CurDAG->getMachineNode(PPC::NOR, dl, MVT::i32, Op, Op), 0); + SDNode *AD = CurDAG->getMachineNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, + Op, getI32Imm(~0U)); return CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32, SDValue(AD, 0), Op, SDValue(AD, 1)); } case ISD::SETLT: { - SDValue AD = SDValue(CurDAG->getTargetNode(PPC::ADDI, dl, MVT::i32, Op, - getI32Imm(1)), 0); - SDValue AN = SDValue(CurDAG->getTargetNode(PPC::AND, dl, MVT::i32, AD, - Op), 0); + SDValue AD = SDValue(CurDAG->getMachineNode(PPC::ADDI, dl, MVT::i32, Op, + getI32Imm(1)), 0); + SDValue AN = SDValue(CurDAG->getMachineNode(PPC::AND, dl, MVT::i32, AD, + Op), 0); SDValue Ops[] = { AN, getI32Imm(1), getI32Imm(31), getI32Imm(31) }; return CurDAG->SelectNodeTo(N, PPC::RLWINM, MVT::i32, Ops, 4); } case ISD::SETGT: { SDValue Ops[] = { Op, getI32Imm(1), getI32Imm(31), getI32Imm(31) }; - Op = SDValue(CurDAG->getTargetNode(PPC::RLWINM, dl, MVT::i32, Ops, 4), + Op = SDValue(CurDAG->getMachineNode(PPC::RLWINM, dl, MVT::i32, Ops, 4), 0); return CurDAG->SelectNodeTo(N, PPC::XORI, MVT::i32, Op, getI32Imm(1)); @@ -729,10 +729,10 @@ InFlag).getValue(1); if (PPCSubTarget.isGigaProcessor() && OtherCondIdx == -1) - IntCR = SDValue(CurDAG->getTargetNode(PPC::MFOCRF, dl, MVT::i32, CR7Reg, - CCReg), 0); + IntCR = SDValue(CurDAG->getMachineNode(PPC::MFOCRF, dl, MVT::i32, CR7Reg, + CCReg), 0); else - IntCR = SDValue(CurDAG->getTargetNode(PPC::MFCR, dl, MVT::i32, CCReg), 0); + IntCR = SDValue(CurDAG->getMachineNode(PPC::MFCR, dl, MVT::i32, CCReg), 0); SDValue Ops[] = { IntCR, getI32Imm((32-(3-Idx)) & 31), getI32Imm(31), getI32Imm(31) }; @@ -741,7 +741,7 @@ // Get the specified bit. SDValue Tmp = - SDValue(CurDAG->getTargetNode(PPC::RLWINM, dl, MVT::i32, Ops, 4), 0); + SDValue(CurDAG->getMachineNode(PPC::RLWINM, dl, MVT::i32, Ops, 4), 0); if (Inv) { assert(OtherCondIdx == -1 && "Can't have split plus negation"); return CurDAG->SelectNodeTo(N, PPC::XORI, MVT::i32, Tmp, getI32Imm(1)); @@ -753,7 +753,7 @@ // Get the other bit of the comparison. Ops[1] = getI32Imm((32-(3-OtherCondIdx)) & 31); SDValue OtherCond = - SDValue(CurDAG->getTargetNode(PPC::RLWINM, dl, MVT::i32, Ops, 4), 0); + SDValue(CurDAG->getMachineNode(PPC::RLWINM, dl, MVT::i32, Ops, 4), 0); return CurDAG->SelectNodeTo(N, PPC::OR, MVT::i32, Tmp, OtherCond); } @@ -806,17 +806,17 @@ // Simple value. if (isInt16(Imm)) { // Just the Lo bits. - Result = CurDAG->getTargetNode(PPC::LI8, dl, MVT::i64, getI32Imm(Lo)); + Result = CurDAG->getMachineNode(PPC::LI8, dl, MVT::i64, getI32Imm(Lo)); } else if (Lo) { // Handle the Hi bits. unsigned OpC = Hi ? PPC::LIS8 : PPC::LI8; - Result = CurDAG->getTargetNode(OpC, dl, MVT::i64, getI32Imm(Hi)); + Result = CurDAG->getMachineNode(OpC, dl, MVT::i64, getI32Imm(Hi)); // And Lo bits. - Result = CurDAG->getTargetNode(PPC::ORI8, dl, MVT::i64, - SDValue(Result, 0), getI32Imm(Lo)); + Result = CurDAG->getMachineNode(PPC::ORI8, dl, MVT::i64, + SDValue(Result, 0), getI32Imm(Lo)); } else { // Just the Hi bits. - Result = CurDAG->getTargetNode(PPC::LIS8, dl, MVT::i64, getI32Imm(Hi)); + Result = CurDAG->getMachineNode(PPC::LIS8, dl, MVT::i64, getI32Imm(Hi)); } // If no shift, we're done. @@ -824,19 +824,20 @@ // Shift for next step if the upper 32-bits were not zero. if (Imm) { - Result = CurDAG->getTargetNode(PPC::RLDICR, dl, MVT::i64, - SDValue(Result, 0), - getI32Imm(Shift), getI32Imm(63 - Shift)); + Result = CurDAG->getMachineNode(PPC::RLDICR, dl, MVT::i64, + SDValue(Result, 0), + getI32Imm(Shift), + getI32Imm(63 - Shift)); } // Add in the last bits as required. if ((Hi = (Remainder >> 16) & 0xFFFF)) { - Result = CurDAG->getTargetNode(PPC::ORIS8, dl, MVT::i64, - SDValue(Result, 0), getI32Imm(Hi)); + Result = CurDAG->getMachineNode(PPC::ORIS8, dl, MVT::i64, + SDValue(Result, 0), getI32Imm(Hi)); } if ((Lo = Remainder & 0xFFFF)) { - Result = CurDAG->getTargetNode(PPC::ORI8, dl, MVT::i64, - SDValue(Result, 0), getI32Imm(Lo)); + Result = CurDAG->getMachineNode(PPC::ORI8, dl, MVT::i64, + SDValue(Result, 0), getI32Imm(Lo)); } return Result; @@ -856,18 +857,18 @@ if (N->hasOneUse()) return CurDAG->SelectNodeTo(N, Opc, Op.getValueType(), TFI, getSmallIPtrImm(0)); - return CurDAG->getTargetNode(Opc, dl, Op.getValueType(), TFI, - getSmallIPtrImm(0)); + return CurDAG->getMachineNode(Opc, dl, Op.getValueType(), TFI, + getSmallIPtrImm(0)); } case PPCISD::MFCR: { SDValue InFlag = N->getOperand(1); // Use MFOCRF if supported. if (PPCSubTarget.isGigaProcessor()) - return CurDAG->getTargetNode(PPC::MFOCRF, dl, MVT::i32, - N->getOperand(0), InFlag); + return CurDAG->getMachineNode(PPC::MFOCRF, dl, MVT::i32, + N->getOperand(0), InFlag); else - return CurDAG->getTargetNode(PPC::MFCR, dl, MVT::i32, InFlag); + return CurDAG->getMachineNode(PPC::MFCR, dl, MVT::i32, InFlag); } case ISD::SDIV: { @@ -881,17 +882,17 @@ SDValue N0 = N->getOperand(0); if ((signed)Imm > 0 && isPowerOf2_32(Imm)) { SDNode *Op = - CurDAG->getTargetNode(PPC::SRAWI, dl, MVT::i32, MVT::Flag, - N0, getI32Imm(Log2_32(Imm))); + CurDAG->getMachineNode(PPC::SRAWI, dl, MVT::i32, MVT::Flag, + N0, getI32Imm(Log2_32(Imm))); return CurDAG->SelectNodeTo(N, PPC::ADDZE, MVT::i32, SDValue(Op, 0), SDValue(Op, 1)); } else if ((signed)Imm < 0 && isPowerOf2_32(-Imm)) { SDNode *Op = - CurDAG->getTargetNode(PPC::SRAWI, dl, MVT::i32, MVT::Flag, - N0, getI32Imm(Log2_32(-Imm))); + CurDAG->getMachineNode(PPC::SRAWI, dl, MVT::i32, MVT::Flag, + N0, getI32Imm(Log2_32(-Imm))); SDValue PT = - SDValue(CurDAG->getTargetNode(PPC::ADDZE, dl, MVT::i32, - SDValue(Op, 0), SDValue(Op, 1)), + SDValue(CurDAG->getMachineNode(PPC::ADDZE, dl, MVT::i32, + SDValue(Op, 0), SDValue(Op, 1)), 0); return CurDAG->SelectNodeTo(N, PPC::NEG, MVT::i32, PT); } @@ -945,9 +946,9 @@ SDValue Base = LD->getBasePtr(); SDValue Ops[] = { Offset, Base, Chain }; // FIXME: PPC64 - return CurDAG->getTargetNode(Opcode, dl, LD->getValueType(0), - PPCLowering.getPointerTy(), - MVT::Other, Ops, 3); + return CurDAG->getMachineNode(Opcode, dl, LD->getValueType(0), + PPCLowering.getPointerTy(), + MVT::Other, Ops, 3); } else { llvm_unreachable("R+R preindex loads not supported yet!"); } @@ -989,7 +990,7 @@ SDValue Ops[] = { N->getOperand(0).getOperand(0), N->getOperand(0).getOperand(1), getI32Imm(0), getI32Imm(MB),getI32Imm(ME) }; - return CurDAG->getTargetNode(PPC::RLWIMI, dl, MVT::i32, Ops, 5); + return CurDAG->getMachineNode(PPC::RLWIMI, dl, MVT::i32, Ops, 5); } } @@ -1039,8 +1040,8 @@ // FIXME: Implement this optzn for PPC64. N->getValueType(0) == MVT::i32) { SDNode *Tmp = - CurDAG->getTargetNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, - N->getOperand(0), getI32Imm(~0U)); + CurDAG->getMachineNode(PPC::ADDIC, dl, MVT::i32, MVT::Flag, + N->getOperand(0), getI32Imm(~0U)); return CurDAG->SelectNodeTo(N, PPC::SUBFE, MVT::i32, SDValue(Tmp, 0), N->getOperand(0), SDValue(Tmp, 1)); @@ -1090,8 +1091,8 @@ SDValue Chain = N->getOperand(0); SDValue Target = N->getOperand(1); unsigned Opc = Target.getValueType() == MVT::i32 ? PPC::MTCTR : PPC::MTCTR8; - Chain = SDValue(CurDAG->getTargetNode(Opc, dl, MVT::Other, Target, - Chain), 0); + Chain = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Target, + Chain), 0); return CurDAG->SelectNodeTo(N, PPC::BCTR, MVT::Other, Chain); } } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Sep 25 13:54:59 2009 @@ -909,7 +909,7 @@ Base = DAG.getTargetConstant((Addr - (signed short)Addr) >> 16, MVT::i32); unsigned Opc = CN->getValueType(0) == MVT::i32 ? PPC::LIS : PPC::LIS8; - Base = SDValue(DAG.getTargetNode(Opc, dl, CN->getValueType(0), Base), 0); + Base = SDValue(DAG.getMachineNode(Opc, dl, CN->getValueType(0), Base), 0); return true; } } @@ -1021,7 +1021,7 @@ Disp = DAG.getTargetConstant((short)Addr >> 2, MVT::i32); Base = DAG.getTargetConstant((Addr-(signed short)Addr) >> 16, MVT::i32); unsigned Opc = CN->getValueType(0) == MVT::i32 ? PPC::LIS : PPC::LIS8; - Base = SDValue(DAG.getTargetNode(Opc, dl, CN->getValueType(0), Base),0); + Base = SDValue(DAG.getMachineNode(Opc, dl, CN->getValueType(0), Base),0); return true; } } @@ -2765,7 +2765,7 @@ // Set CR6 to true if this is a vararg call. if (isVarArg) { - SDValue SetCR(DAG.getTargetNode(PPC::CRSET, dl, MVT::i32), 0); + SDValue SetCR(DAG.getMachineNode(PPC::CRSET, dl, MVT::i32), 0); Chain = DAG.getCopyToReg(Chain, dl, PPC::CR1EQ, SetCR, InFlag); InFlag = Chain.getValue(1); } Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -173,12 +173,12 @@ // Set the Y register to the high-part. SDValue TopPart; if (N->getOpcode() == ISD::SDIV) { - TopPart = SDValue(CurDAG->getTargetNode(SP::SRAri, dl, MVT::i32, DivLHS, + TopPart = SDValue(CurDAG->getMachineNode(SP::SRAri, dl, MVT::i32, DivLHS, CurDAG->getTargetConstant(31, MVT::i32)), 0); } else { TopPart = CurDAG->getRegister(SP::G0, MVT::i32); } - TopPart = SDValue(CurDAG->getTargetNode(SP::WRYrr, dl, MVT::Flag, TopPart, + TopPart = SDValue(CurDAG->getMachineNode(SP::WRYrr, dl, MVT::Flag, TopPart, CurDAG->getRegister(SP::G0, MVT::i32)), 0); // FIXME: Handle div by immediate. @@ -192,8 +192,8 @@ SDValue MulLHS = N->getOperand(0); SDValue MulRHS = N->getOperand(1); unsigned Opcode = N->getOpcode() == ISD::MULHU ? SP::UMULrr : SP::SMULrr; - SDNode *Mul = CurDAG->getTargetNode(Opcode, dl, MVT::i32, MVT::Flag, - MulLHS, MulRHS); + SDNode *Mul = CurDAG->getMachineNode(Opcode, dl, MVT::i32, MVT::Flag, + MulLHS, MulRHS); // The high part is in the Y register. return CurDAG->SelectNodeTo(N, SP::RDY, MVT::i32, SDValue(Mul, 1)); return NULL; Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -663,37 +663,38 @@ // Prepare the dividend SDNode *Dividend; if (is32Bit) - Dividend = CurDAG->getTargetNode(SystemZ::MOVSX64rr32, dl, MVT::i64, N0); + Dividend = CurDAG->getMachineNode(SystemZ::MOVSX64rr32, dl, MVT::i64, N0); else Dividend = N0.getNode(); // Insert prepared dividend into suitable 'subreg' - SDNode *Tmp = CurDAG->getTargetNode(TargetInstrInfo::IMPLICIT_DEF, - dl, ResVT); + SDNode *Tmp = CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + dl, ResVT); Dividend = - CurDAG->getTargetNode(TargetInstrInfo::INSERT_SUBREG, dl, ResVT, - SDValue(Tmp, 0), SDValue(Dividend, 0), - CurDAG->getTargetConstant(subreg_odd, MVT::i32)); + CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, ResVT, + SDValue(Tmp, 0), SDValue(Dividend, 0), + CurDAG->getTargetConstant(subreg_odd, MVT::i32)); SDNode *Result; SDValue DivVal = SDValue(Dividend, 0); if (foldedLoad) { SDValue Ops[] = { DivVal, Tmp0, Tmp1, Tmp2, N1.getOperand(0) }; - Result = CurDAG->getTargetNode(MOpc, dl, ResVT, Ops, array_lengthof(Ops)); + Result = CurDAG->getMachineNode(MOpc, dl, ResVT, + Ops, array_lengthof(Ops)); // Update the chain. ReplaceUses(N1.getValue(1), SDValue(Result, 0)); } else { - Result = CurDAG->getTargetNode(Opc, dl, ResVT, SDValue(Dividend, 0), N1); + Result = CurDAG->getMachineNode(Opc, dl, ResVT, SDValue(Dividend, 0), N1); } // Copy the division (odd subreg) result, if it is needed. if (!Op.getValue(0).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_odd32 : subreg_odd); - SDNode *Div = CurDAG->getTargetNode(TargetInstrInfo::EXTRACT_SUBREG, - dl, NVT, - SDValue(Result, 0), - CurDAG->getTargetConstant(SubRegIdx, - MVT::i32)); + SDNode *Div = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + dl, NVT, + SDValue(Result, 0), + CurDAG->getTargetConstant(SubRegIdx, + MVT::i32)); ReplaceUses(Op.getValue(0), SDValue(Div, 0)); DEBUG(errs().indent(Indent-2) << "=> "; @@ -704,11 +705,11 @@ // Copy the remainder (even subreg) result, if it is needed. if (!Op.getValue(1).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_even32 : subreg_even); - SDNode *Rem = CurDAG->getTargetNode(TargetInstrInfo::EXTRACT_SUBREG, - dl, NVT, - SDValue(Result, 0), - CurDAG->getTargetConstant(SubRegIdx, - MVT::i32)); + SDNode *Rem = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + dl, NVT, + SDValue(Result, 0), + CurDAG->getTargetConstant(SubRegIdx, + MVT::i32)); ReplaceUses(Op.getValue(1), SDValue(Rem, 0)); DEBUG(errs().indent(Indent-2) << "=> "; @@ -751,39 +752,39 @@ SDNode *Dividend = N0.getNode(); // Insert prepared dividend into suitable 'subreg' - SDNode *Tmp = CurDAG->getTargetNode(TargetInstrInfo::IMPLICIT_DEF, - dl, ResVT); + SDNode *Tmp = CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + dl, ResVT); { unsigned SubRegIdx = (is32Bit ? subreg_odd32 : subreg_odd); Dividend = - CurDAG->getTargetNode(TargetInstrInfo::INSERT_SUBREG, dl, ResVT, - SDValue(Tmp, 0), SDValue(Dividend, 0), - CurDAG->getTargetConstant(SubRegIdx, MVT::i32)); + CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, ResVT, + SDValue(Tmp, 0), SDValue(Dividend, 0), + CurDAG->getTargetConstant(SubRegIdx, MVT::i32)); } // Zero out even subreg - Dividend = CurDAG->getTargetNode(ClrOpc, dl, ResVT, SDValue(Dividend, 0)); + Dividend = CurDAG->getMachineNode(ClrOpc, dl, ResVT, SDValue(Dividend, 0)); SDValue DivVal = SDValue(Dividend, 0); SDNode *Result; if (foldedLoad) { SDValue Ops[] = { DivVal, Tmp0, Tmp1, Tmp2, N1.getOperand(0) }; - Result = CurDAG->getTargetNode(MOpc, dl,ResVT, - Ops, array_lengthof(Ops)); + Result = CurDAG->getMachineNode(MOpc, dl,ResVT, + Ops, array_lengthof(Ops)); // Update the chain. ReplaceUses(N1.getValue(1), SDValue(Result, 0)); } else { - Result = CurDAG->getTargetNode(Opc, dl, ResVT, DivVal, N1); + Result = CurDAG->getMachineNode(Opc, dl, ResVT, DivVal, N1); } // Copy the division (odd subreg) result, if it is needed. if (!Op.getValue(0).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_odd32 : subreg_odd); - SDNode *Div = CurDAG->getTargetNode(TargetInstrInfo::EXTRACT_SUBREG, - dl, NVT, - SDValue(Result, 0), - CurDAG->getTargetConstant(SubRegIdx, - MVT::i32)); + SDNode *Div = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + dl, NVT, + SDValue(Result, 0), + CurDAG->getTargetConstant(SubRegIdx, + MVT::i32)); ReplaceUses(Op.getValue(0), SDValue(Div, 0)); DEBUG(errs().indent(Indent-2) << "=> "; Result->dump(CurDAG); @@ -793,11 +794,11 @@ // Copy the remainder (even subreg) result, if it is needed. if (!Op.getValue(1).use_empty()) { unsigned SubRegIdx = (is32Bit ? subreg_even32 : subreg_even); - SDNode *Rem = CurDAG->getTargetNode(TargetInstrInfo::EXTRACT_SUBREG, - dl, NVT, - SDValue(Result, 0), - CurDAG->getTargetConstant(SubRegIdx, - MVT::i32)); + SDNode *Rem = CurDAG->getMachineNode(TargetInstrInfo::EXTRACT_SUBREG, + dl, NVT, + SDValue(Result, 0), + CurDAG->getTargetConstant(SubRegIdx, + MVT::i32)); ReplaceUses(Op.getValue(1), SDValue(Rem, 0)); DEBUG(errs().indent(Indent-2) << "=> "; Result->dump(CurDAG); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -1467,9 +1467,9 @@ return NULL; SDValue LSI = Node->getOperand(4); // MemOperand const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, In2L, In2H, LSI, Chain}; - return CurDAG->getTargetNode(Opc, Node->getDebugLoc(), - MVT::i32, MVT::i32, MVT::Other, Ops, - array_lengthof(Ops)); + return CurDAG->getMachineNode(Opc, Node->getDebugLoc(), + MVT::i32, MVT::i32, MVT::Other, Ops, + array_lengthof(Ops)); } SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) { @@ -1603,17 +1603,17 @@ } DebugLoc dl = Node->getDebugLoc(); - SDValue Undef = SDValue(CurDAG->getTargetNode(TargetInstrInfo::IMPLICIT_DEF, - dl, NVT), 0); + SDValue Undef = SDValue(CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + dl, NVT), 0); SDValue MemOp = CurDAG->getMemOperand(cast(Node)->getMemOperand()); if (isInc || isDec) { SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, MemOp, Chain }; - SDValue Ret = SDValue(CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 7), 0); + SDValue Ret = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 7), 0); SDValue RetVals[] = { Undef, Ret }; return CurDAG->getMergeValues(RetVals, 2, dl).getNode(); } else { SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Val, MemOp, Chain }; - SDValue Ret = SDValue(CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8), 0); + SDValue Ret = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 8), 0); SDValue RetVals[] = { Undef, Ret }; return CurDAG->getMergeValues(RetVals, 2, dl).getNode(); } @@ -1723,14 +1723,14 @@ SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, N1.getOperand(0), InFlag }; SDNode *CNode = - CurDAG->getTargetNode(MOpc, dl, MVT::Other, MVT::Flag, Ops, - array_lengthof(Ops)); + CurDAG->getMachineNode(MOpc, dl, MVT::Other, MVT::Flag, Ops, + array_lengthof(Ops)); InFlag = SDValue(CNode, 1); // Update the chain. ReplaceUses(N1.getValue(1), SDValue(CNode, 0)); } else { InFlag = - SDValue(CurDAG->getTargetNode(Opc, dl, MVT::Flag, N1, InFlag), 0); + SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Flag, N1, InFlag), 0); } // Copy the low half of the result, if it is needed. @@ -1756,8 +1756,8 @@ Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, X86::AX, MVT::i16, InFlag); InFlag = Result.getValue(2); - Result = SDValue(CurDAG->getTargetNode(X86::SHR16ri, dl, MVT::i16, - Result, + Result = SDValue(CurDAG->getMachineNode(X86::SHR16ri, dl, MVT::i16, + Result, CurDAG->getTargetConstant(8, MVT::i8)), 0); // Then truncate it down to i8. Result = CurDAG->getTargetExtractSubreg(X86::SUBREG_8BIT, dl, @@ -1846,14 +1846,14 @@ if (TryFoldLoad(N, N0, Tmp0, Tmp1, Tmp2, Tmp3, Tmp4)) { SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, N0.getOperand(0) }; Move = - SDValue(CurDAG->getTargetNode(X86::MOVZX16rm8, dl, MVT::i16, - MVT::Other, Ops, - array_lengthof(Ops)), 0); + SDValue(CurDAG->getMachineNode(X86::MOVZX16rm8, dl, MVT::i16, + MVT::Other, Ops, + array_lengthof(Ops)), 0); Chain = Move.getValue(1); ReplaceUses(N0.getValue(1), Chain); } else { Move = - SDValue(CurDAG->getTargetNode(X86::MOVZX16rr8, dl, MVT::i16, N0),0); + SDValue(CurDAG->getMachineNode(X86::MOVZX16rr8, dl, MVT::i16, N0),0); Chain = CurDAG->getEntryNode(); } Chain = CurDAG->getCopyToReg(Chain, dl, X86::AX, Move, SDValue()); @@ -1865,27 +1865,27 @@ if (isSigned && !signBitIsZero) { // Sign extend the low part into the high part. InFlag = - SDValue(CurDAG->getTargetNode(SExtOpcode, dl, MVT::Flag, InFlag),0); + SDValue(CurDAG->getMachineNode(SExtOpcode, dl, MVT::Flag, InFlag),0); } else { // Zero out the high part, effectively zero extending the input. SDValue ClrNode; if (NVT.getSimpleVT() == MVT::i64) { - ClrNode = SDValue(CurDAG->getTargetNode(X86::MOV32r0, dl, MVT::i32), + ClrNode = SDValue(CurDAG->getMachineNode(X86::MOV32r0, dl, MVT::i32), 0); // We just did a 32-bit clear, insert it into a 64-bit register to // clear the whole 64-bit reg. SDValue Undef = - SDValue(CurDAG->getTargetNode(TargetInstrInfo::IMPLICIT_DEF, - dl, MVT::i64), 0); + SDValue(CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, + dl, MVT::i64), 0); SDValue SubRegNo = CurDAG->getTargetConstant(X86::SUBREG_32BIT, MVT::i32); ClrNode = - SDValue(CurDAG->getTargetNode(TargetInstrInfo::INSERT_SUBREG, dl, - MVT::i64, Undef, ClrNode, SubRegNo), + SDValue(CurDAG->getMachineNode(TargetInstrInfo::INSERT_SUBREG, dl, + MVT::i64, Undef, ClrNode, SubRegNo), 0); } else { - ClrNode = SDValue(CurDAG->getTargetNode(ClrOpcode, dl, NVT), 0); + ClrNode = SDValue(CurDAG->getMachineNode(ClrOpcode, dl, NVT), 0); } InFlag = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl, HiReg, @@ -1897,14 +1897,14 @@ SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, N1.getOperand(0), InFlag }; SDNode *CNode = - CurDAG->getTargetNode(MOpc, dl, MVT::Other, MVT::Flag, Ops, - array_lengthof(Ops)); + CurDAG->getMachineNode(MOpc, dl, MVT::Other, MVT::Flag, Ops, + array_lengthof(Ops)); InFlag = SDValue(CNode, 1); // Update the chain. ReplaceUses(N1.getValue(1), SDValue(CNode, 0)); } else { InFlag = - SDValue(CurDAG->getTargetNode(Opc, dl, MVT::Flag, N1, InFlag), 0); + SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Flag, N1, InFlag), 0); } // Copy the division (low) result, if it is needed. @@ -1930,7 +1930,7 @@ Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, X86::AX, MVT::i16, InFlag); InFlag = Result.getValue(2); - Result = SDValue(CurDAG->getTargetNode(X86::SHR16ri, dl, MVT::i16, + Result = SDValue(CurDAG->getMachineNode(X86::SHR16ri, dl, MVT::i16, Result, CurDAG->getTargetConstant(8, MVT::i8)), 0); @@ -1985,8 +1985,8 @@ default: llvm_unreachable("Unsupported TEST operand type!"); } SDValue RC = CurDAG->getTargetConstant(TRC->getID(), MVT::i32); - Reg = SDValue(CurDAG->getTargetNode(X86::COPY_TO_REGCLASS, dl, - Reg.getValueType(), Reg, RC), 0); + Reg = SDValue(CurDAG->getMachineNode(X86::COPY_TO_REGCLASS, dl, + Reg.getValueType(), Reg, RC), 0); } // Extract the l-register. @@ -1994,7 +1994,7 @@ MVT::i8, Reg); // Emit a testb. - return CurDAG->getTargetNode(X86::TEST8ri, dl, MVT::i32, Subreg, Imm); + return CurDAG->getMachineNode(X86::TEST8ri, dl, MVT::i32, Subreg, Imm); } // For example, "testl %eax, $2048" to "testb %ah, $8". @@ -2013,8 +2013,8 @@ default: llvm_unreachable("Unsupported TEST operand type!"); } SDValue RC = CurDAG->getTargetConstant(TRC->getID(), MVT::i32); - Reg = SDValue(CurDAG->getTargetNode(X86::COPY_TO_REGCLASS, dl, - Reg.getValueType(), Reg, RC), 0); + Reg = SDValue(CurDAG->getMachineNode(X86::COPY_TO_REGCLASS, dl, + Reg.getValueType(), Reg, RC), 0); // Extract the h-register. SDValue Subreg = CurDAG->getTargetExtractSubreg(X86::SUBREG_8BIT_HI, dl, @@ -2022,8 +2022,8 @@ // Emit a testb. No special NOREX tricks are needed since there's // only one GPR operand! - return CurDAG->getTargetNode(X86::TEST8ri, dl, MVT::i32, - Subreg, ShiftedImm); + return CurDAG->getMachineNode(X86::TEST8ri, dl, MVT::i32, + Subreg, ShiftedImm); } // For example, "testl %eax, $32776" to "testw %ax, $32776". @@ -2037,7 +2037,7 @@ MVT::i16, Reg); // Emit a testw. - return CurDAG->getTargetNode(X86::TEST16ri, dl, MVT::i32, Subreg, Imm); + return CurDAG->getMachineNode(X86::TEST16ri, dl, MVT::i32, Subreg, Imm); } // For example, "testq %rax, $268468232" to "testl %eax, $268468232". @@ -2051,7 +2051,7 @@ MVT::i32, Reg); // Emit a testl. - return CurDAG->getTargetNode(X86::TEST32ri, dl, MVT::i32, Subreg, Imm); + return CurDAG->getMachineNode(X86::TEST32ri, dl, MVT::i32, Subreg, Imm); } } break; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Sep 25 13:54:59 2009 @@ -2588,8 +2588,8 @@ EVT VT = *RC->vt_begin(); bool isAligned = (RI.getStackAlignment() >= 16) || RI.needsStackRealignment(MF); - Load = DAG.getTargetNode(getLoadRegOpcode(0, RC, isAligned, TM), dl, - VT, MVT::Other, &AddrOps[0], AddrOps.size()); + Load = DAG.getMachineNode(getLoadRegOpcode(0, RC, isAligned, TM), dl, + VT, MVT::Other, &AddrOps[0], AddrOps.size()); NewNodes.push_back(Load); } @@ -2608,8 +2608,8 @@ if (Load) BeforeOps.push_back(SDValue(Load, 0)); std::copy(AfterOps.begin(), AfterOps.end(), std::back_inserter(BeforeOps)); - SDNode *NewNode= DAG.getTargetNode(Opc, dl, VTs, &BeforeOps[0], - BeforeOps.size()); + SDNode *NewNode= DAG.getMachineNode(Opc, dl, VTs, &BeforeOps[0], + BeforeOps.size()); NewNodes.push_back(NewNode); // Emit the store instruction. @@ -2621,10 +2621,10 @@ AddrOps.push_back(Chain); bool isAligned = (RI.getStackAlignment() >= 16) || RI.needsStackRealignment(MF); - SDNode *Store = DAG.getTargetNode(getStoreRegOpcode(0, DstRC, - isAligned, TM), - dl, MVT::Other, - &AddrOps[0], AddrOps.size()); + SDNode *Store = DAG.getMachineNode(getStoreRegOpcode(0, DstRC, + isAligned, TM), + dl, MVT::Other, + &AddrOps[0], AddrOps.size()); NewNodes.push_back(Store); } Modified: llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreISelDAGToDAG.cpp Fri Sep 25 13:54:59 2009 @@ -169,7 +169,8 @@ case ISD::Constant: { if (Predicate_immMskBitp(N)) { SDValue MskSize = Transform_msksize_xform(N); - return CurDAG->getTargetNode(XCore::MKMSK_rus, dl, MVT::i32, MskSize); + return CurDAG->getMachineNode(XCore::MKMSK_rus, dl, + MVT::i32, MskSize); } else if (! Predicate_immU16(N)) { unsigned Val = cast(N)->getZExtValue(); @@ -177,20 +178,20 @@ CurDAG->getTargetConstantPool(ConstantInt::get( Type::getInt32Ty(*CurDAG->getContext()), Val), TLI.getPointerTy()); - return CurDAG->getTargetNode(XCore::LDWCP_lru6, dl, MVT::i32, - MVT::Other, CPIdx, - CurDAG->getEntryNode()); + return CurDAG->getMachineNode(XCore::LDWCP_lru6, dl, MVT::i32, + MVT::Other, CPIdx, + CurDAG->getEntryNode()); } break; } case ISD::SMUL_LOHI: { // FIXME fold addition into the macc instruction if (!Subtarget.isXS1A()) { - SDValue Zero(CurDAG->getTargetNode(XCore::LDC_ru6, dl, MVT::i32, + SDValue Zero(CurDAG->getMachineNode(XCore::LDC_ru6, dl, MVT::i32, CurDAG->getTargetConstant(0, MVT::i32)), 0); SDValue Ops[] = { Zero, Zero, Op.getOperand(0), Op.getOperand(1) }; - SDNode *ResNode = CurDAG->getTargetNode(XCore::MACCS_l4r, dl, - MVT::i32, MVT::i32, Ops, 4); + SDNode *ResNode = CurDAG->getMachineNode(XCore::MACCS_l4r, dl, + MVT::i32, MVT::i32, Ops, 4); ReplaceUses(SDValue(N, 0), SDValue(ResNode, 1)); ReplaceUses(SDValue(N, 1), SDValue(ResNode, 0)); return NULL; @@ -199,12 +200,12 @@ } case ISD::UMUL_LOHI: { // FIXME fold addition into the macc / lmul instruction - SDValue Zero(CurDAG->getTargetNode(XCore::LDC_ru6, dl, MVT::i32, + SDValue Zero(CurDAG->getMachineNode(XCore::LDC_ru6, dl, MVT::i32, CurDAG->getTargetConstant(0, MVT::i32)), 0); SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), Zero, Zero }; - SDNode *ResNode = CurDAG->getTargetNode(XCore::LMUL_l6r, dl, MVT::i32, - MVT::i32, Ops, 4); + SDNode *ResNode = CurDAG->getMachineNode(XCore::LMUL_l6r, dl, MVT::i32, + MVT::i32, Ops, 4); ReplaceUses(SDValue(N, 0), SDValue(ResNode, 1)); ReplaceUses(SDValue(N, 1), SDValue(ResNode, 0)); return NULL; @@ -213,8 +214,8 @@ if (!Subtarget.isXS1A()) { SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), Op.getOperand(2) }; - return CurDAG->getTargetNode(XCore::LADD_l5r, dl, MVT::i32, MVT::i32, - Ops, 3); + return CurDAG->getMachineNode(XCore::LADD_l5r, dl, MVT::i32, MVT::i32, + Ops, 3); } break; } @@ -222,8 +223,8 @@ if (!Subtarget.isXS1A()) { SDValue Ops[] = { Op.getOperand(0), Op.getOperand(1), Op.getOperand(2) }; - return CurDAG->getTargetNode(XCore::LSUB_l5r, dl, MVT::i32, MVT::i32, - Ops, 3); + return CurDAG->getMachineNode(XCore::LSUB_l5r, dl, MVT::i32, MVT::i32, + Ops, 3); } break; } Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=82790&r1=82789&r2=82790&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Fri Sep 25 13:54:59 2009 @@ -784,7 +784,7 @@ EmitResultCode(TreePatternNode *N, std::vector DstRegs, bool InFlagDecled, bool ResNodeDecled, bool LikeLeaf = false, bool isRoot = false) { - // List of arguments of getTargetNode() or SelectNodeTo(). + // List of arguments of getMachineNode() or SelectNodeTo(). std::vector NodeOps; // This is something selected from the pattern we matched. if (!N->getName().empty()) { @@ -1089,7 +1089,7 @@ std::string Code = "Opc" + utostr(OpcNo); if (!isRoot || (InputHasChain && !NodeHasChain)) - // For call to "getTargetNode()". + // For call to "getMachineNode()". Code += ", N.getDebugLoc()"; emitOpcode(II.Namespace + "::" + II.TheDef->getName()); @@ -1303,7 +1303,7 @@ // would leave users of the chain dangling. // if (!isRoot || (InputHasChain && !NodeHasChain)) { - Code = "CurDAG->getTargetNode(" + Code; + Code = "CurDAG->getMachineNode(" + Code; } else { Code = "CurDAG->SelectNodeTo(N.getNode(), " + Code; } From daniel at zuster.org Fri Sep 25 13:58:58 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 25 Sep 2009 11:58:58 -0700 Subject: [llvm-commits] [llvm] r82685 - in /llvm/trunk: CMakeLists.txt test/Scripts/count test/Scripts/not utils/Makefile utils/count/ utils/count/CMakeLists.txt utils/count/Makefile utils/count/count.c utils/not/ utils/not/CMakeLists.txt utils/not/Makefi Message-ID: <6a8523d60909251158haddc93ci792271be79e5caf6@mail.gmail.com> 2009/9/24 T?r?k Edwin : > On 2009-09-24 09:23, Daniel Dunbar wrote: >> Author: ddunbar >> Date: Thu Sep 24 01:23:57 2009 >> New Revision: 82685 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82685&view=rev >> Log: >> Add count/not tools as executables. >> ?- Apparently, I'm willing to do incredibly stupid things in the name of portability. >> > > How many tests still use count/not? Dunno. A hell of a lot would be my first and only guess? -- ddunbar at lordcrumb:llvm (master)$ find test | xargs grep '| count' | wc -l 2048 -- > Can't they be converted to CHECK: ? A lot can, probably, but this is a lot of work. Even my auto FileCheckifier (which is currently vaporware, of course) might not eventually do this. It is probably incorrect and pointless to turn: -- // RUN: foo | grep bar | count 232 -- into: -- // RUN: foo | FileCheck ... // CHECK: bar // CHECK: bar // CHECK: bar // CHECK: bar ... // CHECK: bar -- when what really should happen is the test should be more meaningful. Someone else is free to make this their mission in life, though. :) - Daniel From stuart at apple.com Fri Sep 25 14:05:47 2009 From: stuart at apple.com (Stuart Hastings) Date: Fri, 25 Sep 2009 19:05:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82792 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2310.1/ Message-ID: <200909251905.n8PJ5lbH023548@zion.cs.uiuc.edu> Author: stuart Date: Fri Sep 25 14:05:47 2009 New Revision: 82792 URL: http://llvm.org/viewvc/llvm-project?rev=82792&view=rev Log: llvmgcc42-2310.1 Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2310.1/ - copied from r82693, llvm-gcc-4.2/trunk/ From evan.cheng at apple.com Fri Sep 25 14:26:54 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Sep 2009 12:26:54 -0700 Subject: [llvm-commits] [llvm] r82767 - in /llvm/trunk: include/llvm/Target/TargetFrameInfo.h lib/CodeGen/PrologEpilogInserter.cpp lib/Target/ARM/ARMFrameInfo.h test/CodeGen/ARM/2009-09-24-spill-align.ll In-Reply-To: <200909251441.n8PEfoXj021395@zion.cs.uiuc.edu> References: <200909251441.n8PEfoXj021395@zion.cs.uiuc.edu> Message-ID: <631F27AC-5783-46C3-A0C6-68FDD354C6EE@apple.com> On Sep 25, 2009, at 7:41 AM, Bob Wilson wrote: > Author: bwilson > Date: Fri Sep 25 09:41:49 2009 > New Revision: 82767 > > URL: http://llvm.org/viewvc/llvm-project?rev=82767&view=rev > Log: > pr4926: ARM requires the stack pointer to be aligned, even for leaf > functions. Is this true even if the function does not use sp at all? Evan > For the AAPCS ABI, SP must always be 4-byte aligned, and at any > "public > interface" it must be 8-byte aligned. For the older ARM APCS ABI, > the stack > alignment is just always 4 bytes. For X86, we currently align SP at > entry to a function (e.g., to 16 bytes for Darwin), but no stack > alignment > is needed at other times, such as for a leaf function. > > After discussing this with Dan, I decided to go with the approach of > adding > a new "TransientStackAlignment" field to TargetFrameInfo. This value > specifies the stack alignment that must be maintained even in > between calls. > It defaults to 1 except for ARM, where it is 4. (Some other targets > may > also want to set this if they have similar stack requirements. It's > not > currently required for PPC because it sets > targetHandlesStackFrameRounding > and handles the alignment in target-specific code.) The existing > StackAlignment > value specifies the alignment upon entry to a function, which is how > we've > been using it anyway. > > Added: > llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll > Modified: > llvm/trunk/include/llvm/Target/TargetFrameInfo.h > llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp > llvm/trunk/lib/Target/ARM/ARMFrameInfo.h > > Modified: llvm/trunk/include/llvm/Target/TargetFrameInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetFrameInfo.h?rev=82767&r1=82766&r2=82767&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetFrameInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetFrameInfo.h Fri Sep 25 > 09:41:49 2009 > @@ -34,10 +34,13 @@ > private: > StackDirection StackDir; > unsigned StackAlignment; > + unsigned TransientStackAlignment; > int LocalAreaOffset; > public: > - TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO) > - : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {} > + TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO, > + unsigned TransAl = 1) > + : StackDir(D), StackAlignment(StackAl), TransientStackAlignment > (TransAl), > + LocalAreaOffset(LAO) {} > > virtual ~TargetFrameInfo(); > > @@ -48,12 +51,20 @@ > /// > StackDirection getStackGrowthDirection() const { return StackDir; } > > - /// getStackAlignment - This method returns the number of bytes > that the stack > - /// pointer must be aligned to. Typically, this is the largest > alignment for > - /// any data object in the target. > + /// getStackAlignment - This method returns the number of bytes > to which the > + /// stack pointer must be aligned on entry to a function. > Typically, this > + /// is the largest alignment for any data object in the target. > /// > unsigned getStackAlignment() const { return StackAlignment; } > > + /// getTransientStackAlignment - This method returns the number > of bytes to > + /// which the stack pointer must be aligned at all times, even > between > + /// calls. > + /// > + unsigned getTransientStackAlignment() const { > + return TransientStackAlignment; > + } > + > /// getOffsetOfLocalArea - This method returns the offset of the > local area > /// from the stack pointer on entrance to a function. > /// > > Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=82767&r1=82766&r2=82767&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) > +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Fri Sep 25 > 09:41:49 2009 > @@ -484,7 +484,7 @@ > // Loop over all of the stack objects, assigning sequential > addresses... > MachineFrameInfo *FFI = Fn.getFrameInfo(); > > - unsigned MaxAlign = FFI->getMaxAlignment(); > + unsigned MaxAlign = 1; > > // Start at the beginning of the local area. > // The Offset is the distance from the stack top in the direction > @@ -586,23 +586,28 @@ > AdjustStackOffset(FFI, SFI, StackGrowsDown, Offset, MaxAlign); > } > > - // Round up the size to a multiple of the alignment, but only if > there are > - // calls or alloca's in the function. This ensures that any > calls to > - // subroutines have their stack frames suitably aligned. > - // Also do this if we need runtime alignment of the stack. In > this case > - // offsets will be relative to SP not FP; round up the stack size > so this > - // works. > - if (!RegInfo->targetHandlesStackFrameRounding() && > - (FFI->hasCalls() || FFI->hasVarSizedObjects() || > - (RegInfo->needsStackRealignment(Fn) && > - FFI->getObjectIndexEnd() != 0))) { > + if (!RegInfo->targetHandlesStackFrameRounding()) { > // If we have reserved argument space for call sites in the > function > // immediately on entry to the current function, count it as > part of the > // overall stack size. > - if (RegInfo->hasReservedCallFrame(Fn)) > + if (FFI->hasCalls() && RegInfo->hasReservedCallFrame(Fn)) > Offset += FFI->getMaxCallFrameSize(); > > - unsigned AlignMask = std::max(TFI.getStackAlignment(), > MaxAlign) - 1; > + // Round up the size to a multiple of the alignment. If the > function has > + // any calls or alloca's, align to the target's StackAlignment > value to > + // ensure that the callee's frame or the alloca data is > suitably aligned; > + // otherwise, for leaf functions, align to the > TransientStackAlignment > + // value. > + unsigned StackAlign; > + if (FFI->hasCalls() || FFI->hasVarSizedObjects() || > + (RegInfo->needsStackRealignment(Fn) && FFI- > >getObjectIndexEnd() != 0)) > + StackAlign = TFI.getStackAlignment(); > + else > + StackAlign = TFI.getTransientStackAlignment(); > + // If the frame pointer is eliminated, all frame offsets will > be relative > + // to SP not FP; align to MaxAlign so this works. > + StackAlign = std::max(StackAlign, MaxAlign); > + unsigned AlignMask = StackAlign - 1; > Offset = (Offset + AlignMask) & ~uint64_t(AlignMask); > } > > @@ -611,7 +616,8 @@ > > // Remember the required stack alignment in case targets need it > to perform > // dynamic stack alignment. > - FFI->setMaxAlignment(MaxAlign); > + if (MaxAlign > FFI->getMaxAlignment()) > + FFI->setMaxAlignment(MaxAlign); > } > > > > Modified: llvm/trunk/lib/Target/ARM/ARMFrameInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameInfo.h?rev=82767&r1=82766&r2=82767&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMFrameInfo.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMFrameInfo.h Fri Sep 25 09:41:49 2009 > @@ -23,7 +23,7 @@ > class ARMFrameInfo : public TargetFrameInfo { > public: > explicit ARMFrameInfo(const ARMSubtarget &ST) > - : TargetFrameInfo(StackGrowsDown, ST.getStackAlignment(), 0) { > + : TargetFrameInfo(StackGrowsDown, ST.getStackAlignment(), 0, 4) { > } > }; > > > Added: llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll?rev=82767&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll (added) > +++ llvm/trunk/test/CodeGen/ARM/2009-09-24-spill-align.ll Fri Sep 25 > 09:41:49 2009 > @@ -0,0 +1,17 @@ > +; RUN: llc < %s -march=arm -mattr=+neon | FileCheck %s > +; pr4926 > + > +define arm_apcscc void @test_vget_lanep16() nounwind { > +entry: > + %arg0_poly16x4_t = alloca <4 x i16> ; <<4 x i16>*> > [#uses=1] > + %out_poly16_t = alloca i16 ; [#uses=1] > + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] > +; CHECK: fldd > + %0 = load <4 x i16>* %arg0_poly16x4_t, align 8 ; <<4 x i16>> > [#uses=1] > + %1 = extractelement <4 x i16> %0, i32 1 ; [#uses=1] > + store i16 %1, i16* %out_poly16_t, align 2 > + br label %return > + > +return: ; preds = %entry > + ret void > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From bob.wilson at apple.com Fri Sep 25 14:30:10 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Sep 2009 12:30:10 -0700 Subject: [llvm-commits] [llvm] r82767 - in /llvm/trunk: include/llvm/Target/TargetFrameInfo.h lib/CodeGen/PrologEpilogInserter.cpp lib/Target/ARM/ARMFrameInfo.h test/CodeGen/ARM/2009-09-24-spill-align.ll In-Reply-To: <631F27AC-5783-46C3-A0C6-68FDD354C6EE@apple.com> References: <200909251441.n8PEfoXj021395@zion.cs.uiuc.edu> <631F27AC-5783-46C3-A0C6-68FDD354C6EE@apple.com> Message-ID: On Sep 25, 2009, at 12:26 PM, Evan Cheng wrote: > > On Sep 25, 2009, at 7:41 AM, Bob Wilson wrote: > >> Author: bwilson >> Date: Fri Sep 25 09:41:49 2009 >> New Revision: 82767 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=82767&view=rev >> Log: >> pr4926: ARM requires the stack pointer to be aligned, even for leaf >> functions. > > Is this true even if the function does not use sp at all? Yes. (Although it's kind of a moot point, because if the function doesn't use SP at all, then it has no reason to change its value and will leave it aligned.) From jyasskin at google.com Fri Sep 25 15:04:47 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 13:04:47 -0700 Subject: [llvm-commits] [llvm] r82675 - in /llvm/trunk: lib/Support/CommandLine.cpp unittests/Support/CommandLineTest.cpp In-Reply-To: References: <200909240114.n8O1E7Gg001664@zion.cs.uiuc.edu> <305d6f60909250046uc67b97byf1dc40bd95962065@mail.gmail.com> <305d6f60909251134v60abaa17r2291c28f3f8cea29@mail.gmail.com> Message-ID: New patch. Please check that this fixes the test (by skipping it). On Fri, Sep 25, 2009 at 11:51 AM, Jeffrey Yasskin wrote: > The patch I sent should skip the test if you have neither setenv or > _putenv_s, but since _putenv_s doesn't help you run the test, I'll > remove it and send another patch. > > On Fri, Sep 25, 2009 at 11:34 AM, Sandeep Patel wrote: >> This won't work for me. I build our Windows-hosted tools using MinGW. >> I'm not building using native Windows headers. mingwrt-3.15.2 lacks >> _putenv_s in it's headers. >> >> It may just be easier to skip this test on Windows. >> >> deep >> >> On Fri, Sep 25, 2009 at 5:28 PM, Jeffrey Yasskin wrote: >>> Could you check if the attached patch fixes things for you? And if it >>> looks sensible? It includes the new generated configure script so you >>> don't have to regenerate it. >>> >>> On Fri, Sep 25, 2009 at 8:39 AM, Jeffrey Yasskin wrote: >>>> Oops. :( Patch coming up. It appears MinGW intends us to use putenv, >>>> but I may just skip the test when setenv isn't available. >>>> >>>> On Fri, Sep 25, 2009 at 12:46 AM, Sandeep Patel wrote: >>>>> CommandLineTest.cpp breaks MinGW, which lacks setenv/unsetenv. >>>>> >>>>> deep >>>>> >>>>> On Thu, Sep 24, 2009 at 1:14 AM, Jeffrey Yasskin wrote: >>>>>> Author: jyasskin >>>>>> Date: Wed Sep 23 20:14:07 2009 >>>>>> New Revision: 82675 >>>>>> >>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=82675&view=rev >>>>>> Log: >>>>>> Roll back r82348, which introduced an infinite loop in ParseCStringVector() that >>>>>> a trivial unittest would have caught. ?This revision also adds the trivial >>>>>> unittest. >>>>>> >>>>>> >>>>>> Added: >>>>>> ? ?llvm/trunk/unittests/Support/CommandLineTest.cpp >>>>>> Modified: >>>>>> ? ?llvm/trunk/lib/Support/CommandLine.cpp >>>>>> >>>>>> Modified: llvm/trunk/lib/Support/CommandLine.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82675&r1=82674&r2=82675&view=diff >>>>>> >>>>>> ============================================================================== >>>>>> --- llvm/trunk/lib/Support/CommandLine.cpp (original) >>>>>> +++ llvm/trunk/lib/Support/CommandLine.cpp Wed Sep 23 20:14:07 2009 >>>>>> @@ -351,31 +351,42 @@ >>>>>> ?/// using strdup(), so it is the caller's responsibility to free() >>>>>> ?/// them later. >>>>>> ?/// >>>>>> -static void ParseCStringVector(std::vector &OutputVector, >>>>>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *Input) { >>>>>> +static void ParseCStringVector(std::vector &output, >>>>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char *input) { >>>>>> ? // Characters which will be treated as token separators: >>>>>> - ?StringRef Delims = " \v\f\t\r\n"; >>>>>> + ?static const char *const delims = " \v\f\t\r\n"; >>>>>> >>>>>> - ?StringRef WorkStr(Input); >>>>>> - ?while (!WorkStr.empty()) { >>>>>> - ? ?// If the first character is a delimiter, strip them off. >>>>>> - ? ?if (Delims.find(WorkStr[0]) != StringRef::npos) { >>>>>> - ? ? ?size_t Pos = WorkStr.find_first_not_of(Delims); >>>>>> - ? ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>>>>> - ? ? ?WorkStr = WorkStr.substr(Pos); >>>>>> - ? ? ?continue; >>>>>> + ?std::string work(input); >>>>>> + ?// Skip past any delims at head of input string. >>>>>> + ?size_t pos = work.find_first_not_of(delims); >>>>>> + ?// If the string consists entirely of delims, then exit early. >>>>>> + ?if (pos == std::string::npos) return; >>>>>> + ?// Otherwise, jump forward to beginning of first word. >>>>>> + ?work = work.substr(pos); >>>>>> + ?// Find position of first delimiter. >>>>>> + ?pos = work.find_first_of(delims); >>>>>> + >>>>>> + ?while (!work.empty() && pos != std::string::npos) { >>>>>> + ? ?// Everything from 0 to POS is the next word to copy. >>>>>> + ? ?output.push_back(strdup(work.substr(0,pos).c_str())); >>>>>> + ? ?// Is there another word in the string? >>>>>> + ? ?size_t nextpos = work.find_first_not_of(delims, pos + 1); >>>>>> + ? ?if (nextpos != std::string::npos) { >>>>>> + ? ? ?// Yes? Then remove delims from beginning ... >>>>>> + ? ? ?work = work.substr(work.find_first_not_of(delims, pos + 1)); >>>>>> + ? ? ?// and find the end of the word. >>>>>> + ? ? ?pos = work.find_first_of(delims); >>>>>> + ? ?} else { >>>>>> + ? ? ?// No? (Remainder of string is delims.) End the loop. >>>>>> + ? ? ?work = ""; >>>>>> + ? ? ?pos = std::string::npos; >>>>>> ? ? } >>>>>> - >>>>>> - ? ?// Find position of first delimiter. >>>>>> - ? ?size_t Pos = WorkStr.find_first_of(Delims); >>>>>> - ? ?if (Pos == StringRef::npos) Pos = WorkStr.size(); >>>>>> - >>>>>> - ? ?// Everything from 0 to Pos is the next word to copy. >>>>>> - ? ?char *NewStr = (char*)malloc(Pos+1); >>>>>> - ? ?memcpy(NewStr, WorkStr.data(), Pos); >>>>>> - ? ?NewStr[Pos] = 0; >>>>>> - ? ?OutputVector.push_back(NewStr); >>>>>> ? } >>>>>> + >>>>>> + ?// If `input' ended with non-delim char, then we'll get here with >>>>>> + ?// the last word of `input' in `work'; copy it now. >>>>>> + ?if (!work.empty()) >>>>>> + ? ?output.push_back(strdup(work.c_str())); >>>>>> ?} >>>>>> >>>>>> ?/// ParseEnvironmentOptions - An alternative entry point to the >>>>>> >>>>>> Added: llvm/trunk/unittests/Support/CommandLineTest.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82675&view=auto >>>>>> >>>>>> ============================================================================== >>>>>> --- llvm/trunk/unittests/Support/CommandLineTest.cpp (added) >>>>>> +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Wed Sep 23 20:14:07 2009 >>>>>> @@ -0,0 +1,48 @@ >>>>>> +//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===// >>>>>> +// >>>>>> +// ? ? ? ? ? ? ? ? ? ? The LLVM Compiler Infrastructure >>>>>> +// >>>>>> +// This file is distributed under the University of Illinois Open Source >>>>>> +// License. See LICENSE.TXT for details. >>>>>> +// >>>>>> +//===----------------------------------------------------------------------===// >>>>>> + >>>>>> +#include "llvm/Support/CommandLine.h" >>>>>> + >>>>>> +#include "gtest/gtest.h" >>>>>> + >>>>>> +#include >>>>>> +#include >>>>>> + >>>>>> +using namespace llvm; >>>>>> + >>>>>> +namespace { >>>>>> + >>>>>> +class TempEnvVar { >>>>>> + public: >>>>>> + ?TempEnvVar(const char *name, const char *value) >>>>>> + ? ? ?: name(name) { >>>>>> + ? ?const char *old_value = getenv(name); >>>>>> + ? ?EXPECT_EQ(NULL, old_value) << old_value; >>>>>> + ? ?setenv(name, value, true); >>>>>> + ?} >>>>>> + >>>>>> + ?~TempEnvVar() { >>>>>> + ? ?unsetenv(name); >>>>>> + ?} >>>>>> + >>>>>> + private: >>>>>> + ?const char *const name; >>>>>> +}; >>>>>> + >>>>>> +const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; >>>>>> + >>>>>> +cl::opt EnvironmentTestOption("env-test-opt"); >>>>>> +TEST(CommandLineTest, ParseEnvironment) { >>>>>> + ?TempEnvVar TEV(test_env_var, "-env-test-opt=hello"); >>>>>> + ?EXPECT_EQ("", EnvironmentTestOption); >>>>>> + ?cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); >>>>>> + ?EXPECT_EQ("hello", EnvironmentTestOption); >>>>>> +} >>>>>> + >>>>>> +} ?// anonymous namespace >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> llvm-commits mailing list >>>>>> llvm-commits at cs.uiuc.edu >>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: fix_setenv.patch Type: text/x-diff Size: 3576 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090925/2e46a961/attachment.bin From eli.friedman at gmail.com Fri Sep 25 15:22:52 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 25 Sep 2009 13:22:52 -0700 Subject: [llvm-commits] [llvm] r82778 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <305d6f60909251137w41e535ck4fc8adb9e2f96bf9@mail.gmail.com> References: <200909251723.n8PHNNl3009740@zion.cs.uiuc.edu> <305d6f60909251137w41e535ck4fc8adb9e2f96bf9@mail.gmail.com> Message-ID: On Fri, Sep 25, 2009 at 11:37 AM, Sandeep Patel wrote: > Why aren't the front-ends responsible for selecting the intrinsics again? Because there's no compelling reason to move it to the frontend... and there aren't corresponding intrinsics for some of the math functions. -Eli From tonic at nondot.org Fri Sep 25 15:29:09 2009 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 25 Sep 2009 15:29:09 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909252029.n8PKT9wn002034@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.33 -> 1.34 --- Log message: Clean up schedule. --- Diffs of the changes: (+25 -26) index.php | 51 +++++++++++++++++++++++++-------------------------- 1 files changed, 25 insertions(+), 26 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.33 llvm-www/devmtg/2009-10/index.php:1.34 --- llvm-www/devmtg/2009-10/index.php:1.33 Thu Sep 24 01:17:10 2009 +++ llvm-www/devmtg/2009-10/index.php Fri Sep 25 15:27:53 2009 @@ -125,71 +125,71 @@
TimeTalk TitleSpeaker
Time & LocTalk TitleSpeaker
8:00-8:45
Piano Bar:Breakfast
10:20-10:40
Break
Everywhere:Break
10:40-11:20
Town Hall:Unladen Swallow: Python on LLVM From sabre at nondot.org Thu Sep 24 01:16:05 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 24 Sep 2009 01:16:05 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909240616.n8O6G5ZH006788@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.31 -> 1.32 --- Log message: another set of tweaks --- Diffs of the changes: (+3 -3) index.php | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.31 llvm-www/devmtg/2009-10/index.php:1.32 --- llvm-www/devmtg/2009-10/index.php:1.31 Thu Sep 24 01:12:11 2009 +++ llvm-www/devmtg/2009-10/index.php Thu Sep 24 01:15:48 2009 @@ -164,7 +164,7 @@
1:40-2:20
Town Hall:Optimizing ActionScript Bytecode using LLVMScott Petersen, Adobe
Garage 1/2:Targeting XCore resources from LLVM +
Garage 1/2:Targeting XCore Resources from LLVM Richard Osborne, XMOS
2:20-3:00
Everywhere:Break
3:20-4:00
Town Hall:(Title TBD)Nate Begeman, Apple
Town Hall:OpenCLNate Begeman, Apple
Garage 1/2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C Santosh Nagarakatte, University of Pennsylvania
4:40-5:20
Town Hall:LLVM Code Owners Discussion
Town Hall:Open DiscussionLLVM Code Owners
5:30-7:30
Piano Bar:Dinner - Must have registered with dinner option
Everywhere:Break
3:20-4:00
Town Hall:OpenCLNate Begeman, Apple
Town Hall:OpenCLNate Begeman, Apple
Garage 1/2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C Santosh Nagarakatte, University of Pennsylvania
- + - + - + - - - - - - + - + - - + - - + - - + - - + - - + - + - +
Time & LocTalk TitleSpeaker
8:00-8:45
Piano Bar:Breakfast
Breakfast
8:45-9:00
Town Hall:WelcomeChris Lattner, Apple
Room 1:WelcomeChris Lattner
9:00-9:40
Town Hall:State of ClangDoug Gregor, Chris Lattner, Ted Kremenek, Apple
Room 1:State of ClangDoug Gregor, Chris Lattner, Ted Kremenek
9:40-10:20
Town Hall:Tutorial: Building a backend in 24 hours +
Room 1:Tutorial: Building a backend in 24 hours Anton Korobeynikov, Saint Petersburg State University
Garage 1/2:Precise and Efficient Garbage Collection in VMKit with MMTk +
Room 2:Precise and Efficient Garbage Collection in VMKit with MMTk Nicolas Geoffray, Universite Pierre et Marie Curie
10:20-10:40
Everywhere:Break
10:40-11:20
Town Hall:Unladen Swallow: Python on LLVM +
Room 1:Unladen Swallow: Python on LLVM Colin Winter, Google
Garage 1/2:Reimplementing llvm-gcc as a gcc plugin +
Room 2:Reimplementing llvm-gcc as a gcc plugin Duncan Sands, Deep Blue Capital
11:20-12:00
Town Hall:ScalarEvolution and Loop Optimization -Dan Gohman, Apple
Garage 1/2:Object Code Emission +
Room 1:ScalarEvolution and Loop Optimization +Dan Gohman
Room 2:Object Code Emission Bruno Cardoso Lopes, University of Campinas
12:00-1:00
Piano BarLunch
Lunch
1:00-1:40
Town Hall:LLVM on 180k CoresDavid Greene, Cray
Garage 1/2:The Parfait Bug-Checker +
Room 1:LLVM on 180k CoresDavid Greene, Cray
Room 2:The Parfait Bug-Checker Cristina Cifuentes, Sun Microsystems
1:40-2:20
Town Hall:Optimizing ActionScript Bytecode using LLVMScott Petersen, Adobe
Garage 1/2:Targeting XCore Resources from LLVM +
Room 1:Optimizing ActionScript Bytecode using LLVMScott Petersen, Adobe
Room 2:Targeting XCore Resources from LLVM Richard Osborne, XMOS
2:20-3:00
Town Hall:Future Works in LLVM Register AllocationLang Hames, Apple / The University of Sydney
Garage 1/2:CoVaC: Compiler Validation by Program Analysis of the Cross-Product +
Room 1:Future Works in LLVM Register AllocationLang Hames, The University of Sydney
Room 2:CoVaC: Compiler Validation by Program Analysis of the Cross-Product Anna Zaks, New York University
3:00-3:20
Everywhere:Break
3:20-4:00
Town Hall:OpenCLNate Begeman, Apple
Garage 1/2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C +
Room 1:OpenCLNate Begeman
Room 2:SoftBound: Highly Compatible and Complete Spatial Memory Safety for C Santosh Nagarakatte, University of Pennsylvania
4:00-4:40
Town Hall:PLANG: Translating NVIDIA PTX language to LLVM IRVinod Grover, NVIDIA
Garage 1/2:Accelerating Ruby with LLVM +
Room 1:PLANG: Translating NVIDIA PTX language to LLVM IRVinod Grover, NVIDIA
Room 2:Accelerating Ruby with LLVM Evan Phoenix, Engine Yard / Rubinius
4:40-5:20
Town Hall:Open DiscussionLLVM Code Owners
Room 1:Open DiscussionLLVM Code Owners
5:30-7:30
Piano Bar:Dinner - Must have registered with dinner option
Dinner - Must have registered with dinner option
BOFs
@@ -202,9 +202,8 @@

The meeting will be held in building Infinite -Loop 4 at Apple Inc.'s campus. The conference center is publicly accessible -to non-Apple employees. You must check in at the lobby desk and receive a name badge. -The conference is held on the first floor in Town Hall and Piano Bar, and on the second floor in rooms Garage 1 and Garage 2. +Loop 4 at Apple Inc.'s campus. +Only registered attendees are allowed to attend. You must check in at the desk and receive a name badge.

Parking
From tonic at nondot.org Fri Sep 25 15:30:59 2009 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 25 Sep 2009 15:30:59 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2009-10/index.php Message-ID: <200909252030.n8PKUxEp002290@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2009-10: index.php updated: 1.34 -> 1.35 --- Log message: Remove commented out code. --- Diffs of the changes: (+0 -14) index.php | 13 ------------- 1 files changed, 13 deletions(-) Index: llvm-www/devmtg/2009-10/index.php diff -u llvm-www/devmtg/2009-10/index.php:1.34 llvm-www/devmtg/2009-10/index.php:1.35 --- llvm-www/devmtg/2009-10/index.php:1.34 Fri Sep 25 15:27:53 2009 +++ llvm-www/devmtg/2009-10/index.php Fri Sep 25 15:30:43 2009 @@ -68,28 +68,14 @@

This table lists all attendees who have registered to attend this year's conference.

The list of attendees is offline for now.

-

Total Confirmed:

From gohman at apple.com Fri Sep 25 15:36:54 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 20:36:54 -0000 Subject: [llvm-commits] [llvm] r82794 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/PowerPC/ lib/Target/SystemZ/ lib/Target/X86/ test/CodeGen/ARM/ utils/TableGen/ Message-ID: <200909252036.n8PKau9r003134@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 25 15:36:54 2009 New Revision: 82794 URL: http://llvm.org/viewvc/llvm-project?rev=82794&view=rev Log: Improve MachineMemOperand handling. - Allocate MachineMemOperands and MachineMemOperand lists in MachineFunctions. This eliminates MachineInstr's std::list member and allows the data to be created by isel and live for the remainder of codegen, avoiding a lot of copying and unnecessary translation. This also shrinks MemSDNode. - Delete MemOperandSDNode. Introduce MachineSDNode which has dedicated fields for MachineMemOperands. - Change MemSDNode to have a MachineMemOperand member instead of its own fields with the same information. This introduces some redundancy, but it's more consistent with what MachineInstr will eventually want. - Ignore alignment when searching for redundant loads for CSE, but remember the greatest alignment. Target-specific code which previously used MemOperandSDNodes with generic SDNodes now use MemIntrinsicSDNodes, with opcodes in a designated range so that the SelectionDAG framework knows that MachineMemOperand information is available. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/MachineFunction.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/ScheduleDAGEmit.cpp llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/StackSlotColoring.cpp llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrBuilder.h llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Fri Sep 25 15:36:54 2009 @@ -27,6 +27,7 @@ namespace llvm { +class Value; class Function; class MachineRegisterInfo; class MachineFrameInfo; @@ -320,6 +321,24 @@ /// void DeleteMachineBasicBlock(MachineBasicBlock *MBB); + /// getMachineMemOperand - Allocate a new MachineMemOperand. + /// MachineMemOperands are owned by the MachineFunction and need not be + /// explicitly deallocated. + MachineMemOperand *getMachineMemOperand(const Value *v, unsigned f, + int64_t o, uint64_t s, + unsigned base_alignment); + + /// getMachineMemOperand - Allocate a new MachineMemOperand by copying + /// an existing one, adjusting by an offset and using the given EVT. + /// MachineMemOperands are owned by the MachineFunction and need not be + /// explicitly deallocated. + MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, + int64_t Offset, uint64_t Size); + + /// allocateMemRefsArray - Allocate an array to hold MachineMemOperand + /// pointers. This array is owned by the MachineFunction. + MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num); + //===--------------------------------------------------------------------===// // Debug location. // Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Fri Sep 25 15:36:54 2009 @@ -20,10 +20,8 @@ #include "llvm/ADT/ilist_node.h" #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineOperand.h" -#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/Target/TargetInstrDesc.h" #include "llvm/Support/DebugLoc.h" -#include #include namespace llvm { @@ -32,17 +30,23 @@ class TargetInstrInfo; class TargetRegisterInfo; class MachineFunction; +class MachineMemOperand; //===----------------------------------------------------------------------===// /// MachineInstr - Representation of each machine instruction. /// class MachineInstr : public ilist_node { +public: + typedef MachineMemOperand **mmo_iterator; + +private: const TargetInstrDesc *TID; // Instruction descriptor. unsigned short NumImplicitOps; // Number of implicit operands (which // are determined at construction time). std::vector Operands; // the operands - std::list MemOperands; // information on memory references + mmo_iterator MemRefs; // information on memory references + mmo_iterator MemRefsEnd; MachineBasicBlock *Parent; // Pointer to the owning basic block. DebugLoc debugLoc; // Source line information. @@ -132,21 +136,14 @@ unsigned getNumExplicitOperands() const; /// Access to memory operands of the instruction - std::list::iterator memoperands_begin() - { return MemOperands.begin(); } - std::list::iterator memoperands_end() - { return MemOperands.end(); } - std::list::const_iterator memoperands_begin() const - { return MemOperands.begin(); } - std::list::const_iterator memoperands_end() const - { return MemOperands.end(); } - bool memoperands_empty() const { return MemOperands.empty(); } + mmo_iterator memoperands_begin() const { return MemRefs; } + mmo_iterator memoperands_end() const { return MemRefsEnd; } + bool memoperands_empty() const { return MemRefsEnd == MemRefs; } /// hasOneMemOperand - Return true if this instruction has exactly one /// MachineMemOperand. bool hasOneMemOperand() const { - return !memoperands_empty() && - next(memoperands_begin()) == memoperands_end(); + return MemRefsEnd - MemRefs == 1; } /// isIdenticalTo - Return true if this instruction is identical to (same @@ -319,13 +316,17 @@ /// void RemoveOperand(unsigned i); - /// addMemOperand - Add a MachineMemOperand to the machine instruction, - /// referencing arbitrary storage. - void addMemOperand(MachineFunction &MF, - const MachineMemOperand &MO); - - /// clearMemOperands - Erase all of this MachineInstr's MachineMemOperands. - void clearMemOperands(MachineFunction &MF); + /// addMemOperand - Add a MachineMemOperand to the machine instruction. + /// This function should be used only occasionally. The setMemRefs function + /// is the primary method for setting up a MachineInstr's MemRefs list. + void addMemOperand(MachineFunction &MF, MachineMemOperand *MO); + + /// setMemRefs - Assign this MachineInstr's memory reference descriptor + /// list. This does not transfer ownership. + void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) { + MemRefs = NewMemRefs; + MemRefsEnd = NewMemRefsEnd; + } private: /// getRegInfo - If this instruction is embedded into a MachineFunction, Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Fri Sep 25 15:36:54 2009 @@ -121,7 +121,7 @@ return *this; } - const MachineInstrBuilder &addMemOperand(const MachineMemOperand &MMO) const { + const MachineInstrBuilder &addMemOperand(MachineMemOperand *MMO) const { MI->addMemOperand(*MI->getParent()->getParent(), MMO); return *this; } Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Fri Sep 25 15:36:54 2009 @@ -88,6 +88,16 @@ bool isStore() const { return Flags & MOStore; } bool isVolatile() const { return Flags & MOVolatile; } + /// refineAlignment - Update this MachineMemOperand to reflect the alignment + /// of MMO, if it has a greater alignment. This must only be used when the + /// new alignment applies to all users of this MachineMemOperand. + void refineAlignment(const MachineMemOperand *MMO); + + /// setValue - Change the SourceValue for this MachineMemOperand. This + /// should only be used when an object is being relocated and all references + /// to it are being updated. + void setValue(const Value *NewSV) { V = NewSV; } + /// Profile - Gather unique data for the object. /// void Profile(FoldingSetNodeID &ID) const; Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Fri Sep 25 15:36:54 2009 @@ -516,8 +516,6 @@ /// void EmitNoop(); - void AddMemOperand(MachineInstr *MI, const MachineMemOperand &MO); - void EmitPhysRegCopy(SUnit *SU, DenseMap &VRBaseMap); private: Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Sep 25 15:36:54 2009 @@ -19,6 +19,7 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/CodeGen/SelectionDAGNodes.h" +#include "llvm/Support/RecyclingAllocator.h" #include "llvm/Target/TargetMachine.h" #include #include @@ -514,15 +515,23 @@ SDValue getAtomic(unsigned Opcode, DebugLoc dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Cmp, SDValue Swp, const Value* PtrVal, unsigned Alignment=0); + SDValue getAtomic(unsigned Opcode, DebugLoc dl, EVT MemVT, SDValue Chain, + SDValue Ptr, SDValue Cmp, SDValue Swp, + MachineMemOperand *MMO); /// getAtomic - Gets a node for an atomic op, produces result and chain and /// takes 2 operands. SDValue getAtomic(unsigned Opcode, DebugLoc dl, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value* PtrVal, unsigned Alignment = 0); + SDValue getAtomic(unsigned Opcode, DebugLoc dl, EVT MemVT, SDValue Chain, + SDValue Ptr, SDValue Val, + MachineMemOperand *MMO); /// getMemIntrinsicNode - Creates a MemIntrinsicNode that may produce a - /// result and takes a list of operands. + /// result and takes a list of operands. Opcode may be INTRINSIC_VOID, + /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not + /// less than FIRST_TARGET_MEMORY_OPCODE. SDValue getMemIntrinsicNode(unsigned Opcode, DebugLoc dl, const EVT *VTs, unsigned NumVTs, const SDValue *Ops, unsigned NumOps, @@ -536,6 +545,10 @@ unsigned Align = 0, bool Vol = false, bool ReadMem = true, bool WriteMem = true); + SDValue getMemIntrinsicNode(unsigned Opcode, DebugLoc dl, SDVTList VTList, + const SDValue *Ops, unsigned NumOps, + EVT MemVT, MachineMemOperand *MMO); + /// getMergeValues - Create a MERGE_VALUES node from the given operands. SDValue getMergeValues(const SDValue *Ops, unsigned NumOps, DebugLoc dl); @@ -555,25 +568,28 @@ EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, const Value *SV, int SVOffset, EVT MemVT, bool isVolatile=false, unsigned Alignment=0); + SDValue getLoad(ISD::MemIndexedMode AM, DebugLoc dl, ISD::LoadExtType ExtType, + EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset, + EVT MemVT, MachineMemOperand *MMO); /// getStore - Helper function to build ISD::STORE nodes. /// SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile=false, unsigned Alignment=0); + SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, + MachineMemOperand *MMO); SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, EVT TVT, bool isVolatile=false, unsigned Alignment=0); + SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, + EVT TVT, MachineMemOperand *MMO); SDValue getIndexedStore(SDValue OrigStoe, DebugLoc dl, SDValue Base, SDValue Offset, ISD::MemIndexedMode AM); /// getSrcValue - Construct a node to track a Value* through the backend. SDValue getSrcValue(const Value *v); - /// getMemOperand - Construct a node to track a memory reference - /// through the backend. - SDValue getMemOperand(const MachineMemOperand &MO); - /// getShiftAmountOperand - Return the specified value casted to /// the target's desired shift amount type. SDValue getShiftAmountOperand(SDValue Op); @@ -682,8 +698,10 @@ SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, EVT VT4, const SDValue *Ops, unsigned NumOps); SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, - const std::vector &ResultTys, const SDValue *Ops, - unsigned NumOps); + const std::vector &ResultTys, const SDValue *Ops, + unsigned NumOps); + SDNode *getMachineNode(unsigned Opcode, DebugLoc dl, SDVTList VTs, + const SDValue *Ops, unsigned NumOps); /// getTargetExtractSubreg - A convenience function for creating /// TargetInstrInfo::EXTRACT_SUBREG nodes. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Sep 25 15:36:54 2009 @@ -27,13 +27,10 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/MachineMemOperand.h" -#include "llvm/Support/Allocator.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/RecyclingAllocator.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/DebugLoc.h" #include -#include namespace llvm { @@ -536,11 +533,6 @@ // make reference to a value in the LLVM IR. SRCVALUE, - // MEMOPERAND - This is a node that contains a MachineMemOperand which - // records information about a memory reference. This is used to make - // AliasAnalysis queries from the backend. - MEMOPERAND, - // PCMARKER - This corresponds to the pcmarker intrinsic. PCMARKER, @@ -617,10 +609,17 @@ ATOMIC_LOAD_UMIN, ATOMIC_LOAD_UMAX, - // BUILTIN_OP_END - This must be the last enum value in this list. + /// BUILTIN_OP_END - This must be the last enum value in this list. + /// The target-specific pre-isel opcode values start here. BUILTIN_OP_END }; + /// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations + /// which do not reference a specific memory location should be less than + /// this value. Those that do must not be less than this value, and can + /// be used with SelectionDAG::getMemIntrinsicNode. + static const int FIRST_TARGET_MEMORY_OPCODE = 1 << 14; + /// Node predicates /// isBuildVectorAllOnes - Return true if the specified node is a @@ -867,6 +866,7 @@ inline unsigned getNumOperands() const; inline const SDValue &getOperand(unsigned i) const; inline uint64_t getConstantOperandVal(unsigned i) const; + inline bool isTargetMemoryOpcode() const; inline bool isTargetOpcode() const; inline bool isMachineOpcode() const; inline unsigned getMachineOpcode() const; @@ -1031,17 +1031,17 @@ private: /// NodeType - The operation that this node performs. /// - short NodeType; + int16_t NodeType; /// OperandsNeedDelete - This is true if OperandList was new[]'d. If true, /// then they will be delete[]'d when the node is destroyed. - unsigned short OperandsNeedDelete : 1; + uint16_t OperandsNeedDelete : 1; protected: /// SubclassData - This member is defined by this class, but is not used for /// anything. Subclasses can use it to hold whatever state they find useful. /// This field is initialized to zero by the ctor. - unsigned short SubclassData : 15; + uint16_t SubclassData : 15; private: /// NodeId - Unique id per SDNode in the DAG. @@ -1085,6 +1085,13 @@ /// \ISD namespace). bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; } + /// isTargetMemoryOpcode - Test if this node has a target-specific + /// memory-referencing opcode (in the \ISD namespace and + /// greater than FIRST_TARGET_MEMORY_OPCODE). + bool isTargetMemoryOpcode() const { + return NodeType >= ISD::FIRST_TARGET_MEMORY_OPCODE; + } + /// isMachineOpcode - Test if this node has a post-isel opcode, directly /// corresponding to a MachineInstr opcode. bool isMachineOpcode() const { return NodeType < 0; } @@ -1417,6 +1424,9 @@ inline bool SDValue::isTargetOpcode() const { return Node->isTargetOpcode(); } +inline bool SDValue::isTargetMemoryOpcode() const { + return Node->isTargetMemoryOpcode(); +} inline bool SDValue::isMachineOpcode() const { return Node->isMachineOpcode(); } @@ -1515,47 +1525,55 @@ // MemoryVT - VT of in-memory value. EVT MemoryVT; - //! SrcValue - Memory location for alias analysis. - const Value *SrcValue; +protected: + /// MMO - Memory reference information. + MachineMemOperand *MMO; - //! SVOffset - Memory location offset. Note that base is defined in MemSDNode - int SVOffset; public: MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT MemoryVT, - const Value *srcValue, int SVOff, unsigned alignment, - bool isvolatile); + MachineMemOperand *MMO); MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, - unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile); + unsigned NumOps, EVT MemoryVT, MachineMemOperand *MMO); + + bool readMem() const { return MMO->isLoad(); } + bool writeMem() const { return MMO->isStore(); } /// Returns alignment and volatility of the memory access unsigned getOriginalAlignment() const { - return (1u << (SubclassData >> 6)) >> 1; + return MMO->getBaseAlignment(); } unsigned getAlignment() const { - return MinAlign(getOriginalAlignment(), SVOffset); + return MMO->getAlignment(); } - bool isVolatile() const { return (SubclassData >> 5) & 1; } /// getRawSubclassData - Return the SubclassData value, which contains an - /// encoding of the alignment and volatile information, as well as bits - /// used by subclasses. This function should only be used to compute a - /// FoldingSetNodeID value. + /// encoding of the volatile flag, as well as bits used by subclasses. This + /// function should only be used to compute a FoldingSetNodeID value. unsigned getRawSubclassData() const { return SubclassData; } + bool isVolatile() const { return (SubclassData >> 5) & 1; } + /// Returns the SrcValue and offset that describes the location of the access - const Value *getSrcValue() const { return SrcValue; } - int getSrcValueOffset() const { return SVOffset; } + const Value *getSrcValue() const { return MMO->getValue(); } + int64_t getSrcValueOffset() const { return MMO->getOffset(); } /// getMemoryVT - Return the type of the in-memory value. EVT getMemoryVT() const { return MemoryVT; } /// getMemOperand - Return a MachineMemOperand object describing the memory /// reference performed by operation. - MachineMemOperand getMemOperand() const; + MachineMemOperand *getMemOperand() const { return MMO; } + + /// refineAlignment - Update this MemSDNode's MachineMemOperand information + /// to reflect the alignment of NewMMO, if it has a greater alignment. + /// This must only be used when the new alignment applies to all users of + /// this MachineMemOperand. + void refineAlignment(const MachineMemOperand *NewMMO) { + MMO->refineAlignment(NewMMO); + } const SDValue &getChain() const { return getOperand(0); } const SDValue &getBasePtr() const { @@ -1583,7 +1601,7 @@ N->getOpcode() == ISD::ATOMIC_LOAD_UMAX || N->getOpcode() == ISD::INTRINSIC_W_CHAIN || N->getOpcode() == ISD::INTRINSIC_VOID || - N->isTargetOpcode(); + N->isTargetMemoryOpcode(); } }; @@ -1603,17 +1621,18 @@ // Align: alignment of memory AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT, SDValue Chain, SDValue Ptr, - SDValue Cmp, SDValue Swp, const Value* SrcVal, - unsigned Align=0) - : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true) { + SDValue Cmp, SDValue Swp, MachineMemOperand *MMO) + : MemSDNode(Opc, dl, VTL, MemVT, MMO) { + assert(readMem() && "Atomic MachineMemOperand is not a load!"); + assert(writeMem() && "Atomic MachineMemOperand is not a store!"); InitOperands(Ops, Chain, Ptr, Cmp, Swp); } AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT, SDValue Chain, SDValue Ptr, - SDValue Val, const Value* SrcVal, unsigned Align=0) - : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true) { + SDValue Val, MachineMemOperand *MMO) + : MemSDNode(Opc, dl, VTL, MemVT, MMO) { + assert(readMem() && "Atomic MachineMemOperand is not a load!"); + assert(writeMem() && "Atomic MachineMemOperand is not a store!"); InitOperands(Ops, Chain, Ptr, Val); } @@ -1643,24 +1662,18 @@ } }; -/// MemIntrinsicSDNode - This SDNode is used for target intrinsic that touches -/// memory and need an associated memory operand. -/// +/// MemIntrinsicSDNode - This SDNode is used for target intrinsics that touch +/// memory and need an associated MachineMemOperand. Its opcode may be +/// INTRINSIC_VOID, INTRINSIC_W_CHAIN, or a target-specific opcode with a +/// value not less than FIRST_TARGET_MEMORY_OPCODE. class MemIntrinsicSDNode : public MemSDNode { - bool ReadMem; // Intrinsic reads memory - bool WriteMem; // Intrinsic writes memory public: MemIntrinsicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, unsigned NumOps, - EVT MemoryVT, const Value *srcValue, int SVO, - unsigned Align, bool Vol, bool ReadMem, bool WriteMem) - : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol), - ReadMem(ReadMem), WriteMem(WriteMem) { + EVT MemoryVT, MachineMemOperand *MMO) + : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, MMO) { } - bool readMem() const { return ReadMem; } - bool writeMem() const { return WriteMem; } - // Methods to support isa and dyn_cast static bool classof(const MemIntrinsicSDNode *) { return true; } static bool classof(const SDNode *N) { @@ -1668,7 +1681,7 @@ // early a node with a target opcode can be of this class return N->getOpcode() == ISD::INTRINSIC_W_CHAIN || N->getOpcode() == ISD::INTRINSIC_VOID || - N->isTargetOpcode(); + N->isTargetMemoryOpcode(); } }; @@ -1956,10 +1969,6 @@ /// used when the SelectionDAG needs to make a simple reference to something /// in the LLVM IR representation. /// -/// Note that this is not used for carrying alias information; that is done -/// with MemOperandSDNode, which includes a Value which is required to be a -/// pointer, and several other fields specific to memory references. -/// class SrcValueSDNode : public SDNode { const Value *V; friend class SelectionDAG; @@ -1979,28 +1988,6 @@ }; -/// MemOperandSDNode - An SDNode that holds a MachineMemOperand. This is -/// used to represent a reference to memory after ISD::LOAD -/// and ISD::STORE have been lowered. -/// -class MemOperandSDNode : public SDNode { - friend class SelectionDAG; - /// Create a MachineMemOperand node - explicit MemOperandSDNode(const MachineMemOperand &mo) - : SDNode(ISD::MEMOPERAND, DebugLoc::getUnknownLoc(), - getSDVTList(MVT::Other)), MO(mo) {} - -public: - /// MO - The contained MachineMemOperand. - const MachineMemOperand MO; - - static bool classof(const MemOperandSDNode *) { return true; } - static bool classof(const SDNode *N) { - return N->getOpcode() == ISD::MEMOPERAND; - } -}; - - class RegisterSDNode : public SDNode { unsigned Reg; friend class SelectionDAG; @@ -2269,9 +2256,8 @@ public: LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands, unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM, - EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) - : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol) { - assert(Align != 0 && "Loads and stores should have non-zero aligment"); + EVT MemVT, MachineMemOperand *MMO) + : MemSDNode(NodeTy, dl, VTs, MemVT, MMO) { SubclassData |= AM << 2; assert(getAddressingMode() == AM && "MemIndexedMode encoding error!"); InitOperands(Ops, Operands, numOperands); @@ -2307,12 +2293,14 @@ class LoadSDNode : public LSBaseSDNode { friend class SelectionDAG; LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs, - ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT LVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false) + ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT MemVT, + MachineMemOperand *MMO) : LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3, - VTs, AM, LVT, SV, O, Align, Vol) { + VTs, AM, MemVT, MMO) { SubclassData |= (unsigned short)ETy; assert(getExtensionType() == ETy && "LoadExtType encoding error!"); + assert(readMem() && "Load MachineMemOperand is not a load!"); + assert(!writeMem() && "Load MachineMemOperand is a store!"); } public: @@ -2336,12 +2324,14 @@ class StoreSDNode : public LSBaseSDNode { friend class SelectionDAG; StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs, - ISD::MemIndexedMode AM, bool isTrunc, EVT SVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false) + ISD::MemIndexedMode AM, bool isTrunc, EVT MemVT, + MachineMemOperand *MMO) : LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4, - VTs, AM, SVT, SV, O, Align, Vol) { + VTs, AM, MemVT, MMO) { SubclassData |= (unsigned short)isTrunc; assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!"); + assert(!readMem() && "Store MachineMemOperand is a load!"); + assert(writeMem() && "Store MachineMemOperand is not a store!"); } public: @@ -2360,6 +2350,44 @@ } }; +/// MachineSDNode - An SDNode that represents everything that will be needed +/// to construct a MachineInstr. These nodes are created during the +/// instruction selection proper phase. +/// +class MachineSDNode : public SDNode { +public: + typedef MachineMemOperand **mmo_iterator; + +private: + friend class SelectionDAG; + MachineSDNode(unsigned Opc, const DebugLoc DL, SDVTList VTs) + : SDNode(Opc, DL, VTs), MemRefs(0), MemRefsEnd(0) {} + + /// LocalOperands - Operands for this instruction, if they fit here. If + /// they don't, this field is unused. + SDUse LocalOperands[4]; + + /// MemRefs - Memory reference descriptions for this instruction. + mmo_iterator MemRefs; + mmo_iterator MemRefsEnd; + +public: + mmo_iterator memoperands_begin() const { return MemRefs; } + mmo_iterator memoperands_end() const { return MemRefsEnd; } + bool memoperands_empty() const { return MemRefsEnd == MemRefs; } + + /// setMemRefs - Assign this MachineSDNodes's memory reference descriptor + /// list. This does not transfer ownership. + void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) { + MemRefs = NewMemRefs; + MemRefsEnd = NewMemRefsEnd; + } + + static bool classof(const MachineSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->isMachineOpcode(); + } +}; class SDNodeIterator : public std::iterator { Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Sep 25 15:36:54 2009 @@ -25,6 +25,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineLoopInfo.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/PseudoSourceValue.h" @@ -1443,12 +1444,12 @@ // If the instruction accesses memory and the memory could be non-constant, // assume the instruction is not rematerializable. - for (std::list::const_iterator - I = MI->memoperands_begin(), E = MI->memoperands_end(); I != E; ++I){ - const MachineMemOperand &MMO = *I; - if (MMO.isVolatile() || MMO.isStore()) + for (MachineInstr::mmo_iterator I = MI->memoperands_begin(), + E = MI->memoperands_end(); I != E; ++I){ + const MachineMemOperand *MMO = *I; + if (MMO->isVolatile() || MMO->isStore()) return false; - const Value *V = MMO.getValue(); + const Value *V = MMO->getValue(); if (!V) return false; if (const PseudoSourceValue *PSV = dyn_cast(V)) { Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Fri Sep 25 15:36:54 2009 @@ -190,11 +190,6 @@ /// void MachineFunction::DeleteMachineInstr(MachineInstr *MI) { - // Clear the instructions memoperands. This must be done manually because - // the instruction's parent pointer is now null, so it can't properly - // deallocate them on its own. - MI->clearMemOperands(*this); - MI->~MachineInstr(); InstructionRecycler.Deallocate(Allocator, MI); } @@ -217,6 +212,29 @@ BasicBlockRecycler.Deallocate(Allocator, MBB); } +MachineMemOperand * +MachineFunction::getMachineMemOperand(const Value *v, unsigned f, + int64_t o, uint64_t s, + unsigned base_alignment) { + return new (Allocator.Allocate()) + MachineMemOperand(v, f, o, s, base_alignment); +} + +MachineMemOperand * +MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO, + int64_t Offset, uint64_t Size) { + return new (Allocator.Allocate()) + MachineMemOperand(MMO->getValue(), MMO->getFlags(), + int64_t(uint64_t(MMO->getOffset()) + + uint64_t(Offset)), + Size, MMO->getBaseAlignment()); +} + +MachineInstr::mmo_iterator +MachineFunction::allocateMemRefsArray(unsigned long Num) { + return Allocator.Allocate(Num); +} + void MachineFunction::dump() const { print(errs()); } Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Sep 25 15:36:54 2009 @@ -17,6 +17,7 @@ #include "llvm/Value.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/Target/TargetMachine.h" @@ -298,40 +299,56 @@ ID.AddInteger(Flags); } -raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MRO) { - assert((MRO.isLoad() || MRO.isStore()) && +void MachineMemOperand::refineAlignment(const MachineMemOperand *MMO) { + // The Value and Offset may differ due to CSE. But the flags and size + // should be the same. + assert(MMO->getFlags() == getFlags() && "Flags mismatch!"); + assert(MMO->getSize() == getSize() && "Size mismatch!"); + + if (MMO->getBaseAlignment() >= getBaseAlignment()) { + // Update the alignment value. + Flags = (Flags & 7) | ((Log2_32(MMO->getBaseAlignment()) + 1) << 3); + // Also update the base and offset, because the new alignment may + // not be applicable with the old ones. + V = MMO->getValue(); + Offset = MMO->getOffset(); + } +} + +raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineMemOperand &MMO) { + assert((MMO.isLoad() || MMO.isStore()) && "SV has to be a load, store or both."); - if (MRO.isVolatile()) + if (MMO.isVolatile()) OS << "Volatile "; - if (MRO.isLoad()) + if (MMO.isLoad()) OS << "LD"; - if (MRO.isStore()) + if (MMO.isStore()) OS << "ST"; - OS << MRO.getSize(); + OS << MMO.getSize(); // Print the address information. OS << "["; - if (!MRO.getValue()) + if (!MMO.getValue()) OS << ""; else - WriteAsOperand(OS, MRO.getValue(), /*PrintType=*/false); + WriteAsOperand(OS, MMO.getValue(), /*PrintType=*/false); // If the alignment of the memory reference itself differs from the alignment // of the base pointer, print the base alignment explicitly, next to the base // pointer. - if (MRO.getBaseAlignment() != MRO.getAlignment()) - OS << "(align=" << MRO.getBaseAlignment() << ")"; + if (MMO.getBaseAlignment() != MMO.getAlignment()) + OS << "(align=" << MMO.getBaseAlignment() << ")"; - if (MRO.getOffset() != 0) - OS << "+" << MRO.getOffset(); + if (MMO.getOffset() != 0) + OS << "+" << MMO.getOffset(); OS << "]"; // Print the alignment of the reference. - if (MRO.getBaseAlignment() != MRO.getAlignment() || - MRO.getBaseAlignment() != MRO.getSize()) - OS << "(align=" << MRO.getAlignment() << ")"; + if (MMO.getBaseAlignment() != MMO.getAlignment() || + MMO.getBaseAlignment() != MMO.getSize()) + OS << "(align=" << MMO.getAlignment() << ")"; return OS; } @@ -343,7 +360,8 @@ /// MachineInstr ctor - This constructor creates a dummy MachineInstr with /// TID NULL and no operands. MachineInstr::MachineInstr() - : TID(0), NumImplicitOps(0), Parent(0), debugLoc(DebugLoc::getUnknownLoc()) { + : TID(0), NumImplicitOps(0), MemRefs(0), MemRefsEnd(0), + Parent(0), debugLoc(DebugLoc::getUnknownLoc()) { // Make sure that we get added to a machine basicblock LeakDetector::addGarbageObject(this); } @@ -362,7 +380,7 @@ /// TargetInstrDesc or the numOperands if it is not zero. (for /// instructions with variable number of operands). MachineInstr::MachineInstr(const TargetInstrDesc &tid, bool NoImp) - : TID(&tid), NumImplicitOps(0), Parent(0), + : TID(&tid), NumImplicitOps(0), MemRefs(0), MemRefsEnd(0), Parent(0), debugLoc(DebugLoc::getUnknownLoc()) { if (!NoImp && TID->getImplicitDefs()) for (const unsigned *ImpDefs = TID->getImplicitDefs(); *ImpDefs; ++ImpDefs) @@ -380,7 +398,8 @@ /// MachineInstr ctor - As above, but with a DebugLoc. MachineInstr::MachineInstr(const TargetInstrDesc &tid, const DebugLoc dl, bool NoImp) - : TID(&tid), NumImplicitOps(0), Parent(0), debugLoc(dl) { + : TID(&tid), NumImplicitOps(0), MemRefs(0), MemRefsEnd(0), + Parent(0), debugLoc(dl) { if (!NoImp && TID->getImplicitDefs()) for (const unsigned *ImpDefs = TID->getImplicitDefs(); *ImpDefs; ++ImpDefs) NumImplicitOps++; @@ -399,7 +418,7 @@ /// basic block. /// MachineInstr::MachineInstr(MachineBasicBlock *MBB, const TargetInstrDesc &tid) - : TID(&tid), NumImplicitOps(0), Parent(0), + : TID(&tid), NumImplicitOps(0), MemRefs(0), MemRefsEnd(0), Parent(0), debugLoc(DebugLoc::getUnknownLoc()) { assert(MBB && "Cannot use inserting ctor with null basic block!"); if (TID->ImplicitDefs) @@ -419,7 +438,8 @@ /// MachineInstr::MachineInstr(MachineBasicBlock *MBB, const DebugLoc dl, const TargetInstrDesc &tid) - : TID(&tid), NumImplicitOps(0), Parent(0), debugLoc(dl) { + : TID(&tid), NumImplicitOps(0), MemRefs(0), MemRefsEnd(0), + Parent(0), debugLoc(dl) { assert(MBB && "Cannot use inserting ctor with null basic block!"); if (TID->ImplicitDefs) for (const unsigned *ImpDefs = TID->getImplicitDefs(); *ImpDefs; ++ImpDefs) @@ -437,8 +457,9 @@ /// MachineInstr ctor - Copies MachineInstr arg exactly /// MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI) - : TID(&MI.getDesc()), NumImplicitOps(0), Parent(0), - debugLoc(MI.getDebugLoc()) { + : TID(&MI.getDesc()), NumImplicitOps(0), + MemRefs(MI.MemRefs), MemRefsEnd(MI.MemRefsEnd), + Parent(0), debugLoc(MI.getDebugLoc()) { Operands.reserve(MI.getNumOperands()); // Add operands @@ -446,11 +467,6 @@ addOperand(MI.getOperand(i)); NumImplicitOps = MI.NumImplicitOps; - // Add memory operands. - for (std::list::const_iterator i = MI.memoperands_begin(), - j = MI.memoperands_end(); i != j; ++i) - addMemOperand(MF, *i); - // Set parent to null. Parent = 0; @@ -459,8 +475,6 @@ MachineInstr::~MachineInstr() { LeakDetector::removeGarbageObject(this); - assert(MemOperands.empty() && - "MachineInstr being deleted with live memoperands!"); #ifndef NDEBUG for (unsigned i = 0, e = Operands.size(); i != e; ++i) { assert(Operands[i].ParentMI == this && "ParentMI mismatch!"); @@ -621,18 +635,24 @@ } } -/// addMemOperand - Add a MachineMemOperand to the machine instruction, -/// referencing arbitrary storage. +/// addMemOperand - Add a MachineMemOperand to the machine instruction. +/// This function should be used only occasionally. The setMemRefs function +/// is the primary method for setting up a MachineInstr's MemRefs list. void MachineInstr::addMemOperand(MachineFunction &MF, - const MachineMemOperand &MO) { - MemOperands.push_back(MO); -} + MachineMemOperand *MO) { + mmo_iterator OldMemRefs = MemRefs; + mmo_iterator OldMemRefsEnd = MemRefsEnd; + + size_t NewNum = (MemRefsEnd - MemRefs) + 1; + mmo_iterator NewMemRefs = MF.allocateMemRefsArray(NewNum); + mmo_iterator NewMemRefsEnd = NewMemRefs + NewNum; -/// clearMemOperands - Erase all of this MachineInstr's MachineMemOperands. -void MachineInstr::clearMemOperands(MachineFunction &MF) { - MemOperands.clear(); -} + std::copy(OldMemRefs, OldMemRefsEnd, NewMemRefs); + NewMemRefs[NewNum - 1] = MO; + MemRefs = NewMemRefs; + MemRefsEnd = NewMemRefsEnd; +} /// removeFromParent - This method unlinks 'this' from the containing basic /// block, and returns it, but does not delete it. @@ -972,9 +992,8 @@ return true; // Check the memory reference information for volatile references. - for (std::list::const_iterator I = memoperands_begin(), - E = memoperands_end(); I != E; ++I) - if (I->isVolatile()) + for (mmo_iterator I = memoperands_begin(), E = memoperands_end(); I != E; ++I) + if ((*I)->isVolatile()) return true; return false; @@ -1004,9 +1023,9 @@ if (!memoperands_empty()) { OS << ", Mem:"; - for (std::list::const_iterator i = memoperands_begin(), - e = memoperands_end(); i != e; ++i) { - OS << *i; + for (mmo_iterator i = memoperands_begin(), e = memoperands_end(); + i != e; ++i) { + OS << **i; if (next(i) != e) OS << " "; } Modified: llvm/trunk/lib/CodeGen/ScheduleDAGEmit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGEmit.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAGEmit.cpp (original) +++ llvm/trunk/lib/CodeGen/ScheduleDAGEmit.cpp Fri Sep 25 15:36:54 2009 @@ -28,10 +28,6 @@ #include "llvm/Support/MathExtras.h" using namespace llvm; -void ScheduleDAG::AddMemOperand(MachineInstr *MI, const MachineMemOperand &MO) { - MI->addMemOperand(MF, MO); -} - void ScheduleDAG::EmitNoop() { TII->insertNoop(*BB, InsertPos); } Modified: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp (original) +++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp Fri Sep 25 15:36:54 2009 @@ -17,6 +17,7 @@ #include "llvm/Operator.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/Target/TargetMachine.h" @@ -96,11 +97,11 @@ /// object, return the Value for that object. Otherwise return null. static const Value *getUnderlyingObjectForInstr(const MachineInstr *MI) { if (!MI->hasOneMemOperand() || - !MI->memoperands_begin()->getValue() || - MI->memoperands_begin()->isVolatile()) + !(*MI->memoperands_begin())->getValue() || + (*MI->memoperands_begin())->isVolatile()) return 0; - const Value *V = MI->memoperands_begin()->getValue(); + const Value *V = (*MI->memoperands_begin())->getValue(); if (!V) return 0; @@ -335,10 +336,10 @@ if (!ChainTID.isCall() && !ChainTID.hasUnmodeledSideEffects() && ChainMI->hasOneMemOperand() && - !ChainMI->memoperands_begin()->isVolatile() && - ChainMI->memoperands_begin()->getValue()) + !(*ChainMI->memoperands_begin())->isVolatile() && + (*ChainMI->memoperands_begin())->getValue()) // We know that the Chain accesses one specific memory location. - ChainMMO = &*ChainMI->memoperands_begin(); + ChainMMO = *ChainMI->memoperands_begin(); else // Unknown memory accesses. Assume the worst. ChainMMO = 0; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Fri Sep 25 15:36:54 2009 @@ -263,19 +263,10 @@ } /// CountOperands - The inputs to target nodes have any actual inputs first, -/// followed by special operands that describe memory references, then an -/// optional chain operand, then an optional flag operand. Compute the number -/// of actual operands that will go into the resulting MachineInstr. +/// followed by an optional chain operand, then an optional flag operand. +/// Compute the number of actual operands that will go into the resulting +/// MachineInstr. unsigned ScheduleDAGSDNodes::CountOperands(SDNode *Node) { - unsigned N = ComputeMemOperandsEnd(Node); - while (N && isa(Node->getOperand(N - 1).getNode())) - --N; // Ignore MEMOPERAND nodes - return N; -} - -/// ComputeMemOperandsEnd - Find the index one past the last MemOperandSDNode -/// operand -unsigned ScheduleDAGSDNodes::ComputeMemOperandsEnd(SDNode *Node) { unsigned N = Node->getNumOperands(); while (N && Node->getOperand(N - 1).getValueType() == MVT::Flag) --N; @@ -284,7 +275,6 @@ return N; } - void ScheduleDAGSDNodes::dumpNode(const SUnit *SU) const { if (!SU->getNode()) { errs() << "PHYS REG COPY\n"; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Fri Sep 25 15:36:54 2009 @@ -58,7 +58,6 @@ if (isa(Node)) return true; if (isa(Node)) return true; if (isa(Node)) return true; - if (isa(Node)) return true; if (Node->getOpcode() == ISD::EntryToken) return true; return false; } @@ -99,15 +98,11 @@ static unsigned CountResults(SDNode *Node); /// CountOperands - The inputs to target nodes have any actual inputs first, - /// followed by special operands that describe memory references, then an - /// optional chain operand, then flag operands. Compute the number of - /// actual operands that will go into the resulting MachineInstr. + /// followed by an optional chain operand, then flag operands. Compute + /// the number of actual operands that will go into the resulting + /// MachineInstr. static unsigned CountOperands(SDNode *Node); - /// ComputeMemOperandsEnd - Find the index one past the last - /// MemOperandSDNode operand - static unsigned ComputeMemOperandsEnd(SDNode *Node); - /// EmitNode - Generate machine code for an node and needed dependencies. /// VRBaseMap contains, for each already emitted node, the first virtual /// register number for the results of the node. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp Fri Sep 25 15:36:54 2009 @@ -497,7 +497,6 @@ const TargetInstrDesc &II = TII->get(Opc); unsigned NumResults = CountResults(Node); unsigned NodeOperands = CountOperands(Node); - unsigned MemOperandsEnd = ComputeMemOperandsEnd(Node); bool HasPhysRegOuts = (NumResults > II.getNumDefs()) && II.getImplicitDefs() != 0; #ifndef NDEBUG @@ -525,9 +524,9 @@ AddOperand(MI, Node->getOperand(i), i-NumSkip+II.getNumDefs(), &II, VRBaseMap); - // Emit all of the memory operands of this instruction - for (unsigned i = NodeOperands; i != MemOperandsEnd; ++i) - AddMemOperand(MI,cast(Node->getOperand(i+NumSkip))->MO); + // Transfer all of the memory reference descriptions of this instruction. + MI->setMemRefs(cast(Node)->memoperands_begin(), + cast(Node)->memoperands_end()); if (II.usesCustomDAGSchedInsertionHook()) { // Insert this instruction into the basic block using a target Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 25 15:36:54 2009 @@ -402,11 +402,6 @@ case ISD::SRCVALUE: ID.AddPointer(cast(N)->getValue()); break; - case ISD::MEMOPERAND: { - const MachineMemOperand &MO = cast(N)->MO; - MO.Profile(ID); - break; - } case ISD::FrameIndex: case ISD::TargetFrameIndex: ID.AddInteger(cast(N)->getIndex()); @@ -481,20 +476,18 @@ } /// encodeMemSDNodeFlags - Generic routine for computing a value for use in -/// the CSE map that carries alignment, volatility, indexing mode, and +/// the CSE map that carries volatility, indexing mode, and /// extension/truncation information. /// static inline unsigned -encodeMemSDNodeFlags(int ConvType, ISD::MemIndexedMode AM, - bool isVolatile, unsigned Alignment) { +encodeMemSDNodeFlags(int ConvType, ISD::MemIndexedMode AM, bool isVolatile) { assert((ConvType & 3) == ConvType && "ConvType may not require more than 2 bits!"); assert((AM & 7) == AM && "AM may not require more than 3 bits!"); return ConvType | (AM << 2) | - (isVolatile << 5) | - ((Log2_32(Alignment) + 1) << 6); + (isVolatile << 5); } //===----------------------------------------------------------------------===// @@ -1330,28 +1323,6 @@ return SDValue(N, 0); } -SDValue SelectionDAG::getMemOperand(const MachineMemOperand &MO) { -#ifndef NDEBUG - const Value *v = MO.getValue(); - assert((!v || isa(v->getType())) && - "SrcValue is not a pointer?"); -#endif - - FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::MEMOPERAND, getVTList(MVT::Other), 0, 0); - MO.Profile(ID); - - void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) - return SDValue(E, 0); - - SDNode *N = NodeAllocator.Allocate(); - new (N) MemOperandSDNode(MO); - CSEMap.InsertNode(N, IP); - AllNodes.push_back(N); - return SDValue(N, 0); -} - /// getShiftAmountOperand - Return the specified value casted to /// the target's desired shift amount type. SDValue SelectionDAG::getShiftAmountOperand(SDValue Op) { @@ -3523,25 +3494,49 @@ SDValue Ptr, SDValue Cmp, SDValue Swp, const Value* PtrVal, unsigned Alignment) { + if (Alignment == 0) // Ensure that codegen never sees alignment 0 + Alignment = getEVTAlignment(MemVT); + + // Check if the memory reference references a frame index + if (!PtrVal) + if (const FrameIndexSDNode *FI = + dyn_cast(Ptr.getNode())) + PtrVal = PseudoSourceValue::getFixedStack(FI->getIndex()); + + MachineFunction &MF = getMachineFunction(); + unsigned Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore; + + // For now, atomics are considered to be volatile always. + Flags |= MachineMemOperand::MOVolatile; + + MachineMemOperand *MMO = + MF.getMachineMemOperand(PtrVal, Flags, 0, + MemVT.getStoreSize(), Alignment); + + return getAtomic(Opcode, dl, MemVT, Chain, Ptr, Cmp, Swp, MMO); +} + +SDValue SelectionDAG::getAtomic(unsigned Opcode, DebugLoc dl, EVT MemVT, + SDValue Chain, + SDValue Ptr, SDValue Cmp, + SDValue Swp, MachineMemOperand *MMO) { assert(Opcode == ISD::ATOMIC_CMP_SWAP && "Invalid Atomic Op"); assert(Cmp.getValueType() == Swp.getValueType() && "Invalid Atomic Op Types"); EVT VT = Cmp.getValueType(); - if (Alignment == 0) // Ensure that codegen never sees alignment 0 - Alignment = getEVTAlignment(MemVT); - SDVTList VTs = getVTList(VT, MVT::Other); FoldingSetNodeID ID; ID.AddInteger(MemVT.getRawBits()); SDValue Ops[] = {Chain, Ptr, Cmp, Swp}; AddNodeIDNode(ID, Opcode, VTs, Ops, 4); void* IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { + cast(E)->refineAlignment(MMO); return SDValue(E, 0); + } SDNode* N = NodeAllocator.Allocate(); - new (N) AtomicSDNode(Opcode, dl, VTs, MemVT, - Chain, Ptr, Cmp, Swp, PtrVal, Alignment); + new (N) AtomicSDNode(Opcode, dl, VTs, MemVT, Chain, Ptr, Cmp, Swp, MMO); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3552,6 +3547,32 @@ SDValue Ptr, SDValue Val, const Value* PtrVal, unsigned Alignment) { + if (Alignment == 0) // Ensure that codegen never sees alignment 0 + Alignment = getEVTAlignment(MemVT); + + // Check if the memory reference references a frame index + if (!PtrVal) + if (const FrameIndexSDNode *FI = + dyn_cast(Ptr.getNode())) + PtrVal = PseudoSourceValue::getFixedStack(FI->getIndex()); + + MachineFunction &MF = getMachineFunction(); + unsigned Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore; + + // For now, atomics are considered to be volatile always. + Flags |= MachineMemOperand::MOVolatile; + + MachineMemOperand *MMO = + MF.getMachineMemOperand(PtrVal, Flags, 0, + MemVT.getStoreSize(), Alignment); + + return getAtomic(Opcode, dl, MemVT, Chain, Ptr, Val, MMO); +} + +SDValue SelectionDAG::getAtomic(unsigned Opcode, DebugLoc dl, EVT MemVT, + SDValue Chain, + SDValue Ptr, SDValue Val, + MachineMemOperand *MMO) { assert((Opcode == ISD::ATOMIC_LOAD_ADD || Opcode == ISD::ATOMIC_LOAD_SUB || Opcode == ISD::ATOMIC_LOAD_AND || @@ -3567,20 +3588,18 @@ EVT VT = Val.getValueType(); - if (Alignment == 0) // Ensure that codegen never sees alignment 0 - Alignment = getEVTAlignment(MemVT); - SDVTList VTs = getVTList(VT, MVT::Other); FoldingSetNodeID ID; ID.AddInteger(MemVT.getRawBits()); SDValue Ops[] = {Chain, Ptr, Val}; AddNodeIDNode(ID, Opcode, VTs, Ops, 3); void* IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { + cast(E)->refineAlignment(MMO); return SDValue(E, 0); + } SDNode* N = NodeAllocator.Allocate(); - new (N) AtomicSDNode(Opcode, dl, VTs, MemVT, - Chain, Ptr, Val, PtrVal, Alignment); + new (N) AtomicSDNode(Opcode, dl, VTs, MemVT, Chain, Ptr, Val, MMO); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3619,23 +3638,51 @@ EVT MemVT, const Value *srcValue, int SVOff, unsigned Align, bool Vol, bool ReadMem, bool WriteMem) { + if (Align == 0) // Ensure that codegen never sees alignment 0 + Align = getEVTAlignment(MemVT); + + MachineFunction &MF = getMachineFunction(); + unsigned Flags = 0; + if (WriteMem) + Flags |= MachineMemOperand::MOStore; + if (ReadMem) + Flags |= MachineMemOperand::MOLoad; + if (Vol) + Flags |= MachineMemOperand::MOVolatile; + MachineMemOperand *MMO = + MF.getMachineMemOperand(srcValue, Flags, SVOff, + MemVT.getStoreSize(), Align); + + return getMemIntrinsicNode(Opcode, dl, VTList, Ops, NumOps, MemVT, MMO); +} + +SDValue +SelectionDAG::getMemIntrinsicNode(unsigned Opcode, DebugLoc dl, SDVTList VTList, + const SDValue *Ops, unsigned NumOps, + EVT MemVT, MachineMemOperand *MMO) { + assert((Opcode == ISD::INTRINSIC_VOID || + Opcode == ISD::INTRINSIC_W_CHAIN || + (Opcode <= INT_MAX && + (int)Opcode >= ISD::FIRST_TARGET_MEMORY_OPCODE)) && + "Opcode is not a memory-accessing opcode!"); + // Memoize the node unless it returns a flag. MemIntrinsicSDNode *N; if (VTList.VTs[VTList.NumVTs-1] != MVT::Flag) { FoldingSetNodeID ID; AddNodeIDNode(ID, Opcode, VTList, Ops, NumOps); void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { + cast(E)->refineAlignment(MMO); return SDValue(E, 0); + } N = NodeAllocator.Allocate(); - new (N) MemIntrinsicSDNode(Opcode, dl, VTList, Ops, NumOps, MemVT, - srcValue, SVOff, Align, Vol, ReadMem, WriteMem); + new (N) MemIntrinsicSDNode(Opcode, dl, VTList, Ops, NumOps, MemVT, MMO); CSEMap.InsertNode(N, IP); } else { N = NodeAllocator.Allocate(); - new (N) MemIntrinsicSDNode(Opcode, dl, VTList, Ops, NumOps, MemVT, - srcValue, SVOff, Align, Vol, ReadMem, WriteMem); + new (N) MemIntrinsicSDNode(Opcode, dl, VTList, Ops, NumOps, MemVT, MMO); } AllNodes.push_back(N); return SDValue(N, 0); @@ -3650,6 +3697,27 @@ if (Alignment == 0) // Ensure that codegen never sees alignment 0 Alignment = getEVTAlignment(VT); + // Check if the memory reference references a frame index + if (!SV) + if (const FrameIndexSDNode *FI = + dyn_cast(Ptr.getNode())) + SV = PseudoSourceValue::getFixedStack(FI->getIndex()); + + MachineFunction &MF = getMachineFunction(); + unsigned Flags = MachineMemOperand::MOLoad; + if (isVolatile) + Flags |= MachineMemOperand::MOVolatile; + MachineMemOperand *MMO = + MF.getMachineMemOperand(SV, Flags, SVOffset, + MemVT.getStoreSize(), Alignment); + return getLoad(AM, dl, ExtType, VT, Chain, Ptr, Offset, MemVT, MMO); +} + +SDValue +SelectionDAG::getLoad(ISD::MemIndexedMode AM, DebugLoc dl, + ISD::LoadExtType ExtType, EVT VT, SDValue Chain, + SDValue Ptr, SDValue Offset, EVT MemVT, + MachineMemOperand *MMO) { if (VT == MemVT) { ExtType = ISD::NON_EXTLOAD; } else if (ExtType == ISD::NON_EXTLOAD) { @@ -3678,13 +3746,14 @@ FoldingSetNodeID ID; AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(MemVT.getRawBits()); - ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, isVolatile, Alignment)); + ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, MMO->isVolatile())); void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { + cast(E)->refineAlignment(MMO); return SDValue(E, 0); + } SDNode *N = NodeAllocator.Allocate(); - new (N) LoadSDNode(Ops, dl, VTs, AM, ExtType, MemVT, SV, SVOffset, - Alignment, isVolatile); + new (N) LoadSDNode(Ops, dl, VTs, AM, ExtType, MemVT, MMO); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3724,25 +3793,43 @@ SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr, const Value *SV, int SVOffset, bool isVolatile, unsigned Alignment) { - EVT VT = Val.getValueType(); - if (Alignment == 0) // Ensure that codegen never sees alignment 0 - Alignment = getEVTAlignment(VT); + Alignment = getEVTAlignment(Val.getValueType()); + // Check if the memory reference references a frame index + if (!SV) + if (const FrameIndexSDNode *FI = + dyn_cast(Ptr.getNode())) + SV = PseudoSourceValue::getFixedStack(FI->getIndex()); + + MachineFunction &MF = getMachineFunction(); + unsigned Flags = MachineMemOperand::MOStore; + if (isVolatile) + Flags |= MachineMemOperand::MOVolatile; + MachineMemOperand *MMO = + MF.getMachineMemOperand(SV, Flags, SVOffset, + Val.getValueType().getStoreSize(), Alignment); + + return getStore(Chain, dl, Val, Ptr, MMO); +} + +SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val, + SDValue Ptr, MachineMemOperand *MMO) { + EVT VT = Val.getValueType(); SDVTList VTs = getVTList(MVT::Other); SDValue Undef = getUNDEF(Ptr.getValueType()); SDValue Ops[] = { Chain, Val, Ptr, Undef }; FoldingSetNodeID ID; AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(VT.getRawBits()); - ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, - isVolatile, Alignment)); + ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile())); void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { + cast(E)->refineAlignment(MMO); return SDValue(E, 0); + } SDNode *N = NodeAllocator.Allocate(); - new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, false, - VT, SV, SVOffset, Alignment, isVolatile); + new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, false, VT, MMO); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3752,17 +3839,37 @@ SDValue Ptr, const Value *SV, int SVOffset, EVT SVT, bool isVolatile, unsigned Alignment) { + if (Alignment == 0) // Ensure that codegen never sees alignment 0 + Alignment = getEVTAlignment(SVT); + + // Check if the memory reference references a frame index + if (!SV) + if (const FrameIndexSDNode *FI = + dyn_cast(Ptr.getNode())) + SV = PseudoSourceValue::getFixedStack(FI->getIndex()); + + MachineFunction &MF = getMachineFunction(); + unsigned Flags = MachineMemOperand::MOStore; + if (isVolatile) + Flags |= MachineMemOperand::MOVolatile; + MachineMemOperand *MMO = + MF.getMachineMemOperand(SV, Flags, SVOffset, SVT.getStoreSize(), Alignment); + + return getTruncStore(Chain, dl, Val, Ptr, SVT, MMO); +} + +SDValue SelectionDAG::getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, + SDValue Ptr, EVT SVT, + MachineMemOperand *MMO) { EVT VT = Val.getValueType(); if (VT == SVT) - return getStore(Chain, dl, Val, Ptr, SV, SVOffset, isVolatile, Alignment); + return getStore(Chain, dl, Val, Ptr, MMO); assert(VT.bitsGT(SVT) && "Not a truncation?"); assert(VT.isInteger() == SVT.isInteger() && "Can't do FP-INT conversion!"); - if (Alignment == 0) // Ensure that codegen never sees alignment 0 - Alignment = getEVTAlignment(VT); SDVTList VTs = getVTList(MVT::Other); SDValue Undef = getUNDEF(Ptr.getValueType()); @@ -3770,14 +3877,14 @@ FoldingSetNodeID ID; AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(SVT.getRawBits()); - ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, - isVolatile, Alignment)); + ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, MMO->isVolatile())); void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) { + cast(E)->refineAlignment(MMO); return SDValue(E, 0); + } SDNode *N = NodeAllocator.Allocate(); - new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, true, - SVT, SV, SVOffset, Alignment, isVolatile); + new (N) StoreSDNode(Ops, dl, VTs, ISD::UNINDEXED, true, SVT, MMO); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -3801,8 +3908,7 @@ SDNode *N = NodeAllocator.Allocate(); new (N) StoreSDNode(Ops, dl, VTs, AM, ST->isTruncatingStore(), ST->getMemoryVT(), - ST->getSrcValue(), ST->getSrcValueOffset(), - ST->getAlignment(), ST->isVolatile()); + ST->getMemOperand()); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); return SDValue(N, 0); @@ -4454,29 +4560,35 @@ DeadNodeSet.insert(Used); } - // If NumOps is larger than the # of operands we currently have, reallocate - // the operand list. - if (NumOps > N->NumOperands) { - if (N->OperandsNeedDelete) - delete[] N->OperandList; - - if (N->isMachineOpcode()) { - // We're creating a final node that will live unmorphed for the - // remainder of the current SelectionDAG iteration, so we can allocate - // the operands directly out of a pool with no recycling metadata. - N->OperandList = OperandAllocator.Allocate(NumOps); - N->OperandsNeedDelete = false; - } else { - N->OperandList = new SDUse[NumOps]; + if (MachineSDNode *MN = dyn_cast(N)) { + // Initialize the memory references information. + MN->setMemRefs(0, 0); + // If NumOps is larger than the # of operands we can have in a + // MachineSDNode, reallocate the operand list. + if (NumOps > MN->NumOperands || !MN->OperandsNeedDelete) { + if (MN->OperandsNeedDelete) + delete[] MN->OperandList; + if (NumOps > array_lengthof(MN->LocalOperands)) + // We're creating a final node that will live unmorphed for the + // remainder of the current SelectionDAG iteration, so we can allocate + // the operands directly out of a pool with no recycling metadata. + MN->InitOperands(OperandAllocator.Allocate(NumOps), + Ops, NumOps); + else + MN->InitOperands(MN->LocalOperands, Ops, NumOps); + MN->OperandsNeedDelete = false; + } else + MN->InitOperands(MN->OperandList, Ops, NumOps); + } else { + // If NumOps is larger than the # of operands we currently have, reallocate + // the operand list. + if (NumOps > N->NumOperands) { + if (N->OperandsNeedDelete) + delete[] N->OperandList; + N->InitOperands(new SDUse[NumOps], Ops, NumOps); N->OperandsNeedDelete = true; - } - } - - // Assign the new operands. - N->NumOperands = NumOps; - for (unsigned i = 0, e = NumOps; i != e; ++i) { - N->OperandList[i].setUser(N); - N->OperandList[i].setInitial(Ops[i]); + } else + MN->InitOperands(MN->OperandList, Ops, NumOps); } // Delete any nodes that are still dead after adding the uses for the @@ -4501,41 +4613,49 @@ /// node of the specified opcode and operands, it returns that node instead of /// the current one. SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT) { - return getNode(~Opcode, dl, VT).getNode(); + SDVTList VTs = getVTList(VT); + return getMachineNode(Opcode, dl, VTs, 0, 0); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1) { - return getNode(~Opcode, dl, VT, Op1).getNode(); + SDVTList VTs = getVTList(VT); + SDValue Ops[] = { Op1 }; + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1, SDValue Op2) { - return getNode(~Opcode, dl, VT, Op1, Op2).getNode(); + SDVTList VTs = getVTList(VT); + SDValue Ops[] = { Op1, Op2 }; + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1, SDValue Op2, SDValue Op3) { - return getNode(~Opcode, dl, VT, Op1, Op2, Op3).getNode(); + SDVTList VTs = getVTList(VT); + SDValue Ops[] = { Op1, Op2, Op3 }; + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, const SDValue *Ops, unsigned NumOps) { - return getNode(~Opcode, dl, VT, Ops, NumOps).getNode(); + SDVTList VTs = getVTList(VT); + return getMachineNode(Opcode, dl, VTs, Ops, NumOps); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2) { SDVTList VTs = getVTList(VT1, VT2); - SDValue Op; - return getNode(~Opcode, dl, VTs, &Op, 0).getNode(); + return getMachineNode(Opcode, dl, VTs, 0, 0); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, SDValue Op1) { SDVTList VTs = getVTList(VT1, VT2); - return getNode(~Opcode, dl, VTs, &Op1, 1).getNode(); + SDValue Ops[] = { Op1 }; + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, @@ -4543,7 +4663,7 @@ SDValue Op2) { SDVTList VTs = getVTList(VT1, VT2); SDValue Ops[] = { Op1, Op2 }; - return getNode(~Opcode, dl, VTs, Ops, 2).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, @@ -4551,14 +4671,14 @@ SDValue Op2, SDValue Op3) { SDVTList VTs = getVTList(VT1, VT2); SDValue Ops[] = { Op1, Op2, Op3 }; - return getNode(~Opcode, dl, VTs, Ops, 3).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, const SDValue *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2); - return getNode(~Opcode, dl, VTs, Ops, NumOps).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, NumOps); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, @@ -4566,7 +4686,7 @@ SDValue Op1, SDValue Op2) { SDVTList VTs = getVTList(VT1, VT2, VT3); SDValue Ops[] = { Op1, Op2 }; - return getNode(~Opcode, dl, VTs, Ops, 2).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, @@ -4575,27 +4695,67 @@ SDValue Op3) { SDVTList VTs = getVTList(VT1, VT2, VT3); SDValue Ops[] = { Op1, Op2, Op3 }; - return getNode(~Opcode, dl, VTs, Ops, 3).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, array_lengthof(Ops)); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, const SDValue *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2, VT3); - return getNode(~Opcode, dl, VTs, Ops, NumOps).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, NumOps); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT1, EVT VT2, EVT VT3, EVT VT4, const SDValue *Ops, unsigned NumOps) { SDVTList VTs = getVTList(VT1, VT2, VT3, VT4); - return getNode(~Opcode, dl, VTs, Ops, NumOps).getNode(); + return getMachineNode(Opcode, dl, VTs, Ops, NumOps); } SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, const std::vector &ResultTys, const SDValue *Ops, unsigned NumOps) { - return getNode(~Opcode, dl, ResultTys, Ops, NumOps).getNode(); + SDVTList VTs = getVTList(&ResultTys[0], ResultTys.size()); + return getMachineNode(Opcode, dl, VTs, Ops, NumOps); +} + +SDNode *SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc DL, SDVTList VTs, + const SDValue *Ops, unsigned NumOps) { + bool DoCSE = VTs.VTs[VTs.NumVTs-1] != MVT::Flag; + MachineSDNode *N; + void *IP; + + if (DoCSE) { + FoldingSetNodeID ID; + AddNodeIDNode(ID, ~Opcode, VTs, Ops, NumOps); + IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + return E; + } + + // Allocate a new MachineSDNode. + N = NodeAllocator.Allocate(); + new (N) MachineSDNode(~Opcode, DL, VTs); + + // Initialize the operands list. + if (NumOps > array_lengthof(N->LocalOperands)) + // We're creating a final node that will live unmorphed for the + // remainder of the current SelectionDAG iteration, so we can allocate + // the operands directly out of a pool with no recycling metadata. + N->InitOperands(OperandAllocator.Allocate(NumOps), + Ops, NumOps); + else + N->InitOperands(N->LocalOperands, Ops, NumOps); + N->OperandsNeedDelete = false; + + if (DoCSE) + CSEMap.InsertNode(N, IP); + + AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif + return N; } /// getTargetExtractSubreg - A convenience function for creating @@ -4968,57 +5128,21 @@ } MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT memvt, - const Value *srcValue, int SVO, unsigned alignment, - bool vol) - : SDNode(Opc, dl, VTs), MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { - SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); - assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); - assert(getOriginalAlignment() == alignment && "Alignment encoding error!"); - assert(isVolatile() == vol && "Volatile encoding error!"); + MachineMemOperand *mmo) + : SDNode(Opc, dl, VTs), MemoryVT(memvt), MMO(mmo) { + SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile()); + assert(isVolatile() == MMO->isVolatile() && "Volatile encoding error!"); + assert(memvt.getStoreSize() == MMO->getSize() && "Size mismatch!"); } MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, unsigned NumOps, EVT memvt, - const Value *srcValue, int SVO, unsigned alignment, - bool vol) + MachineMemOperand *mmo) : SDNode(Opc, dl, VTs, Ops, NumOps), - MemoryVT(memvt), SrcValue(srcValue), SVOffset(SVO) { - SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, vol, alignment); - assert(isPowerOf2_32(alignment) && "Alignment is not a power of 2!"); - assert(getOriginalAlignment() == alignment && "Alignment encoding error!"); - assert(isVolatile() == vol && "Volatile encoding error!"); -} - -/// getMemOperand - Return a MachineMemOperand object describing the memory -/// reference performed by this memory reference. -MachineMemOperand MemSDNode::getMemOperand() const { - int Flags = 0; - if (isa(this)) - Flags = MachineMemOperand::MOLoad; - else if (isa(this)) - Flags = MachineMemOperand::MOStore; - else if (isa(this)) { - Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore; - } - else { - const MemIntrinsicSDNode* MemIntrinNode = dyn_cast(this); - assert(MemIntrinNode && "Unknown MemSDNode opcode!"); - if (MemIntrinNode->readMem()) Flags |= MachineMemOperand::MOLoad; - if (MemIntrinNode->writeMem()) Flags |= MachineMemOperand::MOStore; - } - - int Size = (getMemoryVT().getSizeInBits() + 7) >> 3; - if (isVolatile()) Flags |= MachineMemOperand::MOVolatile; - - // Check if the memory reference references a frame index - const FrameIndexSDNode *FI = - dyn_cast(getBasePtr().getNode()); - if (!getSrcValue() && FI) - return MachineMemOperand(PseudoSourceValue::getFixedStack(FI->getIndex()), - Flags, 0, Size, getOriginalAlignment()); - else - return MachineMemOperand(getSrcValue(), Flags, getSrcValueOffset(), - Size, getOriginalAlignment()); + MemoryVT(memvt), MMO(mmo) { + SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile()); + assert(isVolatile() == MMO->isVolatile() && "Volatile encoding error!"); + assert(memvt.getStoreSize() == MMO->getSize() && "Size mismatch!"); } /// Profile - Gather unique data for the node. @@ -5221,7 +5345,6 @@ case ISD::PCMARKER: return "PCMarker"; case ISD::READCYCLECOUNTER: return "ReadCycleCounter"; case ISD::SRCVALUE: return "SrcValue"; - case ISD::MEMOPERAND: return "MemOperand"; case ISD::EntryToken: return "EntryToken"; case ISD::TokenFactor: return "TokenFactor"; case ISD::AssertSext: return "AssertSext"; @@ -5500,8 +5623,20 @@ } void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const { - if (!isTargetOpcode() && getOpcode() == ISD::VECTOR_SHUFFLE) { - const ShuffleVectorSDNode *SVN = cast(this); + if (const MachineSDNode *MN = dyn_cast(this)) { + if (!MN->memoperands_empty()) { + OS << "<"; + OS << "Mem:"; + for (MachineSDNode::mmo_iterator i = MN->memoperands_begin(), + e = MN->memoperands_end(); i != e; ++i) { + OS << **i; + if (next(i) != e) + OS << " "; + } + OS << ">"; + } + } else if (const ShuffleVectorSDNode *SVN = + dyn_cast(this)) { OS << "<"; for (unsigned i = 0, e = ValueList[0].getVectorNumElements(); i != e; ++i) { int Idx = SVN->getMaskElt(i); @@ -5512,9 +5647,7 @@ OS << Idx; } OS << ">"; - } - - if (const ConstantSDNode *CSDN = dyn_cast(this)) { + } else if (const ConstantSDNode *CSDN = dyn_cast(this)) { OS << '<' << CSDN->getAPIntValue() << '>'; } else if (const ConstantFPSDNode *CSDN = dyn_cast(this)) { if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle) @@ -5579,68 +5712,40 @@ OS << "<" << M->getValue() << ">"; else OS << ""; - } else if (const MemOperandSDNode *M = dyn_cast(this)) { - OS << ": " << M->MO; } else if (const VTSDNode *N = dyn_cast(this)) { OS << ":" << N->getVT().getEVTString(); } else if (const LoadSDNode *LD = dyn_cast(this)) { - const Value *SrcValue = LD->getSrcValue(); - int SrcOffset = LD->getSrcValueOffset(); - OS << " <"; - if (SrcValue) - OS << SrcValue; - else - OS << "null"; - OS << ":" << SrcOffset << ">"; + OS << " <" << *LD->getMemOperand(); bool doExt = true; switch (LD->getExtensionType()) { default: doExt = false; break; - case ISD::EXTLOAD: OS << " getMemoryVT().getEVTString() << ">"; + OS << " from " << LD->getMemoryVT().getEVTString(); const char *AM = getIndexedModeName(LD->getAddressingMode()); if (*AM) - OS << " " << AM; - if (LD->isVolatile()) - OS << " "; - OS << " alignment=" << LD->getAlignment(); + OS << ", " << AM; + + OS << ">"; } else if (const StoreSDNode *ST = dyn_cast(this)) { - const Value *SrcValue = ST->getSrcValue(); - int SrcOffset = ST->getSrcValueOffset(); - OS << " <"; - if (SrcValue) - OS << SrcValue; - else - OS << "null"; - OS << ":" << SrcOffset << ">"; + OS << " <" << *ST->getMemOperand(); if (ST->isTruncatingStore()) - OS << " getMemoryVT().getEVTString() << ">"; + OS << ", trunc to " << ST->getMemoryVT().getEVTString(); const char *AM = getIndexedModeName(ST->getAddressingMode()); if (*AM) - OS << " " << AM; - if (ST->isVolatile()) - OS << " "; - OS << " alignment=" << ST->getAlignment(); - } else if (const AtomicSDNode* AT = dyn_cast(this)) { - const Value *SrcValue = AT->getSrcValue(); - int SrcOffset = AT->getSrcValueOffset(); - OS << " <"; - if (SrcValue) - OS << SrcValue; - else - OS << "null"; - OS << ":" << SrcOffset << ">"; - if (AT->isVolatile()) - OS << " "; - OS << " alignment=" << AT->getAlignment(); + OS << ", " << AM; + + OS << ">"; + } else if (const MemSDNode* M = dyn_cast(this)) { + OS << " <" << *M->getMemOperand() << ">"; } } Modified: llvm/trunk/lib/CodeGen/StackSlotColoring.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackSlotColoring.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StackSlotColoring.cpp (original) +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Fri Sep 25 15:36:54 2009 @@ -18,6 +18,7 @@ #include "llvm/CodeGen/LiveStackAnalysis.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineLoopInfo.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/Support/CommandLine.h" @@ -451,6 +452,7 @@ /// to old frame index with new one. void StackSlotColoring::RewriteInstruction(MachineInstr *MI, int OldFI, int NewFI, MachineFunction &MF) { + // Update the operands. for (unsigned i = 0, ee = MI->getNumOperands(); i != ee; ++i) { MachineOperand &MO = MI->getOperand(i); if (!MO.isFI()) @@ -461,22 +463,15 @@ MO.setIndex(NewFI); } - // Update the MachineMemOperand for the new memory location. - // FIXME: We need a better method of managing these too. - SmallVector MMOs(MI->memoperands_begin(), - MI->memoperands_end()); - MI->clearMemOperands(MF); + // Update the memory references. This changes the MachineMemOperands + // directly. They may be in use by multiple instructions, however all + // instructions using OldFI are being rewritten to use NewFI. const Value *OldSV = PseudoSourceValue::getFixedStack(OldFI); - for (unsigned i = 0, ee = MMOs.size(); i != ee; ++i) { - if (MMOs[i].getValue() != OldSV) - MI->addMemOperand(MF, MMOs[i]); - else { - MachineMemOperand MMO(PseudoSourceValue::getFixedStack(NewFI), - MMOs[i].getFlags(), MMOs[i].getOffset(), - MMOs[i].getSize(), MMOs[i].getBaseAlignment()); - MI->addMemOperand(MF, MMO); - } - } + const Value *NewSV = PseudoSourceValue::getFixedStack(NewFI); + for (MachineInstr::mmo_iterator I = MI->memoperands_begin(), + E = MI->memoperands_end(); I != E; ++I) + if ((*I)->getValue() == OldSV) + (*I)->setValue(NewSV); } /// PropagateBackward - Traverse backward and look for the definition of Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Fri Sep 25 15:36:54 2009 @@ -17,6 +17,7 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/PseudoSourceValue.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" @@ -203,11 +204,11 @@ "Folded a use to a non-load!"); const MachineFrameInfo &MFI = *MF.getFrameInfo(); assert(MFI.getObjectOffset(FrameIndex) != -1); - MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FrameIndex), - Flags, - /*Offset=*/0, - MFI.getObjectSize(FrameIndex), - MFI.getObjectAlignment(FrameIndex)); + MachineMemOperand *MMO = + MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FrameIndex), + Flags, /*Offset=*/0, + MFI.getObjectSize(FrameIndex), + MFI.getObjectAlignment(FrameIndex)); NewMI->addMemOperand(MF, MMO); return NewMI; @@ -232,9 +233,8 @@ if (!NewMI) return 0; // Copy the memoperands from the load to the folded instruction. - for (std::list::iterator I = LoadMI->memoperands_begin(), - E = LoadMI->memoperands_end(); I != E; ++I) - NewMI->addMemOperand(MF, *I); + NewMI->setMemRefs(LoadMI->memoperands_begin(), + LoadMI->memoperands_end()); return NewMI; } Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Fri Sep 25 15:36:54 2009 @@ -1174,11 +1174,11 @@ // Must sure the base address satisfies i64 ld / st alignment requirement. if (!Op0->hasOneMemOperand() || - !Op0->memoperands_begin()->getValue() || - Op0->memoperands_begin()->isVolatile()) + !(*Op0->memoperands_begin())->getValue() || + (*Op0->memoperands_begin())->isVolatile()) return false; - unsigned Align = Op0->memoperands_begin()->getAlignment(); + unsigned Align = (*Op0->memoperands_begin())->getAlignment(); unsigned ReqAlign = STI->hasV6Ops() ? TD->getPrefTypeAlignment( Type::getInt64Ty(Op0->getParent()->getParent()->getFunction()->getContext())) Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Sep 25 15:36:54 2009 @@ -3377,7 +3377,8 @@ // 64-bit registers. In particular, sign extend the input value into the // 64-bit register with extsw, store the WHOLE 64-bit value into the stack // then lfd it and fcfid it. - MachineFrameInfo *FrameInfo = DAG.getMachineFunction().getFrameInfo(); + MachineFunction &MF = DAG.getMachineFunction(); + MachineFrameInfo *FrameInfo = MF.getFrameInfo(); int FrameIdx = FrameInfo->CreateStackObject(8, 8); EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); SDValue FIdx = DAG.getFrameIndex(FrameIdx, PtrVT); @@ -3386,11 +3387,13 @@ Op.getOperand(0)); // STD the extended value into the stack slot. - MachineMemOperand MO(PseudoSourceValue::getFixedStack(FrameIdx), - MachineMemOperand::MOStore, 0, 8, 8); - SDValue Store = DAG.getNode(PPCISD::STD_32, dl, MVT::Other, - DAG.getEntryNode(), Ext64, FIdx, - DAG.getMemOperand(MO)); + MachineMemOperand *MMO = + MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FrameIdx), + MachineMemOperand::MOStore, 0, 8, 8); + SDValue Ops[] = { DAG.getEntryNode(), Ext64, FIdx }; + SDValue Store = + DAG.getMemIntrinsicNode(PPCISD::STD_32, dl, DAG.getVTList(MVT::Other), + Ops, 4, MVT::i64, MMO); // Load the value as a double. SDValue Ld = DAG.getLoad(MVT::f64, dl, Store, FIdx, NULL, 0); @@ -4931,9 +4934,15 @@ if (BSwapOp.getValueType() == MVT::i16) BSwapOp = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, BSwapOp); - return DAG.getNode(PPCISD::STBRX, dl, MVT::Other, N->getOperand(0), - BSwapOp, N->getOperand(2), N->getOperand(3), - DAG.getValueType(N->getOperand(1).getValueType())); + SDValue Ops[] = { + N->getOperand(0), BSwapOp, N->getOperand(2), + DAG.getValueType(N->getOperand(1).getValueType()) + }; + return + DAG.getMemIntrinsicNode(PPCISD::STBRX, dl, DAG.getVTList(MVT::Other), + Ops, array_lengthof(Ops), + cast(N)->getMemoryVT(), + cast(N)->getMemOperand()); } break; case ISD::BSWAP: @@ -4944,17 +4953,15 @@ SDValue Load = N->getOperand(0); LoadSDNode *LD = cast(Load); // Create the byte-swapping load. - std::vector VTs; - VTs.push_back(MVT::i32); - VTs.push_back(MVT::Other); - SDValue MO = DAG.getMemOperand(LD->getMemOperand()); SDValue Ops[] = { LD->getChain(), // Chain LD->getBasePtr(), // Ptr - MO, // MemOperand DAG.getValueType(N->getValueType(0)) // VT }; - SDValue BSLoad = DAG.getNode(PPCISD::LBRX, dl, VTs, Ops, 4); + SDValue BSLoad = + DAG.getMemIntrinsicNode(PPCISD::LBRX, dl, + DAG.getVTList(MVT::i32, MVT::Other), Ops, 3, + LD->getMemoryVT(), LD->getMemOperand()); // If this is an i16 load, insert the truncate. SDValue ResVal = BSLoad; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Fri Sep 25 15:36:54 2009 @@ -41,8 +41,7 @@ FCTIDZ, FCTIWZ, /// STFIWX - The STFIWX instruction. The first operand is an input token - /// chain, then an f64 value to store, then an address to store it to, - /// then a SRCVALUE for the address. + /// chain, then an f64 value to store, then an address to store it to. STFIWX, // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking @@ -80,9 +79,6 @@ /// registers. EXTSW_32, - /// STD_32 - This is the STD instruction for use with "32-bit" registers. - STD_32, - /// CALL - A direct function call. CALL_Darwin, CALL_SVR4, @@ -124,18 +120,6 @@ /// an optional input flag argument. COND_BRANCH, - /// CHAIN = STBRX CHAIN, GPRC, Ptr, SRCVALUE, Type - This is a - /// byte-swapping store instruction. It byte-swaps the low "Type" bits of - /// the GPRC input, then stores it through Ptr. Type can be either i16 or - /// i32. - STBRX, - - /// GPRC, CHAIN = LBRX CHAIN, Ptr, SRCVALUE, Type - This is a - /// byte-swapping load instruction. It loads "Type" bits, byte swaps it, - /// then puts it in the bottom bits of the GPRC. TYPE can be either i16 - /// or i32. - LBRX, - // The following 5 instructions are used only as part of the // long double-to-int conversion sequence. @@ -170,7 +154,22 @@ /// operand #1 callee (register or absolute) /// operand #2 stack adjustment /// operand #3 optional in flag - TC_RETURN + TC_RETURN, + + /// STD_32 - This is the STD instruction for use with "32-bit" registers. + STD_32 = ISD::FIRST_TARGET_MEMORY_OPCODE, + + /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a + /// byte-swapping store instruction. It byte-swaps the low "Type" bits of + /// the GPRC input, then stores it through Ptr. Type can be either i16 or + /// i32. + STBRX, + + /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a + /// byte-swapping load instruction. It loads "Type" bits, byte swaps it, + /// then puts it in the bottom bits of the GPRC. TYPE can be either i16 + /// or i32. + LBRX }; } Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Fri Sep 25 15:36:54 2009 @@ -35,11 +35,11 @@ SDTCisVT<0, i32>, SDTCisVT<2, OtherVT> ]>; -def SDT_PPClbrx : SDTypeProfile<1, 3, [ - SDTCisVT<0, i32>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT>, SDTCisVT<3, OtherVT> +def SDT_PPClbrx : SDTypeProfile<1, 2, [ + SDTCisVT<0, i32>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT> ]>; -def SDT_PPCstbrx : SDTypeProfile<0, 4, [ - SDTCisVT<0, i32>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT>, SDTCisVT<3, OtherVT> +def SDT_PPCstbrx : SDTypeProfile<0, 3, [ + SDTCisVT<0, i32>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT> ]>; def SDT_PPClarx : SDTypeProfile<1, 1, [ @@ -741,10 +741,10 @@ def LHBRX : XForm_1<31, 790, (outs GPRC:$rD), (ins memrr:$src), "lhbrx $rD, $src", LdStGeneral, - [(set GPRC:$rD, (PPClbrx xoaddr:$src, srcvalue:$sv, i16))]>; + [(set GPRC:$rD, (PPClbrx xoaddr:$src, i16))]>; def LWBRX : XForm_1<31, 534, (outs GPRC:$rD), (ins memrr:$src), "lwbrx $rD, $src", LdStGeneral, - [(set GPRC:$rD, (PPClbrx xoaddr:$src, srcvalue:$sv, i32))]>; + [(set GPRC:$rD, (PPClbrx xoaddr:$src, i32))]>; def LFSX : XForm_25<31, 535, (outs F4RC:$frD), (ins memrr:$src), "lfsx $frD, $src", LdStLFDU, @@ -837,11 +837,11 @@ } def STHBRX: XForm_8<31, 918, (outs), (ins GPRC:$rS, memrr:$dst), "sthbrx $rS, $dst", LdStGeneral, - [(PPCstbrx GPRC:$rS, xoaddr:$dst, srcvalue:$dummy, i16)]>, + [(PPCstbrx GPRC:$rS, xoaddr:$dst, i16)]>, PPC970_DGroup_Cracked; def STWBRX: XForm_8<31, 662, (outs), (ins GPRC:$rS, memrr:$dst), "stwbrx $rS, $dst", LdStGeneral, - [(PPCstbrx GPRC:$rS, xoaddr:$dst, srcvalue:$dummy, i32)]>, + [(PPCstbrx GPRC:$rS, xoaddr:$dst, i32)]>, PPC970_DGroup_Cracked; def STFIWX: XForm_28<31, 983, (outs), (ins F8RC:$frS, memrr:$dst), Modified: llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h (original) +++ llvm/trunk/lib/Target/SystemZ/SystemZInstrBuilder.h Fri Sep 25 15:36:54 2009 @@ -23,6 +23,7 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/PseudoSourceValue.h" namespace llvm { @@ -113,11 +114,11 @@ Flags |= MachineMemOperand::MOLoad; if (TID.mayStore()) Flags |= MachineMemOperand::MOStore; - MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FI), - Flags, - Offset, - MFI.getObjectSize(FI), - MFI.getObjectAlignment(FI)); + MachineMemOperand *MMO = + MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI), + Flags, Offset, + MFI.getObjectSize(FI), + MFI.getObjectAlignment(FI)); return addOffset(MIB.addFrameIndex(FI), Offset) .addMemOperand(MMO); } Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Sep 25 15:36:54 2009 @@ -1465,11 +1465,14 @@ SDValue Tmp0, Tmp1, Tmp2, Tmp3, Tmp4; if (!SelectAddr(In1, In1, Tmp0, Tmp1, Tmp2, Tmp3, Tmp4)) return NULL; - SDValue LSI = Node->getOperand(4); // MemOperand - const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, In2L, In2H, LSI, Chain}; - return CurDAG->getMachineNode(Opc, Node->getDebugLoc(), - MVT::i32, MVT::i32, MVT::Other, Ops, - array_lengthof(Ops)); + MachineSDNode::mmo_iterator MemOp = MF->allocateMemRefsArray(1); + MemOp[0] = cast(Node)->getMemOperand(); + const SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, In2L, In2H, Chain}; + SDNode *ResNode = CurDAG->getMachineNode(Opc, Node->getDebugLoc(), + MVT::i32, MVT::i32, MVT::Other, Ops, + array_lengthof(Ops)); + cast(ResNode)->setMemRefs(MemOp, MemOp + 1); + return ResNode; } SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) { @@ -1605,15 +1608,18 @@ DebugLoc dl = Node->getDebugLoc(); SDValue Undef = SDValue(CurDAG->getMachineNode(TargetInstrInfo::IMPLICIT_DEF, dl, NVT), 0); - SDValue MemOp = CurDAG->getMemOperand(cast(Node)->getMemOperand()); + MachineSDNode::mmo_iterator MemOp = MF->allocateMemRefsArray(1); + MemOp[0] = cast(Node)->getMemOperand(); if (isInc || isDec) { - SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, MemOp, Chain }; - SDValue Ret = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 7), 0); + SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Chain }; + SDValue Ret = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 6), 0); + cast(Ret)->setMemRefs(MemOp, MemOp + 1); SDValue RetVals[] = { Undef, Ret }; return CurDAG->getMergeValues(RetVals, 2, dl).getNode(); } else { - SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Val, MemOp, Chain }; - SDValue Ret = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 8), 0); + SDValue Ops[] = { Tmp0, Tmp1, Tmp2, Tmp3, Tmp4, Val, Chain }; + SDValue Ret = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Other, Ops, 7), 0); + cast(Ret)->setMemRefs(MemOp, MemOp + 1); SDValue RetVals[] = { Undef, Ret }; return CurDAG->getMergeValues(RetVals, 2, dl).getNode(); } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 25 15:36:54 2009 @@ -6983,12 +6983,11 @@ Node->getOperand(2), DAG.getIntPtrConstant(0)); SDValue In2H = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, Node->getOperand(2), DAG.getIntPtrConstant(1)); - // This is a generalized SDNode, not an AtomicSDNode, so it doesn't - // have a MemOperand. Pass the info through as a normal operand. - SDValue LSI = DAG.getMemOperand(cast(Node)->getMemOperand()); - SDValue Ops[] = { Chain, In1, In2L, In2H, LSI }; + SDValue Ops[] = { Chain, In1, In2L, In2H }; SDVTList Tys = DAG.getVTList(MVT::i32, MVT::i32, MVT::Other); - SDValue Result = DAG.getNode(NewOp, dl, Tys, Ops, 5); + SDValue Result = + DAG.getMemIntrinsicNode(NewOp, dl, Tys, Ops, 4, MVT::i64, + cast(Node)->getMemOperand()); SDValue OpsF[] = { Result.getValue(0), Result.getValue(1)}; Results.push_back(DAG.getNode(ISD::BUILD_PAIR, dl, MVT::i64, OpsF, 2)); Results.push_back(Result.getValue(2)); @@ -7396,7 +7395,8 @@ (*MIB).addOperand(*argOpers[i]); MIB.addReg(t2); assert(bInstr->hasOneMemOperand() && "Unexpected number of memoperand"); - (*MIB).addMemOperand(*F, *bInstr->memoperands_begin()); + (*MIB).setMemRefs(bInstr->memoperands_begin(), + bInstr->memoperands_end()); MIB = BuildMI(newMBB, dl, TII->get(copyOpc), destOper.getReg()); MIB.addReg(EAXreg); @@ -7548,7 +7548,8 @@ (*MIB).addOperand(*argOpers[i]); assert(bInstr->hasOneMemOperand() && "Unexpected number of memoperand"); - (*MIB).addMemOperand(*F, *bInstr->memoperands_begin()); + (*MIB).setMemRefs(bInstr->memoperands_begin(), + bInstr->memoperands_end()); MIB = BuildMI(newMBB, dl, TII->get(copyOpc), t3); MIB.addReg(X86::EAX); @@ -7652,7 +7653,8 @@ (*MIB).addOperand(*argOpers[i]); MIB.addReg(t3); assert(mInstr->hasOneMemOperand() && "Unexpected number of memoperand"); - (*MIB).addMemOperand(*F, *mInstr->memoperands_begin()); + (*MIB).setMemRefs(mInstr->memoperands_begin(), + mInstr->memoperands_end()); MIB = BuildMI(newMBB, dl, TII->get(X86::MOV32rr), destOper.getReg()); MIB.addReg(X86::EAX); @@ -7747,6 +7749,11 @@ // In the XMM save block, save all the XMM argument registers. for (int i = 3, e = MI->getNumOperands(); i != e; ++i) { int64_t Offset = (i - 3) * 16 + VarArgsFPOffset; + MachineMemOperand *MMO = + F->getMachineMemOperand( + PseudoSourceValue::getFixedStack(RegSaveFrameIndex), + MachineMemOperand::MOStore, Offset, + /*Size=*/16, /*Align=*/16); BuildMI(XMMSaveMBB, DL, TII->get(X86::MOVAPSmr)) .addFrameIndex(RegSaveFrameIndex) .addImm(/*Scale=*/1) @@ -7754,10 +7761,7 @@ .addImm(/*Disp=*/Offset) .addReg(/*Segment=*/0) .addReg(MI->getOperand(i).getReg()) - .addMemOperand(MachineMemOperand( - PseudoSourceValue::getFixedStack(RegSaveFrameIndex), - MachineMemOperand::MOStore, Offset, - /*Size=*/16, /*Align=*/16)); + .addMemOperand(MMO); } F->DeleteMachineInstr(MI); // The pseudo instruction is gone now. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Sep 25 15:36:54 2009 @@ -204,17 +204,6 @@ LCMPXCHG_DAG, LCMPXCHG8_DAG, - // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, - // ATOMXOR64_DAG, ATOMNAND64_DAG, ATOMSWAP64_DAG - - // Atomic 64-bit binary operations. - ATOMADD64_DAG, - ATOMSUB64_DAG, - ATOMOR64_DAG, - ATOMXOR64_DAG, - ATOMAND64_DAG, - ATOMNAND64_DAG, - ATOMSWAP64_DAG, - // FNSTCW16m - Store FP control world into i16 memory. FNSTCW16m, @@ -248,7 +237,18 @@ // VASTART_SAVE_XMM_REGS - Save xmm argument registers to the stack, // according to %al. An operator is needed so that this can be expanded // with control flow. - VASTART_SAVE_XMM_REGS + VASTART_SAVE_XMM_REGS, + + // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, + // ATOMXOR64_DAG, ATOMNAND64_DAG, ATOMSWAP64_DAG - + // Atomic 64-bit binary operations. + ATOMADD64_DAG = ISD::FIRST_TARGET_MEMORY_OPCODE, + ATOMSUB64_DAG, + ATOMOR64_DAG, + ATOMXOR64_DAG, + ATOMAND64_DAG, + ATOMNAND64_DAG, + ATOMSWAP64_DAG }; } Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Fri Sep 25 15:36:54 2009 @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/PseudoSourceValue.h" namespace llvm { @@ -142,11 +143,11 @@ Flags |= MachineMemOperand::MOLoad; if (TID.mayStore()) Flags |= MachineMemOperand::MOStore; - MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FI), - Flags, - Offset, - MFI.getObjectSize(FI), - MFI.getObjectAlignment(FI)); + MachineMemOperand *MMO = + MF.getMachineMemOperand(PseudoSourceValue::getFixedStack(FI), + Flags, Offset, + MFI.getObjectSize(FI), + MFI.getObjectAlignment(FI)); return addOffset(MIB.addFrameIndex(FI), Offset) .addMemOperand(MMO); } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Sep 25 15:36:54 2009 @@ -2296,7 +2296,7 @@ // Determine the alignment of the load. unsigned Alignment = 0; if (LoadMI->hasOneMemOperand()) - Alignment = LoadMI->memoperands_begin()->getAlignment(); + Alignment = (*LoadMI->memoperands_begin())->getAlignment(); else switch (LoadMI->getOpcode()) { case X86::V_SET0: @@ -2567,7 +2567,7 @@ std::vector AfterOps; DebugLoc dl = N->getDebugLoc(); unsigned NumOps = N->getNumOperands(); - for (unsigned i = 0; i != NumOps-2; ++i) { + for (unsigned i = 0; i != NumOps-1; ++i) { SDValue Op = N->getOperand(i); if (i >= Index-NumDefs && i < Index-NumDefs + X86AddrNumOperands) AddrOps.push_back(Op); @@ -2576,8 +2576,6 @@ else if (i > Index-NumDefs) AfterOps.push_back(Op); } - SDValue MemOp = N->getOperand(NumOps-2); - AddrOps.push_back(MemOp); SDValue Chain = N->getOperand(NumOps-1); AddrOps.push_back(Chain); @@ -2615,9 +2613,7 @@ // Emit the store instruction. if (FoldedStore) { AddrOps.pop_back(); - AddrOps.pop_back(); AddrOps.push_back(SDValue(NewNode, 0)); - AddrOps.push_back(MemOp); AddrOps.push_back(Chain); bool isAligned = (RI.getStackAlignment() >= 16) || RI.needsStackRealignment(MF); Modified: llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll Fri Sep 25 15:36:54 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 162 +; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 159 %"struct.Adv5::Ekin<3>" = type <{ i8 }> %"struct.Adv5::X::Energyflux<3>" = type { double } Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=82794&r1=82793&r2=82794&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Fri Sep 25 15:36:54 2009 @@ -1135,24 +1135,18 @@ emitCode("}"); } - // Generate MemOperandSDNodes nodes for each memory accesses covered by + // Populate MemRefs with entries for each memory accesses covered by // this pattern. - if (II.mayLoad | II.mayStore) { - std::vector::const_iterator mi, mie; - for (mi = LSI.begin(), mie = LSI.end(); mi != mie; ++mi) { - std::string LSIName = "LSI_" + *mi; - emitCode("SDValue " + LSIName + " = " - "CurDAG->getMemOperand(cast(" + - *mi + ")->getMemOperand());"); - if (GenDebug) { - emitCode("CurDAG->setSubgraphColor(" + LSIName +".getNode(), \"yellow\");"); - emitCode("CurDAG->setSubgraphColor(" + LSIName +".getNode(), \"black\");"); - } - if (IsVariadic) - emitCode("Ops" + utostr(OpsNo) + ".push_back(" + LSIName + ");"); - else - AllOps.push_back(LSIName); - } + if (isRoot && !LSI.empty()) { + std::string MemRefs = "MemRefs" + utostr(OpsNo); + emitCode("MachineSDNode::mmo_iterator " + MemRefs + " = " + "MF->allocateMemRefsArray(" + utostr(LSI.size()) + ");"); + for (unsigned i = 0, e = LSI.size(); i != e; ++i) + emitCode(MemRefs + "[" + utostr(i) + "] = " + "cast(" + LSI[i] + ")->getMemOperand();"); + After.push_back("cast(ResNode)->setMemRefs(" + + MemRefs + ", " + MemRefs + " + " + utostr(LSI.size()) + + ");"); } if (NodeHasChain) { @@ -1965,7 +1959,6 @@ << " assert(!N.isMachineOpcode() && \"Node already selected!\");\n" << " break;\n" << " case ISD::EntryToken: // These nodes remain the same.\n" - << " case ISD::MEMOPERAND:\n" << " case ISD::BasicBlock:\n" << " case ISD::Register:\n" << " case ISD::HANDLENODE:\n" From deeppatel1987 at gmail.com Fri Sep 25 15:40:48 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Fri, 25 Sep 2009 20:40:48 +0000 Subject: [llvm-commits] [llvm] r82778 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: References: <200909251723.n8PHNNl3009740@zion.cs.uiuc.edu> <305d6f60909251137w41e535ck4fc8adb9e2f96bf9@mail.gmail.com> Message-ID: <305d6f60909251340v7d89ce80ja890d40b6d87142e@mail.gmail.com> On Fri, Sep 25, 2009 at 8:22 PM, Eli Friedman wrote: > On Fri, Sep 25, 2009 at 11:37 AM, Sandeep Patel wrote: >> Why aren't the front-ends responsible for selecting the intrinsics again? > > Because there's no compelling reason to move it to the frontend... and > there aren't corresponding intrinsics for some of the math functions. Only the frontend knows that the function matches the proper signature and was declared in the proper header file. Doing matching by name like this in the backend is just bound to cause trouble for freestanding and kernel folks (like me). deep From jyasskin at google.com Fri Sep 25 15:41:19 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 13:41:19 -0700 Subject: [llvm-commits] [PATCH] Provide debug syms in release builds In-Reply-To: References: <6a8523d60909251143y1e2fa69dp3f0b168dbd4c1738@mail.gmail.com> Message-ID: New patch. Does this look better? (I'd already submitted the first one on Chris's review, so this is just relative to that.) Also at http://codereview.appspot.com/124047 On Fri, Sep 25, 2009 at 11:48 AM, Jeffrey Yasskin wrote: > It looked like DEBUG_RUNTIME only affected .bc files, which can only > be used if the compiler is part of the runtime. But I can change it. > Do DEBUG_SYMBOLS and --enable-debug-symbols work for you? > > On Fri, Sep 25, 2009 at 11:43 AM, Daniel Dunbar wrote: >> DEBUG_RUNTIME is something else entirely, and should not be conflated >> with the behavior you want (it is about RUNTIME pieces, which are >> conceptually part of the target, whereas you are wanting something for >> the host). >> >> I think this should come in under a different Makefile variable and >> configure option. >> >> ?- Daniel >> >> On Fri, Sep 25, 2009 at 12:27 AM, Jeffrey Yasskin wrote: >>> This patch causes the --enable-debug-runtime configure flag and the >>> DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's >>> objects. Without this, it's very hard to debug crashes that happen in >>> Release-Asserts mode but not Debug mode. >>> >>> Jeffrey >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: debug_symbols.patch Type: application/octet-stream Size: 1754 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090925/e94e3fd8/attachment.obj From bob.wilson at apple.com Fri Sep 25 15:51:26 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 25 Sep 2009 20:51:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r82795 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Message-ID: <200909252051.n8PKpRZX005048@zion.cs.uiuc.edu> Author: bwilson Date: Fri Sep 25 15:51:26 2009 New Revision: 82795 URL: http://llvm.org/viewvc/llvm-project?rev=82795&view=rev Log: Revert fix for pr5037 (svn 82787). It broke the NEON-specific mangling for C++. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=82795&r1=82794&r2=82795&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Fri Sep 25 15:51:26 2009 @@ -16734,6 +16734,17 @@ return VALID_NEON_DREG_MODE (mode) || VALID_NEON_QREG_MODE (mode); } +/* APPLE LOCAL begin 7083296 Build without warnings. */ +static tree +make_neon_float_type (void) +{ + tree neon_float_type_node = make_node (REAL_TYPE); + TYPE_PRECISION (neon_float_type_node) = FLOAT_TYPE_SIZE; + layout_type (neon_float_type_node); + return neon_float_type_node; +} +/* APPLE LOCAL end 7083296 Build without warnings. */ + /* LLVM LOCAL begin multi-vector types */ #ifdef ENABLE_LLVM /* Create a new builtin struct type containing NUMVECS fields (where NUMVECS @@ -16869,8 +16880,7 @@ tree neon_intSI_type_node = make_signed_type (GET_MODE_PRECISION (SImode)); tree neon_intDI_type_node = make_signed_type (GET_MODE_PRECISION (DImode)); /* APPLE LOCAL begin 7083296 Build without warnings. */ - /* LLVM LOCAL pr5037 */ - tree neon_float_type_node = build_variant_type_copy (float_type_node); + tree neon_float_type_node = make_neon_float_type (); /* APPLE LOCAL end 7083296 Build without warnings. */ tree intQI_pointer_node = build_pointer_type (neon_intQI_type_node); From dalej at apple.com Fri Sep 25 15:54:50 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 20:54:50 -0000 Subject: [llvm-commits] [llvm] r82796 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstCombine/no-negzero.ll Message-ID: <200909252054.n8PKso38005483@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 25 15:54:50 2009 New Revision: 82796 URL: http://llvm.org/viewvc/llvm-project?rev=82796&view=rev Log: Handle sqrt in CannotBeNegativeZero. absf and absl appear to be misspellings, removed in favor of fabs*. Added: llvm/trunk/test/Transforms/InstCombine/no-negzero.ll Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=82796&r1=82795&r2=82796&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri Sep 25 15:54:50 2009 @@ -840,9 +840,13 @@ if (F->isDeclaration()) { // abs(x) != -0.0 if (F->getName() == "abs") return true; - // abs[lf](x) != -0.0 - if (F->getName() == "absf") return true; - if (F->getName() == "absl") return true; + // fabs[lf](x) != -0.0 + if (F->getName() == "fabs") return true; + if (F->getName() == "fabsf") return true; + if (F->getName() == "fabsl") return true; + if (F->getName() == "sqrt" || F->getName() == "sqrtf" || + F->getName() == "sqrtl") + return CannotBeNegativeZero(CI->getOperand(1), Depth+1); } } Added: llvm/trunk/test/Transforms/InstCombine/no-negzero.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/no-negzero.ll?rev=82796&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/no-negzero.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/no-negzero.ll Fri Sep 25 15:54:50 2009 @@ -0,0 +1,33 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s +; ModuleID = '3555a.c' +; sqrt(fabs) cannot be negative zero, so we should eliminate the fadd. +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9.8" + +; CHECK: @mysqrt +; CHECK-NOT: fadd +; CHECK: ret +define double @mysqrt(double %x) nounwind { +entry: + %x_addr = alloca double ; [#uses=2] + %retval = alloca double, align 8 ; [#uses=2] + %0 = alloca double, align 8 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store double %x, double* %x_addr + %1 = load double* %x_addr, align 8 ; [#uses=1] + %2 = call double @fabs(double %1) nounwind readnone ; [#uses=1] + %3 = call double @sqrt(double %2) nounwind readonly ; [#uses=1] + %4 = fadd double %3, 0.000000e+00 ; [#uses=1] + store double %4, double* %0, align 8 + %5 = load double* %0, align 8 ; [#uses=1] + store double %5, double* %retval, align 8 + br label %return + +return: ; preds = %entry + %retval1 = load double* %retval ; [#uses=1] + ret double %retval1 +} + +declare double @fabs(double) + +declare double @sqrt(double) nounwind readonly From dalej at apple.com Fri Sep 25 16:02:07 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 25 Sep 2009 14:02:07 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r82640 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <2909ED8F-1969-44A3-8018-5F033AA59ACE@apple.com> References: <200909231850.n8NIoWV6017404@zion.cs.uiuc.edu> <69095BD4-0679-46CA-AE5C-8DEE66A67308@apple.com> <5F4D6E81-311D-4BA1-AFA7-53B1EF4BCDB4@apple.com> <869FAED3-006E-4AA4-9369-4D61405DF097@apple.com> <2909ED8F-1969-44A3-8018-5F033AA59ACE@apple.com> Message-ID: <2FC33514-F1E3-4803-8697-59D6D46F83E8@apple.com> I haven't tried to touch clang. I think the rest of it is done. (Should probably mention sqrt, and other math intrinsics, are readonly not readnone because of: // These functions do not actually read memory, but they are sensitive to the // rounding mode. This needs to be modelled separately; in the meantime // declaring them as reading memory is conservatively correct.) On Sep 23, 2009, at 11:04 PM, Chris Lattner wrote: > On Sep 23, 2009, at 6:10 PM, Evan Cheng wrote: > On Sep 23, 2009, at 3:21 PM, Dale Johannesen wrote: >>> On Sep 23, 2009, at 3:18 PMPDT, Evan Cheng wrote: >>> >>>> Are we generating a call to sqrt now? If so, that's bad. We should >>>> be using SSE sqrts* instructions. >>> >>> Agreed. My proposed semantic change would fix that. >> >> You mean change to llvm.sqrt and then llvm-gcc can switch bad to >> generating the intrinsic? It seems like the current fix is not what >> we >> want. Perhaps we should revert it first? >> >> According to Chris, the semantics of sqrt of negative value is >> defined >> and this is just some optimization bug. > > Sorry, I'm just catching up on this now. There are a couple of > things that confuse the issue, but I'll just try to keep it "to the > point" instead of rambling about history. > > 1. I did tell Evan that sqrt is defined on negative number, but I > misunderstood and didn't think about llvm.sqrt. Please disregard my > comment Evan. llvm.sqrt should be undefined on negative numbers as > langref says, and llvm-gcc/clang should only transform sqrt to > llvm.sqrt if the appropriate "I don't care about fp semantics" flag > is set. > > 2. Dale's patch to llvm-gcc is ok, but it would be better to still > do the transformation when -ffast-math is specified or whatever the > more precise "nan's aren't generated" flag is. We should do the > same thing for clang as well. > > 3. Please make sure that llvm-gcc/clang on the mac (and other > targets with -fno-math-errno) are producing a call to sqrt that is > marked as readnone. Given this, the mid-level optimizer should > hoist and cse the calls to sqrt just as well as it did calls to > llvm.sqrt. > > 4. The constant folding of llvm.sqrt(-123) -> 0 is ok because the > intrinsic really is undefined on negative. The constant folding of > sqrt(-123) doesn't fold if the input is negative, so it will just > not optimize the curious case. > > 5. Please make the X86 backend compile calls to readonly/readnone > "sqrt" produce a sqrtsd (etc) instruction. We really don't want to > get a function call on the mac (or other x86 target with -fno-math- > errno). Like malloc, if someone cares about -fno-builtin-sqrt, they > can solve the general problem. We already constant fold "real sqrt" > calls in Analysis/ConstantFolding.cpp anyway. > > 6. Please add handling of "real sqrt" to llvm::CannotBeNegativeZero > to match the handling of llvm.sqrt. > > Thanks! > > -Chris From jyasskin at google.com Fri Sep 25 16:07:21 2009 From: jyasskin at google.com (Jeffrey Yasskin) Date: Fri, 25 Sep 2009 21:07:21 -0000 Subject: [llvm-commits] [llvm] r82797 - in /llvm/trunk: autoconf/configure.ac cmake/config-ix.cmake configure include/llvm/Config/config.h.cmake include/llvm/Config/config.h.in unittests/Support/CommandLineTest.cpp Message-ID: <200909252107.n8PL7Lsa007157@zion.cs.uiuc.edu> Author: jyasskin Date: Fri Sep 25 16:07:20 2009 New Revision: 82797 URL: http://llvm.org/viewvc/llvm-project?rev=82797&view=rev Log: Fix a compile failure introduced by r82675 on MinGW which doesn't have setenv(). This patch just disables the test rather than getting putenv() to work. Thanks to Sandeep Patel for reporting the problem. Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/cmake/config-ix.cmake llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.cmake llvm/trunk/include/llvm/Config/config.h.in llvm/trunk/unittests/Support/CommandLineTest.cpp Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=82797&r1=82796&r2=82797&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Fri Sep 25 16:07:20 2009 @@ -1080,7 +1080,7 @@ AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup ]) -AC_CHECK_FUNCS([strerror strerror_r strerror_s ]) +AC_CHECK_FUNCS([strerror strerror_r strerror_s setenv ]) AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp]) AC_C_PRINTF_A Modified: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=82797&r1=82796&r2=82797&view=diff ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (original) +++ llvm/trunk/cmake/config-ix.cmake Fri Sep 25 16:07:20 2009 @@ -71,6 +71,7 @@ check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) check_symbol_exists(strerror_s string.h HAVE_STRERROR_S) +check_symbol_exists(setenv stdlib.h HAVE_SETENV) check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) if( LLVM_USING_GLIBC ) Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=82797&r1=82796&r2=82797&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Fri Sep 25 16:07:20 2009 @@ -32291,7 +32291,8 @@ -for ac_func in strerror strerror_r strerror_s + +for ac_func in strerror strerror_r strerror_s setenv do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 Modified: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=82797&r1=82796&r2=82797&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (original) +++ llvm/trunk/include/llvm/Config/config.h.cmake Fri Sep 25 16:07:20 2009 @@ -291,6 +291,9 @@ /* Define to 1 if you have the `sbrk' function. */ #undef HAVE_SBRK +/* Define to 1 if you have the `setenv' function. */ +#cmakedefine HAVE_SETENV ${HAVE_SETENV} + /* Define to 1 if you have the `setjmp' function. */ #undef HAVE_SETJMP Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=82797&r1=82796&r2=82797&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Fri Sep 25 16:07:20 2009 @@ -321,6 +321,9 @@ /* Define to 1 if you have the `sbrk' function. */ #undef HAVE_SBRK +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + /* Define to 1 if you have the `setjmp' function. */ #undef HAVE_SETJMP Modified: llvm/trunk/unittests/Support/CommandLineTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=82797&r1=82796&r2=82797&view=diff ============================================================================== --- llvm/trunk/unittests/Support/CommandLineTest.cpp (original) +++ llvm/trunk/unittests/Support/CommandLineTest.cpp Fri Sep 25 16:07:20 2009 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/CommandLine.h" +#include "llvm/Config/config.h" #include "gtest/gtest.h" @@ -24,17 +25,26 @@ : name(name) { const char *old_value = getenv(name); EXPECT_EQ(NULL, old_value) << old_value; +#if HAVE_SETENV setenv(name, value, true); +#else +# define SKIP_ENVIRONMENT_TESTS +#endif } ~TempEnvVar() { +#if HAVE_SETENV + // Assume setenv and unsetenv come together. unsetenv(name); +#endif } private: const char *const name; }; +#ifndef SKIP_ENVIRONMENT_TESTS + const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; cl::opt EnvironmentTestOption("env-test-opt"); @@ -45,4 +55,6 @@ EXPECT_EQ("hello", EnvironmentTestOption); } +#endif // SKIP_ENVIRONMENT_TESTS + } // anonymous namespace From snaroff at apple.com Fri Sep 25 16:34:35 2009 From: snaroff at apple.com (Steve Naroff) Date: Fri, 25 Sep 2009 21:34:35 -0000 Subject: [llvm-commits] [llvm] r82799 - /llvm/tags/cremebrulee/cremebrulee-9/ Message-ID: <200909252134.n8PLYZeT010649@zion.cs.uiuc.edu> Author: snaroff Date: Fri Sep 25 16:34:35 2009 New Revision: 82799 URL: http://llvm.org/viewvc/llvm-project?rev=82799&view=rev Log: Tagging cremebrulee-9. Added: llvm/tags/cremebrulee/cremebrulee-9/ - copied from r82798, llvm/trunk/ From snaroff at apple.com Fri Sep 25 16:35:07 2009 From: snaroff at apple.com (Steve Naroff) Date: Fri, 25 Sep 2009 21:35:07 -0000 Subject: [llvm-commits] [llvm] r82801 - /llvm/tags/cremebrulee/cremebrulee-8/ Message-ID: <200909252135.n8PLZ80s010731@zion.cs.uiuc.edu> Author: snaroff Date: Fri Sep 25 16:35:07 2009 New Revision: 82801 URL: http://llvm.org/viewvc/llvm-project?rev=82801&view=rev Log: Removing cremebrulee-8. Removed: llvm/tags/cremebrulee/cremebrulee-8/ From evan.cheng at apple.com Fri Sep 25 16:38:12 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Sep 2009 21:38:12 -0000 Subject: [llvm-commits] [llvm] r82803 - in /llvm/trunk: lib/CodeGen/LLVMTargetMachine.cpp test/CodeGen/ARM/2009-08-21-PostRAKill.ll test/CodeGen/ARM/2009-08-21-PostRAKill2.ll test/CodeGen/ARM/2009-08-21-PostRAKill3.ll test/CodeGen/ARM/2009-08-21-PostRAKill4.ll test/CodeGen/X86/break-anti-dependencies.ll Message-ID: <200909252138.n8PLcCoN011188@zion.cs.uiuc.edu> Author: evancheng Date: Fri Sep 25 16:38:11 2009 New Revision: 82803 URL: http://llvm.org/viewvc/llvm-project?rev=82803&view=rev Log: Flip -disable-post-RA-scheduler to -post-RA-scheduler. Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill.ll llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll llvm/trunk/test/CodeGen/X86/break-anti-dependencies.ll Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=82803&r1=82802&r2=82803&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Fri Sep 25 16:38:11 2009 @@ -45,11 +45,13 @@ cl::desc("Verify generated machine code"), cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL)); -// When this works it will be on by default. +// This is not enabled by default due to 1) high compile time cost, 2) it's not +// beneficial to all targets. The plan is to let targets decide whether this +// is enabled. static cl::opt -DisablePostRAScheduler("disable-post-RA-scheduler", - cl::desc("Disable scheduling after register allocation"), - cl::init(true)); +EnablePostRAScheduler("post-RA-scheduler", + cl::desc("Enable scheduling after register allocation"), + cl::init(false)); // Enable or disable FastISel. Both options are needed, because // FastISel is enabled by default with -fast, and we wish to be @@ -324,7 +326,7 @@ printAndVerify(PM); // Second pass scheduler. - if (OptLevel != CodeGenOpt::None && !DisablePostRAScheduler) { + if (OptLevel != CodeGenOpt::None && EnablePostRAScheduler) { PM.add(createPostRAScheduler()); printAndVerify(PM); } Modified: llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill.ll?rev=82803&r1=82802&r2=82803&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill.ll Fri Sep 25 16:38:11 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=arm -mattr=+vfp2 -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards +; RUN: llc < %s -march=arm -mattr=+vfp2 -mcpu=cortex-a8 -post-RA-scheduler -avoid-hazards ; ModuleID = '' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" Modified: llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll?rev=82803&r1=82802&r2=82803&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll Fri Sep 25 16:38:11 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards +; RUN: llc < %s -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -post-RA-scheduler=0 -avoid-hazards ; ModuleID = '' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" Modified: llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll?rev=82803&r1=82802&r2=82803&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll Fri Sep 25 16:38:11 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards +; RUN: llc < %s -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -post-RA-scheduler=0 -avoid-hazards ; ModuleID = '' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" Modified: llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll?rev=82803&r1=82802&r2=82803&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll (original) +++ llvm/trunk/test/CodeGen/ARM/2009-08-21-PostRAKill4.ll Fri Sep 25 16:38:11 2009 @@ -1,4 +1,4 @@ -; RUN: llc < %s -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards +; RUN: llc < %s -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -post-RA-scheduler=0 -avoid-hazards ; ModuleID = '' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" Modified: llvm/trunk/test/CodeGen/X86/break-anti-dependencies.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/break-anti-dependencies.ll?rev=82803&r1=82802&r2=82803&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/break-anti-dependencies.ll (original) +++ llvm/trunk/test/CodeGen/X86/break-anti-dependencies.ll Fri Sep 25 16:38:11 2009 @@ -1,7 +1,7 @@ -; RUN: llc < %s -march=x86-64 -disable-post-RA-scheduler=false -break-anti-dependencies=false > %t +; RUN: llc < %s -march=x86-64 -post-RA-scheduler -break-anti-dependencies=false > %t ; RUN: grep {%xmm0} %t | count 14 ; RUN: not grep {%xmm1} %t -; RUN: llc < %s -march=x86-64 -disable-post-RA-scheduler=false -break-anti-dependencies > %t +; RUN: llc < %s -march=x86-64 -post-RA-scheduler -break-anti-dependencies > %t ; RUN: grep {%xmm0} %t | count 7 ; RUN: grep {%xmm1} %t | count 7 From evan.cheng at apple.com Fri Sep 25 16:43:58 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Sep 2009 21:43:58 -0000 Subject: [llvm-commits] [test-suite] r82804 - /test-suite/trunk/Makefile.programs Message-ID: <200909252143.n8PLhx1h011890@zion.cs.uiuc.edu> Author: evancheng Date: Fri Sep 25 16:43:58 2009 New Revision: 82804 URL: http://llvm.org/viewvc/llvm-project?rev=82804&view=rev Log: ARM / Thumb llcbeta is now -post-RA-scheduler. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=82804&r1=82803&r2=82804&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Fri Sep 25 16:43:58 2009 @@ -245,12 +245,15 @@ LLCBETAOPTION := -enable-sparc-v9-insts endif ifeq ($(ARCH),ARM) -LLCBETAOPTION := -schedule-livein-copies +LLCBETAOPTION := -post-RA-scheduler +#-arm-pre-alloc-loadstore-opti +#-schedule-livein-copies #-new-coalescer-heuristic=true #-march=thumb endif ifeq ($(ARCH),THUMB) -LLCBETAOPTION := --enable-thumb-reg-scavenging +LLCBETAOPTION := -post-RA-scheduler +#--enable-thumb-reg-scavenging endif print-llcbeta-option: From evan.cheng at apple.com Fri Sep 25 16:44:53 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 25 Sep 2009 21:44:53 -0000 Subject: [llvm-commits] [llvm] r82805 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200909252144.n8PLirdf012011@zion.cs.uiuc.edu> Author: evancheng Date: Fri Sep 25 16:44:53 2009 New Revision: 82805 URL: http://llvm.org/viewvc/llvm-project?rev=82805&view=rev Log: Code clean up and prepare for Thumb2 support. No functionality changes. 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=82805&r1=82804&r2=82805&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Fri Sep 25 16:44:53 2009 @@ -1071,6 +1071,7 @@ const TargetRegisterInfo *TRI; const ARMSubtarget *STI; MachineRegisterInfo *MRI; + MachineFunction *MF; virtual bool runOnMachineFunction(MachineFunction &Fn); @@ -1083,7 +1084,8 @@ unsigned &NewOpc, unsigned &EvenReg, unsigned &OddReg, unsigned &BaseReg, unsigned &OffReg, unsigned &Offset, - unsigned &PredReg, ARMCC::CondCodes &Pred); + unsigned &PredReg, ARMCC::CondCodes &Pred, + bool &isT2); bool RescheduleOps(MachineBasicBlock *MBB, SmallVector &Ops, unsigned Base, bool isLd, @@ -1099,6 +1101,7 @@ TRI = Fn.getTarget().getRegisterInfo(); STI = &Fn.getTarget().getSubtarget(); MRI = &Fn.getRegInfo(); + MF = &Fn; bool Modified = false; for (MachineFunction::iterator MFI = Fn.begin(), E = Fn.end(); MFI != E; @@ -1162,15 +1165,29 @@ unsigned &OddReg, unsigned &BaseReg, unsigned &OffReg, unsigned &Offset, unsigned &PredReg, - ARMCC::CondCodes &Pred) { + ARMCC::CondCodes &Pred, + bool &isT2) { // FIXME: FLDS / FSTS -> FLDD / FSTD + unsigned Scale = 1; unsigned Opcode = Op0->getOpcode(); if (Opcode == ARM::LDR) NewOpc = ARM::LDRD; else if (Opcode == ARM::STR) NewOpc = ARM::STRD; - else - return 0; + else if (Opcode == ARM::t2LDRi8 || Opcode == ARM::t2LDRi12) { + NewOpc = ARM::t2LDRDi8; + Scale = 4; + isT2 = true; + } else if (Opcode == ARM::t2STRi8 || Opcode == ARM::t2STRi12) { + NewOpc = ARM::t2STRDi8; + Scale = 4; + isT2 = true; + } else + return false; + + if (!isT2 && + (Op0->getOperand(2).getReg() != Op1->getOperand(2).getReg())) + return false; // Must sure the base address satisfies i64 ld / st alignment requirement. if (!Op0->hasOneMemOperand() || @@ -1179,10 +1196,10 @@ return false; unsigned Align = (*Op0->memoperands_begin())->getAlignment(); + Function *Func = MF->getFunction(); unsigned ReqAlign = STI->hasV6Ops() - ? TD->getPrefTypeAlignment( - Type::getInt64Ty(Op0->getParent()->getParent()->getFunction()->getContext())) - : 8; // Pre-v6 need 8-byte align + ? TD->getPrefTypeAlignment(Type::getInt64Ty(Func->getContext())) + : 8; // Pre-v6 need 8-byte align if (Align < ReqAlign) return false; @@ -1193,16 +1210,21 @@ AddSub = ARM_AM::sub; OffImm = - OffImm; } - if (OffImm >= 256) // 8 bits + int Limit = (1 << 8) * Scale; + if (OffImm >= Limit || (OffImm & (Scale-1))) return false; - Offset = ARM_AM::getAM3Opc(AddSub, OffImm); + if (isT2) + Offset = OffImm; + else + Offset = ARM_AM::getAM3Opc(AddSub, OffImm); EvenReg = Op0->getOperand(0).getReg(); OddReg = Op1->getOperand(0).getReg(); if (EvenReg == OddReg) return false; BaseReg = Op0->getOperand(1).getReg(); - OffReg = Op0->getOperand(2).getReg(); + if (!isT2) + OffReg = Op0->getOperand(2).getReg(); Pred = llvm::getInstrPredicate(Op0, PredReg); dl = Op0->getDebugLoc(); return true; @@ -1255,7 +1277,7 @@ LastOffset = Offset; LastBytes = Bytes; LastOpcode = Opcode; - if (++NumMove == 8) // FIXME: Tune + if (++NumMove == 8) // FIXME: Tune this limit. break; } @@ -1291,29 +1313,36 @@ unsigned EvenReg = 0, OddReg = 0; unsigned BaseReg = 0, OffReg = 0, PredReg = 0; ARMCC::CondCodes Pred = ARMCC::AL; + bool isT2 = false; unsigned NewOpc = 0; unsigned Offset = 0; DebugLoc dl; if (NumMove == 2 && CanFormLdStDWord(Op0, Op1, dl, NewOpc, EvenReg, OddReg, BaseReg, OffReg, - Offset, PredReg, Pred)) { + Offset, PredReg, Pred, isT2)) { Ops.pop_back(); Ops.pop_back(); // Form the pair instruction. if (isLd) { - BuildMI(*MBB, InsertPos, dl, TII->get(NewOpc)) + MachineInstrBuilder MIB = BuildMI(*MBB, InsertPos, + dl, TII->get(NewOpc)) .addReg(EvenReg, RegState::Define) .addReg(OddReg, RegState::Define) - .addReg(BaseReg).addReg(0).addImm(Offset) - .addImm(Pred).addReg(PredReg); + .addReg(BaseReg); + if (!isT2) + MIB.addReg(OffReg); + MIB.addImm(Offset).addImm(Pred).addReg(PredReg); ++NumLDRDFormed; } else { - BuildMI(*MBB, InsertPos, dl, TII->get(NewOpc)) + MachineInstrBuilder MIB = BuildMI(*MBB, InsertPos, + dl, TII->get(NewOpc)) .addReg(EvenReg) .addReg(OddReg) - .addReg(BaseReg).addReg(0).addImm(Offset) - .addImm(Pred).addReg(PredReg); + .addReg(BaseReg); + if (!isT2) + MIB.addReg(OffReg); + MIB.addImm(Offset).addImm(Pred).addReg(PredReg); ++NumSTRDFormed; } MBB->erase(Op0); @@ -1369,9 +1398,8 @@ if (llvm::getInstrPredicate(MI, PredReg) != ARMCC::AL) continue; - int Opcode = MI->getOpcode(); - bool isLd = Opcode == ARM::LDR || - Opcode == ARM::FLDS || Opcode == ARM::FLDD; + int Opc = MI->getOpcode(); + bool isLd = isi32Load(Opc) || Opc == ARM::FLDS || Opc == ARM::FLDD; unsigned Base = MI->getOperand(1).getReg(); int Offset = getMemoryOpOffset(MI); From snaroff at apple.com Fri Sep 25 16:46:25 2009 From: snaroff at apple.com (Steve Naroff) Date: Fri, 25 Sep 2009 21:46:25 -0000 Subject: [llvm-commits] [llvm] r82808 - /llvm/tags/cremebrulee/cremebrulee-9/trunk/ Message-ID: <200909252146.n8PLkQTr012242@zion.cs.uiuc.edu> Author: snaroff Date: Fri Sep 25 16:46:25 2009 New Revision: 82808 URL: http://llvm.org/viewvc/llvm-project?rev=82808&view=rev Log: Tagging cremebrulee-9. Added: llvm/tags/cremebrulee/cremebrulee-9/trunk/ - copied from r82807, llvm/trunk/ From gohman at apple.com Fri Sep 25 17:24:52 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 22:24:52 -0000 Subject: [llvm-commits] [llvm] r82811 - /llvm/trunk/lib/CodeGen/MachineSink.cpp Message-ID: <200909252224.n8PMOqCx017087@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 25 17:24:52 2009 New Revision: 82811 URL: http://llvm.org/viewvc/llvm-project?rev=82811&view=rev Log: Simplify this code by using use_iterator instead of reg_iterator and skipping the defs. Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSink.cpp?rev=82811&r1=82810&r2=82811&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineSink.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineSink.cpp Fri Sep 25 17:24:52 2009 @@ -70,10 +70,8 @@ MachineBasicBlock *MBB) const { assert(TargetRegisterInfo::isVirtualRegister(Reg) && "Only makes sense for vregs"); - for (MachineRegisterInfo::reg_iterator I = RegInfo->reg_begin(Reg), - E = RegInfo->reg_end(); I != E; ++I) { - if (I.getOperand().isDef()) continue; // ignore def. - + for (MachineRegisterInfo::use_iterator I = RegInfo->use_begin(Reg), + E = RegInfo->use_end(); I != E; ++I) { // Determine the block of the use. MachineInstr *UseInst = &*I; MachineBasicBlock *UseBlock = UseInst->getParent(); From gohman at apple.com Fri Sep 25 17:26:13 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 22:26:13 -0000 Subject: [llvm-commits] [llvm] r82812 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp MachineRegisterInfo.cpp RegAllocLinearScan.cpp Message-ID: <200909252226.n8PMQDbC017265@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 25 17:26:13 2009 New Revision: 82812 URL: http://llvm.org/viewvc/llvm-project?rev=82812&view=rev Log: Simplify a few more uses of reg_iterator. Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=82812&r1=82811&r2=82812&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Sep 25 17:26:13 2009 @@ -1087,11 +1087,9 @@ SmallVector &OtherCopies) { bool HaveConflict = false; unsigned NumIdent = 0; - for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(SrcInt.reg), - re = mri_->reg_end(); ri != re; ++ri) { + for (MachineRegisterInfo::def_iterator ri = mri_->def_begin(SrcInt.reg), + re = mri_->def_end(); ri != re; ++ri) { MachineOperand &O = ri.getOperand(); - if (!O.isDef()) - continue; MachineInstr *MI = &*ri; unsigned SrcReg, DstReg, SrcSubReg, DstSubReg; Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=82812&r1=82811&r2=82812&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Fri Sep 25 17:26:13 2009 @@ -110,11 +110,9 @@ MachineInstr *MachineRegisterInfo::getVRegDef(unsigned Reg) const { assert(Reg-TargetRegisterInfo::FirstVirtualRegister < VRegInfo.size() && "Invalid vreg!"); - for (reg_iterator I = reg_begin(Reg), E = reg_end(); I != E; ++I) { - // Since we are in SSA form, we can stop at the first definition. - if (I.getOperand().isDef()) - return &*I; - } + // Since we are in SSA form, we can use the first definition. + if (!def_empty(Reg)) + return &*def_begin(Reg); return 0; } Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=82812&r1=82811&r2=82812&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Sep 25 17:26:13 2009 @@ -397,10 +397,10 @@ // Remove unnecessary kills since a copy does not clobber the register. if (li_->hasInterval(SrcReg)) { LiveInterval &SrcLI = li_->getInterval(SrcReg); - for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(cur.reg), - E = mri_->reg_end(); I != E; ++I) { + for (MachineRegisterInfo::use_iterator I = mri_->use_begin(cur.reg), + E = mri_->use_end(); I != E; ++I) { MachineOperand &O = I.getOperand(); - if (!O.isUse() || !O.isKill()) + if (!O.isKill()) continue; MachineInstr *MI = &*I; if (SrcLI.liveAt(li_->getDefIndex(li_->getInstructionIndex(MI)))) From asl at math.spbu.ru Fri Sep 25 17:52:30 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 25 Sep 2009 22:52:30 -0000 Subject: [llvm-commits] [llvm] r82813 - /llvm/trunk/utils/PerfectShuffle/PerfectShuffle.cpp Message-ID: <200909252252.n8PMqUui020652@zion.cs.uiuc.edu> Author: asl Date: Fri Sep 25 17:52:29 2009 New Revision: 82813 URL: http://llvm.org/viewvc/llvm-project?rev=82813&view=rev Log: Provide proper masks for neon perfect shuffle table. I definitely need to read documentation better :( Modified: llvm/trunk/utils/PerfectShuffle/PerfectShuffle.cpp Modified: llvm/trunk/utils/PerfectShuffle/PerfectShuffle.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/PerfectShuffle/PerfectShuffle.cpp?rev=82813&r1=82812&r2=82813&view=diff ============================================================================== --- llvm/trunk/utils/PerfectShuffle/PerfectShuffle.cpp (original) +++ llvm/trunk/utils/PerfectShuffle/PerfectShuffle.cpp Fri Sep 25 17:52:29 2009 @@ -545,27 +545,27 @@ vext<3> the_vext3("vext3", OP_VEXT3); struct vuzpl : public Operator { - vuzpl() : Operator(0x1032, "vuzpl", OP_VUZPL, 2) {} + vuzpl() : Operator(0x0246, "vuzpl", OP_VUZPL, 2) {} } the_vuzpl; struct vuzpr : public Operator { - vuzpr() : Operator(0x4602, "vuzpr", OP_VUZPR, 2) {} + vuzpr() : Operator(0x1357, "vuzpr", OP_VUZPR, 2) {} } the_vuzpr; struct vzipl : public Operator { - vzipl() : Operator(0x6273, "vzipl", OP_VZIPL, 2) {} + vzipl() : Operator(0x0415, "vzipl", OP_VZIPL, 2) {} } the_vzipl; struct vzipr : public Operator { - vzipr() : Operator(0x4051, "vzipr", OP_VZIPR, 2) {} + vzipr() : Operator(0x2637, "vzipr", OP_VZIPR, 2) {} } the_vzipr; struct vtrnl : public Operator { - vtrnl() : Operator(0x5173, "vtrnl", OP_VTRNL, 2) {} + vtrnl() : Operator(0x0426, "vtrnl", OP_VTRNL, 2) {} } the_vtrnl; struct vtrnr : public Operator { - vtrnr() : Operator(0x4062, "vtrnr", OP_VTRNR, 2) {} + vtrnr() : Operator(0x1537, "vtrnr", OP_VTRNR, 2) {} } the_vtrnr; #endif From gohman at apple.com Fri Sep 25 17:53:30 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 25 Sep 2009 22:53:30 -0000 Subject: [llvm-commits] [llvm] r82815 - in /llvm/trunk: lib/CodeGen/MachineSink.cpp test/CodeGen/X86/sink.ll Message-ID: <200909252253.n8PMrU64020862@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 25 17:53:29 2009 New Revision: 82815 URL: http://llvm.org/viewvc/llvm-project?rev=82815&view=rev Log: Fix MachineSink to be able to sink instructions that use physical registers which have no defs anywhere in the function. In particular, this fixes sinking of instructions that reference RIP on x86-64, which is currently being modeled as a register. Added: llvm/trunk/test/CodeGen/X86/sink.ll Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp Modified: llvm/trunk/lib/CodeGen/MachineSink.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineSink.cpp?rev=82815&r1=82814&r2=82815&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineSink.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineSink.cpp Fri Sep 25 17:53:29 2009 @@ -35,6 +35,7 @@ class VISIBILITY_HIDDEN MachineSinking : public MachineFunctionPass { const TargetMachine *TM; const TargetInstrInfo *TII; + const TargetRegisterInfo *TRI; MachineFunction *CurMF; // Current MachineFunction MachineRegisterInfo *RegInfo; // Machine register information MachineDominatorTree *DT; // Machine dominator tree @@ -95,6 +96,7 @@ CurMF = &MF; TM = &CurMF->getTarget(); TII = TM->getInstrInfo(); + TRI = TM->getRegisterInfo(); RegInfo = &CurMF->getRegInfo(); DT = &getAnalysis(); @@ -176,8 +178,19 @@ if (TargetRegisterInfo::isPhysicalRegister(Reg)) { // If this is a physical register use, we can't move it. If it is a def, // we can move it, but only if the def is dead. - if (MO.isUse() || !MO.isDead()) + if (MO.isUse()) { + // If the physreg has no defs anywhere, it's just an ambient register + // and we can freely move its uses. + if (!RegInfo->def_empty(Reg)) + return false; + // Check for a def among the register's aliases too. + for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias) + if (!RegInfo->def_empty(*Alias)) + return false; + } else if (!MO.isDead()) { + // A def that isn't dead. We can't move it. return false; + } } else { // Virtual register uses are always safe to sink. if (MO.isUse()) continue; Added: llvm/trunk/test/CodeGen/X86/sink.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sink.ll?rev=82815&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/sink.ll (added) +++ llvm/trunk/test/CodeGen/X86/sink.ll Fri Sep 25 17:53:29 2009 @@ -0,0 +1,18 @@ +; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s + +; Currently, floating-point selects are lowered to CFG triangles. +; This means that one side of the select is always unconditionally +; evaluated, however with MachineSink we can sink the other side so +; that it's conditionally evaluated. + +; CHECK: foo: +; CHECK-NEXT: divsd +; CHECK-NEXT: testb $1, %dil +; CHECK-NEXT: jne + +define double @foo(double %x, double %y, i1 %c) nounwind { + %a = fdiv double %x, 3.2 + %b = fdiv double %y, 3.3 + %z = select i1 %c, double %a, double %b + ret double %z +} From asl at math.spbu.ru Fri Sep 25 17:53:17 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 25 Sep 2009 22:53:17 -0000 Subject: [llvm-commits] [llvm] r82814 - /llvm/trunk/lib/Target/ARM/ARMPerfectShuffle.h Message-ID: <200909252253.n8PMrIiH020825@zion.cs.uiuc.edu> Author: asl Date: Fri Sep 25 17:53:17 2009 New Revision: 82814 URL: http://llvm.org/viewvc/llvm-project?rev=82814&view=rev Log: Regenerate Modified: llvm/trunk/lib/Target/ARM/ARMPerfectShuffle.h Modified: llvm/trunk/lib/Target/ARM/ARMPerfectShuffle.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMPerfectShuffle.h?rev=82814&r1=82813&r2=82814&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMPerfectShuffle.h (original) +++ llvm/trunk/lib/Target/ARM/ARMPerfectShuffle.h Fri Sep 25 17:53:17 2009 @@ -14,159 +14,159 @@ // 31 entries have cost 0 // 242 entries have cost 1 -// 1374 entries have cost 2 -// 3515 entries have cost 3 -// 1390 entries have cost 4 -// 9 entries have cost 5 +// 1447 entries have cost 2 +// 3602 entries have cost 3 +// 1237 entries have cost 4 +// 2 entries have cost 5 // This table is 6561*4 = 26244 bytes in size. static const unsigned PerfectShuffleTable[6561+1] = { 135053414U, // <0,0,0,0>: Cost 1 vdup0 LHS 1543503974U, // <0,0,0,1>: Cost 2 vext2 <0,0,0,0>, LHS - 2819407872U, // <0,0,0,2>: Cost 3 vuzpr LHS, <0,0,0,0> + 2618572962U, // <0,0,0,2>: Cost 3 vext2 <0,2,0,0>, <0,2,0,0> 2568054923U, // <0,0,0,3>: Cost 3 vext1 <3,0,0,0>, <3,0,0,0> 1476398390U, // <0,0,0,4>: Cost 2 vext1 <0,0,0,0>, RHS 2550140624U, // <0,0,0,5>: Cost 3 vext1 <0,0,0,0>, <5,1,7,3> 2550141434U, // <0,0,0,6>: Cost 3 vext1 <0,0,0,0>, <6,2,7,3> 2591945711U, // <0,0,0,7>: Cost 3 vext1 <7,0,0,0>, <7,0,0,0> 135053414U, // <0,0,0,u>: Cost 1 vdup0 LHS - 2556117094U, // <0,0,1,0>: Cost 3 vext1 <1,0,0,1>, LHS - 1879883878U, // <0,0,1,1>: Cost 2 vzipr LHS, LHS + 2886516736U, // <0,0,1,0>: Cost 3 vzipl LHS, <0,0,0,0> + 1812775014U, // <0,0,1,1>: Cost 2 vzipl LHS, LHS 1618133094U, // <0,0,1,2>: Cost 2 vext3 <1,2,3,0>, LHS - 2568063116U, // <0,0,1,3>: Cost 3 vext1 <3,0,0,1>, <3,0,0,1> - 2556120374U, // <0,0,1,4>: Cost 3 vext1 <1,0,0,1>, RHS + 2625209292U, // <0,0,1,3>: Cost 3 vext2 <1,3,0,0>, <1,3,0,0> + 2886558034U, // <0,0,1,4>: Cost 3 vzipl LHS, <0,4,1,5> 2617246864U, // <0,0,1,5>: Cost 3 vext2 <0,0,0,0>, <1,5,3,7> - 3629863418U, // <0,0,1,6>: Cost 4 vext1 <1,0,0,1>, <6,2,7,3> + 3659723031U, // <0,0,1,6>: Cost 4 vext1 <6,0,0,1>, <6,0,0,1> 2591953904U, // <0,0,1,7>: Cost 3 vext1 <7,0,0,1>, <7,0,0,1> - 1884528742U, // <0,0,1,u>: Cost 2 vzipr LHS, LHS - 3088351334U, // <0,0,2,0>: Cost 3 vtrnr <0,2,0,2>, LHS - 2953625764U, // <0,0,2,1>: Cost 3 vzipr LHS, <0,2,0,2> - 2014101606U, // <0,0,2,2>: Cost 2 vtrnr LHS, LHS + 1812775581U, // <0,0,1,u>: Cost 2 vzipl LHS, LHS + 3020734464U, // <0,0,2,0>: Cost 3 vtrnl LHS, <0,0,0,0> + 3020734474U, // <0,0,2,1>: Cost 3 vtrnl LHS, <0,0,1,1> + 1946992742U, // <0,0,2,2>: Cost 2 vtrnl LHS, LHS 2631181989U, // <0,0,2,3>: Cost 3 vext2 <2,3,0,0>, <2,3,0,0> - 2562100534U, // <0,0,2,4>: Cost 3 vext1 <2,0,0,2>, RHS - 3635842768U, // <0,0,2,5>: Cost 4 vext1 <2,0,0,2>, <5,1,7,3> + 3020734668U, // <0,0,2,4>: Cost 3 vtrnl LHS, <0,2,4,6> + 3826550569U, // <0,0,2,5>: Cost 4 vuzpl <0,2,0,2>, <2,4,5,6> 2617247674U, // <0,0,2,6>: Cost 3 vext2 <0,0,0,0>, <2,6,3,7> 2591962097U, // <0,0,2,7>: Cost 3 vext1 <7,0,0,2>, <7,0,0,2> - 2014543974U, // <0,0,2,u>: Cost 2 vtrnr LHS, LHS + 1946992796U, // <0,0,2,u>: Cost 2 vtrnl LHS, LHS 2635163787U, // <0,0,3,0>: Cost 3 vext2 <3,0,0,0>, <3,0,0,0> - 3704260849U, // <0,0,3,1>: Cost 4 vext2 <2,2,0,0>, <3,1,2,3> + 2686419196U, // <0,0,3,1>: Cost 3 vext3 <0,3,1,0>, <0,3,1,0> 2686492933U, // <0,0,3,2>: Cost 3 vext3 <0,3,2,0>, <0,3,2,0> 2617248156U, // <0,0,3,3>: Cost 3 vext2 <0,0,0,0>, <3,3,3,3> 2617248258U, // <0,0,3,4>: Cost 3 vext2 <0,0,0,0>, <3,4,5,6> - 3913302016U, // <0,0,3,5>: Cost 4 vuzpr <3,4,5,6>, <0,0,0,0> - 3690990218U, // <0,0,3,6>: Cost 4 vext2 <0,0,0,0>, <3,6,2,7> - 3690990275U, // <0,0,3,7>: Cost 4 vext2 <0,0,0,0>, <3,7,0,1> + 3826551298U, // <0,0,3,5>: Cost 4 vuzpl <0,2,0,2>, <3,4,5,6> + 3690990200U, // <0,0,3,6>: Cost 4 vext2 <0,0,0,0>, <3,6,0,7> + 3713551042U, // <0,0,3,7>: Cost 4 vext2 <3,7,0,0>, <3,7,0,0> 2635163787U, // <0,0,3,u>: Cost 3 vext2 <3,0,0,0>, <3,0,0,0> - 2643790738U, // <0,0,4,0>: Cost 3 vext2 <4,4,0,0>, <4,0,5,1> - 2718712146U, // <0,0,4,1>: Cost 3 vext3 <5,6,7,0>, <0,4,1,5> - 2718712156U, // <0,0,4,2>: Cost 3 vext3 <5,6,7,0>, <0,4,2,6> + 2617248658U, // <0,0,4,0>: Cost 3 vext2 <0,0,0,0>, <4,0,5,1> + 2888450150U, // <0,0,4,1>: Cost 3 vzipl <0,4,1,5>, LHS + 3021570150U, // <0,0,4,2>: Cost 3 vtrnl <0,2,4,6>, LHS 3641829519U, // <0,0,4,3>: Cost 4 vext1 <3,0,0,4>, <3,0,0,4> - 2643791016U, // <0,0,4,4>: Cost 3 vext2 <4,4,0,0>, <4,4,0,0> + 3021570252U, // <0,0,4,4>: Cost 3 vtrnl <0,2,4,6>, <0,2,4,6> 1543507254U, // <0,0,4,5>: Cost 2 vext2 <0,0,0,0>, RHS - 2846277632U, // <0,0,4,6>: Cost 3 vuzpr RHS, <0,0,0,0> - 3665720307U, // <0,0,4,7>: Cost 4 vext1 <7,0,0,4>, <7,0,0,4> + 2752810294U, // <0,0,4,6>: Cost 3 vuzpl <0,2,0,2>, RHS + 3786998152U, // <0,0,4,7>: Cost 4 vext3 <4,7,5,0>, <0,4,7,5> 1543507497U, // <0,0,4,u>: Cost 2 vext2 <0,0,0,0>, RHS 2684354972U, // <0,0,5,0>: Cost 3 vext3 <0,0,0,0>, <0,5,0,7> 2617249488U, // <0,0,5,1>: Cost 3 vext2 <0,0,0,0>, <5,1,7,3> - 3696299808U, // <0,0,5,2>: Cost 4 vext2 <0,u,0,0>, <5,2,7,2> - 3690991471U, // <0,0,5,3>: Cost 4 vext2 <0,0,0,0>, <5,3,7,0> + 3765617070U, // <0,0,5,2>: Cost 4 vext3 <1,2,3,0>, <0,5,2,7> + 3635865780U, // <0,0,5,3>: Cost 4 vext1 <2,0,0,5>, <3,0,4,5> 2617249734U, // <0,0,5,4>: Cost 3 vext2 <0,0,0,0>, <5,4,7,6> 2617249796U, // <0,0,5,5>: Cost 3 vext2 <0,0,0,0>, <5,5,5,5> 2718712274U, // <0,0,5,6>: Cost 3 vext3 <5,6,7,0>, <0,5,6,7> - 3923378176U, // <0,0,5,7>: Cost 4 vuzpr <5,1,7,3>, <0,0,0,0> + 2617249960U, // <0,0,5,7>: Cost 3 vext2 <0,0,0,0>, <5,7,5,7> 2720039396U, // <0,0,5,u>: Cost 3 vext3 <5,u,7,0>, <0,5,u,7> 2684355053U, // <0,0,6,0>: Cost 3 vext3 <0,0,0,0>, <0,6,0,7> - 3786113526U, // <0,0,6,1>: Cost 4 vext3 <4,6,2,0>, <0,6,1,7> + 3963609190U, // <0,0,6,1>: Cost 4 vzipl <0,6,2,7>, LHS 2617250298U, // <0,0,6,2>: Cost 3 vext2 <0,0,0,0>, <6,2,7,3> - 3704263240U, // <0,0,6,3>: Cost 4 vext2 <2,2,0,0>, <6,3,7,0> - 3729478234U, // <0,0,6,4>: Cost 4 vext2 <6,4,0,0>, <6,4,0,0> - 3717534443U, // <0,0,6,5>: Cost 4 vext2 <4,4,0,0>, <6,5,7,1> + 3796435464U, // <0,0,6,3>: Cost 4 vext3 <6,3,7,0>, <0,6,3,7> + 3659762998U, // <0,0,6,4>: Cost 4 vext1 <6,0,0,6>, RHS + 3659763810U, // <0,0,6,5>: Cost 4 vext1 <6,0,0,6>, <5,6,7,0> 2617250616U, // <0,0,6,6>: Cost 3 vext2 <0,0,0,0>, <6,6,6,6> 2657727309U, // <0,0,6,7>: Cost 3 vext2 <6,7,0,0>, <6,7,0,0> 2658390942U, // <0,0,6,u>: Cost 3 vext2 <6,u,0,0>, <6,u,0,0> 2659054575U, // <0,0,7,0>: Cost 3 vext2 <7,0,0,0>, <7,0,0,0> - 3934208000U, // <0,0,7,1>: Cost 4 vuzpr <7,0,1,2>, <0,0,0,0> - 3934265508U, // <0,0,7,2>: Cost 4 vuzpr <7,0,2,0>, <0,2,0,2> + 3635880854U, // <0,0,7,1>: Cost 4 vext1 <2,0,0,7>, <1,2,3,0> + 3635881401U, // <0,0,7,2>: Cost 4 vext1 <2,0,0,7>, <2,0,0,7> 3734787298U, // <0,0,7,3>: Cost 4 vext2 <7,3,0,0>, <7,3,0,0> 2617251174U, // <0,0,7,4>: Cost 3 vext2 <0,0,0,0>, <7,4,5,6> - 3665743970U, // <0,0,7,5>: Cost 4 vext1 <7,0,0,7>, <5,6,7,0> - 3665744562U, // <0,0,7,6>: Cost 4 vext1 <7,0,0,7>, <6,5,0,7> + 3659772002U, // <0,0,7,5>: Cost 4 vext1 <6,0,0,7>, <5,6,7,0> + 3659772189U, // <0,0,7,6>: Cost 4 vext1 <6,0,0,7>, <6,0,0,7> 2617251436U, // <0,0,7,7>: Cost 3 vext2 <0,0,0,0>, <7,7,7,7> 2659054575U, // <0,0,7,u>: Cost 3 vext2 <7,0,0,0>, <7,0,0,0> 135053414U, // <0,0,u,0>: Cost 1 vdup0 LHS - 1879884445U, // <0,0,u,1>: Cost 2 vzipr LHS, LHS - 2014101660U, // <0,0,u,2>: Cost 2 vtrnr LHS, LHS + 1817419878U, // <0,0,u,1>: Cost 2 vzipl LHS, LHS + 1947435110U, // <0,0,u,2>: Cost 2 vtrnl LHS, LHS 2568120467U, // <0,0,u,3>: Cost 3 vext1 <3,0,0,u>, <3,0,0,u> 1476463926U, // <0,0,u,4>: Cost 2 vext1 <0,0,0,u>, RHS 1543510170U, // <0,0,u,5>: Cost 2 vext2 <0,0,0,0>, RHS - 2870165504U, // <0,0,u,6>: Cost 3 vuzpr RHS, <0,0,0,0> + 2752813210U, // <0,0,u,6>: Cost 3 vuzpl <0,2,0,2>, RHS 2592011255U, // <0,0,u,7>: Cost 3 vext1 <7,0,0,u>, <7,0,0,u> 135053414U, // <0,0,u,u>: Cost 1 vdup0 LHS - 2631188480U, // <0,1,0,0>: Cost 3 vext2 <2,3,0,1>, <0,0,0,0> + 2618581002U, // <0,1,0,0>: Cost 3 vext2 <0,2,0,1>, <0,0,1,1> 1557446758U, // <0,1,0,1>: Cost 2 vext2 <2,3,0,1>, LHS - 2819448842U, // <0,1,0,2>: Cost 3 vuzpr LHS, <0,0,1,1> - 3020734464U, // <0,1,0,3>: Cost 3 vtrnl LHS, <0,0,0,0> - 2568129846U, // <0,1,0,4>: Cost 3 vext1 <3,0,1,0>, RHS - 3641872080U, // <0,1,0,5>: Cost 4 vext1 <3,0,1,0>, <5,1,7,3> + 2618581155U, // <0,1,0,2>: Cost 3 vext2 <0,2,0,1>, <0,2,0,1> + 2690548468U, // <0,1,0,3>: Cost 3 vext3 <1,0,3,0>, <1,0,3,0> + 2626543954U, // <0,1,0,4>: Cost 3 vext2 <1,5,0,1>, <0,4,1,5> + 4094985216U, // <0,1,0,5>: Cost 4 vtrnl <0,2,0,2>, <1,3,5,7> 2592019278U, // <0,1,0,6>: Cost 3 vext1 <7,0,1,0>, <6,7,0,1> 2592019448U, // <0,1,0,7>: Cost 3 vext1 <7,0,1,0>, <7,0,1,0> 1557447325U, // <0,1,0,u>: Cost 2 vext2 <2,3,0,1>, LHS - 1524252774U, // <0,1,1,0>: Cost 2 vext1 , LHS - 2556191459U, // <0,1,1,1>: Cost 3 vext1 <1,0,1,1>, <1,0,1,1> - 2960310374U, // <0,1,1,2>: Cost 3 vzipr <1,2,3,0>, LHS - 3020734474U, // <0,1,1,3>: Cost 3 vtrnl LHS, <0,0,1,1> - 1524256054U, // <0,1,1,4>: Cost 2 vext1 , RHS - 2580082247U, // <0,1,1,5>: Cost 3 vext1 <5,0,1,1>, <5,0,1,1> - 2597999098U, // <0,1,1,6>: Cost 3 vext1 , <6,2,7,3> - 2597999610U, // <0,1,1,7>: Cost 3 vext1 , <7,0,1,2> - 1524258514U, // <0,1,1,u>: Cost 2 vext1 , + 1476476938U, // <0,1,1,0>: Cost 2 vext1 <0,0,1,1>, <0,0,1,1> + 2886517556U, // <0,1,1,1>: Cost 3 vzipl LHS, <1,1,1,1> + 2886517654U, // <0,1,1,2>: Cost 3 vzipl LHS, <1,2,3,0> + 2886517720U, // <0,1,1,3>: Cost 3 vzipl LHS, <1,3,1,3> + 1476480310U, // <0,1,1,4>: Cost 2 vext1 <0,0,1,1>, RHS + 2886558864U, // <0,1,1,5>: Cost 3 vzipl LHS, <1,5,3,7> + 2550223354U, // <0,1,1,6>: Cost 3 vext1 <0,0,1,1>, <6,2,7,3> + 2550223856U, // <0,1,1,7>: Cost 3 vext1 <0,0,1,1>, <7,0,0,1> + 1476482862U, // <0,1,1,u>: Cost 2 vext1 <0,0,1,1>, LHS 1494401126U, // <0,1,2,0>: Cost 2 vext1 <3,0,1,2>, LHS - 2556199652U, // <0,1,2,1>: Cost 3 vext1 <1,0,1,2>, <1,0,1,2> + 3020735284U, // <0,1,2,1>: Cost 3 vtrnl LHS, <1,1,1,1> 2562172349U, // <0,1,2,2>: Cost 3 vext1 <2,0,1,2>, <2,0,1,2> 835584U, // <0,1,2,3>: Cost 0 copy LHS 1494404406U, // <0,1,2,4>: Cost 2 vext1 <3,0,1,2>, RHS - 2568146640U, // <0,1,2,5>: Cost 3 vext1 <3,0,1,2>, <5,1,7,3> - 2568147450U, // <0,1,2,6>: Cost 3 vext1 <3,0,1,2>, <6,2,7,3> + 3020735488U, // <0,1,2,5>: Cost 3 vtrnl LHS, <1,3,5,7> + 2631190458U, // <0,1,2,6>: Cost 3 vext2 <2,3,0,1>, <2,6,3,7> 1518294010U, // <0,1,2,7>: Cost 2 vext1 <7,0,1,2>, <7,0,1,2> 835584U, // <0,1,2,u>: Cost 0 copy LHS - 2631190676U, // <0,1,3,0>: Cost 3 vext2 <2,3,0,1>, <3,0,1,0> - 3696969948U, // <0,1,3,1>: Cost 4 vext2 <1,0,0,1>, <3,1,0,0> - 2631190856U, // <0,1,3,2>: Cost 3 vext2 <2,3,0,1>, <3,2,3,0> + 2692318156U, // <0,1,3,0>: Cost 3 vext3 <1,3,0,0>, <1,3,0,0> + 2691875800U, // <0,1,3,1>: Cost 3 vext3 <1,2,3,0>, <1,3,1,3> + 2691875806U, // <0,1,3,2>: Cost 3 vext3 <1,2,3,0>, <1,3,2,0> 2692539367U, // <0,1,3,3>: Cost 3 vext3 <1,3,3,0>, <1,3,3,0> - 2631191042U, // <0,1,3,4>: Cost 3 vext2 <2,3,0,1>, <3,4,5,6> - 3704932898U, // <0,1,3,5>: Cost 4 vext2 <2,3,0,1>, <3,5,0,2> - 2657733296U, // <0,1,3,6>: Cost 3 vext2 <6,7,0,1>, <3,6,7,0> + 2562182454U, // <0,1,3,4>: Cost 3 vext1 <2,0,1,3>, RHS + 2691875840U, // <0,1,3,5>: Cost 3 vext3 <1,2,3,0>, <1,3,5,7> + 2692760578U, // <0,1,3,6>: Cost 3 vext3 <1,3,6,0>, <1,3,6,0> 2639817411U, // <0,1,3,7>: Cost 3 vext2 <3,7,0,1>, <3,7,0,1> - 2692908052U, // <0,1,3,u>: Cost 3 vext3 <1,3,u,0>, <1,3,u,0> - 2631191442U, // <0,1,4,0>: Cost 3 vext2 <2,3,0,1>, <4,0,5,1> - 3704933322U, // <0,1,4,1>: Cost 4 vext2 <2,3,0,1>, <4,1,2,3> + 2691875863U, // <0,1,3,u>: Cost 3 vext3 <1,2,3,0>, <1,3,u,3> + 2568159334U, // <0,1,4,0>: Cost 3 vext1 <3,0,1,4>, LHS + 4095312692U, // <0,1,4,1>: Cost 4 vtrnl <0,2,4,6>, <1,1,1,1> 2568160934U, // <0,1,4,2>: Cost 3 vext1 <3,0,1,4>, <2,3,0,1> 2568161432U, // <0,1,4,3>: Cost 3 vext1 <3,0,1,4>, <3,0,1,4> 2568162614U, // <0,1,4,4>: Cost 3 vext1 <3,0,1,4>, RHS 1557450038U, // <0,1,4,5>: Cost 2 vext2 <2,3,0,1>, RHS - 2631191884U, // <0,1,4,6>: Cost 3 vext2 <2,3,0,1>, <4,6,0,2> + 2754235702U, // <0,1,4,6>: Cost 3 vuzpl <0,4,1,5>, RHS 2592052220U, // <0,1,4,7>: Cost 3 vext1 <7,0,1,4>, <7,0,1,4> 1557450281U, // <0,1,4,u>: Cost 2 vext2 <2,3,0,1>, RHS - 3704933959U, // <0,1,5,0>: Cost 4 vext2 <2,3,0,1>, <5,0,1,1> - 2631192272U, // <0,1,5,1>: Cost 3 vext2 <2,3,0,1>, <5,1,7,3> - 3696308006U, // <0,1,5,2>: Cost 4 vext2 <0,u,0,1>, <5,2,7,u> - 2718712976U, // <0,1,5,3>: Cost 3 vext3 <5,6,7,0>, <1,5,3,7> + 3765617775U, // <0,1,5,0>: Cost 4 vext3 <1,2,3,0>, <1,5,0,1> + 2647781007U, // <0,1,5,1>: Cost 3 vext2 <5,1,0,1>, <5,1,0,1> + 3704934138U, // <0,1,5,2>: Cost 4 vext2 <2,3,0,1>, <5,2,3,0> + 2691875984U, // <0,1,5,3>: Cost 3 vext3 <1,2,3,0>, <1,5,3,7> 2657734598U, // <0,1,5,4>: Cost 3 vext2 <6,7,0,1>, <5,4,7,6> - 2657734660U, // <0,1,5,5>: Cost 3 vext2 <6,7,0,1>, <5,5,5,5> + 2650435539U, // <0,1,5,5>: Cost 3 vext2 <5,5,0,1>, <5,5,0,1> 2651099172U, // <0,1,5,6>: Cost 3 vext2 <5,6,0,1>, <5,6,0,1> - 3704934518U, // <0,1,5,7>: Cost 4 vext2 <2,3,0,1>, <5,7,0,2> - 2631192839U, // <0,1,5,u>: Cost 3 vext2 <2,3,0,1>, <5,u,7,3> + 2651762805U, // <0,1,5,7>: Cost 3 vext2 <5,7,0,1>, <5,7,0,1> + 2691876029U, // <0,1,5,u>: Cost 3 vext3 <1,2,3,0>, <1,5,u,7> 2592063590U, // <0,1,6,0>: Cost 3 vext1 <7,0,1,6>, LHS - 3704934780U, // <0,1,6,1>: Cost 4 vext2 <2,3,0,1>, <6,1,2,3> - 2631193082U, // <0,1,6,2>: Cost 3 vext2 <2,3,0,1>, <6,2,7,3> - 3704934984U, // <0,1,6,3>: Cost 4 vext2 <2,3,0,1>, <6,3,7,0> + 3765617871U, // <0,1,6,1>: Cost 4 vext3 <1,2,3,0>, <1,6,1,7> + 2654417337U, // <0,1,6,2>: Cost 3 vext2 <6,2,0,1>, <6,2,0,1> + 3765617889U, // <0,1,6,3>: Cost 4 vext3 <1,2,3,0>, <1,6,3,7> 2592066870U, // <0,1,6,4>: Cost 3 vext1 <7,0,1,6>, RHS - 3721523947U, // <0,1,6,5>: Cost 4 vext2 <5,1,0,1>, <6,5,7,1> - 2657735480U, // <0,1,6,6>: Cost 3 vext2 <6,7,0,1>, <6,6,6,6> + 3765617907U, // <0,1,6,5>: Cost 4 vext3 <1,2,3,0>, <1,6,5,7> + 2657071869U, // <0,1,6,6>: Cost 3 vext2 <6,6,0,1>, <6,6,0,1> 1583993678U, // <0,1,6,7>: Cost 2 vext2 <6,7,0,1>, <6,7,0,1> 1584657311U, // <0,1,6,u>: Cost 2 vext2 <6,u,0,1>, <6,u,0,1> 2657735672U, // <0,1,7,0>: Cost 3 vext2 <6,7,0,1>, <7,0,1,0> - 3731477571U, // <0,1,7,1>: Cost 4 vext2 <6,7,0,1>, <7,1,0,3> + 2657735808U, // <0,1,7,1>: Cost 3 vext2 <6,7,0,1>, <7,1,7,1> 2631193772U, // <0,1,7,2>: Cost 3 vext2 <2,3,0,1>, <7,2,3,0> 2661053667U, // <0,1,7,3>: Cost 3 vext2 <7,3,0,1>, <7,3,0,1> 2657736038U, // <0,1,7,4>: Cost 3 vext2 <6,7,0,1>, <7,4,5,6> @@ -176,403 +176,403 @@ 2657736322U, // <0,1,7,u>: Cost 3 vext2 <6,7,0,1>, <7,u,1,2> 1494450278U, // <0,1,u,0>: Cost 2 vext1 <3,0,1,u>, LHS 1557452590U, // <0,1,u,1>: Cost 2 vext2 <2,3,0,1>, LHS - 2960310941U, // <0,1,u,2>: Cost 3 vzipr <1,2,3,0>, LHS + 2754238254U, // <0,1,u,2>: Cost 3 vuzpl <0,4,1,5>, LHS 835584U, // <0,1,u,3>: Cost 0 copy LHS 1494453558U, // <0,1,u,4>: Cost 2 vext1 <3,0,1,u>, RHS 1557452954U, // <0,1,u,5>: Cost 2 vext2 <2,3,0,1>, RHS - 2631194800U, // <0,1,u,6>: Cost 3 vext2 <2,3,0,1>, + 2754238618U, // <0,1,u,6>: Cost 3 vuzpl <0,4,1,5>, RHS 1518343168U, // <0,1,u,7>: Cost 2 vext1 <7,0,1,u>, <7,0,1,u> 835584U, // <0,1,u,u>: Cost 0 copy LHS - 2618589184U, // <0,2,0,0>: Cost 3 vext2 <0,2,0,2>, <0,0,0,0> + 2752299008U, // <0,2,0,0>: Cost 3 vuzpl LHS, <0,0,0,0> 1544847462U, // <0,2,0,1>: Cost 2 vext2 <0,2,0,2>, LHS - 1745666150U, // <0,2,0,2>: Cost 2 vuzpr LHS, LHS - 2886516736U, // <0,2,0,3>: Cost 3 vzipl LHS, <0,0,0,0> - 2562231606U, // <0,2,0,4>: Cost 3 vext1 <2,0,2,0>, RHS - 3635973840U, // <0,2,0,5>: Cost 4 vext1 <2,0,2,0>, <5,1,7,3> - 2586120488U, // <0,2,0,6>: Cost 3 vext1 <6,0,2,0>, <6,0,2,0> + 1678557286U, // <0,2,0,2>: Cost 2 vuzpl LHS, LHS + 2696521165U, // <0,2,0,3>: Cost 3 vext3 <2,0,3,0>, <2,0,3,0> + 2752340172U, // <0,2,0,4>: Cost 3 vuzpl LHS, <0,2,4,6> + 2691876326U, // <0,2,0,5>: Cost 3 vext3 <1,2,3,0>, <2,0,5,7> + 2618589695U, // <0,2,0,6>: Cost 3 vext2 <0,2,0,2>, <0,6,2,7> 2592093185U, // <0,2,0,7>: Cost 3 vext1 <7,0,2,0>, <7,0,2,0> - 1746108518U, // <0,2,0,u>: Cost 2 vuzpr LHS, LHS + 1678557340U, // <0,2,0,u>: Cost 2 vuzpl LHS, LHS 2618589942U, // <0,2,1,0>: Cost 3 vext2 <0,2,0,2>, <1,0,3,2> - 2618590004U, // <0,2,1,1>: Cost 3 vext2 <0,2,0,2>, <1,1,1,1> - 2618590102U, // <0,2,1,2>: Cost 3 vext2 <0,2,0,2>, <1,2,3,0> - 2886518438U, // <0,2,1,3>: Cost 3 vzipl LHS, <2,3,0,1> - 2556267830U, // <0,2,1,4>: Cost 3 vext1 <1,0,2,1>, RHS - 2645132432U, // <0,2,1,5>: Cost 3 vext2 <4,6,0,2>, <1,5,3,7> - 2586128681U, // <0,2,1,6>: Cost 3 vext1 <6,0,2,1>, <6,0,2,1> - 3725509931U, // <0,2,1,7>: Cost 4 vext2 <5,7,0,2>, <1,7,3,0> - 2886559398U, // <0,2,1,u>: Cost 3 vzipl LHS, <2,3,0,1> - 1524334694U, // <0,2,2,0>: Cost 2 vext1 , LHS - 2618590744U, // <0,2,2,1>: Cost 3 vext2 <0,2,0,2>, <2,1,2,3> - 2618590824U, // <0,2,2,2>: Cost 3 vext2 <0,2,0,2>, <2,2,2,2> - 2886516900U, // <0,2,2,3>: Cost 3 vzipl LHS, <0,2,0,2> - 1524337974U, // <0,2,2,4>: Cost 2 vext1 , RHS - 2598080208U, // <0,2,2,5>: Cost 3 vext1 , <5,1,7,3> - 2645133242U, // <0,2,2,6>: Cost 3 vext2 <4,6,0,2>, <2,6,3,7> - 2598081530U, // <0,2,2,7>: Cost 3 vext1 , <7,0,1,2> - 1524340444U, // <0,2,2,u>: Cost 2 vext1 , + 2752299828U, // <0,2,1,1>: Cost 3 vuzpl LHS, <1,1,1,1> + 2886518376U, // <0,2,1,2>: Cost 3 vzipl LHS, <2,2,2,2> + 2752299766U, // <0,2,1,3>: Cost 3 vuzpl LHS, <1,0,3,2> + 2550295862U, // <0,2,1,4>: Cost 3 vext1 <0,0,2,1>, RHS + 2752340992U, // <0,2,1,5>: Cost 3 vuzpl LHS, <1,3,5,7> + 2886559674U, // <0,2,1,6>: Cost 3 vzipl LHS, <2,6,3,7> + 3934208106U, // <0,2,1,7>: Cost 4 vuzpr <7,0,1,2>, <0,1,2,7> + 2752340771U, // <0,2,1,u>: Cost 3 vuzpl LHS, <1,0,u,2> + 1476558868U, // <0,2,2,0>: Cost 2 vext1 <0,0,2,2>, <0,0,2,2> + 2226628029U, // <0,2,2,1>: Cost 3 vrev <2,0,1,2> + 2752300648U, // <0,2,2,2>: Cost 3 vuzpl LHS, <2,2,2,2> + 3020736114U, // <0,2,2,3>: Cost 3 vtrnl LHS, <2,2,3,3> + 1476562230U, // <0,2,2,4>: Cost 2 vext1 <0,0,2,2>, RHS + 2550304464U, // <0,2,2,5>: Cost 3 vext1 <0,0,2,2>, <5,1,7,3> + 2618591162U, // <0,2,2,6>: Cost 3 vext2 <0,2,0,2>, <2,6,3,7> + 2550305777U, // <0,2,2,7>: Cost 3 vext1 <0,0,2,2>, <7,0,0,2> + 1476564782U, // <0,2,2,u>: Cost 2 vext1 <0,0,2,2>, LHS 2618591382U, // <0,2,3,0>: Cost 3 vext2 <0,2,0,2>, <3,0,1,2> - 2691876528U, // <0,2,3,1>: Cost 3 vext3 <1,2,3,0>, <2,3,1,2> - 3692333360U, // <0,2,3,2>: Cost 4 vext2 <0,2,0,2>, <3,2,0,3> - 2618591644U, // <0,2,3,3>: Cost 3 vext2 <0,2,0,2>, <3,3,3,3> + 2752301206U, // <0,2,3,1>: Cost 3 vuzpl LHS, <3,0,1,2> + 3826043121U, // <0,2,3,2>: Cost 4 vuzpl LHS, <3,1,2,3> + 2752301468U, // <0,2,3,3>: Cost 3 vuzpl LHS, <3,3,3,3> 2618591746U, // <0,2,3,4>: Cost 3 vext2 <0,2,0,2>, <3,4,5,6> - 2839560294U, // <0,2,3,5>: Cost 3 vuzpr <3,4,5,6>, LHS - 3692333706U, // <0,2,3,6>: Cost 4 vext2 <0,2,0,2>, <3,6,2,7> + 2752301570U, // <0,2,3,5>: Cost 3 vuzpl LHS, <3,4,5,6> + 3830688102U, // <0,2,3,6>: Cost 4 vuzpl LHS, <3,2,6,3> 2698807012U, // <0,2,3,7>: Cost 3 vext3 <2,3,7,0>, <2,3,7,0> - 2618592030U, // <0,2,3,u>: Cost 3 vext2 <0,2,0,2>, <3,u,1,2> - 2618592146U, // <0,2,4,0>: Cost 3 vext2 <0,2,0,2>, <4,0,5,1> - 3692334062U, // <0,2,4,1>: Cost 4 vext2 <0,2,0,2>, <4,1,6,3> + 2752301269U, // <0,2,3,u>: Cost 3 vuzpl LHS, <3,0,u,2> + 2562261094U, // <0,2,4,0>: Cost 3 vext1 <2,0,2,4>, LHS + 4095313828U, // <0,2,4,1>: Cost 4 vtrnl <0,2,4,6>, <2,6,1,3> 2226718152U, // <0,2,4,2>: Cost 3 vrev <2,0,2,4> 2568235169U, // <0,2,4,3>: Cost 3 vext1 <3,0,2,4>, <3,0,2,4> 2562264374U, // <0,2,4,4>: Cost 3 vext1 <2,0,2,4>, RHS 1544850742U, // <0,2,4,5>: Cost 2 vext2 <0,2,0,2>, RHS - 1772535910U, // <0,2,4,6>: Cost 2 vuzpr RHS, LHS + 1678560566U, // <0,2,4,6>: Cost 2 vuzpl LHS, RHS 2592125957U, // <0,2,4,7>: Cost 3 vext1 <7,0,2,4>, <7,0,2,4> - 1544850985U, // <0,2,4,u>: Cost 2 vext2 <0,2,0,2>, RHS + 1678560584U, // <0,2,4,u>: Cost 2 vuzpl LHS, RHS 2691876686U, // <0,2,5,0>: Cost 3 vext3 <1,2,3,0>, <2,5,0,7> 2618592976U, // <0,2,5,1>: Cost 3 vext2 <0,2,0,2>, <5,1,7,3> - 2618593056U, // <0,2,5,2>: Cost 3 vext2 <0,2,0,2>, <5,2,7,2> - 3964905940U, // <0,2,5,3>: Cost 4 vzipl LHS, <3,4,0,5> - 2645135302U, // <0,2,5,4>: Cost 3 vext2 <4,6,0,2>, <5,4,7,6> - 2645135364U, // <0,2,5,5>: Cost 3 vext2 <4,6,0,2>, <5,5,5,5> - 2645135458U, // <0,2,5,6>: Cost 3 vext2 <4,6,0,2>, <5,6,7,0> - 2849636454U, // <0,2,5,7>: Cost 3 vuzpr <5,1,7,3>, LHS - 2645135620U, // <0,2,5,u>: Cost 3 vext2 <4,6,0,2>, <5,u,7,0> - 2645135656U, // <0,2,6,0>: Cost 3 vext2 <4,6,0,2>, <6,0,2,0> - 2645135740U, // <0,2,6,1>: Cost 3 vext2 <4,6,0,2>, <6,1,2,3> + 3765618528U, // <0,2,5,2>: Cost 4 vext3 <1,2,3,0>, <2,5,2,7> + 3765618536U, // <0,2,5,3>: Cost 4 vext3 <1,2,3,0>, <2,5,3,6> + 2618593222U, // <0,2,5,4>: Cost 3 vext2 <0,2,0,2>, <5,4,7,6> + 2752303108U, // <0,2,5,5>: Cost 3 vuzpl LHS, <5,5,5,5> + 2618593378U, // <0,2,5,6>: Cost 3 vext2 <0,2,0,2>, <5,6,7,0> + 2824785206U, // <0,2,5,7>: Cost 3 vuzpr <1,0,3,2>, RHS + 2824785207U, // <0,2,5,u>: Cost 3 vuzpr <1,0,3,2>, RHS + 2752303950U, // <0,2,6,0>: Cost 3 vuzpl LHS, <6,7,0,1> + 3830690081U, // <0,2,6,1>: Cost 4 vuzpl LHS, <6,0,1,2> 2618593786U, // <0,2,6,2>: Cost 3 vext2 <0,2,0,2>, <6,2,7,3> - 2718713786U, // <0,2,6,3>: Cost 3 vext3 <5,6,7,0>, <2,6,3,7> - 2645135980U, // <0,2,6,4>: Cost 3 vext2 <4,6,0,2>, <6,4,2,0> - 2645136068U, // <0,2,6,5>: Cost 3 vext2 <4,6,0,2>, <6,5,2,7> - 2645136184U, // <0,2,6,6>: Cost 3 vext2 <4,6,0,2>, <6,6,6,6> - 2645136206U, // <0,2,6,7>: Cost 3 vext2 <4,6,0,2>, <6,7,0,1> - 2618594272U, // <0,2,6,u>: Cost 3 vext2 <0,2,0,2>, <6,u,7,3> - 2645136378U, // <0,2,7,0>: Cost 3 vext2 <4,6,0,2>, <7,0,1,2> - 2860466278U, // <0,2,7,1>: Cost 3 vuzpr <7,0,1,2>, LHS - 3692336303U, // <0,2,7,2>: Cost 4 vext2 <0,2,0,2>, <7,2,3,3> + 2691876794U, // <0,2,6,3>: Cost 3 vext3 <1,2,3,0>, <2,6,3,7> + 2752303990U, // <0,2,6,4>: Cost 3 vuzpl LHS, <6,7,4,5> + 3830690445U, // <0,2,6,5>: Cost 4 vuzpl LHS, <6,4,5,6> + 2752303928U, // <0,2,6,6>: Cost 3 vuzpl LHS, <6,6,6,6> + 2657743695U, // <0,2,6,7>: Cost 3 vext2 <6,7,0,2>, <6,7,0,2> + 2691876839U, // <0,2,6,u>: Cost 3 vext3 <1,2,3,0>, <2,6,u,7> + 2659070961U, // <0,2,7,0>: Cost 3 vext2 <7,0,0,2>, <7,0,0,2> + 2659734594U, // <0,2,7,1>: Cost 3 vext2 <7,1,0,2>, <7,1,0,2> + 3734140051U, // <0,2,7,2>: Cost 4 vext2 <7,2,0,2>, <7,2,0,2> 2701166596U, // <0,2,7,3>: Cost 3 vext3 <2,7,3,0>, <2,7,3,0> - 2645136742U, // <0,2,7,4>: Cost 3 vext2 <4,6,0,2>, <7,4,5,6> - 2863448166U, // <0,2,7,5>: Cost 3 vuzpr <7,4,5,6>, LHS - 3718878688U, // <0,2,7,6>: Cost 4 vext2 <4,6,0,2>, <7,6,1,2> - 2645137004U, // <0,2,7,7>: Cost 3 vext2 <4,6,0,2>, <7,7,7,7> - 2645137026U, // <0,2,7,u>: Cost 3 vext2 <4,6,0,2>, <7,u,1,2> - 1524383846U, // <0,2,u,0>: Cost 2 vext1 , LHS + 2662389094U, // <0,2,7,4>: Cost 3 vext2 <7,5,0,2>, <7,4,5,6> + 2662389126U, // <0,2,7,5>: Cost 3 vext2 <7,5,0,2>, <7,5,0,2> + 3736794583U, // <0,2,7,6>: Cost 4 vext2 <7,6,0,2>, <7,6,0,2> + 2752304748U, // <0,2,7,7>: Cost 3 vuzpl LHS, <7,7,7,7> + 2659070961U, // <0,2,7,u>: Cost 3 vext2 <7,0,0,2>, <7,0,0,2> + 1476608026U, // <0,2,u,0>: Cost 2 vext1 <0,0,2,u>, <0,0,2,u> 1544853294U, // <0,2,u,1>: Cost 2 vext2 <0,2,0,2>, LHS - 1793441894U, // <0,2,u,2>: Cost 2 vuzpr LHS, LHS - 2886518445U, // <0,2,u,3>: Cost 3 vzipl LHS, <2,3,0,u> - 1524387126U, // <0,2,u,4>: Cost 2 vext1 , RHS + 1678563118U, // <0,2,u,2>: Cost 2 vuzpl LHS, LHS + 3021178482U, // <0,2,u,3>: Cost 3 vtrnl LHS, <2,2,3,3> + 1476611382U, // <0,2,u,4>: Cost 2 vext1 <0,0,2,u>, RHS 1544853658U, // <0,2,u,5>: Cost 2 vext2 <0,2,0,2>, RHS - 1796423782U, // <0,2,u,6>: Cost 2 vuzpr RHS, LHS - 2645137664U, // <0,2,u,7>: Cost 3 vext2 <4,6,0,2>, - 1544853861U, // <0,2,u,u>: Cost 2 vext2 <0,2,0,2>, LHS - 2618597376U, // <0,3,0,0>: Cost 3 vext2 <0,2,0,3>, <0,0,0,0> - 2618597478U, // <0,3,0,1>: Cost 3 vext2 <0,2,0,3>, LHS - 2618597541U, // <0,3,0,2>: Cost 3 vext2 <0,2,0,3>, <0,2,0,3> - 3692339443U, // <0,3,0,3>: Cost 4 vext2 <0,2,0,3>, <0,3,0,0> - 2691877044U, // <0,3,0,4>: Cost 3 vext3 <1,2,3,0>, <3,0,4,5> - 3765618873U, // <0,3,0,5>: Cost 4 vext3 <1,2,3,0>, <3,0,5,1> - 3765618883U, // <0,3,0,6>: Cost 4 vext3 <1,2,3,0>, <3,0,6,2> - 3665908746U, // <0,3,0,7>: Cost 4 vext1 <7,0,3,0>, <7,0,3,0> - 2618598045U, // <0,3,0,u>: Cost 3 vext2 <0,2,0,3>, LHS - 2562310246U, // <0,3,1,0>: Cost 3 vext1 <2,0,3,1>, LHS - 3692340020U, // <0,3,1,1>: Cost 4 vext2 <0,2,0,3>, <1,1,1,1> + 1678563482U, // <0,2,u,6>: Cost 2 vuzpl LHS, RHS + 2824785449U, // <0,2,u,7>: Cost 3 vuzpr <1,0,3,2>, RHS + 1678563172U, // <0,2,u,u>: Cost 2 vuzpl LHS, LHS + 2556329984U, // <0,3,0,0>: Cost 3 vext1 <1,0,3,0>, <0,0,0,0> + 2686421142U, // <0,3,0,1>: Cost 3 vext3 <0,3,1,0>, <3,0,1,2> + 2562303437U, // <0,3,0,2>: Cost 3 vext1 <2,0,3,0>, <2,0,3,0> + 4094986652U, // <0,3,0,3>: Cost 4 vtrnl <0,2,0,2>, <3,3,3,3> + 2556333366U, // <0,3,0,4>: Cost 3 vext1 <1,0,3,0>, RHS + 4094986754U, // <0,3,0,5>: Cost 4 vtrnl <0,2,0,2>, <3,4,5,6> + 3798796488U, // <0,3,0,6>: Cost 4 vext3 <6,7,3,0>, <3,0,6,7> + 3776530634U, // <0,3,0,7>: Cost 4 vext3 <3,0,7,0>, <3,0,7,0> + 2556335918U, // <0,3,0,u>: Cost 3 vext1 <1,0,3,0>, LHS + 2886518934U, // <0,3,1,0>: Cost 3 vzipl LHS, <3,0,1,2> + 2556338933U, // <0,3,1,1>: Cost 3 vext1 <1,0,3,1>, <1,0,3,1> 2691877105U, // <0,3,1,2>: Cost 3 vext3 <1,2,3,0>, <3,1,2,3> - 2568284327U, // <0,3,1,3>: Cost 3 vext1 <3,0,3,1>, <3,0,3,1> - 2562313526U, // <0,3,1,4>: Cost 3 vext1 <2,0,3,1>, RHS - 3765618956U, // <0,3,1,5>: Cost 4 vext3 <1,2,3,0>, <3,1,5,3> - 3636056570U, // <0,3,1,6>: Cost 4 vext1 <2,0,3,1>, <6,2,7,3> - 3665916939U, // <0,3,1,7>: Cost 4 vext1 <7,0,3,1>, <7,0,3,1> - 2695858471U, // <0,3,1,u>: Cost 3 vext3 <1,u,3,0>, <3,1,u,3> + 2886519196U, // <0,3,1,3>: Cost 3 vzipl LHS, <3,3,3,3> + 2886519298U, // <0,3,1,4>: Cost 3 vzipl LHS, <3,4,5,6> + 4095740418U, // <0,3,1,5>: Cost 4 vtrnl <0,3,1,4>, <3,4,5,6> + 3659944242U, // <0,3,1,6>: Cost 4 vext1 <6,0,3,1>, <6,0,3,1> + 3769600286U, // <0,3,1,7>: Cost 4 vext3 <1,u,3,0>, <3,1,7,3> + 2886519582U, // <0,3,1,u>: Cost 3 vzipl LHS, <3,u,1,2> 1482604646U, // <0,3,2,0>: Cost 2 vext1 <1,0,3,2>, LHS 1482605302U, // <0,3,2,1>: Cost 2 vext1 <1,0,3,2>, <1,0,3,2> 2556348008U, // <0,3,2,2>: Cost 3 vext1 <1,0,3,2>, <2,2,2,2> - 2556348566U, // <0,3,2,3>: Cost 3 vext1 <1,0,3,2>, <3,0,1,2> + 3020736924U, // <0,3,2,3>: Cost 3 vtrnl LHS, <3,3,3,3> 1482607926U, // <0,3,2,4>: Cost 2 vext1 <1,0,3,2>, RHS - 2556350160U, // <0,3,2,5>: Cost 3 vext1 <1,0,3,2>, <5,1,7,3> - 2556350970U, // <0,3,2,6>: Cost 3 vext1 <1,0,3,2>, <6,2,7,3> + 3020737026U, // <0,3,2,5>: Cost 3 vtrnl LHS, <3,4,5,6> + 2598154746U, // <0,3,2,6>: Cost 3 vext1 , <6,2,7,3> 2598155258U, // <0,3,2,7>: Cost 3 vext1 , <7,0,1,2> 1482610478U, // <0,3,2,u>: Cost 2 vext1 <1,0,3,2>, LHS - 3692341387U, // <0,3,3,0>: Cost 4 vext2 <0,2,0,3>, <3,0,0,0> + 3692341398U, // <0,3,3,0>: Cost 4 vext2 <0,2,0,3>, <3,0,1,2> 2635851999U, // <0,3,3,1>: Cost 3 vext2 <3,1,0,3>, <3,1,0,3> - 2636515632U, // <0,3,3,2>: Cost 3 vext2 <3,2,0,3>, <3,2,0,3> + 3636069840U, // <0,3,3,2>: Cost 4 vext1 <2,0,3,3>, <2,0,3,3> 2691877276U, // <0,3,3,3>: Cost 3 vext3 <1,2,3,0>, <3,3,3,3> - 3692341762U, // <0,3,3,4>: Cost 4 vext2 <0,2,0,3>, <3,4,5,6> - 3778374059U, // <0,3,3,5>: Cost 4 vext3 <3,3,5,0>, <3,3,5,0> - 3692341898U, // <0,3,3,6>: Cost 5 vext2 <0,2,0,3>, <3,6,2,7> - 3665933325U, // <0,3,3,7>: Cost 4 vext1 <7,0,3,3>, <7,0,3,3> + 3961522690U, // <0,3,3,4>: Cost 4 vzipl <0,3,1,4>, <3,4,5,6> + 3826797058U, // <0,3,3,5>: Cost 4 vuzpl <0,2,3,5>, <3,4,5,6> + 3703622282U, // <0,3,3,6>: Cost 4 vext2 <2,1,0,3>, <3,6,2,7> + 3769600452U, // <0,3,3,7>: Cost 4 vext3 <1,u,3,0>, <3,3,7,7> 2640497430U, // <0,3,3,u>: Cost 3 vext2 <3,u,0,3>, <3,u,0,3> - 3692342162U, // <0,3,4,0>: Cost 4 vext2 <0,2,0,3>, <4,0,5,1> + 3962194070U, // <0,3,4,0>: Cost 4 vzipl <0,4,1,5>, <3,0,1,2> 2232617112U, // <0,3,4,1>: Cost 3 vrev <3,0,1,4> 2232690849U, // <0,3,4,2>: Cost 3 vrev <3,0,2,4> - 3306506410U, // <0,3,4,3>: Cost 4 vrev <3,0,3,4> - 3765987832U, // <0,3,4,4>: Cost 4 vext3 <1,2,u,0>, <3,4,4,5> - 2618600758U, // <0,3,4,5>: Cost 3 vext2 <0,2,0,3>, RHS - 2705369605U, // <0,3,4,6>: Cost 3 vext3 <3,4,6,0>, <3,4,6,0> + 4095314332U, // <0,3,4,3>: Cost 4 vtrnl <0,2,4,6>, <3,3,3,3> + 3962194434U, // <0,3,4,4>: Cost 4 vzipl <0,4,1,5>, <3,4,5,6> + 2691877378U, // <0,3,4,5>: Cost 3 vext3 <1,2,3,0>, <3,4,5,6> + 3826765110U, // <0,3,4,6>: Cost 4 vuzpl <0,2,3,1>, RHS 3665941518U, // <0,3,4,7>: Cost 4 vext1 <7,0,3,4>, <7,0,3,4> - 2618601001U, // <0,3,4,u>: Cost 3 vext2 <0,2,0,3>, RHS - 3765619234U, // <0,3,5,0>: Cost 4 vext3 <1,2,3,0>, <3,5,0,2> - 3692342992U, // <0,3,5,1>: Cost 4 vext2 <0,2,0,3>, <5,1,7,3> - 3708268318U, // <0,3,5,2>: Cost 4 vext2 <2,u,0,3>, <5,2,7,0> - 3648031234U, // <0,3,5,3>: Cost 4 vext1 <4,0,3,5>, <3,4,5,6> + 2691877405U, // <0,3,4,u>: Cost 3 vext3 <1,2,3,0>, <3,4,u,6> + 3630112870U, // <0,3,5,0>: Cost 4 vext1 <1,0,3,5>, LHS + 3630113526U, // <0,3,5,1>: Cost 4 vext1 <1,0,3,5>, <1,0,3,2> + 4035199734U, // <0,3,5,2>: Cost 4 vzipr <1,4,0,5>, <1,0,3,2> + 3769600578U, // <0,3,5,3>: Cost 4 vext3 <1,u,3,0>, <3,5,3,7> 2232846516U, // <0,3,5,4>: Cost 3 vrev <3,0,4,5> - 3779701325U, // <0,3,5,5>: Cost 4 vext3 <3,5,5,0>, <3,5,5,0> + 3779037780U, // <0,3,5,5>: Cost 4 vext3 <3,4,5,0>, <3,5,5,7> 2718714461U, // <0,3,5,6>: Cost 3 vext3 <5,6,7,0>, <3,5,6,7> - 3779848799U, // <0,3,5,7>: Cost 4 vext3 <3,5,7,0>, <3,5,7,0> + 2706106975U, // <0,3,5,7>: Cost 3 vext3 <3,5,7,0>, <3,5,7,0> 2233141464U, // <0,3,5,u>: Cost 3 vrev <3,0,u,5> - 3648036966U, // <0,3,6,0>: Cost 4 vext1 <4,0,3,6>, LHS - 3306375322U, // <0,3,6,1>: Cost 4 vrev <3,0,1,6> - 3692343802U, // <0,3,6,2>: Cost 4 vext2 <0,2,0,3>, <6,2,7,3> - 3703624266U, // <0,3,6,3>: Cost 4 vext2 <2,1,0,3>, <6,3,7,2> - 3306596533U, // <0,3,6,4>: Cost 4 vrev <3,0,4,6> + 2691877496U, // <0,3,6,0>: Cost 3 vext3 <1,2,3,0>, <3,6,0,7> + 3727511914U, // <0,3,6,1>: Cost 4 vext2 <6,1,0,3>, <6,1,0,3> + 3765619338U, // <0,3,6,2>: Cost 4 vext3 <1,2,3,0>, <3,6,2,7> + 3765619347U, // <0,3,6,3>: Cost 4 vext3 <1,2,3,0>, <3,6,3,7> + 3765987996U, // <0,3,6,4>: Cost 4 vext3 <1,2,u,0>, <3,6,4,7> 3306670270U, // <0,3,6,5>: Cost 4 vrev <3,0,5,6> - 3733484344U, // <0,3,6,6>: Cost 4 vext2 <7,1,0,3>, <6,6,6,6> + 3792456365U, // <0,3,6,6>: Cost 4 vext3 <5,6,7,0>, <3,6,6,6> 2706770608U, // <0,3,6,7>: Cost 3 vext3 <3,6,7,0>, <3,6,7,0> 2706844345U, // <0,3,6,u>: Cost 3 vext3 <3,6,u,0>, <3,6,u,0> - 3796437698U, // <0,3,7,0>: Cost 4 vext3 <6,3,7,0>, <3,7,0,0> + 3769600707U, // <0,3,7,0>: Cost 4 vext3 <1,u,3,0>, <3,7,0,1> 2659742787U, // <0,3,7,1>: Cost 3 vext2 <7,1,0,3>, <7,1,0,3> - 3734148244U, // <0,3,7,2>: Cost 4 vext2 <7,2,0,3>, <7,2,0,3> - 3734811877U, // <0,3,7,3>: Cost 4 vext2 <7,3,0,3>, <7,3,0,3> - 3733484902U, // <0,3,7,4>: Cost 4 vext2 <7,1,0,3>, <7,4,5,6> - 3781028591U, // <0,3,7,5>: Cost 4 vext3 <3,7,5,0>, <3,7,5,0> - 3736802776U, // <0,3,7,6>: Cost 4 vext2 <7,6,0,3>, <7,6,0,3> - 3733485103U, // <0,3,7,7>: Cost 4 vext2 <7,1,0,3>, <7,7,1,0> + 3636102612U, // <0,3,7,2>: Cost 4 vext1 <2,0,3,7>, <2,0,3,7> + 3769600740U, // <0,3,7,3>: Cost 4 vext3 <1,u,3,0>, <3,7,3,7> + 3769600747U, // <0,3,7,4>: Cost 4 vext3 <1,u,3,0>, <3,7,4,5> + 3769600758U, // <0,3,7,5>: Cost 4 vext3 <1,u,3,0>, <3,7,5,7> + 3659993400U, // <0,3,7,6>: Cost 4 vext1 <6,0,3,7>, <6,0,3,7> + 3781176065U, // <0,3,7,7>: Cost 4 vext3 <3,7,7,0>, <3,7,7,0> 2664388218U, // <0,3,7,u>: Cost 3 vext2 <7,u,0,3>, <7,u,0,3> 1482653798U, // <0,3,u,0>: Cost 2 vext1 <1,0,3,u>, LHS 1482654460U, // <0,3,u,1>: Cost 2 vext1 <1,0,3,u>, <1,0,3,u> 2556397160U, // <0,3,u,2>: Cost 3 vext1 <1,0,3,u>, <2,2,2,2> - 2556397718U, // <0,3,u,3>: Cost 3 vext1 <1,0,3,u>, <3,0,1,2> + 3021179292U, // <0,3,u,3>: Cost 3 vtrnl LHS, <3,3,3,3> 1482657078U, // <0,3,u,4>: Cost 2 vext1 <1,0,3,u>, RHS - 2618603674U, // <0,3,u,5>: Cost 3 vext2 <0,2,0,3>, RHS - 2556400122U, // <0,3,u,6>: Cost 3 vext1 <1,0,3,u>, <6,2,7,3> - 2598204410U, // <0,3,u,7>: Cost 3 vext1 , <7,0,1,2> + 3021179394U, // <0,3,u,5>: Cost 3 vtrnl LHS, <3,4,5,6> + 2598203898U, // <0,3,u,6>: Cost 3 vext1 , <6,2,7,3> + 2708097874U, // <0,3,u,7>: Cost 3 vext3 <3,u,7,0>, <3,u,7,0> 1482659630U, // <0,3,u,u>: Cost 2 vext1 <1,0,3,u>, LHS 2617278468U, // <0,4,0,0>: Cost 3 vext2 <0,0,0,4>, <0,0,0,4> - 2631213158U, // <0,4,0,1>: Cost 3 vext2 <2,3,0,4>, LHS - 2819408076U, // <0,4,0,2>: Cost 3 vuzpr LHS, <0,2,4,6> + 2618605670U, // <0,4,0,1>: Cost 3 vext2 <0,2,0,4>, LHS + 2618605734U, // <0,4,0,2>: Cost 3 vext2 <0,2,0,4>, <0,2,0,4> 3642091695U, // <0,4,0,3>: Cost 4 vext1 <3,0,4,0>, <3,0,4,0> - 2657755474U, // <0,4,0,4>: Cost 3 vext2 <6,7,0,4>, <0,4,1,5> - 2691877778U, // <0,4,0,5>: Cost 3 vext3 <1,2,3,0>, <4,0,5,1> - 2691877788U, // <0,4,0,6>: Cost 3 vext3 <1,2,3,0>, <4,0,6,2> + 2753134796U, // <0,4,0,4>: Cost 3 vuzpl <0,2,4,6>, <0,2,4,6> + 2718714770U, // <0,4,0,5>: Cost 3 vext3 <5,6,7,0>, <4,0,5,1> + 3021245750U, // <0,4,0,6>: Cost 3 vtrnl <0,2,0,2>, RHS 3665982483U, // <0,4,0,7>: Cost 4 vext1 <7,0,4,0>, <7,0,4,0> - 2691877805U, // <0,4,0,u>: Cost 3 vext3 <1,2,3,0>, <4,0,u,1> + 3021245768U, // <0,4,0,u>: Cost 3 vtrnl <0,2,0,2>, RHS 2568355942U, // <0,4,1,0>: Cost 3 vext1 <3,0,4,1>, LHS - 3704955700U, // <0,4,1,1>: Cost 4 vext2 <2,3,0,4>, <1,1,1,1> - 2631213974U, // <0,4,1,2>: Cost 3 vext2 <2,3,0,4>, <1,2,3,0> + 3692348212U, // <0,4,1,1>: Cost 4 vext2 <0,2,0,4>, <1,1,1,1> + 3692348310U, // <0,4,1,2>: Cost 4 vext2 <0,2,0,4>, <1,2,3,0> 2568358064U, // <0,4,1,3>: Cost 3 vext1 <3,0,4,1>, <3,0,4,1> 2568359222U, // <0,4,1,4>: Cost 3 vext1 <3,0,4,1>, RHS - 1906753638U, // <0,4,1,5>: Cost 2 vzipr RHS, LHS - 3114713098U, // <0,4,1,6>: Cost 3 vtrnr RHS, <0,0,1,1> + 1812778294U, // <0,4,1,5>: Cost 2 vzipl LHS, RHS + 3022671158U, // <0,4,1,6>: Cost 3 vtrnl <0,4,1,5>, RHS 2592248852U, // <0,4,1,7>: Cost 3 vext1 <7,0,4,1>, <7,0,4,1> - 1908744294U, // <0,4,1,u>: Cost 2 vzipr RHS, LHS - 2562392166U, // <0,4,2,0>: Cost 3 vext1 <2,0,4,2>, LHS + 1812778537U, // <0,4,1,u>: Cost 2 vzipl LHS, RHS + 2568364134U, // <0,4,2,0>: Cost 3 vext1 <3,0,4,2>, LHS 2238573423U, // <0,4,2,1>: Cost 3 vrev <4,0,1,2> - 2562393560U, // <0,4,2,2>: Cost 3 vext1 <2,0,4,2>, <2,0,4,2> + 3692349032U, // <0,4,2,2>: Cost 4 vext2 <0,2,0,4>, <2,2,2,2> 2631214761U, // <0,4,2,3>: Cost 3 vext2 <2,3,0,4>, <2,3,0,4> - 2562395446U, // <0,4,2,4>: Cost 3 vext1 <2,0,4,2>, RHS - 3111272550U, // <0,4,2,5>: Cost 3 vtrnr <4,0,5,1>, LHS - 2040971366U, // <0,4,2,6>: Cost 2 vtrnr RHS, LHS + 2568367414U, // <0,4,2,4>: Cost 3 vext1 <3,0,4,2>, RHS + 2887028022U, // <0,4,2,5>: Cost 3 vzipl <0,2,0,2>, RHS + 1946996022U, // <0,4,2,6>: Cost 2 vtrnl LHS, RHS 2592257045U, // <0,4,2,7>: Cost 3 vext1 <7,0,4,2>, <7,0,4,2> - 2041118822U, // <0,4,2,u>: Cost 2 vtrnr RHS, LHS - 3704957078U, // <0,4,3,0>: Cost 4 vext2 <2,3,0,4>, <3,0,1,2> - 3704957169U, // <0,4,3,1>: Cost 4 vext2 <2,3,0,4>, <3,1,2,3> - 3704957232U, // <0,4,3,2>: Cost 4 vext2 <2,3,0,4>, <3,2,0,3> - 3704957340U, // <0,4,3,3>: Cost 4 vext2 <2,3,0,4>, <3,3,3,3> - 3704957442U, // <0,4,3,4>: Cost 4 vext2 <2,3,0,4>, <3,4,5,6> - 3312618388U, // <0,4,3,5>: Cost 4 vrev <4,0,5,3> - 3312692125U, // <0,4,3,6>: Cost 4 vrev <4,0,6,3> + 1946996040U, // <0,4,2,u>: Cost 2 vtrnl LHS, RHS + 3692349590U, // <0,4,3,0>: Cost 4 vext2 <0,2,0,4>, <3,0,1,2> + 3826878614U, // <0,4,3,1>: Cost 4 vuzpl <0,2,4,6>, <3,0,1,2> + 3826878625U, // <0,4,3,2>: Cost 4 vuzpl <0,2,4,6>, <3,0,2,4> + 3692349852U, // <0,4,3,3>: Cost 4 vext2 <0,2,0,4>, <3,3,3,3> + 3692349954U, // <0,4,3,4>: Cost 4 vext2 <0,2,0,4>, <3,4,5,6> + 3826878978U, // <0,4,3,5>: Cost 4 vuzpl <0,2,4,6>, <3,4,5,6> + 4095200566U, // <0,4,3,6>: Cost 4 vtrnl <0,2,3,1>, RHS 3713583814U, // <0,4,3,7>: Cost 4 vext2 <3,7,0,4>, <3,7,0,4> - 3704957726U, // <0,4,3,u>: Cost 4 vext2 <2,3,0,4>, <3,u,1,2> - 2710899880U, // <0,4,4,0>: Cost 3 vext3 <4,4,0,0>, <4,4,0,0> - 3704957924U, // <0,4,4,1>: Cost 4 vext2 <2,3,0,4>, <4,1,5,2> - 3642123945U, // <0,4,4,2>: Cost 4 vext1 <3,0,4,4>, <2,3,0,4> + 3692350238U, // <0,4,3,u>: Cost 4 vext2 <0,2,0,4>, <3,u,1,2> + 2550464552U, // <0,4,4,0>: Cost 3 vext1 <0,0,4,4>, <0,0,4,4> + 3962194914U, // <0,4,4,1>: Cost 4 vzipl <0,4,1,5>, <4,1,5,0> + 3693677631U, // <0,4,4,2>: Cost 4 vext2 <0,4,0,4>, <4,2,6,3> 3642124467U, // <0,4,4,3>: Cost 4 vext1 <3,0,4,4>, <3,0,4,4> 2718715088U, // <0,4,4,4>: Cost 3 vext3 <5,6,7,0>, <4,4,4,4> - 2631216438U, // <0,4,4,5>: Cost 3 vext2 <2,3,0,4>, RHS - 2846277836U, // <0,4,4,6>: Cost 3 vuzpr RHS, <0,2,4,6> + 2618608950U, // <0,4,4,5>: Cost 3 vext2 <0,2,0,4>, RHS + 2753137974U, // <0,4,4,6>: Cost 3 vuzpl <0,2,4,6>, RHS 3666015255U, // <0,4,4,7>: Cost 4 vext1 <7,0,4,4>, <7,0,4,4> - 2631216681U, // <0,4,4,u>: Cost 3 vext2 <2,3,0,4>, RHS + 2618609193U, // <0,4,4,u>: Cost 3 vext2 <0,2,0,4>, RHS 2568388710U, // <0,4,5,0>: Cost 3 vext1 <3,0,4,5>, LHS 2568389526U, // <0,4,5,1>: Cost 3 vext1 <3,0,4,5>, <1,2,3,0> 3636159963U, // <0,4,5,2>: Cost 4 vext1 <2,0,4,5>, <2,0,4,5> 2568390836U, // <0,4,5,3>: Cost 3 vext1 <3,0,4,5>, <3,0,4,5> 2568391990U, // <0,4,5,4>: Cost 3 vext1 <3,0,4,5>, RHS - 2592280674U, // <0,4,5,5>: Cost 3 vext1 <7,0,4,5>, <5,6,7,0> + 2718715180U, // <0,4,5,5>: Cost 3 vext3 <5,6,7,0>, <4,5,5,6> 1618136374U, // <0,4,5,6>: Cost 2 vext3 <1,2,3,0>, RHS 2592281624U, // <0,4,5,7>: Cost 3 vext1 <7,0,4,5>, <7,0,4,5> 1618136392U, // <0,4,5,u>: Cost 2 vext3 <1,2,3,0>, RHS - 2691878220U, // <0,4,6,0>: Cost 3 vext3 <1,2,3,0>, <4,6,0,2> - 3765620052U, // <0,4,6,1>: Cost 4 vext3 <1,2,3,0>, <4,6,1,1> - 2712374620U, // <0,4,6,2>: Cost 3 vext3 <4,6,2,0>, <4,6,2,0> - 3704959560U, // <0,4,6,3>: Cost 4 vext2 <2,3,0,4>, <6,3,7,0> - 2712522094U, // <0,4,6,4>: Cost 3 vext3 <4,6,4,0>, <4,6,4,0> - 4054237677U, // <0,4,6,5>: Cost 4 vzipr RHS, <0,6,0,7> + 2550480938U, // <0,4,6,0>: Cost 3 vext1 <0,0,4,6>, <0,0,4,6> + 3826880801U, // <0,4,6,1>: Cost 4 vuzpl <0,2,4,6>, <6,0,1,2> + 2562426332U, // <0,4,6,2>: Cost 3 vext1 <2,0,4,6>, <2,0,4,6> + 3786190181U, // <0,4,6,3>: Cost 4 vext3 <4,6,3,0>, <4,6,3,0> + 2718715252U, // <0,4,6,4>: Cost 3 vext3 <5,6,7,0>, <4,6,4,6> + 3826881165U, // <0,4,6,5>: Cost 4 vuzpl <0,2,4,6>, <6,4,5,6> 2712669568U, // <0,4,6,6>: Cost 3 vext3 <4,6,6,0>, <4,6,6,0> 2657760081U, // <0,4,6,7>: Cost 3 vext2 <6,7,0,4>, <6,7,0,4> - 2712817042U, // <0,4,6,u>: Cost 3 vext3 <4,6,u,0>, <4,6,u,0> - 3731502074U, // <0,4,7,0>: Cost 4 vext2 <6,7,0,4>, <7,0,1,2> - 3934208204U, // <0,4,7,1>: Cost 4 vuzpr <7,0,1,2>, <0,2,4,6> - 3934298316U, // <0,4,7,2>: Cost 4 vuzpr <7,0,2,4>, <0,2,4,6> + 2718715284U, // <0,4,6,u>: Cost 3 vext3 <5,6,7,0>, <4,6,u,2> + 3654090854U, // <0,4,7,0>: Cost 4 vext1 <5,0,4,7>, LHS + 3934229326U, // <0,4,7,1>: Cost 4 vuzpr <7,0,1,4>, <6,7,0,1> + 3734156437U, // <0,4,7,2>: Cost 4 vext2 <7,2,0,4>, <7,2,0,4> 3734820070U, // <0,4,7,3>: Cost 4 vext2 <7,3,0,4>, <7,3,0,4> - 3731502438U, // <0,4,7,4>: Cost 4 vext2 <6,7,0,4>, <7,4,5,6> - 3937190092U, // <0,4,7,5>: Cost 4 vuzpr <7,4,5,6>, <0,2,4,6> + 3654094134U, // <0,4,7,4>: Cost 4 vext1 <5,0,4,7>, RHS + 2713259464U, // <0,4,7,5>: Cost 3 vext3 <4,7,5,0>, <4,7,5,0> 2713333201U, // <0,4,7,6>: Cost 3 vext3 <4,7,6,0>, <4,7,6,0> - 3731502700U, // <0,4,7,7>: Cost 4 vext2 <6,7,0,4>, <7,7,7,7> - 2713480675U, // <0,4,7,u>: Cost 3 vext3 <4,7,u,0>, <4,7,u,0> - 2691878382U, // <0,4,u,0>: Cost 3 vext3 <1,2,3,0>, <4,u,0,2> - 2631218990U, // <0,4,u,1>: Cost 3 vext2 <2,3,0,4>, LHS - 2562442718U, // <0,4,u,2>: Cost 3 vext1 <2,0,4,u>, <2,0,4,u> + 3654095866U, // <0,4,7,7>: Cost 4 vext1 <5,0,4,7>, <7,0,1,2> + 2713259464U, // <0,4,7,u>: Cost 3 vext3 <4,7,5,0>, <4,7,5,0> + 2568413286U, // <0,4,u,0>: Cost 3 vext1 <3,0,4,u>, LHS + 2618611502U, // <0,4,u,1>: Cost 3 vext2 <0,2,0,4>, LHS + 2753140526U, // <0,4,u,2>: Cost 3 vuzpl <0,2,4,6>, LHS 2568415415U, // <0,4,u,3>: Cost 3 vext1 <3,0,4,u>, <3,0,4,u> - 2562444598U, // <0,4,u,4>: Cost 3 vext1 <2,0,4,u>, RHS - 1906754205U, // <0,4,u,5>: Cost 2 vzipr RHS, LHS - 1618136617U, // <0,4,u,6>: Cost 2 vext3 <1,2,3,0>, RHS + 2568416566U, // <0,4,u,4>: Cost 3 vext1 <3,0,4,u>, RHS + 1817423158U, // <0,4,u,5>: Cost 2 vzipl LHS, RHS + 1947438390U, // <0,4,u,6>: Cost 2 vtrnl LHS, RHS 2592306203U, // <0,4,u,7>: Cost 3 vext1 <7,0,4,u>, <7,0,4,u> - 1618136635U, // <0,4,u,u>: Cost 2 vext3 <1,2,3,0>, RHS - 3636191334U, // <0,5,0,0>: Cost 4 vext1 <2,0,5,0>, LHS - 2637856870U, // <0,5,0,1>: Cost 3 vext2 <3,4,0,5>, LHS - 3636192735U, // <0,5,0,2>: Cost 4 vext1 <2,0,5,0>, <2,0,5,0> - 3642165432U, // <0,5,0,3>: Cost 4 vext1 <3,0,5,0>, <3,0,5,0> - 3636194614U, // <0,5,0,4>: Cost 4 vext1 <2,0,5,0>, RHS - 3711598998U, // <0,5,0,5>: Cost 4 vext2 <3,4,0,5>, <0,5,0,1> + 1947438408U, // <0,4,u,u>: Cost 2 vtrnl LHS, RHS + 3630219264U, // <0,5,0,0>: Cost 4 vext1 <1,0,5,0>, <0,0,0,0> + 2625912934U, // <0,5,0,1>: Cost 3 vext2 <1,4,0,5>, LHS + 3692355748U, // <0,5,0,2>: Cost 4 vext2 <0,2,0,5>, <0,2,0,2> + 3693019384U, // <0,5,0,3>: Cost 4 vext2 <0,3,0,5>, <0,3,0,5> + 3630222646U, // <0,5,0,4>: Cost 4 vext1 <1,0,5,0>, RHS + 3699655062U, // <0,5,0,5>: Cost 4 vext2 <1,4,0,5>, <0,5,0,1> 2718715508U, // <0,5,0,6>: Cost 3 vext3 <5,6,7,0>, <5,0,6,1> - 3047604224U, // <0,5,0,7>: Cost 3 vtrnl RHS, <0,0,0,0> - 2637857437U, // <0,5,0,u>: Cost 3 vext2 <3,4,0,5>, LHS + 3087011126U, // <0,5,0,7>: Cost 3 vtrnr <0,0,0,0>, RHS + 2625913501U, // <0,5,0,u>: Cost 3 vext2 <1,4,0,5>, LHS 1500659814U, // <0,5,1,0>: Cost 2 vext1 <4,0,5,1>, LHS - 2574402294U, // <0,5,1,1>: Cost 3 vext1 <4,0,5,1>, <1,0,3,2> + 2886520528U, // <0,5,1,1>: Cost 3 vzipl LHS, <5,1,7,3> 2574403176U, // <0,5,1,2>: Cost 3 vext1 <4,0,5,1>, <2,2,2,2> 2574403734U, // <0,5,1,3>: Cost 3 vext1 <4,0,5,1>, <3,0,1,2> 1500662674U, // <0,5,1,4>: Cost 2 vext1 <4,0,5,1>, <4,0,5,1> - 2574405328U, // <0,5,1,5>: Cost 3 vext1 <4,0,5,1>, <5,1,7,3> - 2574406138U, // <0,5,1,6>: Cost 3 vext1 <4,0,5,1>, <6,2,7,3> - 2691878608U, // <0,5,1,7>: Cost 3 vext3 <1,2,3,0>, <5,1,7,3> + 2886520836U, // <0,5,1,5>: Cost 3 vzipl LHS, <5,5,5,5> + 2886520930U, // <0,5,1,6>: Cost 3 vzipl LHS, <5,6,7,0> + 2718715600U, // <0,5,1,7>: Cost 3 vext3 <5,6,7,0>, <5,1,7,3> 1500665646U, // <0,5,1,u>: Cost 2 vext1 <4,0,5,1>, LHS - 2568437862U, // <0,5,2,0>: Cost 3 vext1 <3,0,5,2>, LHS + 2556493926U, // <0,5,2,0>: Cost 3 vext1 <1,0,5,2>, LHS 2244546120U, // <0,5,2,1>: Cost 3 vrev <5,0,1,2> - 3636209121U, // <0,5,2,2>: Cost 4 vext1 <2,0,5,2>, <2,0,5,2> + 3692357256U, // <0,5,2,2>: Cost 4 vext2 <0,2,0,5>, <2,2,5,7> 2568439994U, // <0,5,2,3>: Cost 3 vext1 <3,0,5,2>, <3,0,5,2> - 2568441142U, // <0,5,2,4>: Cost 3 vext1 <3,0,5,2>, RHS - 3120595046U, // <0,5,2,5>: Cost 3 vtrnr <5,5,5,5>, LHS - 3765620504U, // <0,5,2,6>: Cost 4 vext3 <1,2,3,0>, <5,2,6,3> - 3047604244U, // <0,5,2,7>: Cost 3 vtrnl RHS, <0,0,2,2> - 2568443694U, // <0,5,2,u>: Cost 3 vext1 <3,0,5,2>, LHS - 3710937274U, // <0,5,3,0>: Cost 4 vext2 <3,3,0,5>, <3,0,5,2> - 3790024505U, // <0,5,3,1>: Cost 4 vext3 <5,3,1,0>, <5,3,1,0> - 3318369874U, // <0,5,3,2>: Cost 4 vrev <5,0,2,3> - 3710937475U, // <0,5,3,3>: Cost 4 vext2 <3,3,0,5>, <3,3,0,5> + 2556497206U, // <0,5,2,4>: Cost 3 vext1 <1,0,5,2>, RHS + 3020738564U, // <0,5,2,5>: Cost 3 vtrnl LHS, <5,5,5,5> + 4027877161U, // <0,5,2,6>: Cost 4 vzipr <0,2,0,2>, <2,4,5,6> + 3093220662U, // <0,5,2,7>: Cost 3 vtrnr <1,0,3,2>, RHS + 3093220663U, // <0,5,2,u>: Cost 3 vtrnr <1,0,3,2>, RHS + 3699656854U, // <0,5,3,0>: Cost 4 vext2 <1,4,0,5>, <3,0,1,2> + 3699656927U, // <0,5,3,1>: Cost 4 vext2 <1,4,0,5>, <3,1,0,3> + 3699657006U, // <0,5,3,2>: Cost 4 vext2 <1,4,0,5>, <3,2,0,1> + 3699657116U, // <0,5,3,3>: Cost 4 vext2 <1,4,0,5>, <3,3,3,3> 2637859284U, // <0,5,3,4>: Cost 3 vext2 <3,4,0,5>, <3,4,0,5> 3790319453U, // <0,5,3,5>: Cost 4 vext3 <5,3,5,0>, <5,3,5,0> - 3790393190U, // <0,5,3,6>: Cost 4 vext3 <5,3,6,0>, <5,3,6,0> + 3699657354U, // <0,5,3,6>: Cost 4 vext2 <1,4,0,5>, <3,6,2,7> 2716725103U, // <0,5,3,7>: Cost 3 vext3 <5,3,7,0>, <5,3,7,0> - 2640513816U, // <0,5,3,u>: Cost 3 vext2 <3,u,0,5>, <3,u,0,5> - 2637859730U, // <0,5,4,0>: Cost 3 vext2 <3,4,0,5>, <4,0,5,1> - 3711601637U, // <0,5,4,1>: Cost 4 vext2 <3,4,0,5>, <4,1,5,3> + 2716798840U, // <0,5,3,u>: Cost 3 vext3 <5,3,u,0>, <5,3,u,0> + 2661747602U, // <0,5,4,0>: Cost 3 vext2 <7,4,0,5>, <4,0,5,1> + 3630252810U, // <0,5,4,1>: Cost 4 vext1 <1,0,5,4>, <1,0,5,4> 3636225507U, // <0,5,4,2>: Cost 4 vext1 <2,0,5,4>, <2,0,5,4> - 3648170452U, // <0,5,4,3>: Cost 4 vext1 <4,0,5,4>, <3,4,0,5> - 3636227382U, // <0,5,4,4>: Cost 4 vext1 <2,0,5,4>, RHS - 2637860150U, // <0,5,4,5>: Cost 3 vext2 <3,4,0,5>, RHS - 2718715836U, // <0,5,4,6>: Cost 3 vext3 <5,6,7,0>, <5,4,6,5> + 3716910172U, // <0,5,4,3>: Cost 4 vext2 <4,3,0,5>, <4,3,0,5> + 3962195892U, // <0,5,4,4>: Cost 4 vzipl <0,4,1,5>, <5,4,5,6> + 2625916214U, // <0,5,4,5>: Cost 3 vext2 <1,4,0,5>, RHS + 3718901071U, // <0,5,4,6>: Cost 4 vext2 <4,6,0,5>, <4,6,0,5> 2718715846U, // <0,5,4,7>: Cost 3 vext3 <5,6,7,0>, <5,4,7,6> - 2637860393U, // <0,5,4,u>: Cost 3 vext2 <3,4,0,5>, RHS - 3792457683U, // <0,5,5,0>: Cost 4 vext3 <5,6,7,0>, <5,5,0,1> - 3704966864U, // <0,5,5,1>: Cost 4 vext2 <2,3,0,5>, <5,1,7,3> - 3711602411U, // <0,5,5,2>: Cost 4 vext2 <3,4,0,5>, <5,2,1,3> - 3642206397U, // <0,5,5,3>: Cost 4 vext1 <3,0,5,5>, <3,0,5,5> + 2625916457U, // <0,5,4,u>: Cost 3 vext2 <1,4,0,5>, RHS + 3791278034U, // <0,5,5,0>: Cost 4 vext3 <5,5,0,0>, <5,5,0,0> + 3791351771U, // <0,5,5,1>: Cost 4 vext3 <5,5,1,0>, <5,5,1,0> + 3318386260U, // <0,5,5,2>: Cost 4 vrev <5,0,2,5> + 3791499245U, // <0,5,5,3>: Cost 4 vext3 <5,5,3,0>, <5,5,3,0> 3318533734U, // <0,5,5,4>: Cost 4 vrev <5,0,4,5> 2718715908U, // <0,5,5,5>: Cost 3 vext3 <5,6,7,0>, <5,5,5,5> 2657767522U, // <0,5,5,6>: Cost 3 vext2 <6,7,0,5>, <5,6,7,0> 2718715928U, // <0,5,5,7>: Cost 3 vext3 <5,6,7,0>, <5,5,7,7> 2718715937U, // <0,5,5,u>: Cost 3 vext3 <5,6,7,0>, <5,5,u,7> 2592358502U, // <0,5,6,0>: Cost 3 vext1 <7,0,5,6>, LHS - 3788918835U, // <0,5,6,1>: Cost 4 vext3 <5,1,4,0>, <5,6,1,7> - 3711603194U, // <0,5,6,2>: Cost 4 vext2 <3,4,0,5>, <6,2,7,3> + 3792015404U, // <0,5,6,1>: Cost 4 vext3 <5,6,1,0>, <5,6,1,0> + 3731509754U, // <0,5,6,2>: Cost 4 vext2 <6,7,0,5>, <6,2,7,3> 3785748546U, // <0,5,6,3>: Cost 4 vext3 <4,5,6,0>, <5,6,3,4> 2592361782U, // <0,5,6,4>: Cost 3 vext1 <7,0,5,6>, RHS 2592362594U, // <0,5,6,5>: Cost 3 vext1 <7,0,5,6>, <5,6,7,0> - 3792384089U, // <0,5,6,6>: Cost 4 vext3 <5,6,6,0>, <5,6,6,0> + 3785748576U, // <0,5,6,6>: Cost 4 vext3 <4,5,6,0>, <5,6,6,7> 1644974178U, // <0,5,6,7>: Cost 2 vext3 <5,6,7,0>, <5,6,7,0> 1645047915U, // <0,5,6,u>: Cost 2 vext3 <5,6,u,0>, <5,6,u,0> - 3765620854U, // <0,5,7,0>: Cost 4 vext3 <1,2,3,0>, <5,7,0,2> - 3699659876U, // <0,5,7,1>: Cost 4 vext2 <1,4,0,5>, <7,1,4,0> - 3792752774U, // <0,5,7,2>: Cost 4 vext3 <5,7,2,0>, <5,7,2,0> - 3734828263U, // <0,5,7,3>: Cost 4 vext2 <7,3,0,5>, <7,3,0,5> - 2661750072U, // <0,5,7,4>: Cost 3 vext2 <7,4,0,5>, <7,4,0,5> - 3792457896U, // <0,5,7,5>: Cost 4 vext3 <5,6,7,0>, <5,7,5,7> - 3660140874U, // <0,5,7,6>: Cost 4 vext1 <6,0,5,7>, <6,0,5,7> + 2562506854U, // <0,5,7,0>: Cost 3 vext1 <2,0,5,7>, LHS + 2562507670U, // <0,5,7,1>: Cost 3 vext1 <2,0,5,7>, <1,2,3,0> + 2562508262U, // <0,5,7,2>: Cost 3 vext1 <2,0,5,7>, <2,0,5,7> + 3636250774U, // <0,5,7,3>: Cost 4 vext1 <2,0,5,7>, <3,0,1,2> + 2562510134U, // <0,5,7,4>: Cost 3 vext1 <2,0,5,7>, RHS + 2718716072U, // <0,5,7,5>: Cost 3 vext3 <5,6,7,0>, <5,7,5,7> + 2718716074U, // <0,5,7,6>: Cost 3 vext3 <5,6,7,0>, <5,7,6,0> 2719379635U, // <0,5,7,7>: Cost 3 vext3 <5,7,7,0>, <5,7,7,0> - 2719453372U, // <0,5,7,u>: Cost 3 vext3 <5,7,u,0>, <5,7,u,0> + 2562512686U, // <0,5,7,u>: Cost 3 vext1 <2,0,5,7>, LHS 1500717158U, // <0,5,u,0>: Cost 2 vext1 <4,0,5,u>, LHS - 2637862702U, // <0,5,u,1>: Cost 3 vext2 <3,4,0,5>, LHS - 2574460520U, // <0,5,u,2>: Cost 3 vext1 <4,0,5,u>, <2,2,2,2> + 2625918766U, // <0,5,u,1>: Cost 3 vext2 <1,4,0,5>, LHS + 2719674583U, // <0,5,u,2>: Cost 3 vext3 <5,u,2,0>, <5,u,2,0> 2568489152U, // <0,5,u,3>: Cost 3 vext1 <3,0,5,u>, <3,0,5,u> 1500720025U, // <0,5,u,4>: Cost 2 vext1 <4,0,5,u>, <4,0,5,u> - 2637863066U, // <0,5,u,5>: Cost 3 vext2 <3,4,0,5>, RHS - 2574463482U, // <0,5,u,6>: Cost 3 vext1 <4,0,5,u>, <6,2,7,3> + 2625919130U, // <0,5,u,5>: Cost 3 vext2 <1,4,0,5>, RHS + 2586407243U, // <0,5,u,6>: Cost 3 vext1 <6,0,5,u>, <6,0,5,u> 1646301444U, // <0,5,u,7>: Cost 2 vext3 <5,u,7,0>, <5,u,7,0> - 1500722990U, // <0,5,u,u>: Cost 2 vext1 <4,0,5,u>, LHS - 2574467174U, // <0,6,0,0>: Cost 3 vext1 <4,0,6,0>, LHS - 2637865062U, // <0,6,0,1>: Cost 3 vext2 <3,4,0,6>, LHS - 2250576168U, // <0,6,0,2>: Cost 3 vrev <6,0,2,0> - 3779113269U, // <0,6,0,3>: Cost 4 vext3 <3,4,6,0>, <6,0,3,4> - 2574470042U, // <0,6,0,4>: Cost 3 vext1 <4,0,6,0>, <4,0,6,0> - 3648212688U, // <0,6,0,5>: Cost 4 vext1 <4,0,6,0>, <5,1,7,3> + 1646375181U, // <0,5,u,u>: Cost 2 vext3 <5,u,u,0>, <5,u,u,0> + 2586411110U, // <0,6,0,0>: Cost 3 vext1 <6,0,6,0>, LHS + 2619949158U, // <0,6,0,1>: Cost 3 vext2 <0,4,0,6>, LHS + 2619949220U, // <0,6,0,2>: Cost 3 vext2 <0,4,0,6>, <0,2,0,2> + 3785748789U, // <0,6,0,3>: Cost 4 vext3 <4,5,6,0>, <6,0,3,4> + 2619949386U, // <0,6,0,4>: Cost 3 vext2 <0,4,0,6>, <0,4,0,6> + 2586415202U, // <0,6,0,5>: Cost 3 vext1 <6,0,6,0>, <5,6,7,0> 2586415436U, // <0,6,0,6>: Cost 3 vext1 <6,0,6,0>, <6,0,6,0> - 2913386496U, // <0,6,0,7>: Cost 3 vzipl RHS, <0,0,0,0> - 2637865629U, // <0,6,0,u>: Cost 3 vext2 <3,4,0,6>, LHS - 2574475366U, // <0,6,1,0>: Cost 3 vext1 <4,0,6,1>, LHS - 3699663668U, // <0,6,1,1>: Cost 4 vext2 <1,4,0,6>, <1,1,1,1> - 2990489702U, // <0,6,1,2>: Cost 3 vzipr <6,2,7,3>, LHS - 3642247362U, // <0,6,1,3>: Cost 4 vext1 <3,0,6,1>, <3,0,6,1> - 2574478235U, // <0,6,1,4>: Cost 3 vext1 <4,0,6,1>, <4,0,6,1> + 2952793398U, // <0,6,0,7>: Cost 3 vzipr <0,0,0,0>, RHS + 2619949725U, // <0,6,0,u>: Cost 3 vext2 <0,4,0,6>, LHS + 2562531430U, // <0,6,1,0>: Cost 3 vext1 <2,0,6,1>, LHS + 3693691700U, // <0,6,1,1>: Cost 4 vext2 <0,4,0,6>, <1,1,1,1> + 2886521338U, // <0,6,1,2>: Cost 3 vzipl LHS, <6,2,7,3> + 3693691864U, // <0,6,1,3>: Cost 4 vext2 <0,4,0,6>, <1,3,1,3> + 2562534710U, // <0,6,1,4>: Cost 3 vext1 <2,0,6,1>, RHS 2580450932U, // <0,6,1,5>: Cost 3 vext1 <5,0,6,1>, <5,0,6,1> - 2993094758U, // <0,6,1,6>: Cost 3 vzipr <6,6,6,6>, LHS - 2913388198U, // <0,6,1,7>: Cost 3 vzipl RHS, <2,3,0,1> - 2574481198U, // <0,6,1,u>: Cost 3 vext1 <4,0,6,1>, LHS + 2886521656U, // <0,6,1,6>: Cost 3 vzipl LHS, <6,6,6,6> + 2966736182U, // <0,6,1,7>: Cost 3 vzipr <2,3,0,1>, RHS + 2966736183U, // <0,6,1,u>: Cost 3 vzipr <2,3,0,1>, RHS 1500741734U, // <0,6,2,0>: Cost 2 vext1 <4,0,6,2>, LHS - 2574484214U, // <0,6,2,1>: Cost 3 vext1 <4,0,6,2>, <1,0,3,2> + 2250518817U, // <0,6,2,1>: Cost 3 vrev <6,0,1,2> 2574485096U, // <0,6,2,2>: Cost 3 vext1 <4,0,6,2>, <2,2,2,2> - 2574485654U, // <0,6,2,3>: Cost 3 vext1 <4,0,6,2>, <3,0,1,2> + 2631894694U, // <0,6,2,3>: Cost 3 vext2 <2,4,0,6>, <2,3,0,1> 1500744604U, // <0,6,2,4>: Cost 2 vext1 <4,0,6,2>, <4,0,6,2> 2574487248U, // <0,6,2,5>: Cost 3 vext1 <4,0,6,2>, <5,1,7,3> - 2574488013U, // <0,6,2,6>: Cost 3 vext1 <4,0,6,2>, <6,2,2,3> - 2691879418U, // <0,6,2,7>: Cost 3 vext3 <1,2,3,0>, <6,2,7,3> + 3020739384U, // <0,6,2,6>: Cost 3 vtrnl LHS, <6,6,6,6> + 2954136886U, // <0,6,2,7>: Cost 3 vzipr <0,2,0,2>, RHS 1500747566U, // <0,6,2,u>: Cost 2 vext1 <4,0,6,2>, LHS - 3711608982U, // <0,6,3,0>: Cost 4 vext2 <3,4,0,6>, <3,0,1,2> - 3324268834U, // <0,6,3,1>: Cost 4 vrev <6,0,1,3> - 3324342571U, // <0,6,3,2>: Cost 4 vrev <6,0,2,3> - 3711609244U, // <0,6,3,3>: Cost 4 vext2 <3,4,0,6>, <3,3,3,3> + 3693693078U, // <0,6,3,0>: Cost 4 vext2 <0,4,0,6>, <3,0,1,2> + 3705637136U, // <0,6,3,1>: Cost 4 vext2 <2,4,0,6>, <3,1,5,7> + 3705637192U, // <0,6,3,2>: Cost 4 vext2 <2,4,0,6>, <3,2,3,0> + 3693693340U, // <0,6,3,3>: Cost 4 vext2 <0,4,0,6>, <3,3,3,3> 2637867477U, // <0,6,3,4>: Cost 3 vext2 <3,4,0,6>, <3,4,0,6> - 3796292150U, // <0,6,3,5>: Cost 4 vext3 <6,3,5,0>, <6,3,5,0> + 3705637424U, // <0,6,3,5>: Cost 4 vext2 <2,4,0,6>, <3,5,1,7> 3666154056U, // <0,6,3,6>: Cost 4 vext1 <7,0,6,3>, <6,3,7,0> 2722697800U, // <0,6,3,7>: Cost 3 vext3 <6,3,7,0>, <6,3,7,0> - 2640522009U, // <0,6,3,u>: Cost 3 vext2 <3,u,0,6>, <3,u,0,6> - 2637867932U, // <0,6,4,0>: Cost 3 vext2 <3,4,0,6>, <4,0,6,2> - 3324277027U, // <0,6,4,1>: Cost 4 vrev <6,0,1,4> - 2250608940U, // <0,6,4,2>: Cost 3 vrev <6,0,2,4> - 3711609997U, // <0,6,4,3>: Cost 4 vext2 <3,4,0,6>, <4,3,6,0> - 3648244638U, // <0,6,4,4>: Cost 4 vext1 <4,0,6,4>, <4,0,6,4> - 2637868342U, // <0,6,4,5>: Cost 3 vext2 <3,4,0,6>, RHS + 2722771537U, // <0,6,3,u>: Cost 3 vext3 <6,3,u,0>, <6,3,u,0> + 2562556006U, // <0,6,4,0>: Cost 3 vext1 <2,0,6,4>, LHS + 4095316257U, // <0,6,4,1>: Cost 4 vtrnl <0,2,4,6>, <6,0,1,2> + 2562557420U, // <0,6,4,2>: Cost 3 vext1 <2,0,6,4>, <2,0,6,4> + 3636299926U, // <0,6,4,3>: Cost 4 vext1 <2,0,6,4>, <3,0,1,2> + 2562559286U, // <0,6,4,4>: Cost 3 vext1 <2,0,6,4>, RHS + 2619952438U, // <0,6,4,5>: Cost 3 vext2 <0,4,0,6>, RHS 2723287696U, // <0,6,4,6>: Cost 3 vext3 <6,4,6,0>, <6,4,6,0> - 3779039902U, // <0,6,4,7>: Cost 4 vext3 <3,4,5,0>, <6,4,7,5> - 2637868585U, // <0,6,4,u>: Cost 3 vext2 <3,4,0,6>, RHS + 4027895094U, // <0,6,4,7>: Cost 4 vzipr <0,2,0,4>, RHS + 2619952681U, // <0,6,4,u>: Cost 3 vext2 <0,4,0,6>, RHS 2718716594U, // <0,6,5,0>: Cost 3 vext3 <5,6,7,0>, <6,5,0,7> - 3711610576U, // <0,6,5,1>: Cost 4 vext2 <3,4,0,6>, <5,1,7,3> - 3786265284U, // <0,6,5,2>: Cost 4 vext3 <4,6,4,0>, <6,5,2,7> - 3711610736U, // <0,6,5,3>: Cost 5 vext2 <3,4,0,6>, <5,3,7,1> - 3723554695U, // <0,6,5,4>: Cost 4 vext2 <5,4,0,6>, <5,4,0,6> - 3792458460U, // <0,6,5,5>: Cost 4 vext3 <5,6,7,0>, <6,5,5,4> + 3648250774U, // <0,6,5,1>: Cost 4 vext1 <4,0,6,5>, <1,2,3,0> + 3792458436U, // <0,6,5,2>: Cost 4 vext3 <5,6,7,0>, <6,5,2,7> + 3705638767U, // <0,6,5,3>: Cost 5 vext2 <2,4,0,6>, <5,3,7,0> + 3648252831U, // <0,6,5,4>: Cost 4 vext1 <4,0,6,5>, <4,0,6,5> + 3797619416U, // <0,6,5,5>: Cost 4 vext3 <6,5,5,0>, <6,5,5,0> 3792458472U, // <0,6,5,6>: Cost 4 vext3 <5,6,7,0>, <6,5,6,7> - 3784643307U, // <0,6,5,7>: Cost 4 vext3 <4,4,0,0>, <6,5,7,1> + 4035202358U, // <0,6,5,7>: Cost 4 vzipr <1,4,0,5>, RHS 2718716594U, // <0,6,5,u>: Cost 3 vext3 <5,6,7,0>, <6,5,0,7> 3786412796U, // <0,6,6,0>: Cost 4 vext3 <4,6,6,0>, <6,6,0,0> - 3765621511U, // <0,6,6,1>: Cost 4 vext3 <1,2,3,0>, <6,6,1,2> - 3704975866U, // <0,6,6,2>: Cost 4 vext2 <2,3,0,6>, <6,2,7,3> - 3642288327U, // <0,6,6,3>: Cost 4 vext1 <3,0,6,6>, <3,0,6,6> + 3792458504U, // <0,6,6,1>: Cost 4 vext3 <5,6,7,0>, <6,6,1,3> + 3728200126U, // <0,6,6,2>: Cost 4 vext2 <6,2,0,6>, <6,2,0,6> + 3798135575U, // <0,6,6,3>: Cost 4 vext3 <6,6,3,0>, <6,6,3,0> 3786412836U, // <0,6,6,4>: Cost 4 vext3 <4,6,6,0>, <6,6,4,4> - 3666178146U, // <0,6,6,5>: Cost 4 vext1 <7,0,6,6>, <5,6,7,0> + 3792458543U, // <0,6,6,5>: Cost 4 vext3 <5,6,7,0>, <6,6,5,6> 2718716728U, // <0,6,6,6>: Cost 3 vext3 <5,6,7,0>, <6,6,6,6> 2718716738U, // <0,6,6,7>: Cost 3 vext3 <5,6,7,0>, <6,6,7,7> 2718716747U, // <0,6,6,u>: Cost 3 vext3 <5,6,7,0>, <6,6,u,7> 2718716750U, // <0,6,7,0>: Cost 3 vext3 <5,6,7,0>, <6,7,0,1> 2724909910U, // <0,6,7,1>: Cost 3 vext3 <6,7,1,0>, <6,7,1,0> - 3786117986U, // <0,6,7,2>: Cost 4 vext3 <4,6,2,0>, <6,7,2,3> + 3636323823U, // <0,6,7,2>: Cost 4 vext1 <2,0,6,7>, <2,0,6,7> 2725057384U, // <0,6,7,3>: Cost 3 vext3 <6,7,3,0>, <6,7,3,0> 2718716790U, // <0,6,7,4>: Cost 3 vext3 <5,6,7,0>, <6,7,4,5> 2718716800U, // <0,6,7,5>: Cost 3 vext3 <5,6,7,0>, <6,7,5,6> @@ -580,241 +580,241 @@ 2725352332U, // <0,6,7,7>: Cost 3 vext3 <6,7,7,0>, <6,7,7,0> 2718716822U, // <0,6,7,u>: Cost 3 vext3 <5,6,7,0>, <6,7,u,1> 1500790886U, // <0,6,u,0>: Cost 2 vext1 <4,0,6,u>, LHS - 2637870894U, // <0,6,u,1>: Cost 3 vext2 <3,4,0,6>, LHS - 2574534248U, // <0,6,u,2>: Cost 3 vext1 <4,0,6,u>, <2,2,2,2> - 2574534806U, // <0,6,u,3>: Cost 3 vext1 <4,0,6,u>, <3,0,1,2> + 2619954990U, // <0,6,u,1>: Cost 3 vext2 <0,4,0,6>, LHS + 2562590192U, // <0,6,u,2>: Cost 3 vext1 <2,0,6,u>, <2,0,6,u> + 2725721017U, // <0,6,u,3>: Cost 3 vext3 <6,u,3,0>, <6,u,3,0> 1500793762U, // <0,6,u,4>: Cost 2 vext1 <4,0,6,u>, <4,0,6,u> - 2637871258U, // <0,6,u,5>: Cost 3 vext2 <3,4,0,6>, RHS - 2574537210U, // <0,6,u,6>: Cost 3 vext1 <4,0,6,u>, <6,2,7,3> - 2691879904U, // <0,6,u,7>: Cost 3 vext3 <1,2,3,0>, <6,u,7,3> + 2619955354U, // <0,6,u,5>: Cost 3 vext2 <0,4,0,6>, RHS + 2725942228U, // <0,6,u,6>: Cost 3 vext3 <6,u,6,0>, <6,u,6,0> + 2954186038U, // <0,6,u,7>: Cost 3 vzipr <0,2,0,u>, RHS 1500796718U, // <0,6,u,u>: Cost 2 vext1 <4,0,6,u>, LHS 2256401391U, // <0,7,0,0>: Cost 3 vrev <7,0,0,0> - 2718716922U, // <0,7,0,1>: Cost 3 vext3 <5,6,7,0>, <7,0,1,2> + 2632564838U, // <0,7,0,1>: Cost 3 vext2 <2,5,0,7>, LHS 2256548865U, // <0,7,0,2>: Cost 3 vrev <7,0,2,0> - 3990487040U, // <0,7,0,3>: Cost 4 vzipl <5,1,7,3>, <0,0,0,0> + 3700998396U, // <0,7,0,3>: Cost 4 vext2 <1,6,0,7>, <0,3,1,0> 2718716952U, // <0,7,0,4>: Cost 3 vext3 <5,6,7,0>, <7,0,4,5> 2718716962U, // <0,7,0,5>: Cost 3 vext3 <5,6,7,0>, <7,0,5,6> 2621284845U, // <0,7,0,6>: Cost 3 vext2 <0,6,0,7>, <0,6,0,7> - 3993174016U, // <0,7,0,7>: Cost 4 vzipl <5,5,7,7>, <0,0,0,0> - 2718716984U, // <0,7,0,u>: Cost 3 vext3 <5,6,7,0>, <7,0,u,1> - 2580521062U, // <0,7,1,0>: Cost 3 vext1 <5,0,7,1>, LHS - 3654263542U, // <0,7,1,1>: Cost 4 vext1 <5,0,7,1>, <1,0,3,2> - 2586494630U, // <0,7,1,2>: Cost 3 vext1 <6,0,7,1>, <2,3,0,1> - 3654264982U, // <0,7,1,3>: Cost 4 vext1 <5,0,7,1>, <3,0,1,2> - 2580523922U, // <0,7,1,4>: Cost 3 vext1 <5,0,7,1>, <4,0,5,1> - 2580524669U, // <0,7,1,5>: Cost 3 vext1 <5,0,7,1>, <5,0,7,1> - 2586497366U, // <0,7,1,6>: Cost 3 vext1 <6,0,7,1>, <6,0,7,1> - 2999812198U, // <0,7,1,7>: Cost 3 vzipr <7,7,7,7>, LHS - 2580526894U, // <0,7,1,u>: Cost 3 vext1 <5,0,7,1>, LHS - 2580529254U, // <0,7,2,0>: Cost 3 vext1 <5,0,7,2>, LHS + 3904685542U, // <0,7,0,7>: Cost 4 vuzpr <2,0,5,7>, <2,0,5,7> + 2632565405U, // <0,7,0,u>: Cost 3 vext2 <2,5,0,7>, LHS + 2256409584U, // <0,7,1,0>: Cost 3 vrev <7,0,0,1> + 3706307380U, // <0,7,1,1>: Cost 4 vext2 <2,5,0,7>, <1,1,1,1> + 2632565654U, // <0,7,1,2>: Cost 3 vext2 <2,5,0,7>, <1,2,3,0> + 3769603168U, // <0,7,1,3>: Cost 4 vext3 <1,u,3,0>, <7,1,3,5> + 2256704532U, // <0,7,1,4>: Cost 3 vrev <7,0,4,1> + 3769603184U, // <0,7,1,5>: Cost 4 vext3 <1,u,3,0>, <7,1,5,3> + 3700999366U, // <0,7,1,6>: Cost 4 vext2 <1,6,0,7>, <1,6,0,7> + 2886522476U, // <0,7,1,7>: Cost 3 vzipl LHS, <7,7,7,7> + 2256999480U, // <0,7,1,u>: Cost 3 vrev <7,0,u,1> + 2586501222U, // <0,7,2,0>: Cost 3 vext1 <6,0,7,2>, LHS 1182749690U, // <0,7,2,1>: Cost 2 vrev <7,0,1,2> - 3654272616U, // <0,7,2,2>: Cost 4 vext1 <5,0,7,2>, <2,2,2,2> + 3636356595U, // <0,7,2,2>: Cost 4 vext1 <2,0,7,2>, <2,0,7,2> 2727711916U, // <0,7,2,3>: Cost 3 vext3 <7,2,3,0>, <7,2,3,0> - 2580532534U, // <0,7,2,4>: Cost 3 vext1 <5,0,7,2>, RHS - 2580532862U, // <0,7,2,5>: Cost 3 vext1 <5,0,7,2>, <5,0,7,2> + 2586504502U, // <0,7,2,4>: Cost 3 vext1 <6,0,7,2>, RHS + 2632566606U, // <0,7,2,5>: Cost 3 vext2 <2,5,0,7>, <2,5,0,7> 2586505559U, // <0,7,2,6>: Cost 3 vext1 <6,0,7,2>, <6,0,7,2> - 3134029926U, // <0,7,2,7>: Cost 3 vtrnr <7,7,7,7>, LHS + 3020740204U, // <0,7,2,7>: Cost 3 vtrnl LHS, <7,7,7,7> 1183265849U, // <0,7,2,u>: Cost 2 vrev <7,0,u,2> - 3792458979U, // <0,7,3,0>: Cost 4 vext3 <5,6,7,0>, <7,3,0,1> - 3330241531U, // <0,7,3,1>: Cost 4 vrev <7,0,1,3> + 3701000342U, // <0,7,3,0>: Cost 4 vext2 <1,6,0,7>, <3,0,1,2> + 3706308849U, // <0,7,3,1>: Cost 4 vext2 <2,5,0,7>, <3,1,2,3> 3330315268U, // <0,7,3,2>: Cost 4 vrev <7,0,2,3> - 3792459008U, // <0,7,3,3>: Cost 4 vext3 <5,6,7,0>, <7,3,3,3> - 3787740430U, // <0,7,3,4>: Cost 4 vext3 <4,u,6,0>, <7,3,4,u> + 3706309020U, // <0,7,3,3>: Cost 4 vext2 <2,5,0,7>, <3,3,3,3> + 3706309122U, // <0,7,3,4>: Cost 4 vext2 <2,5,0,7>, <3,4,5,6> 3712281127U, // <0,7,3,5>: Cost 4 vext2 <3,5,0,7>, <3,5,0,7> - 3712944760U, // <0,7,3,6>: Cost 4 vext2 <3,6,0,7>, <3,6,0,7> + 2639202936U, // <0,7,3,6>: Cost 3 vext2 <3,6,0,7>, <3,6,0,7> 3802412321U, // <0,7,3,7>: Cost 4 vext3 <7,3,7,0>, <7,3,7,0> - 3714272026U, // <0,7,3,u>: Cost 4 vext2 <3,u,0,7>, <3,u,0,7> + 2640530202U, // <0,7,3,u>: Cost 3 vext2 <3,u,0,7>, <3,u,0,7> 3654287462U, // <0,7,4,0>: Cost 4 vext1 <5,0,7,4>, LHS 2256507900U, // <0,7,4,1>: Cost 3 vrev <7,0,1,4> 2256581637U, // <0,7,4,2>: Cost 3 vrev <7,0,2,4> - 3330397198U, // <0,7,4,3>: Cost 4 vrev <7,0,3,4> + 3660262008U, // <0,7,4,3>: Cost 4 vext1 <6,0,7,4>, <3,6,0,7> 3786413405U, // <0,7,4,4>: Cost 4 vext3 <4,6,6,0>, <7,4,4,6> - 2718717286U, // <0,7,4,5>: Cost 3 vext3 <5,6,7,0>, <7,4,5,6> - 2729260393U, // <0,7,4,6>: Cost 3 vext3 <7,4,6,0>, <7,4,6,0> - 3792459127U, // <0,7,4,7>: Cost 4 vext3 <5,6,7,0>, <7,4,7,5> - 2718717313U, // <0,7,4,u>: Cost 3 vext3 <5,6,7,0>, <7,4,u,6> - 3712282238U, // <0,7,5,0>: Cost 4 vext2 <3,5,0,7>, <5,0,7,2> - 3712282320U, // <0,7,5,1>: Cost 4 vext2 <3,5,0,7>, <5,1,7,3> - 3789804957U, // <0,7,5,2>: Cost 4 vext3 <5,2,7,0>, <7,5,2,7> - 3654297780U, // <0,7,5,3>: Cost 4 vext1 <5,0,7,5>, <3,0,4,5> + 2632568118U, // <0,7,4,5>: Cost 3 vext2 <2,5,0,7>, RHS + 3718917457U, // <0,7,4,6>: Cost 4 vext2 <4,6,0,7>, <4,6,0,7> + 3787003255U, // <0,7,4,7>: Cost 4 vext3 <4,7,5,0>, <7,4,7,5> + 2632568361U, // <0,7,4,u>: Cost 3 vext2 <2,5,0,7>, RHS + 3706310268U, // <0,7,5,0>: Cost 4 vext2 <2,5,0,7>, <5,0,7,0> + 3792459156U, // <0,7,5,1>: Cost 4 vext3 <5,6,7,0>, <7,5,1,7> + 3330331654U, // <0,7,5,2>: Cost 4 vrev <7,0,2,5> + 3722899255U, // <0,7,5,3>: Cost 4 vext2 <5,3,0,7>, <5,3,0,7> 2256737304U, // <0,7,5,4>: Cost 3 vrev <7,0,4,5> - 3654299265U, // <0,7,5,5>: Cost 4 vext1 <5,0,7,5>, <5,0,7,5> + 3724226521U, // <0,7,5,5>: Cost 4 vext2 <5,5,0,7>, <5,5,0,7> 2718717377U, // <0,7,5,6>: Cost 3 vext3 <5,6,7,0>, <7,5,6,7> - 3792459210U, // <0,7,5,7>: Cost 4 vext3 <5,6,7,0>, <7,5,7,7> - 2257032252U, // <0,7,5,u>: Cost 3 vrev <7,0,u,5> - 3712946519U, // <0,7,6,0>: Cost 4 vext2 <3,6,0,7>, <6,0,7,2> + 2729997763U, // <0,7,5,7>: Cost 3 vext3 <7,5,7,0>, <7,5,7,0> + 2720044499U, // <0,7,5,u>: Cost 3 vext3 <5,u,7,0>, <7,5,u,7> + 3712946517U, // <0,7,6,0>: Cost 4 vext2 <3,6,0,7>, <6,0,7,0> 2256524286U, // <0,7,6,1>: Cost 3 vrev <7,0,1,6> - 3712946682U, // <0,7,6,2>: Cost 4 vext2 <3,6,0,7>, <6,2,7,3> - 3660278229U, // <0,7,6,3>: Cost 4 vext1 <6,0,7,6>, <3,4,0,6> - 3792459262U, // <0,7,6,4>: Cost 4 vext3 <5,6,7,0>, <7,6,4,5> + 3792459246U, // <0,7,6,2>: Cost 4 vext3 <5,6,7,0>, <7,6,2,7> + 3796440567U, // <0,7,6,3>: Cost 4 vext3 <6,3,7,0>, <7,6,3,7> + 3654307126U, // <0,7,6,4>: Cost 4 vext1 <5,0,7,6>, RHS 2656457394U, // <0,7,6,5>: Cost 3 vext2 <6,5,0,7>, <6,5,0,7> 3792459281U, // <0,7,6,6>: Cost 4 vext3 <5,6,7,0>, <7,6,6,6> 2730661396U, // <0,7,6,7>: Cost 3 vext3 <7,6,7,0>, <7,6,7,0> 2658448293U, // <0,7,6,u>: Cost 3 vext2 <6,u,0,7>, <6,u,0,7> - 3792459303U, // <0,7,7,0>: Cost 4 vext3 <5,6,7,0>, <7,7,0,1> - 3934208226U, // <0,7,7,1>: Cost 4 vuzpr <7,0,1,2>, <0,2,7,1> - 3801454139U, // <0,7,7,2>: Cost 4 vext3 <7,2,3,0>, <7,7,2,3> + 3787003431U, // <0,7,7,0>: Cost 4 vext3 <4,7,5,0>, <7,7,0,1> + 3654312854U, // <0,7,7,1>: Cost 4 vext1 <5,0,7,7>, <1,2,3,0> + 3654313446U, // <0,7,7,2>: Cost 4 vext1 <5,0,7,7>, <2,0,5,7> 3804771905U, // <0,7,7,3>: Cost 4 vext3 <7,7,3,0>, <7,7,3,0> - 3792459343U, // <0,7,7,4>: Cost 4 vext3 <5,6,7,0>, <7,7,4,5> - 3792459352U, // <0,7,7,5>: Cost 4 vext3 <5,6,7,0>, <7,7,5,5> - 3730200066U, // <0,7,7,6>: Cost 4 vext2 <6,5,0,7>, <7,6,5,0> + 3654315318U, // <0,7,7,4>: Cost 4 vext1 <5,0,7,7>, RHS + 3654315651U, // <0,7,7,5>: Cost 4 vext1 <5,0,7,7>, <5,0,7,7> + 3660288348U, // <0,7,7,6>: Cost 4 vext1 <6,0,7,7>, <6,0,7,7> 2718717548U, // <0,7,7,7>: Cost 3 vext3 <5,6,7,0>, <7,7,7,7> - 2718717548U, // <0,7,7,u>: Cost 3 vext3 <5,6,7,0>, <7,7,7,7> - 2580578406U, // <0,7,u,0>: Cost 3 vext1 <5,0,7,u>, LHS + 2664420990U, // <0,7,7,u>: Cost 3 vext2 <7,u,0,7>, <7,u,0,7> + 2256466935U, // <0,7,u,0>: Cost 3 vrev <7,0,0,u> 1182798848U, // <0,7,u,1>: Cost 2 vrev <7,0,1,u> - 2731619977U, // <0,7,u,2>: Cost 3 vext3 <7,u,2,0>, <7,u,2,0> + 2256614409U, // <0,7,u,2>: Cost 3 vrev <7,0,2,u> 2731693714U, // <0,7,u,3>: Cost 3 vext3 <7,u,3,0>, <7,u,3,0> - 2580581686U, // <0,7,u,4>: Cost 3 vext1 <5,0,7,u>, RHS - 2580582020U, // <0,7,u,5>: Cost 3 vext1 <5,0,7,u>, <5,0,7,u> - 2586554717U, // <0,7,u,6>: Cost 3 vext1 <6,0,7,u>, <6,0,7,u> - 2999812765U, // <0,7,u,7>: Cost 3 vzipr <7,7,7,7>, LHS + 2256761883U, // <0,7,u,4>: Cost 3 vrev <7,0,4,u> + 2632571034U, // <0,7,u,5>: Cost 3 vext2 <2,5,0,7>, RHS + 2669066421U, // <0,7,u,6>: Cost 3 vext2 , + 2731988662U, // <0,7,u,7>: Cost 3 vext3 <7,u,7,0>, <7,u,7,0> 1183315007U, // <0,7,u,u>: Cost 2 vrev <7,0,u,u> 135053414U, // <0,u,0,0>: Cost 1 vdup0 LHS 1544896614U, // <0,u,0,1>: Cost 2 vext2 <0,2,0,u>, LHS - 1745666204U, // <0,u,0,2>: Cost 2 vuzpr LHS, LHS - 2886959104U, // <0,u,0,3>: Cost 3 vzipl LHS, <0,0,0,0> + 1678999654U, // <0,u,0,2>: Cost 2 vuzpl LHS, LHS + 2691880677U, // <0,u,0,3>: Cost 3 vext3 <1,2,3,0>, 1476988214U, // <0,u,0,4>: Cost 2 vext1 <0,0,u,0>, RHS - 2691880694U, // <0,u,0,5>: Cost 3 vext3 <1,2,3,0>, - 2691880704U, // <0,u,0,6>: Cost 3 vext3 <1,2,3,0>, - 2913533952U, // <0,u,0,7>: Cost 3 vzipl RHS, <0,0,0,0> + 2718791419U, // <0,u,0,5>: Cost 3 vext3 <5,6,u,0>, + 3021248666U, // <0,u,0,6>: Cost 3 vtrnl <0,2,0,2>, RHS + 2592535607U, // <0,u,0,7>: Cost 3 vext1 <7,0,u,0>, <7,0,u,0> 135053414U, // <0,u,0,u>: Cost 1 vdup0 LHS - 1500880998U, // <0,u,1,0>: Cost 2 vext1 <4,0,u,1>, LHS - 1927659622U, // <0,u,1,1>: Cost 2 vzipr LHS, LHS + 1476993097U, // <0,u,1,0>: Cost 2 vext1 <0,0,u,1>, <0,0,u,1> + 1812780846U, // <0,u,1,1>: Cost 2 vzipl LHS, LHS 1618138926U, // <0,u,1,2>: Cost 2 vext3 <1,2,3,0>, LHS - 2886960806U, // <0,u,1,3>: Cost 3 vzipl LHS, <2,3,0,1> - 1500883885U, // <0,u,1,4>: Cost 2 vext1 <4,0,u,1>, <4,0,u,1> - 1930641510U, // <0,u,1,5>: Cost 2 vzipr RHS, LHS - 2574627322U, // <0,u,1,6>: Cost 3 vext1 <4,0,u,1>, <6,2,7,3> - 2691880795U, // <0,u,1,7>: Cost 3 vext3 <1,2,3,0>, - 1618138980U, // <0,u,1,u>: Cost 2 vext3 <1,2,3,0>, LHS + 2752742134U, // <0,u,1,3>: Cost 3 vuzpl LHS, <1,0,3,2> + 1476996406U, // <0,u,1,4>: Cost 2 vext1 <0,0,u,1>, RHS + 1812781210U, // <0,u,1,5>: Cost 2 vzipl LHS, RHS + 2887006416U, // <0,u,1,6>: Cost 3 vzipl LHS, + 2966736200U, // <0,u,1,7>: Cost 3 vzipr <2,3,0,1>, RHS + 1812781413U, // <0,u,1,u>: Cost 2 vzipl LHS, LHS 1482973286U, // <0,u,2,0>: Cost 2 vext1 <1,0,u,2>, LHS 1482973987U, // <0,u,2,1>: Cost 2 vext1 <1,0,u,2>, <1,0,u,2> - 2061877350U, // <0,u,2,2>: Cost 2 vtrnr LHS, LHS + 1946998574U, // <0,u,2,2>: Cost 2 vtrnl LHS, LHS 835584U, // <0,u,2,3>: Cost 0 copy LHS 1482976566U, // <0,u,2,4>: Cost 2 vext1 <1,0,u,2>, RHS - 2556718800U, // <0,u,2,5>: Cost 3 vext1 <1,0,u,2>, <5,1,7,3> - 2064859238U, // <0,u,2,6>: Cost 2 vtrnr RHS, LHS + 3020781631U, // <0,u,2,5>: Cost 3 vtrnl LHS, + 1946998938U, // <0,u,2,6>: Cost 2 vtrnl LHS, RHS 1518810169U, // <0,u,2,7>: Cost 2 vext1 <7,0,u,2>, <7,0,u,2> 835584U, // <0,u,2,u>: Cost 0 copy LHS 2618640534U, // <0,u,3,0>: Cost 3 vext2 <0,2,0,u>, <3,0,1,2> - 2691880902U, // <0,u,3,1>: Cost 3 vext3 <1,2,3,0>, + 2752743574U, // <0,u,3,1>: Cost 3 vuzpl LHS, <3,0,1,2> 2636556597U, // <0,u,3,2>: Cost 3 vext2 <3,2,0,u>, <3,2,0,u> - 2618640796U, // <0,u,3,3>: Cost 3 vext2 <0,2,0,u>, <3,3,3,3> + 2752743836U, // <0,u,3,3>: Cost 3 vuzpl LHS, <3,3,3,3> 2618640898U, // <0,u,3,4>: Cost 3 vext2 <0,2,0,u>, <3,4,5,6> - 2839560348U, // <0,u,3,5>: Cost 3 vuzpr <3,4,5,6>, LHS - 2657733296U, // <0,u,3,6>: Cost 3 vext2 <6,7,0,1>, <3,6,7,0> - 2734643194U, // <0,u,3,7>: Cost 3 vext3 , - 2618641182U, // <0,u,3,u>: Cost 3 vext2 <0,2,0,u>, <3,u,1,2> - 2618641298U, // <0,u,4,0>: Cost 3 vext2 <0,2,0,u>, <4,0,5,1> - 2718717978U, // <0,u,4,1>: Cost 3 vext3 <5,6,7,0>, - 2562704894U, // <0,u,4,2>: Cost 3 vext1 <2,0,u,4>, <2,0,u,4> + 2752743938U, // <0,u,3,5>: Cost 3 vuzpl LHS, <3,4,5,6> + 2639202936U, // <0,u,3,6>: Cost 3 vext2 <3,6,0,7>, <3,6,0,7> + 2639874762U, // <0,u,3,7>: Cost 3 vext2 <3,7,0,u>, <3,7,0,u> + 2752743637U, // <0,u,3,u>: Cost 3 vuzpl LHS, <3,0,u,2> + 2562703462U, // <0,u,4,0>: Cost 3 vext1 <2,0,u,4>, LHS + 2888455982U, // <0,u,4,1>: Cost 3 vzipl <0,4,1,5>, LHS + 3021575982U, // <0,u,4,2>: Cost 3 vtrnl <0,2,4,6>, LHS 2568677591U, // <0,u,4,3>: Cost 3 vext1 <3,0,u,4>, <3,0,u,4> 2562706742U, // <0,u,4,4>: Cost 3 vext1 <2,0,u,4>, RHS 1544899894U, // <0,u,4,5>: Cost 2 vext2 <0,2,0,u>, RHS - 1772535964U, // <0,u,4,6>: Cost 2 vuzpr RHS, LHS + 1679002934U, // <0,u,4,6>: Cost 2 vuzpl LHS, RHS 2718718033U, // <0,u,4,7>: Cost 3 vext3 <5,6,7,0>, - 1544900137U, // <0,u,4,u>: Cost 2 vext2 <0,2,0,u>, RHS + 1679002952U, // <0,u,4,u>: Cost 2 vuzpl LHS, RHS 2568683622U, // <0,u,5,0>: Cost 3 vext1 <3,0,u,5>, LHS - 2618642128U, // <0,u,5,1>: Cost 3 vext2 <0,2,0,u>, <5,1,7,3> - 2618642214U, // <0,u,5,2>: Cost 3 vext2 <0,2,0,u>, <5,2,7,u> - 2568685784U, // <0,u,5,3>: Cost 3 vext1 <3,0,u,5>, <3,0,u,5> + 2568684438U, // <0,u,5,1>: Cost 3 vext1 <3,0,u,5>, <1,2,3,0> + 3765622902U, // <0,u,5,2>: Cost 4 vext3 <1,2,3,0>, + 2691881087U, // <0,u,5,3>: Cost 3 vext3 <1,2,3,0>, 2568686902U, // <0,u,5,4>: Cost 3 vext1 <3,0,u,5>, RHS - 2645184516U, // <0,u,5,5>: Cost 3 vext2 <4,6,0,u>, <5,5,5,5> + 2650492890U, // <0,u,5,5>: Cost 3 vext2 <5,5,0,u>, <5,5,0,u> 1618139290U, // <0,u,5,6>: Cost 2 vext3 <1,2,3,0>, RHS - 2849636508U, // <0,u,5,7>: Cost 3 vuzpr <5,1,7,3>, LHS + 2824834358U, // <0,u,5,7>: Cost 3 vuzpr <1,0,3,u>, RHS 1618139308U, // <0,u,5,u>: Cost 2 vext3 <1,2,3,0>, RHS - 2691881136U, // <0,u,6,0>: Cost 3 vext3 <1,2,3,0>, - 2645184946U, // <0,u,6,1>: Cost 3 vext2 <4,6,0,u>, <6,1,u,3> - 2618642938U, // <0,u,6,2>: Cost 3 vext2 <0,2,0,u>, <6,2,7,3> - 2718718160U, // <0,u,6,3>: Cost 3 vext3 <5,6,7,0>, - 2718718168U, // <0,u,6,4>: Cost 3 vext3 <5,6,7,0>, + 2592579686U, // <0,u,6,0>: Cost 3 vext1 <7,0,u,6>, LHS + 2262496983U, // <0,u,6,1>: Cost 3 vrev + 2654474688U, // <0,u,6,2>: Cost 3 vext2 <6,2,0,u>, <6,2,0,u> + 2691881168U, // <0,u,6,3>: Cost 3 vext3 <1,2,3,0>, + 2592582966U, // <0,u,6,4>: Cost 3 vext1 <7,0,u,6>, RHS 2656465587U, // <0,u,6,5>: Cost 3 vext2 <6,5,0,u>, <6,5,0,u> - 2645185336U, // <0,u,6,6>: Cost 3 vext2 <4,6,0,u>, <6,6,6,6> + 2657129220U, // <0,u,6,6>: Cost 3 vext2 <6,6,0,u>, <6,6,0,u> 1584051029U, // <0,u,6,7>: Cost 2 vext2 <6,7,0,u>, <6,7,0,u> 1584714662U, // <0,u,6,u>: Cost 2 vext2 <6,u,0,u>, <6,u,0,u> - 2645185530U, // <0,u,7,0>: Cost 3 vext2 <4,6,0,u>, <7,0,1,2> - 2860466332U, // <0,u,7,1>: Cost 3 vuzpr <7,0,1,2>, LHS - 2631193772U, // <0,u,7,2>: Cost 3 vext2 <2,3,0,1>, <7,2,3,0> + 2562728038U, // <0,u,7,0>: Cost 3 vext1 <2,0,u,7>, LHS + 2562728854U, // <0,u,7,1>: Cost 3 vext1 <2,0,u,7>, <1,2,3,0> + 2562729473U, // <0,u,7,2>: Cost 3 vext1 <2,0,u,7>, <2,0,u,7> 2661111018U, // <0,u,7,3>: Cost 3 vext2 <7,3,0,u>, <7,3,0,u> - 2645185894U, // <0,u,7,4>: Cost 3 vext2 <4,6,0,u>, <7,4,5,6> + 2562731318U, // <0,u,7,4>: Cost 3 vext1 <2,0,u,7>, RHS 2718718258U, // <0,u,7,5>: Cost 3 vext3 <5,6,7,0>, - 2663101917U, // <0,u,7,6>: Cost 3 vext2 <7,6,0,u>, <7,6,0,u> - 2645186156U, // <0,u,7,7>: Cost 3 vext2 <4,6,0,u>, <7,7,7,7> - 2645186178U, // <0,u,7,u>: Cost 3 vext2 <4,6,0,u>, <7,u,1,2> + 2586620261U, // <0,u,7,6>: Cost 3 vext1 <6,0,u,7>, <6,0,u,7> + 2657793644U, // <0,u,7,7>: Cost 3 vext2 <6,7,0,u>, <7,7,7,7> + 2562733870U, // <0,u,7,u>: Cost 3 vext1 <2,0,u,7>, LHS 135053414U, // <0,u,u,0>: Cost 1 vdup0 LHS 1544902446U, // <0,u,u,1>: Cost 2 vext2 <0,2,0,u>, LHS - 1618139493U, // <0,u,u,2>: Cost 2 vext3 <1,2,3,0>, LHS + 1679005486U, // <0,u,u,2>: Cost 2 vuzpl LHS, LHS 835584U, // <0,u,u,3>: Cost 0 copy LHS 1483025718U, // <0,u,u,4>: Cost 2 vext1 <1,0,u,u>, RHS 1544902810U, // <0,u,u,5>: Cost 2 vext2 <0,2,0,u>, RHS - 1618139533U, // <0,u,u,6>: Cost 2 vext3 <1,2,3,0>, RHS + 1679005850U, // <0,u,u,6>: Cost 2 vuzpl LHS, RHS 1518859327U, // <0,u,u,7>: Cost 2 vext1 <7,0,u,u>, <7,0,u,u> 835584U, // <0,u,u,u>: Cost 0 copy LHS - 2691072000U, // <1,0,0,0>: Cost 3 vext3 <1,1,1,1>, <0,0,0,0> + 2689744896U, // <1,0,0,0>: Cost 3 vext3 <0,u,1,1>, <0,0,0,0> 1610694666U, // <1,0,0,1>: Cost 2 vext3 <0,0,1,1>, <0,0,1,1> - 2691072020U, // <1,0,0,2>: Cost 3 vext3 <1,1,1,1>, <0,0,2,2> - 3704996101U, // <1,0,0,3>: Cost 4 vext2 <2,3,1,0>, <0,3,2,0> - 2556775734U, // <1,0,0,4>: Cost 3 vext1 <1,1,0,0>, RHS + 2689744916U, // <1,0,0,2>: Cost 3 vext3 <0,u,1,1>, <0,0,2,2> + 2619310332U, // <1,0,0,3>: Cost 3 vext2 <0,3,1,0>, <0,3,1,0> + 2684657701U, // <1,0,0,4>: Cost 3 vext3 <0,0,4,1>, <0,0,4,1> 2620637598U, // <1,0,0,5>: Cost 3 vext2 <0,5,1,0>, <0,5,1,0> - 3289440391U, // <1,0,0,6>: Cost 4 vrev <0,1,6,0> + 3708977654U, // <1,0,0,6>: Cost 4 vext2 <3,0,1,0>, <0,6,1,7> 3666351168U, // <1,0,0,7>: Cost 4 vext1 <7,1,0,0>, <7,1,0,0> 1611210825U, // <1,0,0,u>: Cost 2 vext3 <0,0,u,1>, <0,0,u,1> - 2698297426U, // <1,0,1,0>: Cost 3 vext3 <2,3,0,1>, <0,1,0,1> - 2953626420U, // <1,0,1,1>: Cost 3 vzipr LHS, <1,1,1,1> - 1617330278U, // <1,0,1,2>: Cost 2 vext3 <1,1,1,1>, LHS - 3898524378U, // <1,0,1,3>: Cost 4 vuzpr <1,0,3,2>, <1,0,0,1> - 2698297466U, // <1,0,1,4>: Cost 3 vext3 <2,3,0,1>, <0,1,4,5> + 2556780646U, // <1,0,1,0>: Cost 3 vext1 <1,1,0,1>, LHS + 2556781355U, // <1,0,1,1>: Cost 3 vext1 <1,1,0,1>, <1,1,0,1> + 1616003174U, // <1,0,1,2>: Cost 2 vext3 <0,u,1,1>, LHS + 3693052888U, // <1,0,1,3>: Cost 4 vext2 <0,3,1,0>, <1,3,1,3> + 2556783926U, // <1,0,1,4>: Cost 3 vext1 <1,1,0,1>, RHS 2580672143U, // <1,0,1,5>: Cost 3 vext1 <5,1,0,1>, <5,1,0,1> 2724839566U, // <1,0,1,6>: Cost 3 vext3 <6,7,0,1>, <0,1,6,7> 3654415354U, // <1,0,1,7>: Cost 4 vext1 <5,1,0,1>, <7,0,1,2> - 1617330332U, // <1,0,1,u>: Cost 2 vext3 <1,1,1,1>, LHS - 2686279844U, // <1,0,2,0>: Cost 3 vext3 <0,2,u,1>, <0,2,0,2> - 2953626518U, // <1,0,2,1>: Cost 3 vzipr LHS, <1,2,3,0> - 4161585900U, // <1,0,2,2>: Cost 4 vtrnr LHS, <1,0,2,1> - 2631255726U, // <1,0,2,3>: Cost 3 vext2 <2,3,1,0>, <2,3,1,0> - 2556792118U, // <1,0,2,4>: Cost 3 vext1 <1,1,0,2>, RHS - 3759800528U, // <1,0,2,5>: Cost 4 vext3 <0,2,5,1>, <0,2,5,1> - 3630535162U, // <1,0,2,6>: Cost 4 vext1 <1,1,0,2>, <6,2,7,3> - 2686206178U, // <1,0,2,7>: Cost 3 vext3 <0,2,7,1>, <0,2,7,1> + 1616003228U, // <1,0,1,u>: Cost 2 vext3 <0,u,1,1>, LHS + 2685690019U, // <1,0,2,0>: Cost 3 vext3 <0,2,0,1>, <0,2,0,1> + 2685763756U, // <1,0,2,1>: Cost 3 vext3 <0,2,1,1>, <0,2,1,1> + 2698297524U, // <1,0,2,2>: Cost 3 vext3 <2,3,0,1>, <0,2,2,0> + 2685911230U, // <1,0,2,3>: Cost 3 vext3 <0,2,3,1>, <0,2,3,1> + 2689745100U, // <1,0,2,4>: Cost 3 vext3 <0,u,1,1>, <0,2,4,6> + 3764814038U, // <1,0,2,5>: Cost 4 vext3 <1,1,1,1>, <0,2,5,7> + 2724839640U, // <1,0,2,6>: Cost 3 vext3 <6,7,0,1>, <0,2,6,0> + 2592625658U, // <1,0,2,7>: Cost 3 vext1 <7,1,0,2>, <7,0,1,2> 2686279915U, // <1,0,2,u>: Cost 3 vext3 <0,2,u,1>, <0,2,u,1> - 2562768998U, // <1,0,3,0>: Cost 3 vext1 <2,1,0,3>, LHS - 2562769654U, // <1,0,3,1>: Cost 3 vext1 <2,1,0,3>, <1,0,3,2> + 3087843328U, // <1,0,3,0>: Cost 3 vtrnr LHS, <0,0,0,0> + 3087843338U, // <1,0,3,1>: Cost 3 vtrnr LHS, <0,0,1,1> 67944550U, // <1,0,3,2>: Cost 1 vrev LHS 2568743135U, // <1,0,3,3>: Cost 3 vext1 <3,1,0,3>, <3,1,0,3> 2562772278U, // <1,0,3,4>: Cost 3 vext1 <2,1,0,3>, RHS - 3636514512U, // <1,0,3,5>: Cost 4 vext1 <2,1,0,3>, <5,1,7,3> - 3636515322U, // <1,0,3,6>: Cost 4 vext1 <2,1,0,3>, <6,2,7,3> + 4099850454U, // <1,0,3,5>: Cost 4 vtrnl <1,0,3,2>, <0,2,5,7> + 3704998538U, // <1,0,3,6>: Cost 4 vext2 <2,3,1,0>, <3,6,2,7> 2592633923U, // <1,0,3,7>: Cost 3 vext1 <7,1,0,3>, <7,1,0,3> 68386972U, // <1,0,3,u>: Cost 1 vrev LHS 2620640146U, // <1,0,4,0>: Cost 3 vext2 <0,5,1,0>, <4,0,5,1> - 2708619602U, // <1,0,4,1>: Cost 3 vext3 <4,0,5,1>, <0,4,1,5> - 2724839772U, // <1,0,4,2>: Cost 3 vext3 <6,7,0,1>, <0,4,2,6> - 3642493152U, // <1,0,4,3>: Cost 4 vext1 <3,1,0,4>, <3,1,0,4> - 3642494262U, // <1,0,4,4>: Cost 4 vext1 <3,1,0,4>, RHS - 2631257398U, // <1,0,4,5>: Cost 3 vext2 <2,3,1,0>, RHS - 3704999244U, // <1,0,4,6>: Cost 4 vext2 <2,3,1,0>, <4,6,0,2> + 2689745234U, // <1,0,4,1>: Cost 3 vext3 <0,u,1,1>, <0,4,1,5> + 2689745244U, // <1,0,4,2>: Cost 3 vext3 <0,u,1,1>, <0,4,2,6> + 3760980320U, // <1,0,4,3>: Cost 4 vext3 <0,4,3,1>, <0,4,3,1> + 3761054057U, // <1,0,4,4>: Cost 4 vext3 <0,4,4,1>, <0,4,4,1> + 2619313462U, // <1,0,4,5>: Cost 3 vext2 <0,3,1,0>, RHS + 3761201531U, // <1,0,4,6>: Cost 4 vext3 <0,4,6,1>, <0,4,6,1> 3666383940U, // <1,0,4,7>: Cost 4 vext1 <7,1,0,4>, <7,1,0,4> - 2631257641U, // <1,0,4,u>: Cost 3 vext2 <2,3,1,0>, RHS - 3782361494U, // <1,0,5,0>: Cost 4 vext3 <4,0,5,1>, <0,5,0,1> - 2708619678U, // <1,0,5,1>: Cost 3 vext3 <4,0,5,1>, <0,5,1,0> - 3987308882U, // <1,0,5,2>: Cost 4 vzipl <4,6,0,2>, <0,4,1,5> - 3708981104U, // <1,0,5,3>: Cost 4 vext2 <3,0,1,0>, <5,3,7,1> + 2619313705U, // <1,0,4,u>: Cost 3 vext2 <0,3,1,0>, RHS + 4029300736U, // <1,0,5,0>: Cost 4 vzipr <0,4,1,5>, <0,0,0,0> + 2895249510U, // <1,0,5,1>: Cost 3 vzipl <1,5,3,7>, LHS + 3028287590U, // <1,0,5,2>: Cost 3 vtrnl <1,3,5,7>, LHS + 3642501345U, // <1,0,5,3>: Cost 4 vext1 <3,1,0,5>, <3,1,0,5> 2215592058U, // <1,0,5,4>: Cost 3 vrev <0,1,4,5> - 3654446739U, // <1,0,5,5>: Cost 4 vext1 <5,1,0,5>, <5,1,0,5> + 3724242907U, // <1,0,5,5>: Cost 4 vext2 <5,5,1,0>, <5,5,1,0> 3724906540U, // <1,0,5,6>: Cost 4 vext2 <5,6,1,0>, <5,6,1,0> - 3782361560U, // <1,0,5,7>: Cost 4 vext3 <4,0,5,1>, <0,5,7,4> - 2708619678U, // <1,0,5,u>: Cost 3 vext3 <4,0,5,1>, <0,5,1,0> - 3708981590U, // <1,0,6,0>: Cost 4 vext2 <3,0,1,0>, <6,0,7,1> + 3911118134U, // <1,0,5,7>: Cost 4 vuzpr <3,1,3,0>, RHS + 3028287644U, // <1,0,5,u>: Cost 3 vtrnl <1,3,5,7>, LHS + 3762086375U, // <1,0,6,0>: Cost 4 vext3 <0,6,0,1>, <0,6,0,1> 2698297846U, // <1,0,6,1>: Cost 3 vext3 <2,3,0,1>, <0,6,1,7> - 3705000442U, // <1,0,6,2>: Cost 4 vext2 <2,3,1,0>, <6,2,7,3> - 3705000522U, // <1,0,6,3>: Cost 4 vext2 <2,3,1,0>, <6,3,7,2> - 3666398518U, // <1,0,6,4>: Cost 4 vext1 <7,1,0,6>, RHS + 3760022015U, // <1,0,6,2>: Cost 4 vext3 <0,2,u,1>, <0,6,2,7> + 3642509538U, // <1,0,6,3>: Cost 4 vext1 <3,1,0,6>, <3,1,0,6> + 3762381323U, // <1,0,6,4>: Cost 4 vext3 <0,6,4,1>, <0,6,4,1> 3730215604U, // <1,0,6,5>: Cost 4 vext2 <6,5,1,0>, <6,5,1,0> - 3731542840U, // <1,0,6,6>: Cost 4 vext2 <6,7,1,0>, <6,6,6,6> + 3730879237U, // <1,0,6,6>: Cost 4 vext2 <6,6,1,0>, <6,6,1,0> 2657801046U, // <1,0,6,7>: Cost 3 vext2 <6,7,1,0>, <6,7,1,0> 2658464679U, // <1,0,6,u>: Cost 3 vext2 <6,u,1,0>, <6,u,1,0> 2659128312U, // <1,0,7,0>: Cost 3 vext2 <7,0,1,0>, <7,0,1,0> - 3788481088U, // <1,0,7,1>: Cost 4 vext3 <5,0,7,1>, <0,7,1,0> + 4047898278U, // <1,0,7,1>: Cost 4 vzipr <3,5,1,7>, <2,3,0,1> 2215460970U, // <1,0,7,2>: Cost 3 vrev <0,1,2,7> 3734861035U, // <1,0,7,3>: Cost 4 vext2 <7,3,1,0>, <7,3,1,0> 3731543398U, // <1,0,7,4>: Cost 4 vext2 <6,7,1,0>, <7,4,5,6> @@ -822,123 +822,123 @@ 2663110110U, // <1,0,7,6>: Cost 3 vext2 <7,6,1,0>, <7,6,1,0> 3731543660U, // <1,0,7,7>: Cost 4 vext2 <6,7,1,0>, <7,7,7,7> 2664437376U, // <1,0,7,u>: Cost 3 vext2 <7,u,1,0>, <7,u,1,0> - 2689671817U, // <1,0,u,0>: Cost 3 vext3 <0,u,0,1>, <0,u,0,1> + 3087884288U, // <1,0,u,0>: Cost 3 vtrnr LHS, <0,0,0,0> 1616003730U, // <1,0,u,1>: Cost 2 vext3 <0,u,1,1>, <0,u,1,1> 67985515U, // <1,0,u,2>: Cost 1 vrev LHS - 2568784100U, // <1,0,u,3>: Cost 3 vext1 <3,1,0,u>, <3,1,0,u> - 2556841270U, // <1,0,u,4>: Cost 3 vext1 <1,1,0,u>, RHS - 2631260314U, // <1,0,u,5>: Cost 3 vext2 <2,3,1,0>, RHS + 2689893028U, // <1,0,u,3>: Cost 3 vext3 <0,u,3,1>, <0,u,3,1> + 2689745586U, // <1,0,u,4>: Cost 3 vext3 <0,u,1,1>, <0,u,4,6> + 2619316378U, // <1,0,u,5>: Cost 3 vext2 <0,3,1,0>, RHS 2669082807U, // <1,0,u,6>: Cost 3 vext2 , 2592674888U, // <1,0,u,7>: Cost 3 vext1 <7,1,0,u>, <7,1,0,u> 68427937U, // <1,0,u,u>: Cost 1 vrev LHS 1543585802U, // <1,1,0,0>: Cost 2 vext2 <0,0,1,1>, <0,0,1,1> - 1550221414U, // <1,1,0,1>: Cost 2 vext2 <1,1,1,1>, LHS - 2819408692U, // <1,1,0,2>: Cost 3 vuzpr LHS, <1,1,1,1> - 2690335478U, // <1,1,0,3>: Cost 3 vext3 <1,0,0,1>, <1,0,3,2> - 2665103698U, // <1,1,0,4>: Cost 3 vext2 , <0,4,1,5> - 3782361863U, // <1,1,0,5>: Cost 4 vext3 <4,0,5,1>, <1,0,5,1> - 3660452208U, // <1,1,0,6>: Cost 4 vext1 <6,1,1,0>, <6,1,1,0> + 1548894310U, // <1,1,0,1>: Cost 2 vext2 <0,u,1,1>, LHS + 2618654892U, // <1,1,0,2>: Cost 3 vext2 <0,2,1,1>, <0,2,1,1> + 2689745654U, // <1,1,0,3>: Cost 3 vext3 <0,u,1,1>, <1,0,3,2> + 2622636370U, // <1,1,0,4>: Cost 3 vext2 <0,u,1,1>, <0,4,1,5> + 2620645791U, // <1,1,0,5>: Cost 3 vext2 <0,5,1,1>, <0,5,1,1> + 3696378367U, // <1,1,0,6>: Cost 4 vext2 <0,u,1,1>, <0,6,2,7> 3666424905U, // <1,1,0,7>: Cost 4 vext1 <7,1,1,0>, <7,1,1,0> - 1550221981U, // <1,1,0,u>: Cost 2 vext2 <1,1,1,1>, LHS + 1548894866U, // <1,1,0,u>: Cost 2 vext2 <0,u,1,1>, <0,u,1,1> 1483112550U, // <1,1,1,0>: Cost 2 vext1 <1,1,1,1>, LHS 202162278U, // <1,1,1,1>: Cost 1 vdup1 LHS - 2556855912U, // <1,1,1,2>: Cost 3 vext1 <1,1,1,1>, <2,2,2,2> - 3020735284U, // <1,1,1,3>: Cost 3 vtrnl LHS, <1,1,1,1> + 2622636950U, // <1,1,1,2>: Cost 3 vext2 <0,u,1,1>, <1,2,3,0> + 2622637016U, // <1,1,1,3>: Cost 3 vext2 <0,u,1,1>, <1,3,1,3> 1483115830U, // <1,1,1,4>: Cost 2 vext1 <1,1,1,1>, RHS - 2556858064U, // <1,1,1,5>: Cost 3 vext1 <1,1,1,1>, <5,1,7,3> - 2556858874U, // <1,1,1,6>: Cost 3 vext1 <1,1,1,1>, <6,2,7,3> + 2622637200U, // <1,1,1,5>: Cost 3 vext2 <0,u,1,1>, <1,5,3,7> + 2622637263U, // <1,1,1,6>: Cost 3 vext2 <0,u,1,1>, <1,6,1,7> 2592691274U, // <1,1,1,7>: Cost 3 vext1 <7,1,1,1>, <7,1,1,1> 202162278U, // <1,1,1,u>: Cost 1 vdup1 LHS - 2598666342U, // <1,1,2,0>: Cost 3 vext1 , LHS - 2691072903U, // <1,1,2,1>: Cost 3 vext3 <1,1,1,1>, <1,2,1,3> - 2623964776U, // <1,1,2,2>: Cost 3 vext2 <1,1,1,1>, <2,2,2,2> - 2690483094U, // <1,1,2,3>: Cost 3 vext3 <1,0,2,1>, <1,2,3,0> - 2598669622U, // <1,1,2,4>: Cost 3 vext1 , RHS - 3654495897U, // <1,1,2,5>: Cost 4 vext1 <5,1,1,2>, <5,1,1,2> - 2665105338U, // <1,1,2,6>: Cost 3 vext2 , <2,6,3,7> - 3801088954U, // <1,1,2,7>: Cost 4 vext3 <7,1,7,1>, <1,2,7,0> - 2623965243U, // <1,1,2,u>: Cost 3 vext2 <1,1,1,1>, <2,u,0,1> - 2623965334U, // <1,1,3,0>: Cost 3 vext2 <1,1,1,1>, <3,0,1,2> - 2623965414U, // <1,1,3,1>: Cost 3 vext2 <1,1,1,1>, <3,1,1,1> - 4166878102U, // <1,1,3,2>: Cost 4 vtrnr <1,0,2,1>, <1,2,3,0> - 1946992742U, // <1,1,3,3>: Cost 2 vtrnl LHS, LHS - 2623965698U, // <1,1,3,4>: Cost 3 vext2 <1,1,1,1>, <3,4,5,6> - 3697707554U, // <1,1,3,5>: Cost 4 vext2 <1,1,1,1>, <3,5,0,2> - 3697707658U, // <1,1,3,6>: Cost 4 vext2 <1,1,1,1>, <3,6,2,7> + 2550890588U, // <1,1,2,0>: Cost 3 vext1 <0,1,1,2>, <0,1,1,2> + 2617329183U, // <1,1,2,1>: Cost 3 vext2 <0,0,1,1>, <2,1,3,1> + 2622637672U, // <1,1,2,2>: Cost 3 vext2 <0,u,1,1>, <2,2,2,2> + 2622637734U, // <1,1,2,3>: Cost 3 vext2 <0,u,1,1>, <2,3,0,1> + 2550893878U, // <1,1,2,4>: Cost 3 vext1 <0,1,1,2>, RHS + 3696379744U, // <1,1,2,5>: Cost 4 vext2 <0,u,1,1>, <2,5,2,7> + 2622638010U, // <1,1,2,6>: Cost 3 vext2 <0,u,1,1>, <2,6,3,7> + 3804554170U, // <1,1,2,7>: Cost 4 vext3 <7,7,0,1>, <1,2,7,0> + 2622638139U, // <1,1,2,u>: Cost 3 vext2 <0,u,1,1>, <2,u,0,1> + 2622638230U, // <1,1,3,0>: Cost 3 vext2 <0,u,1,1>, <3,0,1,2> + 3087844148U, // <1,1,3,1>: Cost 3 vtrnr LHS, <1,1,1,1> + 4161585244U, // <1,1,3,2>: Cost 4 vtrnr LHS, <0,1,1,2> + 2014101606U, // <1,1,3,3>: Cost 2 vtrnr LHS, LHS + 2622638594U, // <1,1,3,4>: Cost 3 vext2 <0,u,1,1>, <3,4,5,6> + 2689745920U, // <1,1,3,5>: Cost 3 vext3 <0,u,1,1>, <1,3,5,7> + 3763487753U, // <1,1,3,6>: Cost 4 vext3 <0,u,1,1>, <1,3,6,7> 2592707660U, // <1,1,3,7>: Cost 3 vext1 <7,1,1,3>, <7,1,1,3> - 1947033702U, // <1,1,3,u>: Cost 2 vtrnl LHS, LHS - 2623966098U, // <1,1,4,0>: Cost 3 vext2 <1,1,1,1>, <4,0,5,1> + 2014101611U, // <1,1,3,u>: Cost 2 vtrnr LHS, LHS + 2556878950U, // <1,1,4,0>: Cost 3 vext1 <1,1,1,4>, LHS 2221335351U, // <1,1,4,1>: Cost 3 vrev <1,1,1,4> - 3697708086U, // <1,1,4,2>: Cost 4 vext2 <1,1,1,1>, <4,2,5,3> - 3630622870U, // <1,1,4,3>: Cost 4 vext1 <1,1,1,4>, <3,0,1,2> + 3696380988U, // <1,1,4,2>: Cost 4 vext2 <0,u,1,1>, <4,2,6,0> + 3763487805U, // <1,1,4,3>: Cost 4 vext3 <0,u,1,1>, <1,4,3,5> 2556882230U, // <1,1,4,4>: Cost 3 vext1 <1,1,1,4>, RHS - 1550224694U, // <1,1,4,5>: Cost 2 vext2 <1,1,1,1>, RHS - 2623966540U, // <1,1,4,6>: Cost 3 vext2 <1,1,1,1>, <4,6,0,2> + 1548897590U, // <1,1,4,5>: Cost 2 vext2 <0,u,1,1>, RHS + 2758184246U, // <1,1,4,6>: Cost 3 vuzpl <1,1,1,1>, RHS 3666457677U, // <1,1,4,7>: Cost 4 vext1 <7,1,1,4>, <7,1,1,4> - 1550224937U, // <1,1,4,u>: Cost 2 vext2 <1,1,1,1>, RHS - 2647191111U, // <1,1,5,0>: Cost 3 vext2 <5,0,1,1>, <5,0,1,1> - 2623966928U, // <1,1,5,1>: Cost 3 vext2 <1,1,1,1>, <5,1,7,3> - 3697708779U, // <1,1,5,2>: Cost 4 vext2 <1,1,1,1>, <5,2,1,3> - 2724840592U, // <1,1,5,3>: Cost 3 vext3 <6,7,0,1>, <1,5,3,7> + 1548897833U, // <1,1,4,u>: Cost 2 vext2 <0,u,1,1>, RHS + 2693653615U, // <1,1,5,0>: Cost 3 vext3 <1,5,0,1>, <1,5,0,1> + 2617331408U, // <1,1,5,1>: Cost 3 vext2 <0,0,1,1>, <5,1,7,3> + 4029302934U, // <1,1,5,2>: Cost 4 vzipr <0,4,1,5>, <3,0,1,2> + 2689746064U, // <1,1,5,3>: Cost 3 vext3 <0,u,1,1>, <1,5,3,7> 2221564755U, // <1,1,5,4>: Cost 3 vrev <1,1,4,5> - 2650509276U, // <1,1,5,5>: Cost 3 vext2 <5,5,1,1>, <5,5,1,1> - 2665107554U, // <1,1,5,6>: Cost 3 vext2 , <5,6,7,0> - 3697709174U, // <1,1,5,7>: Cost 4 vext2 <1,1,1,1>, <5,7,0,2> - 2623967495U, // <1,1,5,u>: Cost 3 vext2 <1,1,1,1>, <5,u,7,3> - 3697709353U, // <1,1,6,0>: Cost 4 vext2 <1,1,1,1>, <6,0,2,1> - 2684437711U, // <1,1,6,1>: Cost 3 vext3 <0,0,1,1>, <1,6,1,7> - 2623967738U, // <1,1,6,2>: Cost 3 vext2 <1,1,1,1>, <6,2,7,3> - 3697709642U, // <1,1,6,3>: Cost 4 vext2 <1,1,1,1>, <6,3,7,2> - 3630640438U, // <1,1,6,4>: Cost 4 vext1 <1,1,1,6>, RHS - 3724251883U, // <1,1,6,5>: Cost 4 vext2 <5,5,1,1>, <6,5,7,1> - 2665108280U, // <1,1,6,6>: Cost 3 vext2 , <6,6,6,6> + 2955559250U, // <1,1,5,5>: Cost 3 vzipr <0,4,1,5>, <0,4,1,5> + 2617331810U, // <1,1,5,6>: Cost 3 vext2 <0,0,1,1>, <5,6,7,0> + 2825293110U, // <1,1,5,7>: Cost 3 vuzpr <1,1,1,1>, RHS + 2689746109U, // <1,1,5,u>: Cost 3 vext3 <0,u,1,1>, <1,5,u,7> + 3696382241U, // <1,1,6,0>: Cost 4 vext2 <0,u,1,1>, <6,0,1,2> + 2689746127U, // <1,1,6,1>: Cost 3 vext3 <0,u,1,1>, <1,6,1,7> + 2617332218U, // <1,1,6,2>: Cost 3 vext2 <0,0,1,1>, <6,2,7,3> + 3763487969U, // <1,1,6,3>: Cost 4 vext3 <0,u,1,1>, <1,6,3,7> + 3696382605U, // <1,1,6,4>: Cost 4 vext2 <0,u,1,1>, <6,4,5,6> + 4029309266U, // <1,1,6,5>: Cost 4 vzipr <0,4,1,6>, <0,4,1,5> + 2617332536U, // <1,1,6,6>: Cost 3 vext2 <0,0,1,1>, <6,6,6,6> 2724840702U, // <1,1,6,7>: Cost 3 vext3 <6,7,0,1>, <1,6,7,0> - 2623968224U, // <1,1,6,u>: Cost 3 vext2 <1,1,1,1>, <6,u,7,3> - 2665108474U, // <1,1,7,0>: Cost 3 vext2 , <7,0,1,2> + 2725504263U, // <1,1,6,u>: Cost 3 vext3 <6,u,0,1>, <1,6,u,0> + 2617332720U, // <1,1,7,0>: Cost 3 vext2 <0,0,1,1>, <7,0,0,1> 2659800138U, // <1,1,7,1>: Cost 3 vext2 <7,1,1,1>, <7,1,1,1> - 3697710255U, // <1,1,7,2>: Cost 4 vext2 <1,1,1,1>, <7,2,3,3> - 3798582571U, // <1,1,7,3>: Cost 4 vext3 <6,7,0,1>, <1,7,3,0> - 2665108838U, // <1,1,7,4>: Cost 3 vext2 , <7,4,5,6> - 3720934789U, // <1,1,7,5>: Cost 4 vext2 <5,0,1,1>, <7,5,0,1> + 3691074717U, // <1,1,7,2>: Cost 4 vext2 <0,0,1,1>, <7,2,1,3> + 4167811174U, // <1,1,7,3>: Cost 4 vtrnr <1,1,5,7>, LHS + 2617333094U, // <1,1,7,4>: Cost 3 vext2 <0,0,1,1>, <7,4,5,6> + 3295396702U, // <1,1,7,5>: Cost 4 vrev <1,1,5,7> 3803891014U, // <1,1,7,6>: Cost 4 vext3 <7,6,0,1>, <1,7,6,0> - 2665109100U, // <1,1,7,7>: Cost 3 vext2 , <7,7,7,7> - 2665109112U, // <1,1,7,u>: Cost 3 vext2 , <7,u,0,1> - 1591367378U, // <1,1,u,0>: Cost 2 vext2 , + 2617333356U, // <1,1,7,7>: Cost 3 vext2 <0,0,1,1>, <7,7,7,7> + 2659800138U, // <1,1,7,u>: Cost 3 vext2 <7,1,1,1>, <7,1,1,1> + 1483112550U, // <1,1,u,0>: Cost 2 vext1 <1,1,1,1>, LHS 202162278U, // <1,1,u,1>: Cost 1 vdup1 LHS - 2623969132U, // <1,1,u,2>: Cost 3 vext2 <1,1,1,1>, - 1946992747U, // <1,1,u,3>: Cost 2 vtrnl LHS, LHS + 2622642056U, // <1,1,u,2>: Cost 3 vext2 <0,u,1,1>, + 2014142566U, // <1,1,u,3>: Cost 2 vtrnr LHS, LHS 1483115830U, // <1,1,u,4>: Cost 2 vext1 <1,1,1,1>, RHS - 1550227610U, // <1,1,u,5>: Cost 2 vext2 <1,1,1,1>, RHS - 2623969456U, // <1,1,u,6>: Cost 3 vext2 <1,1,1,1>, - 2592748625U, // <1,1,u,7>: Cost 3 vext1 <7,1,1,u>, <7,1,1,u> + 1548900506U, // <1,1,u,5>: Cost 2 vext2 <0,u,1,1>, RHS + 2622642384U, // <1,1,u,6>: Cost 3 vext2 <0,u,1,1>, + 2825293353U, // <1,1,u,7>: Cost 3 vuzpr <1,1,1,1>, RHS 202162278U, // <1,1,u,u>: Cost 1 vdup1 LHS - 2698298804U, // <1,2,0,0>: Cost 3 vext3 <2,3,0,1>, <2,0,0,2> + 2635251712U, // <1,2,0,0>: Cost 3 vext2 <3,0,1,2>, <0,0,0,0> 1561509990U, // <1,2,0,1>: Cost 2 vext2 <3,0,1,2>, LHS - 2629279908U, // <1,2,0,2>: Cost 3 vext2 <2,0,1,2>, <0,2,0,2> + 2618663085U, // <1,2,0,2>: Cost 3 vext2 <0,2,1,2>, <0,2,1,2> 2696529358U, // <1,2,0,3>: Cost 3 vext3 <2,0,3,1>, <2,0,3,1> - 2659139922U, // <1,2,0,4>: Cost 3 vext2 <7,0,1,2>, <0,4,1,5> - 3775727073U, // <1,2,0,5>: Cost 4 vext3 <2,u,5,1>, <2,0,5,2> + 2635252050U, // <1,2,0,4>: Cost 3 vext2 <3,0,1,2>, <0,4,1,5> + 3769533926U, // <1,2,0,5>: Cost 4 vext3 <1,u,2,1>, <2,0,5,7> 2621317617U, // <1,2,0,6>: Cost 3 vext2 <0,6,1,2>, <0,6,1,2> 2659140170U, // <1,2,0,7>: Cost 3 vext2 <7,0,1,2>, <0,7,2,1> 1561510557U, // <1,2,0,u>: Cost 2 vext2 <3,0,1,2>, LHS 2623308516U, // <1,2,1,0>: Cost 3 vext2 <1,0,1,2>, <1,0,1,2> - 2623308596U, // <1,2,1,1>: Cost 3 vext2 <1,0,1,2>, <1,1,1,1> + 2635252532U, // <1,2,1,1>: Cost 3 vext2 <3,0,1,2>, <1,1,1,1> 2631271318U, // <1,2,1,2>: Cost 3 vext2 <2,3,1,2>, <1,2,3,0> - 2886517556U, // <1,2,1,3>: Cost 3 vzipl LHS, <1,1,1,1> - 3764225580U, // <1,2,1,4>: Cost 4 vext3 <1,0,2,1>, <2,1,4,5> - 2659140752U, // <1,2,1,5>: Cost 3 vext2 <7,0,1,2>, <1,5,3,7> - 3794085433U, // <1,2,1,6>: Cost 4 vext3 <6,0,2,1>, <2,1,6,0> + 2958180454U, // <1,2,1,3>: Cost 3 vzipr <0,u,1,1>, LHS + 2550959414U, // <1,2,1,4>: Cost 3 vext1 <0,1,2,1>, RHS + 2635252880U, // <1,2,1,5>: Cost 3 vext2 <3,0,1,2>, <1,5,3,7> + 2635252952U, // <1,2,1,6>: Cost 3 vext2 <3,0,1,2>, <1,6,2,7> 3732882731U, // <1,2,1,7>: Cost 4 vext2 <7,0,1,2>, <1,7,3,0> - 2886557706U, // <1,2,1,u>: Cost 3 vzipl LHS, <0,0,1,1> + 2958180459U, // <1,2,1,u>: Cost 3 vzipr <0,u,1,1>, LHS 2629281213U, // <1,2,2,0>: Cost 3 vext2 <2,0,1,2>, <2,0,1,2> - 3630678846U, // <1,2,2,1>: Cost 4 vext1 <1,1,2,2>, <1,1,2,2> - 2691073640U, // <1,2,2,2>: Cost 3 vext3 <1,1,1,1>, <2,2,2,2> - 2886518934U, // <1,2,2,3>: Cost 3 vzipl LHS, <3,0,1,2> - 3630681398U, // <1,2,2,4>: Cost 4 vext1 <1,1,2,2>, RHS - 3771745922U, // <1,2,2,5>: Cost 4 vext3 <2,2,5,1>, <2,2,5,1> - 2659141562U, // <1,2,2,6>: Cost 3 vext2 <7,0,1,2>, <2,6,3,7> + 2635253280U, // <1,2,2,1>: Cost 3 vext2 <3,0,1,2>, <2,1,3,2> + 2618664552U, // <1,2,2,2>: Cost 3 vext2 <0,2,1,2>, <2,2,2,2> + 2689746546U, // <1,2,2,3>: Cost 3 vext3 <0,u,1,1>, <2,2,3,3> + 3764815485U, // <1,2,2,4>: Cost 4 vext3 <1,1,1,1>, <2,2,4,5> + 3760023176U, // <1,2,2,5>: Cost 4 vext3 <0,2,u,1>, <2,2,5,7> + 2635253690U, // <1,2,2,6>: Cost 3 vext2 <3,0,1,2>, <2,6,3,7> 2659141610U, // <1,2,2,7>: Cost 3 vext2 <7,0,1,2>, <2,7,0,1> - 2886559894U, // <1,2,2,u>: Cost 3 vzipl LHS, <3,0,1,2> + 2689746591U, // <1,2,2,u>: Cost 3 vext3 <0,u,1,1>, <2,2,u,3> 403488870U, // <1,2,3,0>: Cost 1 vext1 LHS, LHS 1477231350U, // <1,2,3,1>: Cost 2 vext1 LHS, <1,0,3,2> 1477232232U, // <1,2,3,2>: Cost 2 vext1 LHS, <2,2,2,2> @@ -948,40 +948,40 @@ 1525010938U, // <1,2,3,6>: Cost 2 vext1 LHS, <6,2,7,3> 1525011450U, // <1,2,3,7>: Cost 2 vext1 LHS, <7,0,1,2> 403494702U, // <1,2,3,u>: Cost 1 vext1 LHS, LHS - 2635254674U, // <1,2,4,0>: Cost 3 vext2 <3,0,1,2>, <4,0,5,1> - 3702361059U, // <1,2,4,1>: Cost 4 vext2 <1,u,1,2>, <4,1,5,1> - 3772630796U, // <1,2,4,2>: Cost 4 vext3 <2,3,u,1>, <2,4,2,4> + 2641226607U, // <1,2,4,0>: Cost 3 vext2 <4,0,1,2>, <4,0,1,2> + 3624723446U, // <1,2,4,1>: Cost 4 vext1 <0,1,2,4>, <1,3,4,6> + 3301123609U, // <1,2,4,2>: Cost 4 vrev <2,1,2,4> 2598759198U, // <1,2,4,3>: Cost 3 vext1 , <3,u,1,2> 2659142864U, // <1,2,4,4>: Cost 3 vext2 <7,0,1,2>, <4,4,4,4> 1561513270U, // <1,2,4,5>: Cost 2 vext2 <3,0,1,2>, RHS - 2635255116U, // <1,2,4,6>: Cost 3 vext2 <3,0,1,2>, <4,6,0,2> - 3732884945U, // <1,2,4,7>: Cost 4 vext2 <7,0,1,2>, <4,7,6,0> + 2659143028U, // <1,2,4,6>: Cost 3 vext2 <7,0,1,2>, <4,6,4,6> + 2659143112U, // <1,2,4,7>: Cost 3 vext2 <7,0,1,2>, <4,7,5,0> 1561513513U, // <1,2,4,u>: Cost 2 vext2 <3,0,1,2>, RHS - 2647199304U, // <1,2,5,0>: Cost 3 vext2 <5,0,1,2>, <5,0,1,2> - 2635255504U, // <1,2,5,1>: Cost 3 vext2 <3,0,1,2>, <5,1,7,3> - 3703025440U, // <1,2,5,2>: Cost 4 vext2 <2,0,1,2>, <5,2,7,2> - 2934292818U, // <1,2,5,3>: Cost 3 vzipl LHS, <0,4,1,5> - 2659143622U, // <1,2,5,4>: Cost 3 vext2 <7,0,1,2>, <5,4,7,6> + 2550988902U, // <1,2,5,0>: Cost 3 vext1 <0,1,2,5>, LHS + 2550989824U, // <1,2,5,1>: Cost 3 vext1 <0,1,2,5>, <1,3,5,7> + 3624732264U, // <1,2,5,2>: Cost 4 vext1 <0,1,2,5>, <2,2,2,2> + 2955559014U, // <1,2,5,3>: Cost 3 vzipr <0,4,1,5>, LHS + 2550992182U, // <1,2,5,4>: Cost 3 vext1 <0,1,2,5>, RHS 2659143684U, // <1,2,5,5>: Cost 3 vext2 <7,0,1,2>, <5,5,5,5> 2659143778U, // <1,2,5,6>: Cost 3 vext2 <7,0,1,2>, <5,6,7,0> - 3708997750U, // <1,2,5,7>: Cost 4 vext2 <3,0,1,2>, <5,7,0,2> - 2635256071U, // <1,2,5,u>: Cost 3 vext2 <3,0,1,2>, <5,u,7,3> - 2653172001U, // <1,2,6,0>: Cost 3 vext2 <6,0,1,2>, <6,0,1,2> + 2659143848U, // <1,2,5,7>: Cost 3 vext2 <7,0,1,2>, <5,7,5,7> + 2550994734U, // <1,2,5,u>: Cost 3 vext1 <0,1,2,5>, LHS + 2700289945U, // <1,2,6,0>: Cost 3 vext3 <2,6,0,1>, <2,6,0,1> 2635256232U, // <1,2,6,1>: Cost 3 vext2 <3,0,1,2>, <6,1,7,2> - 2635256314U, // <1,2,6,2>: Cost 3 vext2 <3,0,1,2>, <6,2,7,3> - 2724841402U, // <1,2,6,3>: Cost 3 vext3 <6,7,0,1>, <2,6,3,7> - 3708998302U, // <1,2,6,4>: Cost 4 vext2 <3,0,1,2>, <6,4,7,5> - 3714306800U, // <1,2,6,5>: Cost 4 vext2 <3,u,1,2>, <6,5,7,6> + 2659144186U, // <1,2,6,2>: Cost 3 vext2 <7,0,1,2>, <6,2,7,3> + 2689746874U, // <1,2,6,3>: Cost 3 vext3 <0,u,1,1>, <2,6,3,7> + 3763488705U, // <1,2,6,4>: Cost 4 vext3 <0,u,1,1>, <2,6,4,5> + 3763488716U, // <1,2,6,5>: Cost 4 vext3 <0,u,1,1>, <2,6,5,7> 2659144504U, // <1,2,6,6>: Cost 3 vext2 <7,0,1,2>, <6,6,6,6> 2657817432U, // <1,2,6,7>: Cost 3 vext2 <6,7,1,2>, <6,7,1,2> - 2635256800U, // <1,2,6,u>: Cost 3 vext2 <3,0,1,2>, <6,u,7,3> + 2689746919U, // <1,2,6,u>: Cost 3 vext3 <0,u,1,1>, <2,6,u,7> 1585402874U, // <1,2,7,0>: Cost 2 vext2 <7,0,1,2>, <7,0,1,2> - 2659144810U, // <1,2,7,1>: Cost 3 vext2 <7,0,1,2>, <7,1,4,6> - 3708998831U, // <1,2,7,2>: Cost 4 vext2 <3,0,1,2>, <7,2,3,3> + 2659144770U, // <1,2,7,1>: Cost 3 vext2 <7,0,1,2>, <7,1,0,2> + 3708998858U, // <1,2,7,2>: Cost 4 vext2 <3,0,1,2>, <7,2,6,3> 2635257059U, // <1,2,7,3>: Cost 3 vext2 <3,0,1,2>, <7,3,0,1> 2659145062U, // <1,2,7,4>: Cost 3 vext2 <7,0,1,2>, <7,4,5,6> - 3726251469U, // <1,2,7,5>: Cost 4 vext2 <5,u,1,2>, <7,5,u,1> - 3731559912U, // <1,2,7,6>: Cost 4 vext2 <6,7,1,2>, <7,6,2,1> + 3732886916U, // <1,2,7,5>: Cost 4 vext2 <7,0,1,2>, <7,5,0,0> + 3732886998U, // <1,2,7,6>: Cost 4 vext2 <7,0,1,2>, <7,6,0,1> 2659145255U, // <1,2,7,7>: Cost 3 vext2 <7,0,1,2>, <7,7,0,1> 1590711938U, // <1,2,7,u>: Cost 2 vext2 <7,u,1,2>, <7,u,1,2> 403529835U, // <1,2,u,0>: Cost 1 vext1 LHS, LHS @@ -989,483 +989,483 @@ 1477273192U, // <1,2,u,2>: Cost 2 vext1 LHS, <2,2,2,2> 1477273750U, // <1,2,u,3>: Cost 2 vext1 LHS, <3,0,1,2> 403533110U, // <1,2,u,4>: Cost 1 vext1 LHS, RHS - 1477275344U, // <1,2,u,5>: Cost 2 vext1 LHS, <5,1,7,3> - 1477276154U, // <1,2,u,6>: Cost 2 vext1 LHS, <6,2,7,3> + 1561516186U, // <1,2,u,5>: Cost 2 vext2 <3,0,1,2>, RHS + 1525051898U, // <1,2,u,6>: Cost 2 vext1 LHS, <6,2,7,3> 1525052410U, // <1,2,u,7>: Cost 2 vext1 LHS, <7,0,1,2> 403535662U, // <1,2,u,u>: Cost 1 vext1 LHS, LHS - 2628624394U, // <1,3,0,0>: Cost 3 vext2 <1,u,1,3>, <0,0,1,1> - 2618671206U, // <1,3,0,1>: Cost 3 vext2 <0,2,1,3>, LHS + 2819407872U, // <1,3,0,0>: Cost 3 vuzpr LHS, <0,0,0,0> + 1551564902U, // <1,3,0,1>: Cost 2 vext2 <1,3,1,3>, LHS 2819408630U, // <1,3,0,2>: Cost 3 vuzpr LHS, <1,0,3,2> - 2702502055U, // <1,3,0,3>: Cost 3 vext3 <3,0,3,1>, <3,0,3,1> - 2702575792U, // <1,3,0,4>: Cost 3 vext3 <3,0,4,1>, <3,0,4,1> - 3764816058U, // <1,3,0,5>: Cost 4 vext3 <1,1,1,1>, <3,0,5,2> - 3776465090U, // <1,3,0,6>: Cost 4 vext3 <3,0,6,1>, <3,0,6,1> - 3666572379U, // <1,3,0,7>: Cost 4 vext1 <7,1,3,0>, <7,1,3,0> - 2819850998U, // <1,3,0,u>: Cost 3 vuzpr LHS, <1,0,3,2> - 2625307382U, // <1,3,1,0>: Cost 3 vext2 <1,3,1,3>, <1,0,3,2> - 2691074278U, // <1,3,1,1>: Cost 3 vext3 <1,1,1,1>, <3,1,1,1> + 2619334911U, // <1,3,0,3>: Cost 3 vext2 <0,3,1,3>, <0,3,1,3> + 2625306962U, // <1,3,0,4>: Cost 3 vext2 <1,3,1,3>, <0,4,1,5> + 3832725879U, // <1,3,0,5>: Cost 4 vuzpl <1,2,3,0>, <0,4,5,6> + 3699048959U, // <1,3,0,6>: Cost 4 vext2 <1,3,1,3>, <0,6,2,7> + 3776538827U, // <1,3,0,7>: Cost 4 vext3 <3,0,7,1>, <3,0,7,1> + 1551565469U, // <1,3,0,u>: Cost 2 vext2 <1,3,1,3>, LHS + 2618671862U, // <1,3,1,0>: Cost 3 vext2 <0,2,1,3>, <1,0,3,2> + 2819408692U, // <1,3,1,1>: Cost 3 vuzpr LHS, <1,1,1,1> 2624643975U, // <1,3,1,2>: Cost 3 vext2 <1,2,1,3>, <1,2,1,3> - 2824782582U, // <1,3,1,3>: Cost 3 vuzpr <1,0,3,2>, <1,0,3,2> - 2562977078U, // <1,3,1,4>: Cost 3 vext1 <2,1,3,1>, RHS - 3764816140U, // <1,3,1,5>: Cost 4 vext3 <1,1,1,1>, <3,1,5,3> - 3636720039U, // <1,3,1,6>: Cost 4 vext1 <2,1,3,1>, <6,1,7,1> - 3666580572U, // <1,3,1,7>: Cost 4 vext1 <7,1,3,1>, <7,1,3,1> - 2628625773U, // <1,3,1,u>: Cost 3 vext2 <1,u,1,3>, <1,u,1,3> - 2703608110U, // <1,3,2,0>: Cost 3 vext3 <3,2,0,1>, <3,2,0,1> - 2698889534U, // <1,3,2,1>: Cost 3 vext3 <2,3,u,1>, <3,2,1,u> - 3692414568U, // <1,3,2,2>: Cost 4 vext2 <0,2,1,3>, <2,2,2,2> - 2618672806U, // <1,3,2,3>: Cost 3 vext2 <0,2,1,3>, <2,3,0,1> - 3764816212U, // <1,3,2,4>: Cost 4 vext3 <1,1,1,1>, <3,2,4,3> - 3772631390U, // <1,3,2,5>: Cost 4 vext3 <2,3,u,1>, <3,2,5,4> - 3718956986U, // <1,3,2,6>: Cost 4 vext2 <4,6,1,3>, <2,6,3,7> - 3666588765U, // <1,3,2,7>: Cost 4 vext1 <7,1,3,2>, <7,1,3,2> - 2701617525U, // <1,3,2,u>: Cost 3 vext3 <2,u,0,1>, <3,2,u,0> + 1745666150U, // <1,3,1,3>: Cost 2 vuzpr LHS, LHS + 2557005110U, // <1,3,1,4>: Cost 3 vext1 <1,1,3,1>, RHS + 2625307792U, // <1,3,1,5>: Cost 3 vext2 <1,3,1,3>, <1,5,3,7> + 3698386127U, // <1,3,1,6>: Cost 4 vext2 <1,2,1,3>, <1,6,1,7> + 2592838748U, // <1,3,1,7>: Cost 3 vext1 <7,1,3,1>, <7,1,3,1> + 1745666155U, // <1,3,1,u>: Cost 2 vuzpr LHS, LHS + 2819408790U, // <1,3,2,0>: Cost 3 vuzpr LHS, <1,2,3,0> + 2625308193U, // <1,3,2,1>: Cost 3 vext2 <1,3,1,3>, <2,1,3,3> + 2819408036U, // <1,3,2,2>: Cost 3 vuzpr LHS, <0,2,0,2> + 2819851890U, // <1,3,2,3>: Cost 3 vuzpr LHS, <2,2,3,3> + 2819408794U, // <1,3,2,4>: Cost 3 vuzpr LHS, <1,2,3,4> + 3893149890U, // <1,3,2,5>: Cost 4 vuzpr LHS, <0,2,3,5> + 2819408076U, // <1,3,2,6>: Cost 3 vuzpr LHS, <0,2,4,6> + 3772041583U, // <1,3,2,7>: Cost 4 vext3 <2,3,0,1>, <3,2,7,3> + 2819408042U, // <1,3,2,u>: Cost 3 vuzpr LHS, <0,2,0,u> 1483276390U, // <1,3,3,0>: Cost 2 vext1 <1,1,3,3>, LHS 1483277128U, // <1,3,3,1>: Cost 2 vext1 <1,1,3,3>, <1,1,3,3> 2557019752U, // <1,3,3,2>: Cost 3 vext1 <1,1,3,3>, <2,2,2,2> - 2691074460U, // <1,3,3,3>: Cost 3 vext3 <1,1,1,1>, <3,3,3,3> + 2819408856U, // <1,3,3,3>: Cost 3 vuzpr LHS, <1,3,1,3> 1483279670U, // <1,3,3,4>: Cost 2 vext1 <1,1,3,3>, RHS - 2557021904U, // <1,3,3,5>: Cost 3 vext1 <1,1,3,3>, <5,1,7,3> - 2557022714U, // <1,3,3,6>: Cost 3 vext1 <1,1,3,3>, <6,2,7,3> - 2598827002U, // <1,3,3,7>: Cost 3 vext1 , <7,0,1,2> + 2819409614U, // <1,3,3,5>: Cost 3 vuzpr LHS, <2,3,4,5> + 2598826490U, // <1,3,3,6>: Cost 3 vext1 , <6,2,7,3> + 3087844352U, // <1,3,3,7>: Cost 3 vtrnr LHS, <1,3,5,7> 1483282222U, // <1,3,3,u>: Cost 2 vext1 <1,1,3,3>, LHS - 2704935376U, // <1,3,4,0>: Cost 3 vext3 <3,4,0,1>, <3,4,0,1> - 3697724387U, // <1,3,4,1>: Cost 4 vext2 <1,1,1,3>, <4,1,5,1> - 3636741666U, // <1,3,4,2>: Cost 4 vext1 <2,1,3,4>, <2,1,3,4> - 3630770690U, // <1,3,4,3>: Cost 4 vext1 <1,1,3,4>, <3,4,5,6> - 3630771510U, // <1,3,4,4>: Cost 4 vext1 <1,1,3,4>, RHS - 2618674486U, // <1,3,4,5>: Cost 3 vext2 <0,2,1,3>, RHS - 2846278390U, // <1,3,4,6>: Cost 3 vuzpr RHS, <1,0,3,2> + 2568970342U, // <1,3,4,0>: Cost 3 vext1 <3,1,3,4>, LHS + 2568971224U, // <1,3,4,1>: Cost 3 vext1 <3,1,3,4>, <1,3,1,3> + 3832761290U, // <1,3,4,2>: Cost 4 vuzpl <1,2,3,4>, <4,1,2,3> + 2233428219U, // <1,3,4,3>: Cost 3 vrev <3,1,3,4> + 2568973622U, // <1,3,4,4>: Cost 3 vext1 <3,1,3,4>, RHS + 1551568182U, // <1,3,4,5>: Cost 2 vext2 <1,3,1,3>, RHS + 2819410434U, // <1,3,4,6>: Cost 3 vuzpr LHS, <3,4,5,6> 3666605151U, // <1,3,4,7>: Cost 4 vext1 <7,1,3,4>, <7,1,3,4> - 2618674729U, // <1,3,4,u>: Cost 3 vext2 <0,2,1,3>, RHS - 3764816418U, // <1,3,5,0>: Cost 4 vext3 <1,1,1,1>, <3,5,0,2> - 3692416720U, // <1,3,5,1>: Cost 4 vext2 <0,2,1,3>, <5,1,7,3> - 2648534763U, // <1,3,5,2>: Cost 3 vext2 <5,2,1,3>, <5,2,1,3> - 3782363712U, // <1,3,5,3>: Cost 4 vext3 <4,0,5,1>, <3,5,3,5> - 3307251973U, // <1,3,5,4>: Cost 4 vrev <3,1,4,5> - 3779709518U, // <1,3,5,5>: Cost 4 vext3 <3,5,5,1>, <3,5,5,1> - 3718959202U, // <1,3,5,6>: Cost 4 vext2 <4,6,1,3>, <5,6,7,0> - 3923378934U, // <1,3,5,7>: Cost 4 vuzpr <5,1,7,3>, <1,0,3,2> - 2652516561U, // <1,3,5,u>: Cost 3 vext2 <5,u,1,3>, <5,u,1,3> - 3780004466U, // <1,3,6,0>: Cost 4 vext3 <3,6,0,1>, <3,6,0,1> - 3697725863U, // <1,3,6,1>: Cost 4 vext2 <1,1,1,3>, <6,1,7,1> - 3692417530U, // <1,3,6,2>: Cost 4 vext2 <0,2,1,3>, <6,2,7,3> - 3699053130U, // <1,3,6,3>: Cost 4 vext2 <1,3,1,3>, <6,3,7,2> - 3798583964U, // <1,3,6,4>: Cost 4 vext3 <6,7,0,1>, <3,6,4,7> - 3722277611U, // <1,3,6,5>: Cost 4 vext2 <5,2,1,3>, <6,5,7,1> - 3718959928U, // <1,3,6,6>: Cost 4 vext2 <4,6,1,3>, <6,6,6,6> - 2724842160U, // <1,3,6,7>: Cost 3 vext3 <6,7,0,1>, <3,6,7,0> - 2725505721U, // <1,3,6,u>: Cost 3 vext3 <6,u,0,1>, <3,6,u,0> + 1551568425U, // <1,3,4,u>: Cost 2 vext2 <1,3,1,3>, RHS + 2563006566U, // <1,3,5,0>: Cost 3 vext1 <2,1,3,5>, LHS + 2568979456U, // <1,3,5,1>: Cost 3 vext1 <3,1,3,5>, <1,3,5,7> + 2563008035U, // <1,3,5,2>: Cost 3 vext1 <2,1,3,5>, <2,1,3,5> + 2233436412U, // <1,3,5,3>: Cost 3 vrev <3,1,3,5> + 2563009846U, // <1,3,5,4>: Cost 3 vext1 <2,1,3,5>, RHS + 2867187716U, // <1,3,5,5>: Cost 3 vuzpr LHS, <5,5,5,5> + 2655834214U, // <1,3,5,6>: Cost 3 vext2 <6,4,1,3>, <5,6,7,4> + 1745669430U, // <1,3,5,7>: Cost 2 vuzpr LHS, RHS + 1745669431U, // <1,3,5,u>: Cost 2 vuzpr LHS, RHS + 2867187810U, // <1,3,6,0>: Cost 3 vuzpr LHS, <5,6,7,0> + 3699052931U, // <1,3,6,1>: Cost 4 vext2 <1,3,1,3>, <6,1,3,1> + 2654507460U, // <1,3,6,2>: Cost 3 vext2 <6,2,1,3>, <6,2,1,3> + 3766291091U, // <1,3,6,3>: Cost 4 vext3 <1,3,3,1>, <3,6,3,7> + 2655834726U, // <1,3,6,4>: Cost 3 vext2 <6,4,1,3>, <6,4,1,3> + 3923384562U, // <1,3,6,5>: Cost 4 vuzpr <5,1,7,3>, + 2657161992U, // <1,3,6,6>: Cost 3 vext2 <6,6,1,3>, <6,6,1,3> + 2819852218U, // <1,3,6,7>: Cost 3 vuzpr LHS, <2,6,3,7> + 2819852219U, // <1,3,6,u>: Cost 3 vuzpr LHS, <2,6,3,u> 2706926275U, // <1,3,7,0>: Cost 3 vext3 <3,7,0,1>, <3,7,0,1> 2659816524U, // <1,3,7,1>: Cost 3 vext2 <7,1,1,3>, <7,1,1,3> - 3934954390U, // <1,3,7,2>: Cost 4 vuzpr <7,1,2,3>, <1,2,3,0> - 3666627120U, // <1,3,7,3>: Cost 4 vext1 <7,1,3,7>, <3,5,1,7> - 3718960486U, // <1,3,7,4>: Cost 4 vext2 <4,6,1,3>, <7,4,5,6> - 3722278295U, // <1,3,7,5>: Cost 4 vext2 <5,2,1,3>, <7,5,2,1> - 3307415833U, // <1,3,7,6>: Cost 4 vrev <3,1,6,7> - 3718960748U, // <1,3,7,7>: Cost 4 vext2 <4,6,1,3>, <7,7,7,7> - 2664461955U, // <1,3,7,u>: Cost 3 vext2 <7,u,1,3>, <7,u,1,3> + 3636766245U, // <1,3,7,2>: Cost 4 vext1 <2,1,3,7>, <2,1,3,7> + 2867187903U, // <1,3,7,3>: Cost 3 vuzpr LHS, <5,7,u,3> + 2625312102U, // <1,3,7,4>: Cost 3 vext2 <1,3,1,3>, <7,4,5,6> + 2867188598U, // <1,3,7,5>: Cost 3 vuzpr LHS, <6,7,4,5> + 3728250344U, // <1,3,7,6>: Cost 4 vext2 <6,2,1,3>, <7,6,2,1> + 2867187880U, // <1,3,7,7>: Cost 3 vuzpr LHS, <5,7,5,7> + 2707516171U, // <1,3,7,u>: Cost 3 vext3 <3,7,u,1>, <3,7,u,1> 1483317350U, // <1,3,u,0>: Cost 2 vext1 <1,1,3,u>, LHS 1483318093U, // <1,3,u,1>: Cost 2 vext1 <1,1,3,u>, <1,1,3,u> - 2557060712U, // <1,3,u,2>: Cost 3 vext1 <1,1,3,u>, <2,2,2,2> - 2557061270U, // <1,3,u,3>: Cost 3 vext1 <1,1,3,u>, <3,0,1,2> + 2819410718U, // <1,3,u,2>: Cost 3 vuzpr LHS, <3,u,1,2> + 1745666717U, // <1,3,u,3>: Cost 2 vuzpr LHS, LHS 1483320630U, // <1,3,u,4>: Cost 2 vext1 <1,1,3,u>, RHS - 2618677402U, // <1,3,u,5>: Cost 3 vext2 <0,2,1,3>, RHS - 2557063674U, // <1,3,u,6>: Cost 3 vext1 <1,1,3,u>, <6,2,7,3> - 2598867962U, // <1,3,u,7>: Cost 3 vext1 , <7,0,1,2> - 1483323182U, // <1,3,u,u>: Cost 2 vext1 <1,1,3,u>, LHS - 2708253541U, // <1,4,0,0>: Cost 3 vext3 <4,0,0,1>, <4,0,0,1> - 2623987814U, // <1,4,0,1>: Cost 3 vext2 <1,1,1,4>, LHS - 3697729700U, // <1,4,0,2>: Cost 4 vext2 <1,1,1,4>, <0,2,0,2> - 3709010200U, // <1,4,0,3>: Cost 4 vext2 <3,0,1,4>, <0,3,4,1> - 2580958098U, // <1,4,0,4>: Cost 3 vext1 <5,1,4,0>, <4,0,5,1> + 1551571098U, // <1,3,u,5>: Cost 2 vext2 <1,3,1,3>, RHS + 2819410758U, // <1,3,u,6>: Cost 3 vuzpr LHS, <3,u,5,6> + 1745669673U, // <1,3,u,7>: Cost 2 vuzpr LHS, RHS + 1745666722U, // <1,3,u,u>: Cost 2 vuzpr LHS, LHS + 2617352205U, // <1,4,0,0>: Cost 3 vext2 <0,0,1,4>, <0,0,1,4> + 2619342950U, // <1,4,0,1>: Cost 3 vext2 <0,3,1,4>, LHS + 3692421295U, // <1,4,0,2>: Cost 4 vext2 <0,2,1,4>, <0,2,1,4> + 2619343104U, // <1,4,0,3>: Cost 3 vext2 <0,3,1,4>, <0,3,1,4> + 2617352530U, // <1,4,0,4>: Cost 3 vext2 <0,0,1,4>, <0,4,1,5> 1634880402U, // <1,4,0,5>: Cost 2 vext3 <4,0,5,1>, <4,0,5,1> - 2691074972U, // <1,4,0,6>: Cost 3 vext3 <1,1,1,1>, <4,0,6,2> - 3654702074U, // <1,4,0,7>: Cost 4 vext1 <5,1,4,0>, <7,0,1,2> + 2713930652U, // <1,4,0,6>: Cost 3 vext3 <4,u,5,1>, <4,0,6,2> + 3732898396U, // <1,4,0,7>: Cost 4 vext2 <7,0,1,4>, <0,7,4,1> 1635101613U, // <1,4,0,u>: Cost 2 vext3 <4,0,u,1>, <4,0,u,1> - 3697730275U, // <1,4,1,0>: Cost 4 vext2 <1,1,1,4>, <1,0,1,1> + 3693085430U, // <1,4,1,0>: Cost 4 vext2 <0,3,1,4>, <1,0,3,2> 2623988535U, // <1,4,1,1>: Cost 3 vext2 <1,1,1,4>, <1,1,1,4> - 3697730439U, // <1,4,1,2>: Cost 4 vext2 <1,1,1,4>, <1,2,1,3> - 3776318416U, // <1,4,1,3>: Cost 4 vext3 <3,0,4,1>, <4,1,3,0> - 3697730590U, // <1,4,1,4>: Cost 4 vext2 <1,1,1,4>, <1,4,0,1> - 2709285859U, // <1,4,1,5>: Cost 3 vext3 <4,1,5,1>, <4,1,5,1> - 2709359596U, // <1,4,1,6>: Cost 3 vext3 <4,1,6,1>, <4,1,6,1> + 3693085590U, // <1,4,1,2>: Cost 4 vext2 <0,3,1,4>, <1,2,3,0> + 3692422134U, // <1,4,1,3>: Cost 4 vext2 <0,2,1,4>, <1,3,4,6> + 3693085726U, // <1,4,1,4>: Cost 4 vext2 <0,3,1,4>, <1,4,0,1> + 2892401974U, // <1,4,1,5>: Cost 3 vzipl <1,1,1,1>, RHS + 3026619702U, // <1,4,1,6>: Cost 3 vtrnl <1,1,1,1>, RHS 3800206324U, // <1,4,1,7>: Cost 4 vext3 <7,0,4,1>, <4,1,7,0> - 2709507070U, // <1,4,1,u>: Cost 3 vext3 <4,1,u,1>, <4,1,u,1> - 3709011380U, // <1,4,2,0>: Cost 4 vext2 <3,0,1,4>, <2,0,0,2> - 3697731103U, // <1,4,2,1>: Cost 4 vext2 <1,1,1,4>, <2,1,3,1> - 3697731176U, // <1,4,2,2>: Cost 4 vext2 <1,1,1,4>, <2,2,2,2> + 2892402217U, // <1,4,1,u>: Cost 3 vzipl <1,1,1,1>, RHS + 3966978927U, // <1,4,2,0>: Cost 4 vzipl <1,2,3,4>, <4,0,1,2> + 3966979018U, // <1,4,2,1>: Cost 4 vzipl <1,2,3,4>, <4,1,2,3> + 3693086312U, // <1,4,2,2>: Cost 4 vext2 <0,3,1,4>, <2,2,2,2> 2635269798U, // <1,4,2,3>: Cost 3 vext2 <3,0,1,4>, <2,3,0,1> - 3642772790U, // <1,4,2,4>: Cost 4 vext1 <3,1,4,2>, RHS - 2980496278U, // <1,4,2,5>: Cost 3 vzipr RHS, <1,2,3,0> - 3771968574U, // <1,4,2,6>: Cost 4 vext3 <2,2,u,1>, <4,2,6,2> + 3966979280U, // <1,4,2,4>: Cost 4 vzipl <1,2,3,4>, <4,4,4,4> + 2893204790U, // <1,4,2,5>: Cost 3 vzipl <1,2,3,0>, RHS + 3693086650U, // <1,4,2,6>: Cost 4 vext2 <0,3,1,4>, <2,6,3,7> 3666662502U, // <1,4,2,7>: Cost 4 vext1 <7,1,4,2>, <7,1,4,2> - 2982486934U, // <1,4,2,u>: Cost 3 vzipr RHS, <1,2,3,0> + 2893205033U, // <1,4,2,u>: Cost 3 vzipl <1,2,3,0>, RHS 2563063910U, // <1,4,3,0>: Cost 3 vext1 <2,1,4,3>, LHS 2563064730U, // <1,4,3,1>: Cost 3 vext1 <2,1,4,3>, <1,2,3,4> 2563065386U, // <1,4,3,2>: Cost 3 vext1 <2,1,4,3>, <2,1,4,3> - 3697731996U, // <1,4,3,3>: Cost 4 vext2 <1,1,1,4>, <3,3,3,3> - 2563067190U, // <1,4,3,4>: Cost 3 vext1 <2,1,4,3>, RHS - 3070443622U, // <1,4,3,5>: Cost 3 vtrnl , LHS - 3040886886U, // <1,4,3,6>: Cost 3 vtrnl <3,4,5,6>, LHS + 3693087132U, // <1,4,3,3>: Cost 4 vext2 <0,3,1,4>, <3,3,3,3> + 2619345410U, // <1,4,3,4>: Cost 3 vext2 <0,3,1,4>, <3,4,5,6> + 3087843666U, // <1,4,3,5>: Cost 3 vtrnr LHS, <0,4,1,5> + 3087843676U, // <1,4,3,6>: Cost 3 vtrnr LHS, <0,4,2,6> 3666670695U, // <1,4,3,7>: Cost 4 vext1 <7,1,4,3>, <7,1,4,3> - 2563069742U, // <1,4,3,u>: Cost 3 vext1 <2,1,4,3>, LHS + 3087843669U, // <1,4,3,u>: Cost 3 vtrnr LHS, <0,4,1,u> 2620672914U, // <1,4,4,0>: Cost 3 vext2 <0,5,1,4>, <4,0,5,1> - 3697732579U, // <1,4,4,1>: Cost 4 vext2 <1,1,1,4>, <4,1,5,1> - 3709013052U, // <1,4,4,2>: Cost 4 vext2 <3,0,1,4>, <4,2,6,0> - 3313142740U, // <1,4,4,3>: Cost 4 vrev <4,1,3,4> - 2724842704U, // <1,4,4,4>: Cost 3 vext3 <6,7,0,1>, <4,4,4,4> - 2623991094U, // <1,4,4,5>: Cost 3 vext2 <1,1,1,4>, RHS - 2724842724U, // <1,4,4,6>: Cost 3 vext3 <6,7,0,1>, <4,4,6,6> - 3786640622U, // <1,4,4,7>: Cost 5 vext3 <4,7,0,1>, <4,4,7,7> - 2623991337U, // <1,4,4,u>: Cost 3 vext2 <1,1,1,4>, RHS + 3630842706U, // <1,4,4,1>: Cost 4 vext1 <1,1,4,4>, <1,1,4,4> + 3313069003U, // <1,4,4,2>: Cost 4 vrev <4,1,2,4> + 3642788100U, // <1,4,4,3>: Cost 4 vext1 <3,1,4,4>, <3,1,4,4> + 2713930960U, // <1,4,4,4>: Cost 3 vext3 <4,u,5,1>, <4,4,4,4> + 2619346230U, // <1,4,4,5>: Cost 3 vext2 <0,3,1,4>, RHS + 2713930980U, // <1,4,4,6>: Cost 3 vext3 <4,u,5,1>, <4,4,6,6> + 3736882642U, // <1,4,4,7>: Cost 4 vext2 <7,6,1,4>, <4,7,6,1> + 2619346473U, // <1,4,4,u>: Cost 3 vext2 <0,3,1,4>, RHS 2557108326U, // <1,4,5,0>: Cost 3 vext1 <1,1,4,5>, LHS 2557109075U, // <1,4,5,1>: Cost 3 vext1 <1,1,4,5>, <1,1,4,5> 2598913774U, // <1,4,5,2>: Cost 3 vext1 , <2,3,u,1> 3630852246U, // <1,4,5,3>: Cost 4 vext1 <1,1,4,5>, <3,0,1,2> 2557111606U, // <1,4,5,4>: Cost 3 vext1 <1,1,4,5>, RHS - 2980504720U, // <1,4,5,5>: Cost 3 vzipr RHS, <1,5,3,7> - 1617333558U, // <1,4,5,6>: Cost 2 vext3 <1,1,1,1>, RHS - 3654743034U, // <1,4,5,7>: Cost 4 vext1 <5,1,4,5>, <7,0,1,2> - 1617333576U, // <1,4,5,u>: Cost 2 vext3 <1,1,1,1>, RHS - 2691075404U, // <1,4,6,0>: Cost 3 vext3 <1,1,1,1>, <4,6,0,2> - 2712309076U, // <1,4,6,1>: Cost 3 vext3 <4,6,1,1>, <4,6,1,1> - 2698300764U, // <1,4,6,2>: Cost 3 vext3 <2,3,0,1>, <4,6,2,0> - 2712456550U, // <1,4,6,3>: Cost 3 vext3 <4,6,3,1>, <4,6,3,1> - 2712825204U, // <1,4,6,4>: Cost 3 vext3 <4,6,u,1>, <4,6,4,6> - 4054238415U, // <1,4,6,5>: Cost 4 vzipr RHS, <1,6,1,7> - 3660722577U, // <1,4,6,6>: Cost 4 vext1 <6,1,4,6>, <6,1,4,6> - 2659160910U, // <1,4,6,7>: Cost 3 vext2 <7,0,1,4>, <6,7,0,1> - 2712825235U, // <1,4,6,u>: Cost 3 vext3 <4,6,u,1>, <4,6,u,1> + 2895252790U, // <1,4,5,5>: Cost 3 vzipl <1,5,3,7>, RHS + 1616006454U, // <1,4,5,6>: Cost 2 vext3 <0,u,1,1>, RHS + 3899059510U, // <1,4,5,7>: Cost 4 vuzpr <1,1,1,4>, RHS + 1616006472U, // <1,4,5,u>: Cost 2 vext3 <0,u,1,1>, RHS + 2557116518U, // <1,4,6,0>: Cost 3 vext1 <1,1,4,6>, LHS + 2557117236U, // <1,4,6,1>: Cost 3 vext1 <1,1,4,6>, <1,1,1,1> + 3630859880U, // <1,4,6,2>: Cost 4 vext1 <1,1,4,6>, <2,2,2,2> + 2569062550U, // <1,4,6,3>: Cost 3 vext1 <3,1,4,6>, <3,0,1,2> + 2557119798U, // <1,4,6,4>: Cost 3 vext1 <1,1,4,6>, RHS + 3763490174U, // <1,4,6,5>: Cost 4 vext3 <0,u,1,1>, <4,6,5,7> + 3763490183U, // <1,4,6,6>: Cost 4 vext3 <0,u,1,1>, <4,6,6,7> + 2712751498U, // <1,4,6,7>: Cost 3 vext3 <4,6,7,1>, <4,6,7,1> + 2557122350U, // <1,4,6,u>: Cost 3 vext1 <1,1,4,6>, LHS 2659161084U, // <1,4,7,0>: Cost 3 vext2 <7,0,1,4>, <7,0,1,4> - 3733566541U, // <1,4,7,1>: Cost 4 vext2 <7,1,1,4>, <7,1,1,4> + 3732903040U, // <1,4,7,1>: Cost 4 vext2 <7,0,1,4>, <7,1,7,1> 3734230174U, // <1,4,7,2>: Cost 4 vext2 <7,2,1,4>, <7,2,1,4> 3734893807U, // <1,4,7,3>: Cost 4 vext2 <7,3,1,4>, <7,3,1,4> - 3732903270U, // <1,4,7,4>: Cost 4 vext2 <7,0,1,4>, <7,4,5,6> - 3736221073U, // <1,4,7,5>: Cost 4 vext2 <7,5,1,4>, <7,5,1,4> - 3798584785U, // <1,4,7,6>: Cost 4 vext3 <6,7,0,1>, <4,7,6,0> - 3732903532U, // <1,4,7,7>: Cost 4 vext2 <7,0,1,4>, <7,7,7,7> + 3660729654U, // <1,4,7,4>: Cost 4 vext1 <6,1,4,7>, RHS + 3786493384U, // <1,4,7,5>: Cost 4 vext3 <4,6,7,1>, <4,7,5,0> + 2713341394U, // <1,4,7,6>: Cost 3 vext3 <4,7,6,1>, <4,7,6,1> + 3660731386U, // <1,4,7,7>: Cost 4 vext1 <6,1,4,7>, <7,0,1,2> 2664470148U, // <1,4,7,u>: Cost 3 vext2 <7,u,1,4>, <7,u,1,4> - 2691075566U, // <1,4,u,0>: Cost 3 vext3 <1,1,1,1>, <4,u,0,2> - 2623993646U, // <1,4,u,1>: Cost 3 vext2 <1,1,1,4>, LHS + 2557132902U, // <1,4,u,0>: Cost 3 vext1 <1,1,4,u>, LHS + 2619348782U, // <1,4,u,1>: Cost 3 vext2 <0,3,1,4>, LHS 2563106351U, // <1,4,u,2>: Cost 3 vext1 <2,1,4,u>, <2,1,4,u> 2713783816U, // <1,4,u,3>: Cost 3 vext3 <4,u,3,1>, <4,u,3,1> - 2557136182U, // <1,4,u,4>: Cost 3 vext1 <1,1,4,u>, RHS - 1634880402U, // <1,4,u,5>: Cost 2 vext3 <4,0,5,1>, <4,0,5,1> - 1617333801U, // <1,4,u,6>: Cost 2 vext3 <1,1,1,1>, RHS - 2659160910U, // <1,4,u,7>: Cost 3 vext2 <7,0,1,4>, <6,7,0,1> - 1617333819U, // <1,4,u,u>: Cost 2 vext3 <1,1,1,1>, RHS - 2575056998U, // <1,5,0,0>: Cost 3 vext1 <4,1,5,0>, LHS - 1594048614U, // <1,5,0,1>: Cost 2 vext2 , LHS - 2667790500U, // <1,5,0,2>: Cost 3 vext2 , <0,2,0,2> - 3648800918U, // <1,5,0,3>: Cost 4 vext1 <4,1,5,0>, <3,0,1,2> + 2622666815U, // <1,4,u,4>: Cost 3 vext2 <0,u,1,4>, + 1640189466U, // <1,4,u,5>: Cost 2 vext3 <4,u,5,1>, <4,u,5,1> + 1616006697U, // <1,4,u,6>: Cost 2 vext3 <0,u,1,1>, RHS + 2712751498U, // <1,4,u,7>: Cost 3 vext3 <4,6,7,1>, <4,6,7,1> + 1616006715U, // <1,4,u,u>: Cost 2 vext3 <0,u,1,1>, RHS + 2620014592U, // <1,5,0,0>: Cost 3 vext2 <0,4,1,5>, <0,0,0,0> + 1546272870U, // <1,5,0,1>: Cost 2 vext2 <0,4,1,5>, LHS + 2618687664U, // <1,5,0,2>: Cost 3 vext2 <0,2,1,5>, <0,2,1,5> + 3693093120U, // <1,5,0,3>: Cost 4 vext2 <0,3,1,5>, <0,3,1,4> 1546273106U, // <1,5,0,4>: Cost 2 vext2 <0,4,1,5>, <0,4,1,5> - 2714594923U, // <1,5,0,5>: Cost 3 vext3 <5,0,5,1>, <5,0,5,1> + 2620678563U, // <1,5,0,5>: Cost 3 vext2 <0,5,1,5>, <0,5,1,5> 2714668660U, // <1,5,0,6>: Cost 3 vext3 <5,0,6,1>, <5,0,6,1> - 2714742397U, // <1,5,0,7>: Cost 3 vext3 <5,0,7,1>, <5,0,7,1> - 1594049181U, // <1,5,0,u>: Cost 2 vext2 , LHS - 2708622991U, // <1,5,1,0>: Cost 3 vext3 <4,0,5,1>, <5,1,0,1> - 2575065908U, // <1,5,1,1>: Cost 3 vext1 <4,1,5,1>, <1,1,1,1> - 2667791254U, // <1,5,1,2>: Cost 3 vext2 , <1,2,3,0> - 3642837258U, // <1,5,1,3>: Cost 4 vext1 <3,1,5,1>, <3,1,5,1> - 2708623026U, // <1,5,1,4>: Cost 3 vext3 <4,0,5,1>, <5,1,4,0> - 2657838224U, // <1,5,1,5>: Cost 3 vext2 <6,7,1,5>, <1,5,3,7> + 3772042877U, // <1,5,0,7>: Cost 4 vext3 <2,3,0,1>, <5,0,7,1> + 1546273437U, // <1,5,0,u>: Cost 2 vext2 <0,4,1,5>, LHS + 2620015350U, // <1,5,1,0>: Cost 3 vext2 <0,4,1,5>, <1,0,3,2> + 2620015412U, // <1,5,1,1>: Cost 3 vext2 <0,4,1,5>, <1,1,1,1> + 2620015510U, // <1,5,1,2>: Cost 3 vext2 <0,4,1,5>, <1,2,3,0> + 2618688512U, // <1,5,1,3>: Cost 3 vext2 <0,2,1,5>, <1,3,5,7> + 2620015677U, // <1,5,1,4>: Cost 3 vext2 <0,4,1,5>, <1,4,3,5> + 2620015727U, // <1,5,1,5>: Cost 3 vext2 <0,4,1,5>, <1,5,0,1> 2620015859U, // <1,5,1,6>: Cost 3 vext2 <0,4,1,5>, <1,6,5,7> - 2691075792U, // <1,5,1,7>: Cost 3 vext3 <1,1,1,1>, <5,1,7,3> - 2691075801U, // <1,5,1,u>: Cost 3 vext3 <1,1,1,1>, <5,1,u,3> - 2575073382U, // <1,5,2,0>: Cost 3 vext1 <4,1,5,2>, LHS - 2708623083U, // <1,5,2,1>: Cost 3 vext3 <4,0,5,1>, <5,2,1,3> - 2667791976U, // <1,5,2,2>: Cost 3 vext2 , <2,2,2,2> - 2667792038U, // <1,5,2,3>: Cost 3 vext2 , <2,3,0,1> - 2575076324U, // <1,5,2,4>: Cost 3 vext1 <4,1,5,2>, <4,1,5,2> - 3648818896U, // <1,5,2,5>: Cost 4 vext1 <4,1,5,2>, <5,1,7,3> - 2667792314U, // <1,5,2,6>: Cost 3 vext2 , <2,6,3,7> - 3760025376U, // <1,5,2,7>: Cost 4 vext3 <0,2,u,1>, <5,2,7,2> - 2575079214U, // <1,5,2,u>: Cost 3 vext1 <4,1,5,2>, LHS - 2569109606U, // <1,5,3,0>: Cost 3 vext1 <3,1,5,3>, LHS - 2592998544U, // <1,5,3,1>: Cost 3 vext1 <7,1,5,3>, <1,5,3,7> - 2569111246U, // <1,5,3,2>: Cost 3 vext1 <3,1,5,3>, <2,3,4,5> - 2569111820U, // <1,5,3,3>: Cost 3 vext1 <3,1,5,3>, <3,1,5,3> - 2569112886U, // <1,5,3,4>: Cost 3 vext1 <3,1,5,3>, RHS - 3053486182U, // <1,5,3,5>: Cost 3 vtrnl <5,5,5,5>, LHS - 3642855930U, // <1,5,3,6>: Cost 4 vext1 <3,1,5,3>, <6,2,7,3> - 1973862502U, // <1,5,3,7>: Cost 2 vtrnl RHS, LHS - 1973870694U, // <1,5,3,u>: Cost 2 vtrnl RHS, LHS - 2667793298U, // <1,5,4,0>: Cost 3 vext2 , <4,0,5,1> - 2667793378U, // <1,5,4,1>: Cost 3 vext2 , <4,1,5,0> - 3741535277U, // <1,5,4,2>: Cost 4 vext2 , <4,2,4,3> - 3319115437U, // <1,5,4,3>: Cost 4 vrev <5,1,3,4> - 2667793616U, // <1,5,4,4>: Cost 3 vext2 , <4,4,4,4> - 1594051894U, // <1,5,4,5>: Cost 2 vext2 , RHS - 2667793740U, // <1,5,4,6>: Cost 3 vext2 , <4,6,0,2> - 2724843462U, // <1,5,4,7>: Cost 3 vext3 <6,7,0,1>, <5,4,7,6> - 1594052137U, // <1,5,4,u>: Cost 2 vext2 , RHS - 2717544403U, // <1,5,5,0>: Cost 3 vext3 <5,5,0,1>, <5,5,0,1> - 2649878224U, // <1,5,5,1>: Cost 3 vext2 <5,4,1,5>, <5,1,7,3> - 3741535979U, // <1,5,5,2>: Cost 4 vext2 , <5,2,1,3> - 3722956606U, // <1,5,5,3>: Cost 4 vext2 <5,3,1,5>, <5,3,1,5> - 2245455543U, // <1,5,5,4>: Cost 3 vrev <5,1,4,5> - 2718134276U, // <1,5,5,5>: Cost 3 vext3 <5,5,u,1>, <5,5,5,5> + 3093728566U, // <1,5,1,7>: Cost 3 vtrnr <1,1,1,1>, RHS + 2620015981U, // <1,5,1,u>: Cost 3 vext2 <0,4,1,5>, <1,u,1,3> + 3692430816U, // <1,5,2,0>: Cost 4 vext2 <0,2,1,5>, <2,0,5,1> + 2620016163U, // <1,5,2,1>: Cost 3 vext2 <0,4,1,5>, <2,1,3,5> + 2620016232U, // <1,5,2,2>: Cost 3 vext2 <0,4,1,5>, <2,2,2,2> + 2620016294U, // <1,5,2,3>: Cost 3 vext2 <0,4,1,5>, <2,3,0,1> + 3693758221U, // <1,5,2,4>: Cost 4 vext2 <0,4,1,5>, <2,4,2,5> + 3692431209U, // <1,5,2,5>: Cost 4 vext2 <0,2,1,5>, <2,5,3,7> + 2620016570U, // <1,5,2,6>: Cost 3 vext2 <0,4,1,5>, <2,6,3,7> + 4173598006U, // <1,5,2,7>: Cost 4 vtrnr <2,1,3,2>, RHS + 2620016699U, // <1,5,2,u>: Cost 3 vext2 <0,4,1,5>, <2,u,0,1> + 2620016790U, // <1,5,3,0>: Cost 3 vext2 <0,4,1,5>, <3,0,1,2> + 2569110672U, // <1,5,3,1>: Cost 3 vext1 <3,1,5,3>, <1,5,3,7> + 3693758785U, // <1,5,3,2>: Cost 4 vext2 <0,4,1,5>, <3,2,2,2> + 2620017052U, // <1,5,3,3>: Cost 3 vext2 <0,4,1,5>, <3,3,3,3> + 2620017154U, // <1,5,3,4>: Cost 3 vext2 <0,4,1,5>, <3,4,5,6> + 3135623172U, // <1,5,3,5>: Cost 3 vtrnr LHS, <5,5,5,5> + 4161587048U, // <1,5,3,6>: Cost 4 vtrnr LHS, <2,5,3,6> + 2014104886U, // <1,5,3,7>: Cost 2 vtrnr LHS, RHS + 2014104887U, // <1,5,3,u>: Cost 2 vtrnr LHS, RHS + 2620017554U, // <1,5,4,0>: Cost 3 vext2 <0,4,1,5>, <4,0,5,1> + 2620017634U, // <1,5,4,1>: Cost 3 vext2 <0,4,1,5>, <4,1,5,0> + 3693759551U, // <1,5,4,2>: Cost 4 vext2 <0,4,1,5>, <4,2,6,3> + 3642861837U, // <1,5,4,3>: Cost 4 vext1 <3,1,5,4>, <3,1,5,4> + 2575092710U, // <1,5,4,4>: Cost 3 vext1 <4,1,5,4>, <4,1,5,4> + 1546276150U, // <1,5,4,5>: Cost 2 vext2 <0,4,1,5>, RHS + 2759855414U, // <1,5,4,6>: Cost 3 vuzpl <1,3,5,7>, RHS + 2713931718U, // <1,5,4,7>: Cost 3 vext3 <4,u,5,1>, <5,4,7,6> + 1546276393U, // <1,5,4,u>: Cost 2 vext2 <0,4,1,5>, RHS + 2557182054U, // <1,5,5,0>: Cost 3 vext1 <1,1,5,5>, LHS + 2557182812U, // <1,5,5,1>: Cost 3 vext1 <1,1,5,5>, <1,1,5,5> + 3630925347U, // <1,5,5,2>: Cost 4 vext1 <1,1,5,5>, <2,1,3,5> + 4029301675U, // <1,5,5,3>: Cost 4 vzipr <0,4,1,5>, <1,2,5,3> + 2557185334U, // <1,5,5,4>: Cost 3 vext1 <1,1,5,5>, RHS + 2713931780U, // <1,5,5,5>: Cost 3 vext3 <4,u,5,1>, <5,5,5,5> 2667794530U, // <1,5,5,6>: Cost 3 vext2 , <5,6,7,0> - 2724843544U, // <1,5,5,7>: Cost 3 vext3 <6,7,0,1>, <5,5,7,7> - 2245750491U, // <1,5,5,u>: Cost 3 vrev <5,1,u,5> + 2713931800U, // <1,5,5,7>: Cost 3 vext3 <4,u,5,1>, <5,5,7,7> + 2557187886U, // <1,5,5,u>: Cost 3 vext1 <1,1,5,5>, LHS 2718208036U, // <1,5,6,0>: Cost 3 vext3 <5,6,0,1>, <5,6,0,1> - 2708623411U, // <1,5,6,1>: Cost 3 vext3 <4,0,5,1>, <5,6,1,7> + 2620019115U, // <1,5,6,1>: Cost 3 vext2 <0,4,1,5>, <6,1,7,5> 2667794938U, // <1,5,6,2>: Cost 3 vext2 , <6,2,7,3> - 3782365250U, // <1,5,6,3>: Cost 4 vext3 <4,0,5,1>, <5,6,3,4> - 3782365255U, // <1,5,6,4>: Cost 4 vext3 <4,0,5,1>, <5,6,4,0> - 3791876183U, // <1,5,6,5>: Cost 4 vext3 <5,5,u,1>, <5,6,5,7> + 3787673666U, // <1,5,6,3>: Cost 4 vext3 <4,u,5,1>, <5,6,3,4> + 3693761165U, // <1,5,6,4>: Cost 4 vext2 <0,4,1,5>, <6,4,5,6> + 3319279297U, // <1,5,6,5>: Cost 4 vrev <5,1,5,6> 2667795256U, // <1,5,6,6>: Cost 3 vext2 , <6,6,6,6> - 2718724195U, // <1,5,6,7>: Cost 3 vext3 <5,6,7,1>, <5,6,7,1> - 2718797932U, // <1,5,6,u>: Cost 3 vext3 <5,6,u,1>, <5,6,u,1> - 2667795450U, // <1,5,7,0>: Cost 3 vext2 , <7,0,1,2> - 4057597227U, // <1,5,7,1>: Cost 4 vzipr <5,1,7,3>, <1,7,3,0> - 3741537445U, // <1,5,7,2>: Cost 4 vext2 , <7,2,2,2> - 3723621648U, // <1,5,7,3>: Cost 4 vext2 <5,4,1,5>, <7,3,5,1> - 2667795814U, // <1,5,7,4>: Cost 3 vext2 , <7,4,5,6> - 3723621780U, // <1,5,7,5>: Cost 4 vext2 <5,4,1,5>, <7,5,1,7> - 3736892899U, // <1,5,7,6>: Cost 4 vext2 <7,6,1,5>, <7,6,1,5> - 2667796076U, // <1,5,7,7>: Cost 3 vext2 , <7,7,7,7> - 2667796098U, // <1,5,7,u>: Cost 3 vext2 , <7,u,1,2> - 2569150566U, // <1,5,u,0>: Cost 3 vext1 <3,1,5,u>, LHS - 1594054446U, // <1,5,u,1>: Cost 2 vext2 , LHS - 2569152206U, // <1,5,u,2>: Cost 3 vext1 <3,1,5,u>, <2,3,4,5> - 2569152785U, // <1,5,u,3>: Cost 3 vext1 <3,1,5,u>, <3,1,5,u> + 2713931874U, // <1,5,6,7>: Cost 3 vext3 <4,u,5,1>, <5,6,7,0> + 2713931883U, // <1,5,6,u>: Cost 3 vext3 <4,u,5,1>, <5,6,u,0> + 2557198438U, // <1,5,7,0>: Cost 3 vext1 <1,1,5,7>, LHS + 2557199156U, // <1,5,7,1>: Cost 3 vext1 <1,1,5,7>, <1,1,1,1> + 2569143974U, // <1,5,7,2>: Cost 3 vext1 <3,1,5,7>, <2,3,0,1> + 2569144592U, // <1,5,7,3>: Cost 3 vext1 <3,1,5,7>, <3,1,5,7> + 2557201718U, // <1,5,7,4>: Cost 3 vext1 <1,1,5,7>, RHS + 2713931944U, // <1,5,7,5>: Cost 3 vext3 <4,u,5,1>, <5,7,5,7> + 3787673770U, // <1,5,7,6>: Cost 4 vext3 <4,u,5,1>, <5,7,6,0> + 2719387828U, // <1,5,7,7>: Cost 3 vext3 <5,7,7,1>, <5,7,7,1> + 2557204270U, // <1,5,7,u>: Cost 3 vext1 <1,1,5,7>, LHS + 2620020435U, // <1,5,u,0>: Cost 3 vext2 <0,4,1,5>, + 1546278702U, // <1,5,u,1>: Cost 2 vext2 <0,4,1,5>, LHS + 2620020616U, // <1,5,u,2>: Cost 3 vext2 <0,4,1,5>, + 2620020668U, // <1,5,u,3>: Cost 3 vext2 <0,4,1,5>, 1594054682U, // <1,5,u,4>: Cost 2 vext2 , - 1594054810U, // <1,5,u,5>: Cost 2 vext2 , RHS - 2667796656U, // <1,5,u,6>: Cost 3 vext2 , - 1973862507U, // <1,5,u,7>: Cost 2 vtrnl RHS, LHS - 1973870699U, // <1,5,u,u>: Cost 2 vtrnl RHS, LHS - 2620022794U, // <1,6,0,0>: Cost 3 vext2 <0,4,1,6>, <0,0,1,1> - 2659172454U, // <1,6,0,1>: Cost 3 vext2 <7,0,1,6>, LHS - 2720346409U, // <1,6,0,2>: Cost 3 vext3 <6,0,2,1>, <6,0,2,1> - 3325055362U, // <1,6,0,3>: Cost 4 vrev <6,1,3,0> - 2620023123U, // <1,6,0,4>: Cost 3 vext2 <0,4,1,6>, <0,4,1,6> - 3798585674U, // <1,6,0,5>: Cost 4 vext3 <6,7,0,1>, <6,0,5,7> + 1546279066U, // <1,5,u,5>: Cost 2 vext2 <0,4,1,5>, RHS + 2620020944U, // <1,5,u,6>: Cost 3 vext2 <0,4,1,5>, + 2014145846U, // <1,5,u,7>: Cost 2 vtrnr LHS, RHS + 2014145847U, // <1,5,u,u>: Cost 2 vtrnr LHS, RHS + 3692437504U, // <1,6,0,0>: Cost 4 vext2 <0,2,1,6>, <0,0,0,0> + 2618695782U, // <1,6,0,1>: Cost 3 vext2 <0,2,1,6>, LHS + 2618695857U, // <1,6,0,2>: Cost 3 vext2 <0,2,1,6>, <0,2,1,6> + 3794161970U, // <1,6,0,3>: Cost 4 vext3 <6,0,3,1>, <6,0,3,1> + 2620023122U, // <1,6,0,4>: Cost 3 vext2 <0,4,1,6>, <0,4,1,5> + 2620686756U, // <1,6,0,5>: Cost 3 vext2 <0,5,1,6>, <0,5,1,6> 2621350389U, // <1,6,0,6>: Cost 3 vext2 <0,6,1,6>, <0,6,1,6> - 2720715094U, // <1,6,0,7>: Cost 3 vext3 <6,0,7,1>, <6,0,7,1> - 2720788831U, // <1,6,0,u>: Cost 3 vext3 <6,0,u,1>, <6,0,u,1> - 2575138918U, // <1,6,1,0>: Cost 3 vext1 <4,1,6,1>, LHS - 2575139636U, // <1,6,1,1>: Cost 3 vext1 <4,1,6,1>, <1,1,1,1> - 3764818300U, // <1,6,1,2>: Cost 4 vext3 <1,1,1,1>, <6,1,2,3> - 3648882838U, // <1,6,1,3>: Cost 4 vext1 <4,1,6,1>, <3,0,1,2> - 2575141868U, // <1,6,1,4>: Cost 3 vext1 <4,1,6,1>, <4,1,6,1> - 3700401277U, // <1,6,1,5>: Cost 4 vext2 <1,5,1,6>, <1,5,1,6> - 3648885159U, // <1,6,1,6>: Cost 4 vext1 <4,1,6,1>, <6,1,7,1> - 2913386506U, // <1,6,1,7>: Cost 3 vzipl RHS, <0,0,1,1> - 2575144750U, // <1,6,1,u>: Cost 3 vext1 <4,1,6,1>, LHS + 4028599606U, // <1,6,0,7>: Cost 4 vzipr <0,3,1,0>, RHS + 2618696349U, // <1,6,0,u>: Cost 3 vext2 <0,2,1,6>, LHS + 3692438262U, // <1,6,1,0>: Cost 4 vext2 <0,2,1,6>, <1,0,3,2> + 2625995572U, // <1,6,1,1>: Cost 3 vext2 <1,4,1,6>, <1,1,1,1> + 3692438422U, // <1,6,1,2>: Cost 4 vext2 <0,2,1,6>, <1,2,3,0> + 3692438488U, // <1,6,1,3>: Cost 4 vext2 <0,2,1,6>, <1,3,1,3> + 2625995820U, // <1,6,1,4>: Cost 3 vext2 <1,4,1,6>, <1,4,1,6> + 3692438672U, // <1,6,1,5>: Cost 4 vext2 <0,2,1,6>, <1,5,3,7> + 3692438720U, // <1,6,1,6>: Cost 4 vext2 <0,2,1,6>, <1,6,0,1> + 2958183734U, // <1,6,1,7>: Cost 3 vzipr <0,u,1,1>, RHS + 2958183735U, // <1,6,1,u>: Cost 3 vzipr <0,u,1,1>, RHS 2721526201U, // <1,6,2,0>: Cost 3 vext3 <6,2,0,1>, <6,2,0,1> - 3630973794U, // <1,6,2,1>: Cost 4 vext1 <1,1,6,2>, <1,1,6,2> - 3764818381U, // <1,6,2,2>: Cost 4 vext3 <1,1,1,1>, <6,2,2,3> - 3709028006U, // <1,6,2,3>: Cost 4 vext2 <3,0,1,6>, <2,3,0,1> - 3630976310U, // <1,6,2,4>: Cost 4 vext1 <1,1,6,2>, RHS - 3654864582U, // <1,6,2,5>: Cost 4 vext1 <5,1,6,2>, <5,1,6,2> - 3630977530U, // <1,6,2,6>: Cost 4 vext1 <1,1,6,2>, <6,2,7,3> - 2691076602U, // <1,6,2,7>: Cost 3 vext3 <1,1,1,1>, <6,2,7,3> - 2691076611U, // <1,6,2,u>: Cost 3 vext3 <1,1,1,1>, <6,2,u,3> - 2575155302U, // <1,6,3,0>: Cost 3 vext1 <4,1,6,3>, LHS - 3636954057U, // <1,6,3,1>: Cost 4 vext1 <2,1,6,3>, <1,2,u,6> - 3047784550U, // <1,6,3,2>: Cost 3 vtrnl <4,6,0,2>, LHS - 2575157762U, // <1,6,3,3>: Cost 3 vext1 <4,1,6,3>, <3,4,5,6> - 2575158254U, // <1,6,3,4>: Cost 3 vext1 <4,1,6,3>, <4,1,6,3> - 3648900816U, // <1,6,3,5>: Cost 4 vext1 <4,1,6,3>, <5,1,7,3> - 3048112230U, // <1,6,3,6>: Cost 3 vtrnl <4,6,4,6>, LHS - 3060285542U, // <1,6,3,7>: Cost 3 vtrnl <6,6,7,7>, LHS - 2575161134U, // <1,6,3,u>: Cost 3 vext1 <4,1,6,3>, LHS - 3782365791U, // <1,6,4,0>: Cost 4 vext3 <4,0,5,1>, <6,4,0,5> - 3699739628U, // <1,6,4,1>: Cost 4 vext2 <1,4,1,6>, <4,1,6,1> - 3794088561U, // <1,6,4,2>: Cost 4 vext3 <6,0,2,1>, <6,4,2,5> + 3692439097U, // <1,6,2,1>: Cost 4 vext2 <0,2,1,6>, <2,1,6,0> + 3692439144U, // <1,6,2,2>: Cost 4 vext2 <0,2,1,6>, <2,2,2,2> + 3692439206U, // <1,6,2,3>: Cost 4 vext2 <0,2,1,6>, <2,3,0,1> + 3636948278U, // <1,6,2,4>: Cost 4 vext1 <2,1,6,2>, RHS + 3787674092U, // <1,6,2,5>: Cost 4 vext3 <4,u,5,1>, <6,2,5,7> + 2618697658U, // <1,6,2,6>: Cost 3 vext2 <0,2,1,6>, <2,6,3,7> + 2970799414U, // <1,6,2,7>: Cost 3 vzipr <3,0,1,2>, RHS + 2970799415U, // <1,6,2,u>: Cost 3 vzipr <3,0,1,2>, RHS + 2563211366U, // <1,6,3,0>: Cost 3 vext1 <2,1,6,3>, LHS + 3699738854U, // <1,6,3,1>: Cost 4 vext2 <1,4,1,6>, <3,1,1,1> + 2563212860U, // <1,6,3,2>: Cost 3 vext1 <2,1,6,3>, <2,1,6,3> + 3692439964U, // <1,6,3,3>: Cost 4 vext2 <0,2,1,6>, <3,3,3,3> + 2563214646U, // <1,6,3,4>: Cost 3 vext1 <2,1,6,3>, RHS + 4191820018U, // <1,6,3,5>: Cost 4 vtrnr <5,1,7,3>, + 2587103648U, // <1,6,3,6>: Cost 3 vext1 <6,1,6,3>, <6,1,6,3> + 3087845306U, // <1,6,3,7>: Cost 3 vtrnr LHS, <2,6,3,7> + 3087845307U, // <1,6,3,u>: Cost 3 vtrnr LHS, <2,6,3,u> + 3693767570U, // <1,6,4,0>: Cost 4 vext2 <0,4,1,6>, <4,0,5,1> + 3693767650U, // <1,6,4,1>: Cost 4 vext2 <0,4,1,6>, <4,1,5,0> + 3636962877U, // <1,6,4,2>: Cost 4 vext1 <2,1,6,4>, <2,1,6,4> 3325088134U, // <1,6,4,3>: Cost 4 vrev <6,1,3,4> - 3648908271U, // <1,6,4,4>: Cost 4 vext1 <4,1,6,4>, <4,1,6,4> - 2659175734U, // <1,6,4,5>: Cost 3 vext2 <7,0,1,6>, RHS - 3786568336U, // <1,6,4,6>: Cost 4 vext3 <4,6,u,1>, <6,4,6,0> - 3772633758U, // <1,6,4,7>: Cost 4 vext3 <2,3,u,1>, <6,4,7,5> - 2659175977U, // <1,6,4,u>: Cost 3 vext2 <7,0,1,6>, RHS - 3648913510U, // <1,6,5,0>: Cost 4 vext1 <4,1,6,5>, LHS - 3648914228U, // <1,6,5,1>: Cost 4 vext1 <4,1,6,5>, <1,1,1,1> - 4064232592U, // <1,6,5,2>: Cost 4 vzipr <6,2,7,3>, <1,5,3,7> + 3693767898U, // <1,6,4,4>: Cost 4 vext2 <0,4,1,6>, <4,4,5,5> + 2618699062U, // <1,6,4,5>: Cost 3 vext2 <0,2,1,6>, RHS + 3833670966U, // <1,6,4,6>: Cost 4 vuzpl <1,3,6,7>, RHS + 4028632374U, // <1,6,4,7>: Cost 4 vzipr <0,3,1,4>, RHS + 2618699305U, // <1,6,4,u>: Cost 3 vext2 <0,2,1,6>, RHS + 3693768264U, // <1,6,5,0>: Cost 4 vext2 <0,4,1,6>, <5,0,1,2> + 3630998373U, // <1,6,5,1>: Cost 4 vext1 <1,1,6,5>, <1,1,6,5> + 3636971070U, // <1,6,5,2>: Cost 4 vext1 <2,1,6,5>, <2,1,6,5> 3642943767U, // <1,6,5,3>: Cost 4 vext1 <3,1,6,5>, <3,1,6,5> - 3648916464U, // <1,6,5,4>: Cost 4 vext1 <4,1,6,5>, <4,1,6,5> - 3724292065U, // <1,6,5,5>: Cost 4 vext2 <5,5,1,6>, <5,5,1,6> - 2668466274U, // <1,6,5,6>: Cost 3 vext2 , <5,6,7,0> - 2915377490U, // <1,6,5,7>: Cost 3 vzipl RHS, <0,4,1,5> - 2913395026U, // <1,6,5,u>: Cost 3 vzipl RHS, <0,4,1,5> + 3693768628U, // <1,6,5,4>: Cost 4 vext2 <0,4,1,6>, <5,4,5,6> + 3732918276U, // <1,6,5,5>: Cost 4 vext2 <7,0,1,6>, <5,5,5,5> + 2620690530U, // <1,6,5,6>: Cost 3 vext2 <0,5,1,6>, <5,6,7,0> + 2955562294U, // <1,6,5,7>: Cost 3 vzipr <0,4,1,5>, RHS + 2955562295U, // <1,6,5,u>: Cost 3 vzipr <0,4,1,5>, RHS 2724180733U, // <1,6,6,0>: Cost 3 vext3 <6,6,0,1>, <6,6,0,1> - 3742871965U, // <1,6,6,1>: Cost 4 vext2 , <6,1,6,0> - 3697750522U, // <1,6,6,2>: Cost 4 vext2 <1,1,1,6>, <6,2,7,3> - 3782365979U, // <1,6,6,3>: Cost 5 vext3 <4,0,5,1>, <6,6,3,4> - 3654896530U, // <1,6,6,4>: Cost 4 vext1 <5,1,6,6>, <4,0,5,1> - 3654897354U, // <1,6,6,5>: Cost 4 vext1 <5,1,6,6>, <5,1,6,6> - 2724770616U, // <1,6,6,6>: Cost 3 vext3 <6,6,u,1>, <6,6,6,6> - 2724844354U, // <1,6,6,7>: Cost 3 vext3 <6,7,0,1>, <6,6,7,7> - 2724770629U, // <1,6,6,u>: Cost 3 vext3 <6,6,u,1>, <6,6,u,1> + 3631006566U, // <1,6,6,1>: Cost 4 vext1 <1,1,6,6>, <1,1,6,6> + 3631007674U, // <1,6,6,2>: Cost 4 vext1 <1,1,6,6>, <2,6,3,7> + 3692442184U, // <1,6,6,3>: Cost 4 vext2 <0,2,1,6>, <6,3,7,0> + 3631009078U, // <1,6,6,4>: Cost 4 vext1 <1,1,6,6>, RHS + 3787674416U, // <1,6,6,5>: Cost 4 vext3 <4,u,5,1>, <6,6,5,7> + 2713932600U, // <1,6,6,6>: Cost 3 vext3 <4,u,5,1>, <6,6,6,6> + 2713932610U, // <1,6,6,7>: Cost 3 vext3 <4,u,5,1>, <6,6,7,7> + 2713932619U, // <1,6,6,u>: Cost 3 vext3 <4,u,5,1>, <6,6,u,7> 1651102542U, // <1,6,7,0>: Cost 2 vext3 <6,7,0,1>, <6,7,0,1> 2724918103U, // <1,6,7,1>: Cost 3 vext3 <6,7,1,1>, <6,7,1,1> 2698302306U, // <1,6,7,2>: Cost 3 vext3 <2,3,0,1>, <6,7,2,3> - 3786199912U, // <1,6,7,3>: Cost 4 vext3 <4,6,3,1>, <6,7,3,0> - 2724844406U, // <1,6,7,4>: Cost 3 vext3 <6,7,0,1>, <6,7,4,5> + 3642960153U, // <1,6,7,3>: Cost 4 vext1 <3,1,6,7>, <3,1,6,7> + 2713932662U, // <1,6,7,4>: Cost 3 vext3 <4,u,5,1>, <6,7,4,5> 2725213051U, // <1,6,7,5>: Cost 3 vext3 <6,7,5,1>, <6,7,5,1> 2724844426U, // <1,6,7,6>: Cost 3 vext3 <6,7,0,1>, <6,7,6,7> - 3987129551U, // <1,6,7,7>: Cost 4 vzipl RHS, <1,6,1,7> + 4035956022U, // <1,6,7,7>: Cost 4 vzipr <1,5,1,7>, RHS 1651692438U, // <1,6,7,u>: Cost 2 vext3 <6,7,u,1>, <6,7,u,1> 1651766175U, // <1,6,u,0>: Cost 2 vext3 <6,u,0,1>, <6,u,0,1> - 2725581736U, // <1,6,u,1>: Cost 3 vext3 <6,u,1,1>, <6,u,1,1> - 3047784555U, // <1,6,u,2>: Cost 3 vtrnl <4,6,0,2>, LHS - 2575198722U, // <1,6,u,3>: Cost 3 vext1 <4,1,6,u>, <3,4,5,6> - 2575199219U, // <1,6,u,4>: Cost 3 vext1 <4,1,6,u>, <4,1,6,u> - 2725876684U, // <1,6,u,5>: Cost 3 vext3 <6,u,5,1>, <6,u,5,1> - 3048112235U, // <1,6,u,6>: Cost 3 vtrnl <4,6,4,6>, LHS - 2691077088U, // <1,6,u,7>: Cost 3 vext3 <1,1,1,1>, <6,u,7,3> + 2618701614U, // <1,6,u,1>: Cost 3 vext2 <0,2,1,6>, LHS + 3135663508U, // <1,6,u,2>: Cost 3 vtrnr LHS, <4,6,u,2> + 3692443580U, // <1,6,u,3>: Cost 4 vext2 <0,2,1,6>, + 2713932743U, // <1,6,u,4>: Cost 3 vext3 <4,u,5,1>, <6,u,4,5> + 2618701978U, // <1,6,u,5>: Cost 3 vext2 <0,2,1,6>, RHS + 2622683344U, // <1,6,u,6>: Cost 3 vext2 <0,u,1,6>, + 3087886266U, // <1,6,u,7>: Cost 3 vtrnr LHS, <2,6,3,7> 1652356071U, // <1,6,u,u>: Cost 2 vext3 <6,u,u,1>, <6,u,u,1> 2726171632U, // <1,7,0,0>: Cost 3 vext3 <7,0,0,1>, <7,0,0,1> - 2638610534U, // <1,7,0,1>: Cost 3 vext2 <3,5,1,7>, LHS - 3706380452U, // <1,7,0,2>: Cost 4 vext2 <2,5,1,7>, <0,2,0,2> - 3654920752U, // <1,7,0,3>: Cost 4 vext1 <5,1,7,0>, <3,5,1,7> + 2626666598U, // <1,7,0,1>: Cost 3 vext2 <1,5,1,7>, LHS + 3695100067U, // <1,7,0,2>: Cost 4 vext2 <0,6,1,7>, <0,2,0,1> + 3707044102U, // <1,7,0,3>: Cost 4 vext2 <2,6,1,7>, <0,3,2,1> 2726466580U, // <1,7,0,4>: Cost 3 vext3 <7,0,4,1>, <7,0,4,1> 3654921933U, // <1,7,0,5>: Cost 4 vext1 <5,1,7,0>, <5,1,7,0> 2621358582U, // <1,7,0,6>: Cost 3 vext2 <0,6,1,7>, <0,6,1,7> 2622022215U, // <1,7,0,7>: Cost 3 vext2 <0,7,1,7>, <0,7,1,7> - 2638611101U, // <1,7,0,u>: Cost 3 vext2 <3,5,1,7>, LHS - 2581184614U, // <1,7,1,0>: Cost 3 vext1 <5,1,7,1>, LHS - 2581185332U, // <1,7,1,1>: Cost 3 vext1 <5,1,7,1>, <1,1,1,1> - 3712353174U, // <1,7,1,2>: Cost 4 vext2 <3,5,1,7>, <1,2,3,0> - 3654928534U, // <1,7,1,3>: Cost 4 vext1 <5,1,7,1>, <3,0,1,2> - 2581187894U, // <1,7,1,4>: Cost 3 vext1 <5,1,7,1>, RHS - 2581188302U, // <1,7,1,5>: Cost 3 vext1 <5,1,7,1>, <5,1,7,1> - 2587160999U, // <1,7,1,6>: Cost 3 vext1 <6,1,7,1>, <6,1,7,1> - 2593133562U, // <1,7,1,7>: Cost 3 vext1 <7,1,7,1>, <7,0,1,2> - 2581190446U, // <1,7,1,u>: Cost 3 vext1 <5,1,7,1>, LHS + 2626667165U, // <1,7,0,u>: Cost 3 vext2 <1,5,1,7>, LHS + 2593128550U, // <1,7,1,0>: Cost 3 vext1 <7,1,7,1>, LHS + 2626667316U, // <1,7,1,1>: Cost 3 vext2 <1,5,1,7>, <1,1,1,1> + 3700409238U, // <1,7,1,2>: Cost 4 vext2 <1,5,1,7>, <1,2,3,0> + 2257294428U, // <1,7,1,3>: Cost 3 vrev <7,1,3,1> + 2593131830U, // <1,7,1,4>: Cost 3 vext1 <7,1,7,1>, RHS + 2626667646U, // <1,7,1,5>: Cost 3 vext2 <1,5,1,7>, <1,5,1,7> + 2627331279U, // <1,7,1,6>: Cost 3 vext2 <1,6,1,7>, <1,6,1,7> + 2593133696U, // <1,7,1,7>: Cost 3 vext1 <7,1,7,1>, <7,1,7,1> + 2628658545U, // <1,7,1,u>: Cost 3 vext2 <1,u,1,7>, <1,u,1,7> 2587164774U, // <1,7,2,0>: Cost 3 vext1 <6,1,7,2>, LHS - 3654935340U, // <1,7,2,1>: Cost 4 vext1 <5,1,7,2>, <1,1,0,2> - 3712353896U, // <1,7,2,2>: Cost 4 vext2 <3,5,1,7>, <2,2,2,2> - 2587166870U, // <1,7,2,3>: Cost 3 vext1 <6,1,7,2>, <3,0,1,2> + 3701073445U, // <1,7,2,1>: Cost 4 vext2 <1,6,1,7>, <2,1,3,7> + 3700409960U, // <1,7,2,2>: Cost 4 vext2 <1,5,1,7>, <2,2,2,2> + 2638612134U, // <1,7,2,3>: Cost 3 vext2 <3,5,1,7>, <2,3,0,1> 2587168054U, // <1,7,2,4>: Cost 3 vext1 <6,1,7,2>, RHS 3706382167U, // <1,7,2,5>: Cost 4 vext2 <2,5,1,7>, <2,5,1,7> 2587169192U, // <1,7,2,6>: Cost 3 vext1 <6,1,7,2>, <6,1,7,2> - 3993176214U, // <1,7,2,7>: Cost 4 vzipl <5,5,7,7>, <3,0,1,2> + 3660911610U, // <1,7,2,7>: Cost 4 vext1 <6,1,7,2>, <7,0,1,2> 2587170606U, // <1,7,2,u>: Cost 3 vext1 <6,1,7,2>, LHS 1507459174U, // <1,7,3,0>: Cost 2 vext1 <5,1,7,3>, LHS - 2581201654U, // <1,7,3,1>: Cost 3 vext1 <5,1,7,3>, <1,0,3,2> + 2569257984U, // <1,7,3,1>: Cost 3 vext1 <3,1,7,3>, <1,3,5,7> 2581202536U, // <1,7,3,2>: Cost 3 vext1 <5,1,7,3>, <2,2,2,2> - 2581203094U, // <1,7,3,3>: Cost 3 vext1 <5,1,7,3>, <3,0,1,2> + 2569259294U, // <1,7,3,3>: Cost 3 vext1 <3,1,7,3>, <3,1,7,3> 1507462454U, // <1,7,3,4>: Cost 2 vext1 <5,1,7,3>, RHS 1507462864U, // <1,7,3,5>: Cost 2 vext1 <5,1,7,3>, <5,1,7,3> 2581205498U, // <1,7,3,6>: Cost 3 vext1 <5,1,7,3>, <6,2,7,3> 2581206010U, // <1,7,3,7>: Cost 3 vext1 <5,1,7,3>, <7,0,1,2> 1507465006U, // <1,7,3,u>: Cost 2 vext1 <5,1,7,3>, LHS - 2651220882U, // <1,7,4,0>: Cost 3 vext2 <5,6,1,7>, <4,0,5,1> - 3330913357U, // <1,7,4,1>: Cost 4 vrev <7,1,1,4> + 2728826164U, // <1,7,4,0>: Cost 3 vext3 <7,4,0,1>, <7,4,0,1> + 3654951732U, // <1,7,4,1>: Cost 4 vext1 <5,1,7,4>, <1,1,1,1> 3330987094U, // <1,7,4,2>: Cost 4 vrev <7,1,2,4> - 3654953520U, // <1,7,4,3>: Cost 4 vext1 <5,1,7,4>, <3,5,1,7> - 3654954294U, // <1,7,4,4>: Cost 4 vext1 <5,1,7,4>, RHS - 2638613814U, // <1,7,4,5>: Cost 3 vext2 <3,5,1,7>, RHS - 3712355660U, // <1,7,4,6>: Cost 4 vext2 <3,5,1,7>, <4,6,0,2> - 3798586743U, // <1,7,4,7>: Cost 4 vext3 <6,7,0,1>, <7,4,7,5> - 2638614057U, // <1,7,4,u>: Cost 3 vext2 <3,5,1,7>, RHS - 2599133286U, // <1,7,5,0>: Cost 3 vext1 , LHS - 2638614224U, // <1,7,5,1>: Cost 3 vext2 <3,5,1,7>, <5,1,7,3> - 3724963563U, // <1,7,5,2>: Cost 4 vext2 <5,6,1,7>, <5,2,1,3> - 3990487378U, // <1,7,5,3>: Cost 4 vzipl <5,1,7,3>, <0,4,1,5> - 2599136566U, // <1,7,5,4>: Cost 3 vext1 , RHS - 3654962898U, // <1,7,5,5>: Cost 4 vext1 <5,1,7,5>, <5,1,7,5> + 3331060831U, // <1,7,4,3>: Cost 4 vrev <7,1,3,4> + 3787674971U, // <1,7,4,4>: Cost 4 vext3 <4,u,5,1>, <7,4,4,4> + 2626669878U, // <1,7,4,5>: Cost 3 vext2 <1,5,1,7>, RHS + 3785979241U, // <1,7,4,6>: Cost 4 vext3 <4,6,0,1>, <7,4,6,0> + 3787085176U, // <1,7,4,7>: Cost 4 vext3 <4,7,6,1>, <7,4,7,6> + 2626670121U, // <1,7,4,u>: Cost 3 vext2 <1,5,1,7>, RHS + 2569273446U, // <1,7,5,0>: Cost 3 vext1 <3,1,7,5>, LHS + 2569274368U, // <1,7,5,1>: Cost 3 vext1 <3,1,7,5>, <1,3,5,7> + 3643016808U, // <1,7,5,2>: Cost 4 vext1 <3,1,7,5>, <2,2,2,2> + 2569275680U, // <1,7,5,3>: Cost 3 vext1 <3,1,7,5>, <3,1,7,5> + 2569276726U, // <1,7,5,4>: Cost 3 vext1 <3,1,7,5>, RHS + 4102034790U, // <1,7,5,5>: Cost 4 vtrnl <1,3,5,7>, <7,4,5,6> 2651222067U, // <1,7,5,6>: Cost 3 vext2 <5,6,1,7>, <5,6,1,7> - 3712356470U, // <1,7,5,7>: Cost 4 vext2 <3,5,1,7>, <5,7,0,2> - 2638614224U, // <1,7,5,u>: Cost 3 vext2 <3,5,1,7>, <5,1,7,3> + 3899378998U, // <1,7,5,7>: Cost 4 vuzpr <1,1,5,7>, RHS + 2569279278U, // <1,7,5,u>: Cost 3 vext1 <3,1,7,5>, LHS 2730153430U, // <1,7,6,0>: Cost 3 vext3 <7,6,0,1>, <7,6,0,1> 2724845022U, // <1,7,6,1>: Cost 3 vext3 <6,7,0,1>, <7,6,1,0> - 3712356858U, // <1,7,6,2>: Cost 4 vext2 <3,5,1,7>, <6,2,7,3> - 3772044786U, // <1,7,6,3>: Cost 4 vext3 <2,3,0,1>, <7,6,3,2> - 3798586878U, // <1,7,6,4>: Cost 4 vext3 <6,7,0,1>, <7,6,4,5> - 3724964587U, // <1,7,6,5>: Cost 4 vext2 <5,6,1,7>, <6,5,7,1> - 3724964664U, // <1,7,6,6>: Cost 4 vext2 <5,6,1,7>, <6,6,6,6> + 3643025338U, // <1,7,6,2>: Cost 4 vext1 <3,1,7,6>, <2,6,3,7> + 3643025697U, // <1,7,6,3>: Cost 4 vext1 <3,1,7,6>, <3,1,7,6> + 3643026742U, // <1,7,6,4>: Cost 4 vext1 <3,1,7,6>, RHS + 3654971091U, // <1,7,6,5>: Cost 4 vext1 <5,1,7,6>, <5,1,7,6> + 3787675153U, // <1,7,6,6>: Cost 4 vext3 <4,u,5,1>, <7,6,6,6> 2724845076U, // <1,7,6,7>: Cost 3 vext3 <6,7,0,1>, <7,6,7,0> 2725508637U, // <1,7,6,u>: Cost 3 vext3 <6,u,0,1>, <7,6,u,0> 2730817063U, // <1,7,7,0>: Cost 3 vext3 <7,7,0,1>, <7,7,0,1> - 4134125710U, // <1,7,7,1>: Cost 4 vtrnl <6,7,0,1>, <0,1,6,7> - 3712357556U, // <1,7,7,2>: Cost 4 vext2 <3,5,1,7>, <7,2,3,u> - 3990489648U, // <1,7,7,3>: Cost 4 vzipl <5,1,7,3>, <3,5,1,7> - 3724965176U, // <1,7,7,4>: Cost 4 vext2 <5,6,1,7>, <7,4,0,5> + 3631088436U, // <1,7,7,1>: Cost 4 vext1 <1,1,7,7>, <1,1,1,1> + 3660949158U, // <1,7,7,2>: Cost 4 vext1 <6,1,7,7>, <2,3,0,1> + 3801904705U, // <1,7,7,3>: Cost 4 vext3 <7,3,0,1>, <7,7,3,0> + 3631090998U, // <1,7,7,4>: Cost 4 vext1 <1,1,7,7>, RHS 2662503828U, // <1,7,7,5>: Cost 3 vext2 <7,5,1,7>, <7,5,1,7> 3660951981U, // <1,7,7,6>: Cost 4 vext1 <6,1,7,7>, <6,1,7,7> - 2724845164U, // <1,7,7,7>: Cost 3 vext3 <6,7,0,1>, <7,7,7,7> + 2713933420U, // <1,7,7,7>: Cost 3 vext3 <4,u,5,1>, <7,7,7,7> 2731406959U, // <1,7,7,u>: Cost 3 vext3 <7,7,u,1>, <7,7,u,1> 1507500134U, // <1,7,u,0>: Cost 2 vext1 <5,1,7,u>, LHS - 2638616366U, // <1,7,u,1>: Cost 3 vext2 <3,5,1,7>, LHS + 2626672430U, // <1,7,u,1>: Cost 3 vext2 <1,5,1,7>, LHS 2581243496U, // <1,7,u,2>: Cost 3 vext1 <5,1,7,u>, <2,2,2,2> - 2581244054U, // <1,7,u,3>: Cost 3 vext1 <5,1,7,u>, <3,0,1,2> + 2569300259U, // <1,7,u,3>: Cost 3 vext1 <3,1,7,u>, <3,1,7,u> 1507503414U, // <1,7,u,4>: Cost 2 vext1 <5,1,7,u>, RHS 1507503829U, // <1,7,u,5>: Cost 2 vext1 <5,1,7,u>, <5,1,7,u> 2581246458U, // <1,7,u,6>: Cost 3 vext1 <5,1,7,u>, <6,2,7,3> 2581246970U, // <1,7,u,7>: Cost 3 vext1 <5,1,7,u>, <7,0,1,2> 1507505966U, // <1,7,u,u>: Cost 2 vext1 <5,1,7,u>, LHS 1543643153U, // <1,u,0,0>: Cost 2 vext2 <0,0,1,u>, <0,0,1,u> - 1561559142U, // <1,u,0,1>: Cost 2 vext2 <3,0,1,u>, LHS - 2819449635U, // <1,u,0,2>: Cost 3 vuzpr LHS, <1,0,u,2> - 2691077861U, // <1,u,0,3>: Cost 3 vext3 <1,1,1,1>, + 1546297446U, // <1,u,0,1>: Cost 2 vext2 <0,4,1,u>, LHS + 2819448852U, // <1,u,0,2>: Cost 3 vuzpr LHS, <0,0,2,2> + 2619375876U, // <1,u,0,3>: Cost 3 vext2 <0,3,1,u>, <0,3,1,u> 1546297685U, // <1,u,0,4>: Cost 2 vext2 <0,4,1,u>, <0,4,1,u> 1658771190U, // <1,u,0,5>: Cost 2 vext3 , - 2691077888U, // <1,u,0,6>: Cost 3 vext3 <1,1,1,1>, + 2736789248U, // <1,u,0,6>: Cost 3 vext3 , 2659189376U, // <1,u,0,7>: Cost 3 vext2 <7,0,1,u>, <0,7,u,1> - 1561559709U, // <1,u,0,u>: Cost 2 vext2 <3,0,1,u>, LHS + 1546298013U, // <1,u,0,u>: Cost 2 vext2 <0,4,1,u>, LHS 1483112550U, // <1,u,1,0>: Cost 2 vext1 <1,1,1,1>, LHS 202162278U, // <1,u,1,1>: Cost 1 vdup1 LHS - 1617336110U, // <1,u,1,2>: Cost 2 vext3 <1,1,1,1>, LHS - 2886959114U, // <1,u,1,3>: Cost 3 vzipl LHS, <0,0,1,1> + 1616009006U, // <1,u,1,2>: Cost 2 vext3 <0,u,1,1>, LHS + 1745707110U, // <1,u,1,3>: Cost 2 vuzpr LHS, LHS 1483115830U, // <1,u,1,4>: Cost 2 vext1 <1,1,1,1>, RHS - 2581262039U, // <1,u,1,5>: Cost 3 vext1 <5,1,u,1>, <5,1,u,1> - 2587234736U, // <1,u,1,6>: Cost 3 vext1 <6,1,u,1>, <6,1,u,1> - 2691077979U, // <1,u,1,7>: Cost 3 vext3 <1,1,1,1>, + 2620040336U, // <1,u,1,5>: Cost 3 vext2 <0,4,1,u>, <1,5,3,7> + 3026622618U, // <1,u,1,6>: Cost 3 vtrnl <1,1,1,1>, RHS + 2958183752U, // <1,u,1,7>: Cost 3 vzipr <0,u,1,1>, RHS 202162278U, // <1,u,1,u>: Cost 1 vdup1 LHS - 2691077996U, // <1,u,2,0>: Cost 3 vext3 <1,1,1,1>, - 2698893174U, // <1,u,2,1>: Cost 3 vext3 <2,3,u,1>, - 2635302504U, // <1,u,2,2>: Cost 3 vext2 <3,0,1,u>, <2,2,2,2> - 2886961302U, // <1,u,2,3>: Cost 3 vzipl LHS, <3,0,1,2> - 2575297535U, // <1,u,2,4>: Cost 3 vext1 <4,1,u,2>, <4,1,u,2> - 3004384150U, // <1,u,2,5>: Cost 3 vzipr RHS, <1,2,3,0> - 2587242929U, // <1,u,2,6>: Cost 3 vext1 <6,1,u,2>, <6,1,u,2> - 2691078060U, // <1,u,2,7>: Cost 3 vext3 <1,1,1,1>, - 2887002262U, // <1,u,2,u>: Cost 3 vzipl LHS, <3,0,1,2> + 2819449750U, // <1,u,2,0>: Cost 3 vuzpr LHS, <1,2,3,0> + 2893207342U, // <1,u,2,1>: Cost 3 vzipl <1,2,3,0>, LHS + 2819448996U, // <1,u,2,2>: Cost 3 vuzpr LHS, <0,2,0,2> + 2819450482U, // <1,u,2,3>: Cost 3 vuzpr LHS, <2,2,3,3> + 2819449754U, // <1,u,2,4>: Cost 3 vuzpr LHS, <1,2,3,4> + 2893207706U, // <1,u,2,5>: Cost 3 vzipl <1,2,3,0>, RHS + 2819449036U, // <1,u,2,6>: Cost 3 vuzpr LHS, <0,2,4,6> + 2970799432U, // <1,u,2,7>: Cost 3 vzipr <3,0,1,2>, RHS + 2819449002U, // <1,u,2,u>: Cost 3 vuzpr LHS, <0,2,0,u> 403931292U, // <1,u,3,0>: Cost 1 vext1 LHS, LHS 1477673718U, // <1,u,3,1>: Cost 2 vext1 LHS, <1,0,3,2> 115726126U, // <1,u,3,2>: Cost 1 vrev LHS - 1477675158U, // <1,u,3,3>: Cost 2 vext1 LHS, <3,0,1,2> + 2014102173U, // <1,u,3,3>: Cost 2 vtrnr LHS, LHS 403934518U, // <1,u,3,4>: Cost 1 vext1 LHS, RHS - 1477676752U, // <1,u,3,5>: Cost 2 vext1 LHS, <5,1,7,3> - 1477677562U, // <1,u,3,6>: Cost 2 vext1 LHS, <6,2,7,3> - 1975853158U, // <1,u,3,7>: Cost 2 vtrnl RHS, LHS + 1507536601U, // <1,u,3,5>: Cost 2 vext1 <5,1,u,3>, <5,1,u,3> + 1525453306U, // <1,u,3,6>: Cost 2 vext1 LHS, <6,2,7,3> + 2014105129U, // <1,u,3,7>: Cost 2 vtrnr LHS, RHS 403937070U, // <1,u,3,u>: Cost 1 vext1 LHS, LHS - 2635303826U, // <1,u,4,0>: Cost 3 vext2 <3,0,1,u>, <4,0,5,1> - 2724845594U, // <1,u,4,1>: Cost 3 vext3 <6,7,0,1>, - 2724845604U, // <1,u,4,2>: Cost 3 vext3 <6,7,0,1>, - 2599201572U, // <1,u,4,3>: Cost 3 vext1 , <3,u,1,u> - 2659192016U, // <1,u,4,4>: Cost 3 vext2 <7,0,1,u>, <4,4,4,4> - 1561562422U, // <1,u,4,5>: Cost 2 vext2 <3,0,1,u>, RHS - 2635304268U, // <1,u,4,6>: Cost 3 vext2 <3,0,1,u>, <4,6,0,2> + 2620042157U, // <1,u,4,0>: Cost 3 vext2 <0,4,1,u>, <4,0,u,1> + 2620042237U, // <1,u,4,1>: Cost 3 vext2 <0,4,1,u>, <4,1,u,0> + 2263217967U, // <1,u,4,2>: Cost 3 vrev + 2569341224U, // <1,u,4,3>: Cost 3 vext1 <3,1,u,4>, <3,1,u,4> + 2569342262U, // <1,u,4,4>: Cost 3 vext1 <3,1,u,4>, RHS + 1546300726U, // <1,u,4,5>: Cost 2 vext2 <0,4,1,u>, RHS + 2819449180U, // <1,u,4,6>: Cost 3 vuzpr LHS, <0,4,2,6> 2724845649U, // <1,u,4,7>: Cost 3 vext3 <6,7,0,1>, - 1561562665U, // <1,u,4,u>: Cost 2 vext2 <3,0,1,u>, RHS - 2557403238U, // <1,u,5,0>: Cost 3 vext1 <1,1,u,5>, LHS - 2557404023U, // <1,u,5,1>: Cost 3 vext1 <1,1,u,5>, <1,1,u,5> - 2648575728U, // <1,u,5,2>: Cost 3 vext2 <5,2,1,u>, <5,2,1,u> - 2724845695U, // <1,u,5,3>: Cost 3 vext3 <6,7,0,1>, - 2557406518U, // <1,u,5,4>: Cost 3 vext1 <1,1,u,5>, RHS - 2581294811U, // <1,u,5,5>: Cost 3 vext1 <5,1,u,5>, <5,1,u,5> - 1617336474U, // <1,u,5,6>: Cost 2 vext3 <1,1,1,1>, RHS - 2913534290U, // <1,u,5,7>: Cost 3 vzipl RHS, <0,4,1,5> - 1617336492U, // <1,u,5,u>: Cost 2 vext3 <1,1,1,1>, RHS - 2691078320U, // <1,u,6,0>: Cost 3 vext3 <1,1,1,1>, + 1546300969U, // <1,u,4,u>: Cost 2 vext2 <0,4,1,u>, RHS + 2551431270U, // <1,u,5,0>: Cost 3 vext1 <0,1,u,5>, LHS + 2551432192U, // <1,u,5,1>: Cost 3 vext1 <0,1,u,5>, <1,3,5,7> + 3028293422U, // <1,u,5,2>: Cost 3 vtrnl <1,3,5,7>, LHS + 2955559068U, // <1,u,5,3>: Cost 3 vzipr <0,4,1,5>, LHS + 2551434550U, // <1,u,5,4>: Cost 3 vext1 <0,1,u,5>, RHS + 2895255706U, // <1,u,5,5>: Cost 3 vzipl <1,5,3,7>, RHS + 1616009370U, // <1,u,5,6>: Cost 2 vext3 <0,u,1,1>, RHS + 1745710390U, // <1,u,5,7>: Cost 2 vuzpr LHS, RHS + 1745710391U, // <1,u,5,u>: Cost 2 vuzpr LHS, RHS + 2653221159U, // <1,u,6,0>: Cost 3 vext2 <6,0,1,u>, <6,0,1,u> 2725509303U, // <1,u,6,1>: Cost 3 vext3 <6,u,0,1>, - 2635305466U, // <1,u,6,2>: Cost 3 vext2 <3,0,1,u>, <6,2,7,3> - 2724845776U, // <1,u,6,3>: Cost 3 vext3 <6,7,0,1>, - 2724845784U, // <1,u,6,4>: Cost 3 vext3 <6,7,0,1>, - 3714355952U, // <1,u,6,5>: Cost 4 vext2 <3,u,1,u>, <6,5,7,6> - 2659193656U, // <1,u,6,6>: Cost 3 vext2 <7,0,1,u>, <6,6,6,6> - 2724845805U, // <1,u,6,7>: Cost 3 vext3 <6,7,0,1>, - 2635305952U, // <1,u,6,u>: Cost 3 vext2 <3,0,1,u>, <6,u,7,3> + 2659193338U, // <1,u,6,2>: Cost 3 vext2 <7,0,1,u>, <6,2,7,3> + 2689751248U, // <1,u,6,3>: Cost 3 vext3 <0,u,1,1>, + 2867228774U, // <1,u,6,4>: Cost 3 vuzpr LHS, <5,6,7,4> + 3764820194U, // <1,u,6,5>: Cost 4 vext3 <1,1,1,1>, + 2657202957U, // <1,u,6,6>: Cost 3 vext2 <6,6,1,u>, <6,6,1,u> + 2819450810U, // <1,u,6,7>: Cost 3 vuzpr LHS, <2,6,3,7> + 2819450811U, // <1,u,6,u>: Cost 3 vuzpr LHS, <2,6,3,u> 1585452032U, // <1,u,7,0>: Cost 2 vext2 <7,0,1,u>, <7,0,1,u> - 2659857489U, // <1,u,7,1>: Cost 3 vext2 <7,1,1,u>, <7,1,1,u> - 2263242546U, // <1,u,7,2>: Cost 3 vrev - 2635257059U, // <1,u,7,3>: Cost 3 vext2 <3,0,1,2>, <7,3,0,1> - 2724845864U, // <1,u,7,4>: Cost 3 vext3 <6,7,0,1>, + 2557420340U, // <1,u,7,1>: Cost 3 vext1 <1,1,u,7>, <1,1,1,1> + 2569365158U, // <1,u,7,2>: Cost 3 vext1 <3,1,u,7>, <2,3,0,1> + 2569365803U, // <1,u,7,3>: Cost 3 vext1 <3,1,u,7>, <3,1,u,7> + 2557422902U, // <1,u,7,4>: Cost 3 vext1 <1,1,u,7>, RHS 2662512021U, // <1,u,7,5>: Cost 3 vext2 <7,5,1,u>, <7,5,1,u> 2724845884U, // <1,u,7,6>: Cost 3 vext3 <6,7,0,1>, 2659194476U, // <1,u,7,7>: Cost 3 vext2 <7,0,1,u>, <7,7,7,7> @@ -1473,1102 +1473,1102 @@ 403972257U, // <1,u,u,0>: Cost 1 vext1 LHS, LHS 202162278U, // <1,u,u,1>: Cost 1 vdup1 LHS 115767091U, // <1,u,u,2>: Cost 1 vrev LHS - 1477716118U, // <1,u,u,3>: Cost 2 vext1 LHS, <3,0,1,2> + 1745707677U, // <1,u,u,3>: Cost 2 vuzpr LHS, LHS 403975478U, // <1,u,u,4>: Cost 1 vext1 LHS, RHS - 1477717712U, // <1,u,u,5>: Cost 2 vext1 LHS, <5,1,7,3> - 1477718522U, // <1,u,u,6>: Cost 2 vext1 LHS, <6,2,7,3> - 1975853163U, // <1,u,u,7>: Cost 2 vtrnl RHS, LHS + 1546303642U, // <1,u,u,5>: Cost 2 vext2 <0,4,1,u>, RHS + 1616009613U, // <1,u,u,6>: Cost 2 vext3 <0,u,1,1>, RHS + 1745710633U, // <1,u,u,7>: Cost 2 vuzpr LHS, RHS 403978030U, // <1,u,u,u>: Cost 1 vext1 LHS, LHS - 2685698048U, // <2,0,0,0>: Cost 3 vext3 <0,2,0,2>, <0,0,0,0> + 2551463936U, // <2,0,0,0>: Cost 3 vext1 <0,2,0,0>, <0,0,0,0> 2685698058U, // <2,0,0,1>: Cost 3 vext3 <0,2,0,2>, <0,0,1,1> 1610776596U, // <2,0,0,2>: Cost 2 vext3 <0,0,2,2>, <0,0,2,2> 2619384069U, // <2,0,0,3>: Cost 3 vext2 <0,3,2,0>, <0,3,2,0> - 2563411254U, // <2,0,0,4>: Cost 3 vext1 <2,2,0,0>, RHS - 3637153488U, // <2,0,0,5>: Cost 4 vext1 <2,2,0,0>, <5,1,7,3> + 2551467318U, // <2,0,0,4>: Cost 3 vext1 <0,2,0,0>, RHS + 3899836596U, // <2,0,0,5>: Cost 4 vuzpr <1,2,3,0>, <3,0,4,5> 2621374968U, // <2,0,0,6>: Cost 3 vext2 <0,6,2,0>, <0,6,2,0> - 3732939321U, // <2,0,0,7>: Cost 4 vext2 <7,0,2,0>, <0,7,0,2> + 4168271334U, // <2,0,0,7>: Cost 4 vtrnr <1,2,3,0>, <2,0,5,7> 1611219018U, // <2,0,0,u>: Cost 2 vext3 <0,0,u,2>, <0,0,u,2> - 2569388134U, // <2,0,1,0>: Cost 3 vext1 <3,2,0,1>, LHS - 2569388790U, // <2,0,1,1>: Cost 3 vext1 <3,2,0,1>, <1,0,3,2> + 2551472138U, // <2,0,1,0>: Cost 3 vext1 <0,2,0,1>, <0,0,1,1> + 2690564186U, // <2,0,1,1>: Cost 3 vext3 <1,0,3,2>, <0,1,1,0> 1611956326U, // <2,0,1,2>: Cost 2 vext3 <0,2,0,2>, LHS - 2569390382U, // <2,0,1,3>: Cost 3 vext1 <3,2,0,1>, <3,2,0,1> - 2569391414U, // <2,0,1,4>: Cost 3 vext1 <3,2,0,1>, RHS - 3290038480U, // <2,0,1,5>: Cost 4 vrev <0,2,5,1> + 2826092646U, // <2,0,1,3>: Cost 3 vuzpr <1,2,3,0>, LHS + 2551475510U, // <2,0,1,4>: Cost 3 vext1 <0,2,0,1>, RHS + 3692463248U, // <2,0,1,5>: Cost 4 vext2 <0,2,2,0>, <1,5,3,7> 2587308473U, // <2,0,1,6>: Cost 3 vext1 <6,2,0,1>, <6,2,0,1> 3661050874U, // <2,0,1,7>: Cost 4 vext1 <6,2,0,1>, <7,0,1,2> 1611956380U, // <2,0,1,u>: Cost 2 vext3 <0,2,0,2>, LHS 1477738598U, // <2,0,2,0>: Cost 2 vext1 <0,2,0,2>, LHS - 2953627240U, // <2,0,2,1>: Cost 3 vzipr LHS, <2,2,2,2> - 3087844968U, // <2,0,2,2>: Cost 3 vtrnr LHS, <2,2,2,2> + 2551481078U, // <2,0,2,1>: Cost 3 vext1 <0,2,0,2>, <1,0,3,2> + 2551481796U, // <2,0,2,2>: Cost 3 vext1 <0,2,0,2>, <2,0,2,0> 2551482518U, // <2,0,2,3>: Cost 3 vext1 <0,2,0,2>, <3,0,1,2> 1477741878U, // <2,0,2,4>: Cost 2 vext1 <0,2,0,2>, RHS 2551484112U, // <2,0,2,5>: Cost 3 vext1 <0,2,0,2>, <5,1,7,3> - 2551484922U, // <2,0,2,6>: Cost 3 vext1 <0,2,0,2>, <6,2,7,3> - 2599261178U, // <2,0,2,7>: Cost 3 vext1 , <7,0,1,2> + 2551484759U, // <2,0,2,6>: Cost 3 vext1 <0,2,0,2>, <6,0,7,2> + 2551485434U, // <2,0,2,7>: Cost 3 vext1 <0,2,0,2>, <7,0,1,2> 1477744430U, // <2,0,2,u>: Cost 2 vext1 <0,2,0,2>, LHS - 2551488512U, // <2,0,3,0>: Cost 3 vext1 <0,2,0,3>, <0,0,0,0> + 2953625600U, // <2,0,3,0>: Cost 3 vzipr LHS, <0,0,0,0> 2953627302U, // <2,0,3,1>: Cost 3 vzipr LHS, <2,3,0,1> - 3087844978U, // <2,0,3,2>: Cost 3 vtrnr LHS, <2,2,3,3> - 2569406768U, // <2,0,3,3>: Cost 3 vext1 <3,2,0,3>, <3,2,0,3> - 2551491894U, // <2,0,3,4>: Cost 3 vext1 <0,2,0,3>, RHS - 3625234128U, // <2,0,3,5>: Cost 4 vext1 <0,2,0,3>, <5,1,7,3> - 3625234938U, // <2,0,3,6>: Cost 4 vext1 <0,2,0,3>, <6,2,7,3> - 3998629990U, // <2,0,3,7>: Cost 4 vzipl <6,5,0,7>, LHS - 3088287346U, // <2,0,3,u>: Cost 3 vtrnr LHS, <2,2,3,3> - 2687025478U, // <2,0,4,0>: Cost 3 vext3 <0,4,0,2>, <0,4,0,2> - 2712240466U, // <2,0,4,1>: Cost 3 vext3 <4,6,0,2>, <0,4,1,5> - 3087845070U, // <2,0,4,2>: Cost 3 vtrnr LHS, <2,3,4,5> - 3289915585U, // <2,0,4,3>: Cost 4 vrev <0,2,3,4> - 3637185846U, // <2,0,4,4>: Cost 4 vext1 <2,2,0,4>, RHS - 2629340470U, // <2,0,4,5>: Cost 3 vext2 <2,0,2,0>, RHS - 2846279334U, // <2,0,4,6>: Cost 3 vuzpr RHS, <2,3,0,1> - 3667047573U, // <2,0,4,7>: Cost 4 vext1 <7,2,0,4>, <7,2,0,4> - 3088287438U, // <2,0,4,u>: Cost 3 vtrnr LHS, <2,3,4,5> - 4162094889U, // <2,0,5,0>: Cost 4 vtrnr <0,2,0,2>, <2,4,5,6> - 3703082704U, // <2,0,5,1>: Cost 4 vext2 <2,0,2,0>, <5,1,7,3> - 2684518830U, // <2,0,5,2>: Cost 3 vext3 <0,0,2,2>, <0,5,2,7> - 3719008112U, // <2,0,5,3>: Cost 4 vext2 <4,6,2,0>, <5,3,7,1> + 2953625764U, // <2,0,3,2>: Cost 3 vzipr LHS, <0,2,0,2> + 4027369695U, // <2,0,3,3>: Cost 4 vzipr LHS, <3,1,0,3> + 3625233718U, // <2,0,3,4>: Cost 4 vext1 <0,2,0,3>, RHS + 3899836110U, // <2,0,3,5>: Cost 4 vuzpr <1,2,3,0>, <2,3,4,5> + 4032012618U, // <2,0,3,6>: Cost 4 vzipr LHS, <0,4,0,6> + 3899835392U, // <2,0,3,7>: Cost 4 vuzpr <1,2,3,0>, <1,3,5,7> + 2953625770U, // <2,0,3,u>: Cost 3 vzipr LHS, <0,2,0,u> + 2551496806U, // <2,0,4,0>: Cost 3 vext1 <0,2,0,4>, LHS + 2685698386U, // <2,0,4,1>: Cost 3 vext3 <0,2,0,2>, <0,4,1,5> + 2685698396U, // <2,0,4,2>: Cost 3 vext3 <0,2,0,2>, <0,4,2,6> + 3625240726U, // <2,0,4,3>: Cost 4 vext1 <0,2,0,4>, <3,0,1,2> + 2551500086U, // <2,0,4,4>: Cost 3 vext1 <0,2,0,4>, RHS + 2618723638U, // <2,0,4,5>: Cost 3 vext2 <0,2,2,0>, RHS + 2765409590U, // <2,0,4,6>: Cost 3 vuzpl <2,3,0,1>, RHS + 3799990664U, // <2,0,4,7>: Cost 4 vext3 <7,0,1,2>, <0,4,7,5> + 2685698450U, // <2,0,4,u>: Cost 3 vext3 <0,2,0,2>, <0,4,u,6> + 3625246822U, // <2,0,5,0>: Cost 4 vext1 <0,2,0,5>, LHS + 3289776304U, // <2,0,5,1>: Cost 4 vrev <0,2,1,5> + 2690564526U, // <2,0,5,2>: Cost 3 vext3 <1,0,3,2>, <0,5,2,7> + 3289923778U, // <2,0,5,3>: Cost 4 vrev <0,2,3,5> 2216255691U, // <2,0,5,4>: Cost 3 vrev <0,2,4,5> - 3719008260U, // <2,0,5,5>: Cost 4 vext2 <4,6,2,0>, <5,5,5,5> - 3719008354U, // <2,0,5,6>: Cost 4 vext2 <4,6,2,0>, <5,6,7,0> - 3923379878U, // <2,0,5,7>: Cost 4 vuzpr <5,1,7,3>, <2,3,0,1> + 3726307332U, // <2,0,5,5>: Cost 4 vext2 <5,u,2,0>, <5,5,5,5> + 3726307426U, // <2,0,5,6>: Cost 4 vext2 <5,u,2,0>, <5,6,7,0> + 2826095926U, // <2,0,5,7>: Cost 3 vuzpr <1,2,3,0>, RHS 2216550639U, // <2,0,5,u>: Cost 3 vrev <0,2,u,5> - 2653229352U, // <2,0,6,0>: Cost 3 vext2 <6,0,2,0>, <6,0,2,0> - 2953627578U, // <2,0,6,1>: Cost 3 vzipr LHS, <2,6,3,7> - 2708701688U, // <2,0,6,2>: Cost 3 vext3 <4,0,6,2>, <0,6,2,0> - 3782443525U, // <2,0,6,3>: Cost 4 vext3 <4,0,6,2>, <0,6,3,4> - 2655883884U, // <2,0,6,4>: Cost 3 vext2 <6,4,2,0>, <6,4,2,0> - 3726971588U, // <2,0,6,5>: Cost 4 vext2 <6,0,2,0>, <6,5,2,7> - 3719009080U, // <2,0,6,6>: Cost 4 vext2 <4,6,2,0>, <6,6,6,6> - 3719009102U, // <2,0,6,7>: Cost 4 vext2 <4,6,2,0>, <6,7,0,1> - 2653229352U, // <2,0,6,u>: Cost 3 vext2 <6,0,2,0>, <6,0,2,0> + 4162420736U, // <2,0,6,0>: Cost 4 vtrnr <0,2,4,6>, <0,0,0,0> + 2901885030U, // <2,0,6,1>: Cost 3 vzipl <2,6,3,7>, LHS + 2685698559U, // <2,0,6,2>: Cost 3 vext3 <0,2,0,2>, <0,6,2,7> + 3643173171U, // <2,0,6,3>: Cost 4 vext1 <3,2,0,6>, <3,2,0,6> + 2216263884U, // <2,0,6,4>: Cost 3 vrev <0,2,4,6> + 3730289341U, // <2,0,6,5>: Cost 4 vext2 <6,5,2,0>, <6,5,2,0> + 3726308152U, // <2,0,6,6>: Cost 4 vext2 <5,u,2,0>, <6,6,6,6> + 3899836346U, // <2,0,6,7>: Cost 4 vuzpr <1,2,3,0>, <2,6,3,7> + 2216558832U, // <2,0,6,u>: Cost 3 vrev <0,2,u,6> 2659202049U, // <2,0,7,0>: Cost 3 vext2 <7,0,2,0>, <7,0,2,0> - 3934209702U, // <2,0,7,1>: Cost 4 vuzpr <7,0,1,2>, <2,3,0,1> + 3726308437U, // <2,0,7,1>: Cost 4 vext2 <5,u,2,0>, <7,1,2,3> 2726249034U, // <2,0,7,2>: Cost 3 vext3 <7,0,1,2>, <0,7,2,1> - 3935667878U, // <2,0,7,3>: Cost 4 vuzpr <7,2,3,0>, <2,3,0,1> - 3719009638U, // <2,0,7,4>: Cost 4 vext2 <4,6,2,0>, <7,4,5,6> - 3937191590U, // <2,0,7,5>: Cost 4 vuzpr <7,4,5,6>, <2,3,0,1> + 3734934772U, // <2,0,7,3>: Cost 4 vext2 <7,3,2,0>, <7,3,2,0> + 3726308710U, // <2,0,7,4>: Cost 4 vext2 <5,u,2,0>, <7,4,5,6> + 3726308814U, // <2,0,7,5>: Cost 4 vext2 <5,u,2,0>, <7,5,u,2> 3736925671U, // <2,0,7,6>: Cost 4 vext2 <7,6,2,0>, <7,6,2,0> - 3719009900U, // <2,0,7,7>: Cost 4 vext2 <4,6,2,0>, <7,7,7,7> - 2664511113U, // <2,0,7,u>: Cost 3 vext2 <7,u,2,0>, <7,u,2,0> + 3726308972U, // <2,0,7,7>: Cost 4 vext2 <5,u,2,0>, <7,7,7,7> + 2659202049U, // <2,0,7,u>: Cost 3 vext2 <7,0,2,0>, <7,0,2,0> 1477787750U, // <2,0,u,0>: Cost 2 vext1 <0,2,0,u>, LHS - 2953668667U, // <2,0,u,1>: Cost 3 vzipr LHS, <2,u,0,1> + 2953668262U, // <2,0,u,1>: Cost 3 vzipr LHS, <2,3,0,1> 1611956893U, // <2,0,u,2>: Cost 2 vext3 <0,2,0,2>, LHS 2551531670U, // <2,0,u,3>: Cost 3 vext1 <0,2,0,u>, <3,0,1,2> 1477791030U, // <2,0,u,4>: Cost 2 vext1 <0,2,0,u>, RHS - 2551533264U, // <2,0,u,5>: Cost 3 vext1 <0,2,0,u>, <5,1,7,3> - 2551534074U, // <2,0,u,6>: Cost 3 vext1 <0,2,0,u>, <6,2,7,3> - 2599310330U, // <2,0,u,7>: Cost 3 vext1 , <7,0,1,2> + 2618726554U, // <2,0,u,5>: Cost 3 vext2 <0,2,2,0>, RHS + 2765412506U, // <2,0,u,6>: Cost 3 vuzpl <2,3,0,1>, RHS + 2826096169U, // <2,0,u,7>: Cost 3 vuzpr <1,2,3,0>, RHS 1611956947U, // <2,0,u,u>: Cost 2 vext3 <0,2,0,2>, LHS - 2690564826U, // <2,1,0,0>: Cost 3 vext3 <1,0,3,2>, <1,0,0,1> - 2690417380U, // <2,1,0,1>: Cost 3 vext3 <1,0,1,2>, <1,0,1,2> - 2617401508U, // <2,1,0,2>: Cost 3 vext2 <0,0,2,1>, <0,2,0,2> + 2569453670U, // <2,1,0,0>: Cost 3 vext1 <3,2,1,0>, LHS + 2619392102U, // <2,1,0,1>: Cost 3 vext2 <0,3,2,1>, LHS + 3759440619U, // <2,1,0,2>: Cost 4 vext3 <0,2,0,2>, <1,0,2,0> 1616823030U, // <2,1,0,3>: Cost 2 vext3 <1,0,3,2>, <1,0,3,2> 2569456950U, // <2,1,0,4>: Cost 3 vext1 <3,2,1,0>, RHS - 3643199184U, // <2,1,0,5>: Cost 4 vext1 <3,2,1,0>, <5,1,7,3> - 3643199994U, // <2,1,0,6>: Cost 4 vext1 <3,2,1,0>, <6,2,7,3> + 2690712328U, // <2,1,0,5>: Cost 3 vext3 <1,0,5,2>, <1,0,5,2> + 3661115841U, // <2,1,0,6>: Cost 4 vext1 <6,2,1,0>, <6,2,1,0> 2622046794U, // <2,1,0,7>: Cost 3 vext2 <0,7,2,1>, <0,7,2,1> 1617191715U, // <2,1,0,u>: Cost 2 vext3 <1,0,u,2>, <1,0,u,2> - 2623374060U, // <2,1,1,0>: Cost 3 vext2 <1,0,2,1>, <1,0,2,1> + 2551545958U, // <2,1,1,0>: Cost 3 vext1 <0,2,1,1>, LHS 2685698868U, // <2,1,1,1>: Cost 3 vext3 <0,2,0,2>, <1,1,1,1> - 2623374230U, // <2,1,1,2>: Cost 3 vext2 <1,0,2,1>, <1,2,3,0> + 2628682646U, // <2,1,1,2>: Cost 3 vext2 <1,u,2,1>, <1,2,3,0> 2685698888U, // <2,1,1,3>: Cost 3 vext3 <0,2,0,2>, <1,1,3,3> - 3625291062U, // <2,1,1,4>: Cost 4 vext1 <0,2,1,1>, RHS - 3726976144U, // <2,1,1,5>: Cost 4 vext2 <6,0,2,1>, <1,5,3,7> - 3765191522U, // <2,1,1,6>: Cost 4 vext3 <1,1,6,2>, <1,1,6,2> - 3296158651U, // <2,1,1,7>: Cost 4 vrev <1,2,7,1> + 2551549238U, // <2,1,1,4>: Cost 3 vext1 <0,2,1,1>, RHS + 3693134992U, // <2,1,1,5>: Cost 4 vext2 <0,3,2,1>, <1,5,3,7> + 3661124034U, // <2,1,1,6>: Cost 4 vext1 <6,2,1,1>, <6,2,1,1> + 3625292794U, // <2,1,1,7>: Cost 4 vext1 <0,2,1,1>, <7,0,1,2> 2685698933U, // <2,1,1,u>: Cost 3 vext3 <0,2,0,2>, <1,1,u,3> - 2629346757U, // <2,1,2,0>: Cost 3 vext2 <2,0,2,1>, <2,0,2,1> - 3759440775U, // <2,1,2,1>: Cost 4 vext3 <0,2,0,2>, <1,2,1,3> - 2629346920U, // <2,1,2,2>: Cost 3 vext2 <2,0,2,1>, <2,2,2,2> - 3020734628U, // <2,1,2,3>: Cost 3 vtrnl LHS, <0,2,0,2> - 2702361508U, // <2,1,2,4>: Cost 3 vext3 <3,0,1,2>, <1,2,4,5> - 3776103337U, // <2,1,2,5>: Cost 4 vext3 <3,0,1,2>, <1,2,5,1> - 3776103347U, // <2,1,2,6>: Cost 4 vext3 <3,0,1,2>, <1,2,6,2> + 2551554150U, // <2,1,2,0>: Cost 3 vext1 <0,2,1,2>, LHS + 3893649571U, // <2,1,2,1>: Cost 4 vuzpr <0,2,0,1>, <0,2,0,1> + 2551555688U, // <2,1,2,2>: Cost 3 vext1 <0,2,1,2>, <2,2,2,2> + 2685698966U, // <2,1,2,3>: Cost 3 vext3 <0,2,0,2>, <1,2,3,0> + 2551557430U, // <2,1,2,4>: Cost 3 vext1 <0,2,1,2>, RHS + 3763422123U, // <2,1,2,5>: Cost 4 vext3 <0,u,0,2>, <1,2,5,3> + 3693135802U, // <2,1,2,6>: Cost 4 vext2 <0,3,2,1>, <2,6,3,7> 2726249402U, // <2,1,2,7>: Cost 3 vext3 <7,0,1,2>, <1,2,7,0> - 3020775588U, // <2,1,2,u>: Cost 3 vtrnl LHS, <0,2,0,2> + 2685699011U, // <2,1,2,u>: Cost 3 vext3 <0,2,0,2>, <1,2,u,0> 2551562342U, // <2,1,3,0>: Cost 3 vext1 <0,2,1,3>, LHS - 2892398694U, // <2,1,3,1>: Cost 3 vzipl <1,1,1,1>, LHS - 2551563942U, // <2,1,3,2>: Cost 3 vext1 <0,2,1,3>, <2,3,0,1> - 3020736114U, // <2,1,3,3>: Cost 3 vtrnl LHS, <2,2,3,3> + 2953625610U, // <2,1,3,1>: Cost 3 vzipr LHS, <0,0,1,1> + 2953627798U, // <2,1,3,2>: Cost 3 vzipr LHS, <3,0,1,2> + 2953626584U, // <2,1,3,3>: Cost 3 vzipr LHS, <1,3,1,3> 2551565622U, // <2,1,3,4>: Cost 3 vext1 <0,2,1,3>, RHS - 2581425899U, // <2,1,3,5>: Cost 3 vext1 <5,2,1,3>, <5,2,1,3> - 3625308666U, // <2,1,3,6>: Cost 4 vext1 <0,2,1,3>, <6,2,7,3> - 3980787814U, // <2,1,3,7>: Cost 4 vzipl <3,5,1,7>, LHS - 3020777074U, // <2,1,3,u>: Cost 3 vtrnl LHS, <2,2,3,3> - 3697118098U, // <2,1,4,0>: Cost 4 vext2 <1,0,2,1>, <4,0,5,1> - 4100359066U, // <2,1,4,1>: Cost 4 vtrnl <1,1,1,1>, <1,2,3,4> - 3977429095U, // <2,1,4,2>: Cost 4 vzipl <3,0,1,2>, <0,1,2,4> + 2953625938U, // <2,1,3,5>: Cost 3 vzipr LHS, <0,4,1,5> + 2587398596U, // <2,1,3,6>: Cost 3 vext1 <6,2,1,3>, <6,2,1,3> + 4032013519U, // <2,1,3,7>: Cost 4 vzipr LHS, <1,6,1,7> + 2953625617U, // <2,1,3,u>: Cost 3 vzipr LHS, <0,0,1,u> + 2690565154U, // <2,1,4,0>: Cost 3 vext3 <1,0,3,2>, <1,4,0,5> + 3625313270U, // <2,1,4,1>: Cost 4 vext1 <0,2,1,4>, <1,3,4,6> + 3771532340U, // <2,1,4,2>: Cost 4 vext3 <2,2,2,2>, <1,4,2,5> 1148404634U, // <2,1,4,3>: Cost 2 vrev <1,2,3,4> - 3643231542U, // <2,1,4,4>: Cost 4 vext1 <3,2,1,4>, RHS - 2623376694U, // <2,1,4,5>: Cost 3 vext2 <1,0,2,1>, RHS - 3697118540U, // <2,1,4,6>: Cost 4 vext2 <1,0,2,1>, <4,6,0,2> - 3667121310U, // <2,1,4,7>: Cost 4 vext1 <7,2,1,4>, <7,2,1,4> + 3625315638U, // <2,1,4,4>: Cost 4 vext1 <0,2,1,4>, RHS + 2619395382U, // <2,1,4,5>: Cost 3 vext2 <0,3,2,1>, RHS + 3837242678U, // <2,1,4,6>: Cost 4 vuzpl <2,0,1,2>, RHS + 3799991394U, // <2,1,4,7>: Cost 4 vext3 <7,0,1,2>, <1,4,7,6> 1148773319U, // <2,1,4,u>: Cost 2 vrev <1,2,u,4> - 3643236454U, // <2,1,5,0>: Cost 4 vext1 <3,2,1,5>, LHS - 3697118928U, // <2,1,5,1>: Cost 4 vext2 <1,0,2,1>, <5,1,7,3> - 3643238099U, // <2,1,5,2>: Cost 4 vext1 <3,2,1,5>, <2,3,5,1> - 2712241296U, // <2,1,5,3>: Cost 3 vext3 <4,6,0,2>, <1,5,3,7> - 2222228388U, // <2,1,5,4>: Cost 3 vrev <1,2,4,5> - 3643240144U, // <2,1,5,5>: Cost 4 vext1 <3,2,1,5>, <5,1,7,3> - 3726979170U, // <2,1,5,6>: Cost 4 vext2 <6,0,2,1>, <5,6,7,0> - 3631297530U, // <2,1,5,7>: Cost 4 vext1 <1,2,1,5>, <7,0,1,2> - 2222523336U, // <2,1,5,u>: Cost 3 vrev <1,2,u,5> - 2653237545U, // <2,1,6,0>: Cost 3 vext2 <6,0,2,1>, <6,0,2,1> - 3785983183U, // <2,1,6,1>: Cost 4 vext3 <4,6,0,2>, <1,6,1,7> - 2653237754U, // <2,1,6,2>: Cost 3 vext2 <6,0,2,1>, <6,2,7,3> - 3068510412U, // <2,1,6,3>: Cost 3 vtrnl LHS, <0,2,4,6> - 3726979697U, // <2,1,6,4>: Cost 4 vext2 <6,0,2,1>, <6,4,2,5> - 3785983220U, // <2,1,6,5>: Cost 4 vext3 <4,6,0,2>, <1,6,5,u> - 3726979896U, // <2,1,6,6>: Cost 4 vext2 <6,0,2,1>, <6,6,6,6> - 3726979918U, // <2,1,6,7>: Cost 4 vext2 <6,0,2,1>, <6,7,0,1> - 2222531529U, // <2,1,6,u>: Cost 3 vrev <1,2,u,6> + 2551578726U, // <2,1,5,0>: Cost 3 vext1 <0,2,1,5>, LHS + 2551579648U, // <2,1,5,1>: Cost 3 vext1 <0,2,1,5>, <1,3,5,7> + 3625321952U, // <2,1,5,2>: Cost 4 vext1 <0,2,1,5>, <2,0,5,1> + 2685699216U, // <2,1,5,3>: Cost 3 vext3 <0,2,0,2>, <1,5,3,7> + 2551582006U, // <2,1,5,4>: Cost 3 vext1 <0,2,1,5>, RHS + 3740913668U, // <2,1,5,5>: Cost 4 vext2 , <5,5,5,5> + 3661156806U, // <2,1,5,6>: Cost 4 vext1 <6,2,1,5>, <6,2,1,5> + 3893652790U, // <2,1,5,7>: Cost 4 vuzpr <0,2,0,1>, RHS + 2685699261U, // <2,1,5,u>: Cost 3 vext3 <0,2,0,2>, <1,5,u,7> + 2551586918U, // <2,1,6,0>: Cost 3 vext1 <0,2,1,6>, LHS + 3625329398U, // <2,1,6,1>: Cost 4 vext1 <0,2,1,6>, <1,0,3,2> + 2551588794U, // <2,1,6,2>: Cost 3 vext1 <0,2,1,6>, <2,6,3,7> + 3088679014U, // <2,1,6,3>: Cost 3 vtrnr <0,2,4,6>, LHS + 2551590198U, // <2,1,6,4>: Cost 3 vext1 <0,2,1,6>, RHS + 4029382994U, // <2,1,6,5>: Cost 4 vzipr <0,4,2,6>, <0,4,1,5> + 3625333560U, // <2,1,6,6>: Cost 4 vext1 <0,2,1,6>, <6,6,6,6> + 3731624800U, // <2,1,6,7>: Cost 4 vext2 <6,7,2,1>, <6,7,2,1> + 2551592750U, // <2,1,6,u>: Cost 3 vext1 <0,2,1,6>, LHS 2622051322U, // <2,1,7,0>: Cost 3 vext2 <0,7,2,1>, <7,0,1,2> 3733615699U, // <2,1,7,1>: Cost 4 vext2 <7,1,2,1>, <7,1,2,1> - 3726980271U, // <2,1,7,2>: Cost 4 vext2 <6,0,2,1>, <7,2,3,3> + 3795125538U, // <2,1,7,2>: Cost 4 vext3 <6,1,7,2>, <1,7,2,0> 2222171037U, // <2,1,7,3>: Cost 3 vrev <1,2,3,7> - 3726980454U, // <2,1,7,4>: Cost 4 vext2 <6,0,2,1>, <7,4,5,6> - 3736270231U, // <2,1,7,5>: Cost 4 vext2 <7,5,2,1>, <7,5,2,1> - 3726980567U, // <2,1,7,6>: Cost 4 vext2 <6,0,2,1>, <7,6,0,2> - 3726980716U, // <2,1,7,7>: Cost 4 vext2 <6,0,2,1>, <7,7,7,7> + 3740915046U, // <2,1,7,4>: Cost 4 vext2 , <7,4,5,6> + 3296060335U, // <2,1,7,5>: Cost 4 vrev <1,2,5,7> + 3736933864U, // <2,1,7,6>: Cost 4 vext2 <7,6,2,1>, <7,6,2,1> + 3805300055U, // <2,1,7,7>: Cost 4 vext3 <7,u,1,2>, <1,7,7,u> 2669827714U, // <2,1,7,u>: Cost 3 vext2 , <7,u,1,2> 2551603302U, // <2,1,u,0>: Cost 3 vext1 <0,2,1,u>, LHS - 2623379246U, // <2,1,u,1>: Cost 3 vext2 <1,0,2,1>, LHS - 2551604902U, // <2,1,u,2>: Cost 3 vext1 <0,2,1,u>, <2,3,0,1> + 2953666570U, // <2,1,u,1>: Cost 3 vzipr LHS, <0,0,1,1> + 2953668758U, // <2,1,u,2>: Cost 3 vzipr LHS, <3,0,1,2> 1148437406U, // <2,1,u,3>: Cost 2 vrev <1,2,3,u> 2551606582U, // <2,1,u,4>: Cost 3 vext1 <0,2,1,u>, RHS - 2623379610U, // <2,1,u,5>: Cost 3 vext2 <1,0,2,1>, RHS - 3625349626U, // <2,1,u,6>: Cost 4 vext1 <0,2,1,u>, <6,2,7,3> + 2953666898U, // <2,1,u,5>: Cost 3 vzipr LHS, <0,4,1,5> + 2587398596U, // <2,1,u,6>: Cost 3 vext1 <6,2,1,3>, <6,2,1,3> 2669828370U, // <2,1,u,7>: Cost 3 vext2 , 1148806091U, // <2,1,u,u>: Cost 2 vrev <1,2,u,u> 1543667732U, // <2,2,0,0>: Cost 2 vext2 <0,0,2,2>, <0,0,2,2> - 1556938854U, // <2,2,0,1>: Cost 2 vext2 <2,2,2,2>, LHS - 2819409512U, // <2,2,0,2>: Cost 3 vuzpr LHS, <2,2,2,2> - 2696537551U, // <2,2,0,3>: Cost 3 vext3 <2,0,3,2>, <2,0,3,2> - 2696611288U, // <2,2,0,4>: Cost 3 vext3 <2,0,4,2>, <2,0,4,2> - 2617409966U, // <2,2,0,5>: Cost 3 vext2 <0,0,2,2>, <0,5,2,7> - 3770500586U, // <2,2,0,6>: Cost 4 vext3 <2,0,6,2>, <2,0,6,2> - 3799991795U, // <2,2,0,7>: Cost 4 vext3 <7,0,1,2>, <2,0,7,2> - 1556939421U, // <2,2,0,u>: Cost 2 vext2 <2,2,2,2>, LHS - 2690565638U, // <2,2,1,0>: Cost 3 vext3 <1,0,3,2>, <2,1,0,3> - 2630681396U, // <2,2,1,1>: Cost 3 vext2 <2,2,2,2>, <1,1,1,1> - 2685699608U, // <2,2,1,2>: Cost 3 vext3 <0,2,0,2>, <2,1,2,3> - 3759441441U, // <2,2,1,3>: Cost 4 vext3 <0,2,0,2>, <2,1,3,3> - 3759441450U, // <2,2,1,4>: Cost 4 vext3 <0,2,0,2>, <2,1,4,3> - 2665186448U, // <2,2,1,5>: Cost 3 vext2 , <1,5,3,7> - 3738928335U, // <2,2,1,6>: Cost 4 vext2 , <1,6,1,7> - 3738928427U, // <2,2,1,7>: Cost 4 vext2 , <1,7,3,0> - 2630681980U, // <2,2,1,u>: Cost 3 vext2 <2,2,2,2>, <1,u,3,0> + 1548976230U, // <2,2,0,1>: Cost 2 vext2 <0,u,2,2>, LHS + 2685699524U, // <2,2,0,2>: Cost 3 vext3 <0,2,0,2>, <2,0,2,0> + 2685699535U, // <2,2,0,3>: Cost 3 vext3 <0,2,0,2>, <2,0,3,2> + 2551614774U, // <2,2,0,4>: Cost 3 vext1 <0,2,2,0>, RHS + 3704422830U, // <2,2,0,5>: Cost 4 vext2 <2,2,2,2>, <0,5,2,7> + 3893657642U, // <2,2,0,6>: Cost 4 vuzpr <0,2,0,2>, <0,0,4,6> + 3770574323U, // <2,2,0,7>: Cost 4 vext3 <2,0,7,2>, <2,0,7,2> + 1548976796U, // <2,2,0,u>: Cost 2 vext2 <0,u,2,2>, <0,u,2,2> + 2622718710U, // <2,2,1,0>: Cost 3 vext2 <0,u,2,2>, <1,0,3,2> + 2622718772U, // <2,2,1,1>: Cost 3 vext2 <0,u,2,2>, <1,1,1,1> + 2622718870U, // <2,2,1,2>: Cost 3 vext2 <0,u,2,2>, <1,2,3,0> + 2819915878U, // <2,2,1,3>: Cost 3 vuzpr <0,2,0,2>, LHS + 3625364790U, // <2,2,1,4>: Cost 4 vext1 <0,2,2,1>, RHS + 2622719120U, // <2,2,1,5>: Cost 3 vext2 <0,u,2,2>, <1,5,3,7> + 3760031292U, // <2,2,1,6>: Cost 4 vext3 <0,2,u,2>, <2,1,6,3> + 3667170468U, // <2,2,1,7>: Cost 4 vext1 <7,2,2,1>, <7,2,2,1> + 2819915883U, // <2,2,1,u>: Cost 3 vuzpr <0,2,0,2>, LHS 1489829990U, // <2,2,2,0>: Cost 2 vext1 <2,2,2,2>, LHS 2563572470U, // <2,2,2,1>: Cost 3 vext1 <2,2,2,2>, <1,0,3,2> 269271142U, // <2,2,2,2>: Cost 1 vdup2 LHS - 2886518376U, // <2,2,2,3>: Cost 3 vzipl LHS, <2,2,2,2> + 2685699698U, // <2,2,2,3>: Cost 3 vext3 <0,2,0,2>, <2,2,3,3> 1489833270U, // <2,2,2,4>: Cost 2 vext1 <2,2,2,2>, RHS - 2563575504U, // <2,2,2,5>: Cost 3 vext1 <2,2,2,2>, <5,1,7,3> - 2563576314U, // <2,2,2,6>: Cost 3 vext1 <2,2,2,2>, <6,2,7,3> + 2685699720U, // <2,2,2,5>: Cost 3 vext3 <0,2,0,2>, <2,2,5,7> + 2622719930U, // <2,2,2,6>: Cost 3 vext2 <0,u,2,2>, <2,6,3,7> 2593436837U, // <2,2,2,7>: Cost 3 vext1 <7,2,2,2>, <7,2,2,2> 269271142U, // <2,2,2,u>: Cost 1 vdup2 LHS 2685699750U, // <2,2,3,0>: Cost 3 vext3 <0,2,0,2>, <2,3,0,1> 2690565806U, // <2,2,3,1>: Cost 3 vext3 <1,0,3,2>, <2,3,1,0> - 2630682945U, // <2,2,3,2>: Cost 3 vext2 <2,2,2,2>, <3,2,2,2> - 1812775014U, // <2,2,3,3>: Cost 2 vzipl LHS, LHS + 2953627240U, // <2,2,3,2>: Cost 3 vzipr LHS, <2,2,2,2> + 1879883878U, // <2,2,3,3>: Cost 2 vzipr LHS, LHS 2685699790U, // <2,2,3,4>: Cost 3 vext3 <0,2,0,2>, <2,3,4,5> - 3625381584U, // <2,2,3,5>: Cost 4 vext1 <0,2,2,3>, <5,1,7,3> - 2698749661U, // <2,2,3,6>: Cost 3 vext3 <2,3,6,2>, <2,3,6,2> + 3893659342U, // <2,2,3,5>: Cost 4 vuzpr <0,2,0,2>, <2,3,4,5> + 2958270812U, // <2,2,3,6>: Cost 3 vzipr LHS, <0,4,2,6> 2593445030U, // <2,2,3,7>: Cost 3 vext1 <7,2,2,3>, <7,2,2,3> - 1812815974U, // <2,2,3,u>: Cost 2 vzipl LHS, LHS - 2630683538U, // <2,2,4,0>: Cost 3 vext2 <2,2,2,2>, <4,0,5,1> - 3704425418U, // <2,2,4,1>: Cost 4 vext2 <2,2,2,2>, <4,1,2,3> - 2228045418U, // <2,2,4,2>: Cost 3 vrev <2,2,2,4> - 3964904904U, // <2,2,4,3>: Cost 4 vzipl LHS, <2,0,2,4> - 3027452826U, // <2,2,4,4>: Cost 3 vtrnl <1,2,3,4>, <1,2,3,4> - 1556942134U, // <2,2,4,5>: Cost 2 vext2 <2,2,2,2>, RHS - 2630683980U, // <2,2,4,6>: Cost 3 vext2 <2,2,2,2>, <4,6,0,2> + 1879883883U, // <2,2,3,u>: Cost 2 vzipr LHS, LHS + 2551644262U, // <2,2,4,0>: Cost 3 vext1 <0,2,2,4>, LHS + 3625386742U, // <2,2,4,1>: Cost 4 vext1 <0,2,2,4>, <1,0,3,2> + 2551645902U, // <2,2,4,2>: Cost 3 vext1 <0,2,2,4>, <2,3,4,5> + 3759441686U, // <2,2,4,3>: Cost 4 vext3 <0,2,0,2>, <2,4,3,5> + 2551647542U, // <2,2,4,4>: Cost 3 vext1 <0,2,2,4>, RHS + 1548979510U, // <2,2,4,5>: Cost 2 vext2 <0,u,2,2>, RHS + 2764901686U, // <2,2,4,6>: Cost 3 vuzpl <2,2,2,2>, RHS 3667195047U, // <2,2,4,7>: Cost 4 vext1 <7,2,2,4>, <7,2,2,4> - 1556942377U, // <2,2,4,u>: Cost 2 vext2 <2,2,2,2>, RHS - 3704426055U, // <2,2,5,0>: Cost 4 vext2 <2,2,2,2>, <5,0,1,1> - 2630684368U, // <2,2,5,1>: Cost 3 vext2 <2,2,2,2>, <5,1,7,3> + 1548979753U, // <2,2,4,u>: Cost 2 vext2 <0,u,2,2>, RHS + 3696463432U, // <2,2,5,0>: Cost 4 vext2 <0,u,2,2>, <5,0,1,2> + 2617413328U, // <2,2,5,1>: Cost 3 vext2 <0,0,2,2>, <5,1,7,3> 2685699936U, // <2,2,5,2>: Cost 3 vext3 <0,2,0,2>, <2,5,2,7> - 3779348328U, // <2,2,5,3>: Cost 4 vext3 <3,5,0,2>, <2,5,3,6> + 4027383910U, // <2,2,5,3>: Cost 4 vzipr <0,1,2,5>, LHS 2228201085U, // <2,2,5,4>: Cost 3 vrev <2,2,4,5> - 2665189380U, // <2,2,5,5>: Cost 3 vext2 , <5,5,5,5> - 2665189474U, // <2,2,5,6>: Cost 3 vext2 , <5,6,7,0> - 3704426614U, // <2,2,5,7>: Cost 4 vext2 <2,2,2,2>, <5,7,0,2> - 2630684935U, // <2,2,5,u>: Cost 3 vext2 <2,2,2,2>, <5,u,7,3> - 3704426793U, // <2,2,6,0>: Cost 4 vext2 <2,2,2,2>, <6,0,2,1> - 3704426876U, // <2,2,6,1>: Cost 4 vext2 <2,2,2,2>, <6,1,2,3> - 2630685178U, // <2,2,6,2>: Cost 3 vext2 <2,2,2,2>, <6,2,7,3> - 2712242106U, // <2,2,6,3>: Cost 3 vext3 <4,6,0,2>, <2,6,3,7> - 3637349686U, // <2,2,6,4>: Cost 4 vext1 <2,2,2,6>, RHS - 3738931890U, // <2,2,6,5>: Cost 4 vext2 , <6,5,0,7> - 2657227536U, // <2,2,6,6>: Cost 3 vext2 <6,6,2,2>, <6,6,2,2> + 2617413636U, // <2,2,5,5>: Cost 3 vext2 <0,0,2,2>, <5,5,5,5> + 2617413730U, // <2,2,5,6>: Cost 3 vext2 <0,0,2,2>, <5,6,7,0> + 2819919158U, // <2,2,5,7>: Cost 3 vuzpr <0,2,0,2>, RHS + 2819919159U, // <2,2,5,u>: Cost 3 vuzpr <0,2,0,2>, RHS + 3625402554U, // <2,2,6,0>: Cost 4 vext1 <0,2,2,6>, <0,2,2,6> + 3760031652U, // <2,2,6,1>: Cost 4 vext3 <0,2,u,2>, <2,6,1,3> + 2617414138U, // <2,2,6,2>: Cost 3 vext2 <0,0,2,2>, <6,2,7,3> + 2685700026U, // <2,2,6,3>: Cost 3 vext3 <0,2,0,2>, <2,6,3,7> + 3625405750U, // <2,2,6,4>: Cost 4 vext1 <0,2,2,6>, RHS + 3760031692U, // <2,2,6,5>: Cost 4 vext3 <0,2,u,2>, <2,6,5,7> + 3088679116U, // <2,2,6,6>: Cost 3 vtrnr <0,2,4,6>, <0,2,4,6> 2657891169U, // <2,2,6,7>: Cost 3 vext2 <6,7,2,2>, <6,7,2,2> - 2630685664U, // <2,2,6,u>: Cost 3 vext2 <2,2,2,2>, <6,u,7,3> + 2685700071U, // <2,2,6,u>: Cost 3 vext3 <0,2,0,2>, <2,6,u,7> 2726250474U, // <2,2,7,0>: Cost 3 vext3 <7,0,1,2>, <2,7,0,1> - 3934209640U, // <2,2,7,1>: Cost 4 vuzpr <7,0,1,2>, <2,2,2,2> + 3704427616U, // <2,2,7,1>: Cost 4 vext2 <2,2,2,2>, <7,1,3,5> 2660545701U, // <2,2,7,2>: Cost 3 vext2 <7,2,2,2>, <7,2,2,2> - 3964906122U, // <2,2,7,3>: Cost 4 vzipl LHS, <3,6,2,7> - 2665190758U, // <2,2,7,4>: Cost 3 vext2 , <7,4,5,6> - 3937191528U, // <2,2,7,5>: Cost 4 vuzpr <7,4,5,6>, <2,2,2,2> - 3730970125U, // <2,2,7,6>: Cost 4 vext2 <6,6,2,2>, <7,6,6,2> - 2665191020U, // <2,2,7,7>: Cost 3 vext2 , <7,7,7,7> + 4030718054U, // <2,2,7,3>: Cost 4 vzipr <0,6,2,7>, LHS + 2617415014U, // <2,2,7,4>: Cost 3 vext2 <0,0,2,2>, <7,4,5,6> + 3302033032U, // <2,2,7,5>: Cost 4 vrev <2,2,5,7> + 3661246929U, // <2,2,7,6>: Cost 4 vext1 <6,2,2,7>, <6,2,2,7> + 2617415276U, // <2,2,7,7>: Cost 3 vext2 <0,0,2,2>, <7,7,7,7> 2731558962U, // <2,2,7,u>: Cost 3 vext3 <7,u,1,2>, <2,7,u,1> - 1591449308U, // <2,2,u,0>: Cost 2 vext2 , - 1556944686U, // <2,2,u,1>: Cost 2 vext2 <2,2,2,2>, LHS + 1489829990U, // <2,2,u,0>: Cost 2 vext1 <2,2,2,2>, LHS + 1548982062U, // <2,2,u,1>: Cost 2 vext2 <0,u,2,2>, LHS 269271142U, // <2,2,u,2>: Cost 1 vdup2 LHS - 1812775019U, // <2,2,u,3>: Cost 2 vzipl LHS, LHS + 1879924838U, // <2,2,u,3>: Cost 2 vzipr LHS, LHS 1489833270U, // <2,2,u,4>: Cost 2 vext1 <2,2,2,2>, RHS - 1556945050U, // <2,2,u,5>: Cost 2 vext2 <2,2,2,2>, RHS - 2630686896U, // <2,2,u,6>: Cost 3 vext2 <2,2,2,2>, - 2593485995U, // <2,2,u,7>: Cost 3 vext1 <7,2,2,u>, <7,2,2,u> + 1548982426U, // <2,2,u,5>: Cost 2 vext2 <0,u,2,2>, RHS + 2953666908U, // <2,2,u,6>: Cost 3 vzipr LHS, <0,4,2,6> + 2819919401U, // <2,2,u,7>: Cost 3 vuzpr <0,2,0,2>, RHS 269271142U, // <2,2,u,u>: Cost 1 vdup2 LHS 1544339456U, // <2,3,0,0>: Cost 2 vext2 LHS, <0,0,0,0> 470597734U, // <2,3,0,1>: Cost 1 vext2 LHS, LHS 1548984484U, // <2,3,0,2>: Cost 2 vext2 LHS, <0,2,0,2> - 2557659286U, // <2,3,0,3>: Cost 3 vext1 <1,2,3,0>, <3,0,1,2> - 1483918646U, // <2,3,0,4>: Cost 2 vext1 <1,2,3,0>, RHS - 2557660880U, // <2,3,0,5>: Cost 3 vext1 <1,2,3,0>, <5,1,7,3> - 2557661690U, // <2,3,0,6>: Cost 3 vext1 <1,2,3,0>, <6,2,7,3> + 2619408648U, // <2,3,0,3>: Cost 3 vext2 <0,3,2,3>, <0,3,2,3> + 1548984658U, // <2,3,0,4>: Cost 2 vext2 LHS, <0,4,1,5> + 2665857454U, // <2,3,0,5>: Cost 3 vext2 LHS, <0,5,2,7> + 2622726655U, // <2,3,0,6>: Cost 3 vext2 LHS, <0,6,2,7> 2593494188U, // <2,3,0,7>: Cost 3 vext1 <7,2,3,0>, <7,2,3,0> 470598301U, // <2,3,0,u>: Cost 1 vext2 LHS, LHS 1544340214U, // <2,3,1,0>: Cost 2 vext2 LHS, <1,0,3,2> 1544340276U, // <2,3,1,1>: Cost 2 vext2 LHS, <1,1,1,1> 1544340374U, // <2,3,1,2>: Cost 2 vext2 LHS, <1,2,3,0> - 2622727118U, // <2,3,1,3>: Cost 3 vext2 LHS, <1,3,0,2> - 2557668662U, // <2,3,1,4>: Cost 3 vext1 <1,2,3,1>, RHS - 1592116368U, // <2,3,1,5>: Cost 2 vext2 LHS, <1,5,3,7> - 2665858255U, // <2,3,1,6>: Cost 3 vext2 LHS, <1,6,1,7> + 1548985304U, // <2,3,1,3>: Cost 2 vext2 LHS, <1,3,1,3> + 2551696694U, // <2,3,1,4>: Cost 3 vext1 <0,2,3,1>, RHS + 1548985488U, // <2,3,1,5>: Cost 2 vext2 LHS, <1,5,3,7> + 2622727375U, // <2,3,1,6>: Cost 3 vext2 LHS, <1,6,1,7> 2665858347U, // <2,3,1,7>: Cost 3 vext2 LHS, <1,7,3,0> - 1548985724U, // <2,3,1,u>: Cost 2 vext2 LHS, <1,u,3,0> - 2622727604U, // <2,3,2,0>: Cost 3 vext2 LHS, <2,0,0,2> - 2622727686U, // <2,3,2,1>: Cost 3 vext2 LHS, <2,1,0,3> + 1548985709U, // <2,3,1,u>: Cost 2 vext2 LHS, <1,u,1,3> + 2622727613U, // <2,3,2,0>: Cost 3 vext2 LHS, <2,0,1,2> + 2622727711U, // <2,3,2,1>: Cost 3 vext2 LHS, <2,1,3,1> 1544341096U, // <2,3,2,2>: Cost 2 vext2 LHS, <2,2,2,2> 1544341158U, // <2,3,2,3>: Cost 2 vext2 LHS, <2,3,0,1> - 2622727928U, // <2,3,2,4>: Cost 3 vext2 LHS, <2,4,0,2> - 2665858894U, // <2,3,2,5>: Cost 3 vext2 LHS, <2,5,0,7> - 1592117178U, // <2,3,2,6>: Cost 2 vext2 LHS, <2,6,3,7> + 2622727958U, // <2,3,2,4>: Cost 3 vext2 LHS, <2,4,3,5> + 2622728032U, // <2,3,2,5>: Cost 3 vext2 LHS, <2,5,2,7> + 1548986298U, // <2,3,2,6>: Cost 2 vext2 LHS, <2,6,3,7> 2665859050U, // <2,3,2,7>: Cost 3 vext2 LHS, <2,7,0,1> 1548986427U, // <2,3,2,u>: Cost 2 vext2 LHS, <2,u,0,1> 1548986518U, // <2,3,3,0>: Cost 2 vext2 LHS, <3,0,1,2> - 2622728414U, // <2,3,3,1>: Cost 3 vext2 LHS, <3,1,0,2> + 2622728415U, // <2,3,3,1>: Cost 3 vext2 LHS, <3,1,0,3> 1489913458U, // <2,3,3,2>: Cost 2 vext1 <2,2,3,3>, <2,2,3,3> 1544341916U, // <2,3,3,3>: Cost 2 vext2 LHS, <3,3,3,3> 1548986882U, // <2,3,3,4>: Cost 2 vext2 LHS, <3,4,5,6> - 2622728738U, // <2,3,3,5>: Cost 3 vext2 LHS, <3,5,0,2> - 2622728842U, // <2,3,3,6>: Cost 3 vext2 LHS, <3,6,2,7> - 2593518767U, // <2,3,3,7>: Cost 3 vext1 <7,2,3,3>, <7,2,3,3> + 2665859632U, // <2,3,3,5>: Cost 3 vext2 LHS, <3,5,1,7> + 2234304870U, // <2,3,3,6>: Cost 3 vrev <3,2,6,3> + 2958271632U, // <2,3,3,7>: Cost 3 vzipr LHS, <1,5,3,7> 1548987166U, // <2,3,3,u>: Cost 2 vext2 LHS, <3,u,1,2> - 1548987282U, // <2,3,4,0>: Cost 2 vext2 LHS, <4,0,5,1> + 1483948134U, // <2,3,4,0>: Cost 2 vext1 <1,2,3,4>, LHS 1483948954U, // <2,3,4,1>: Cost 2 vext1 <1,2,3,4>, <1,2,3,4> - 2622729270U, // <2,3,4,2>: Cost 3 vext2 LHS, <4,2,5,3> + 2622729276U, // <2,3,4,2>: Cost 3 vext2 LHS, <4,2,6,0> 2557692054U, // <2,3,4,3>: Cost 3 vext1 <1,2,3,4>, <3,0,1,2> 1483951414U, // <2,3,4,4>: Cost 2 vext1 <1,2,3,4>, RHS 470601014U, // <2,3,4,5>: Cost 1 vext2 LHS, RHS - 1548987724U, // <2,3,4,6>: Cost 2 vext2 LHS, <4,6,0,2> + 1592118644U, // <2,3,4,6>: Cost 2 vext2 LHS, <4,6,4,6> 2593526960U, // <2,3,4,7>: Cost 3 vext1 <7,2,3,4>, <7,2,3,4> 470601257U, // <2,3,4,u>: Cost 1 vext2 LHS, RHS - 2622729799U, // <2,3,5,0>: Cost 3 vext2 LHS, <5,0,1,1> - 1548988112U, // <2,3,5,1>: Cost 2 vext2 LHS, <5,1,7,3> - 2622729968U, // <2,3,5,2>: Cost 3 vext2 LHS, <5,2,1,u> - 2665860976U, // <2,3,5,3>: Cost 3 vext2 LHS, <5,3,7,1> + 2551726182U, // <2,3,5,0>: Cost 3 vext1 <0,2,3,5>, LHS + 1592118992U, // <2,3,5,1>: Cost 2 vext2 LHS, <5,1,7,3> + 2665860862U, // <2,3,5,2>: Cost 3 vext2 LHS, <5,2,3,4> + 2551728642U, // <2,3,5,3>: Cost 3 vext1 <0,2,3,5>, <3,4,5,6> 1592119238U, // <2,3,5,4>: Cost 2 vext2 LHS, <5,4,7,6> 1592119300U, // <2,3,5,5>: Cost 2 vext2 LHS, <5,5,5,5> 1592119394U, // <2,3,5,6>: Cost 2 vext2 LHS, <5,6,7,0> - 2622730358U, // <2,3,5,7>: Cost 3 vext2 LHS, <5,7,0,2> - 1592119556U, // <2,3,5,u>: Cost 2 vext2 LHS, <5,u,7,0> - 2622730537U, // <2,3,6,0>: Cost 3 vext2 LHS, <6,0,2,1> - 2622730620U, // <2,3,6,1>: Cost 3 vext2 LHS, <6,1,2,3> - 1548988922U, // <2,3,6,2>: Cost 2 vext2 LHS, <6,2,7,3> + 1592119464U, // <2,3,5,7>: Cost 2 vext2 LHS, <5,7,5,7> + 1592119545U, // <2,3,5,u>: Cost 2 vext2 LHS, <5,u,5,7> + 2622730529U, // <2,3,6,0>: Cost 3 vext2 LHS, <6,0,1,2> + 2557707164U, // <2,3,6,1>: Cost 3 vext1 <1,2,3,6>, <1,2,3,6> + 1592119802U, // <2,3,6,2>: Cost 2 vext2 LHS, <6,2,7,3> 2665861682U, // <2,3,6,3>: Cost 3 vext2 LHS, <6,3,4,5> - 2665861740U, // <2,3,6,4>: Cost 3 vext2 LHS, <6,4,2,0> + 2622730893U, // <2,3,6,4>: Cost 3 vext2 LHS, <6,4,5,6> 2665861810U, // <2,3,6,5>: Cost 3 vext2 LHS, <6,5,0,7> 1592120120U, // <2,3,6,6>: Cost 2 vext2 LHS, <6,6,6,6> 1592120142U, // <2,3,6,7>: Cost 2 vext2 LHS, <6,7,0,1> - 1548989408U, // <2,3,6,u>: Cost 2 vext2 LHS, <6,u,7,3> + 1592120223U, // <2,3,6,u>: Cost 2 vext2 LHS, <6,u,0,1> 1592120314U, // <2,3,7,0>: Cost 2 vext2 LHS, <7,0,1,2> 2659890261U, // <2,3,7,1>: Cost 3 vext2 <7,1,2,3>, <7,1,2,3> - 2622731439U, // <2,3,7,2>: Cost 3 vext2 LHS, <7,2,3,3> + 2660553894U, // <2,3,7,2>: Cost 3 vext2 <7,2,2,3>, <7,2,2,3> 2665862371U, // <2,3,7,3>: Cost 3 vext2 LHS, <7,3,0,1> 1592120678U, // <2,3,7,4>: Cost 2 vext2 LHS, <7,4,5,6> - 2665862548U, // <2,3,7,5>: Cost 3 vext2 LHS, <7,5,1,7> + 2665862534U, // <2,3,7,5>: Cost 3 vext2 LHS, <7,5,0,2> 2665862614U, // <2,3,7,6>: Cost 3 vext2 LHS, <7,6,0,1> 1592120940U, // <2,3,7,7>: Cost 2 vext2 LHS, <7,7,7,7> 1592120962U, // <2,3,7,u>: Cost 2 vext2 LHS, <7,u,1,2> - 1548990162U, // <2,3,u,0>: Cost 2 vext2 LHS, + 1548990163U, // <2,3,u,0>: Cost 2 vext2 LHS, 470603566U, // <2,3,u,1>: Cost 1 vext2 LHS, LHS - 1548990316U, // <2,3,u,2>: Cost 2 vext2 LHS, + 1548990341U, // <2,3,u,2>: Cost 2 vext2 LHS, 1548990396U, // <2,3,u,3>: Cost 2 vext2 LHS, 1548990527U, // <2,3,u,4>: Cost 2 vext2 LHS, 470603930U, // <2,3,u,5>: Cost 1 vext2 LHS, RHS - 1548990640U, // <2,3,u,6>: Cost 2 vext2 LHS, + 1548990672U, // <2,3,u,6>: Cost 2 vext2 LHS, 1592121600U, // <2,3,u,7>: Cost 2 vext2 LHS, 470604133U, // <2,3,u,u>: Cost 1 vext2 LHS, LHS - 2708261734U, // <2,4,0,0>: Cost 3 vext3 <4,0,0,2>, <4,0,0,2> - 2629369958U, // <2,4,0,1>: Cost 3 vext2 <2,0,2,4>, LHS - 2819409614U, // <2,4,0,2>: Cost 3 vuzpr LHS, <2,3,4,5> + 2617425942U, // <2,4,0,0>: Cost 3 vext2 <0,0,2,4>, <0,0,2,4> + 2618753126U, // <2,4,0,1>: Cost 3 vext2 <0,2,2,4>, LHS + 2618753208U, // <2,4,0,2>: Cost 3 vext2 <0,2,2,4>, <0,2,2,4> 2619416841U, // <2,4,0,3>: Cost 3 vext2 <0,3,2,4>, <0,3,2,4> - 2712243086U, // <2,4,0,4>: Cost 3 vext3 <4,6,0,2>, <4,0,4,6> - 2685701010U, // <2,4,0,5>: Cost 3 vext3 <0,2,0,2>, <4,0,5,1> + 2587593628U, // <2,4,0,4>: Cost 3 vext1 <6,2,4,0>, <4,0,6,2> + 2712832914U, // <2,4,0,5>: Cost 3 vext3 <4,6,u,2>, <4,0,5,1> 1634962332U, // <2,4,0,6>: Cost 2 vext3 <4,0,6,2>, <4,0,6,2> - 3661337594U, // <2,4,0,7>: Cost 4 vext1 <6,2,4,0>, <7,0,1,2> - 1635109806U, // <2,4,0,u>: Cost 2 vext3 <4,0,u,2>, <4,0,u,2> + 3799993252U, // <2,4,0,7>: Cost 4 vext3 <7,0,1,2>, <4,0,7,1> + 1634962332U, // <2,4,0,u>: Cost 2 vext3 <4,0,6,2>, <4,0,6,2> 2619417334U, // <2,4,1,0>: Cost 3 vext2 <0,3,2,4>, <1,0,3,2> - 3899033294U, // <2,4,1,1>: Cost 4 vuzpr <1,1,1,1>, <2,3,4,5> - 3703112598U, // <2,4,1,2>: Cost 4 vext2 <2,0,2,4>, <1,2,3,0> - 3898525390U, // <2,4,1,3>: Cost 4 vuzpr <1,0,3,2>, <2,3,4,5> - 3643427810U, // <2,4,1,4>: Cost 4 vext1 <3,2,4,1>, <4,1,5,0> - 2709294052U, // <2,4,1,5>: Cost 3 vext3 <4,1,5,2>, <4,1,5,2> - 3759442926U, // <2,4,1,6>: Cost 4 vext3 <0,2,0,2>, <4,1,6,3> - 3701785894U, // <2,4,1,7>: Cost 4 vext2 <1,7,2,4>, <1,7,2,4> - 2709515263U, // <2,4,1,u>: Cost 3 vext3 <4,1,u,2>, <4,1,u,2> + 3692495668U, // <2,4,1,1>: Cost 4 vext2 <0,2,2,4>, <1,1,1,1> + 2625389466U, // <2,4,1,2>: Cost 3 vext2 <1,3,2,4>, <1,2,3,4> + 2826125414U, // <2,4,1,3>: Cost 3 vuzpr <1,2,3,4>, LHS + 3699794995U, // <2,4,1,4>: Cost 4 vext2 <1,4,2,4>, <1,4,2,4> + 3692496016U, // <2,4,1,5>: Cost 4 vext2 <0,2,2,4>, <1,5,3,7> + 3763424238U, // <2,4,1,6>: Cost 4 vext3 <0,u,0,2>, <4,1,6,3> + 3667317942U, // <2,4,1,7>: Cost 4 vext1 <7,2,4,1>, <7,2,4,1> + 2826125419U, // <2,4,1,u>: Cost 3 vuzpr <1,2,3,4>, LHS 2629371336U, // <2,4,2,0>: Cost 3 vext2 <2,0,2,4>, <2,0,2,4> - 3703113240U, // <2,4,2,1>: Cost 4 vext2 <2,0,2,4>, <2,1,2,3> + 3699131946U, // <2,4,2,1>: Cost 4 vext2 <1,3,2,4>, <2,1,4,3> 2630698602U, // <2,4,2,2>: Cost 3 vext2 <2,2,2,4>, <2,2,2,4> - 2632025806U, // <2,4,2,3>: Cost 3 vext2 <2,4,2,4>, <2,3,4,5> - 2832844494U, // <2,4,2,4>: Cost 3 vuzpr <2,3,4,5>, <2,3,4,5> - 2709957685U, // <2,4,2,5>: Cost 3 vext3 <4,2,5,2>, <4,2,5,2> - 2710031422U, // <2,4,2,6>: Cost 3 vext3 <4,2,6,2>, <4,2,6,2> + 2618754766U, // <2,4,2,3>: Cost 3 vext2 <0,2,2,4>, <2,3,4,5> + 2826126234U, // <2,4,2,4>: Cost 3 vuzpr <1,2,3,4>, <1,2,3,4> + 2899119414U, // <2,4,2,5>: Cost 3 vzipl <2,2,2,2>, RHS + 3033337142U, // <2,4,2,6>: Cost 3 vtrnl <2,2,2,2>, RHS 3800214597U, // <2,4,2,7>: Cost 4 vext3 <7,0,4,2>, <4,2,7,0> - 2710178896U, // <2,4,2,u>: Cost 3 vext3 <4,2,u,2>, <4,2,u,2> - 2569699430U, // <2,4,3,0>: Cost 3 vext1 <3,2,4,3>, LHS - 2569700250U, // <2,4,3,1>: Cost 3 vext1 <3,2,4,3>, <1,2,3,4> - 3971678310U, // <2,4,3,2>: Cost 4 vzipl <2,0,4,2>, LHS - 2569701716U, // <2,4,3,3>: Cost 3 vext1 <3,2,4,3>, <3,2,4,3> - 2569702710U, // <2,4,3,4>: Cost 3 vext1 <3,2,4,3>, RHS - 2899951718U, // <2,4,3,5>: Cost 3 vzipl <2,3,4,5>, LHS - 3114714738U, // <2,4,3,6>: Cost 3 vtrnr RHS, <2,2,3,3> - 3987644518U, // <2,4,3,7>: Cost 4 vzipl <4,6,4,7>, LHS - 2899976294U, // <2,4,3,u>: Cost 3 vzipl <2,3,4,u>, LHS - 2563735654U, // <2,4,4,0>: Cost 3 vext1 <2,2,4,4>, LHS - 2563736474U, // <2,4,4,1>: Cost 3 vext1 <2,2,4,4>, <1,2,3,4> - 2563737212U, // <2,4,4,2>: Cost 3 vext1 <2,2,4,4>, <2,2,4,4> - 3637479574U, // <2,4,4,3>: Cost 4 vext1 <2,2,4,4>, <3,0,1,2> - 2563738934U, // <2,4,4,4>: Cost 3 vext1 <2,2,4,4>, RHS - 2629373238U, // <2,4,4,5>: Cost 3 vext2 <2,0,2,4>, RHS - 2846279374U, // <2,4,4,6>: Cost 3 vuzpr RHS, <2,3,4,5> - 3667342521U, // <2,4,4,7>: Cost 4 vext1 <7,2,4,4>, <7,2,4,4> - 2629373481U, // <2,4,4,u>: Cost 3 vext2 <2,0,2,4>, RHS + 2899119657U, // <2,4,2,u>: Cost 3 vzipl <2,2,2,2>, RHS + 2635344033U, // <2,4,3,0>: Cost 3 vext2 <3,0,2,4>, <3,0,2,4> + 4032012325U, // <2,4,3,1>: Cost 4 vzipr LHS, <0,0,4,1> + 3692497228U, // <2,4,3,2>: Cost 4 vext2 <0,2,2,4>, <3,2,3,4> + 3692497308U, // <2,4,3,3>: Cost 4 vext2 <0,2,2,4>, <3,3,3,3> + 3001404624U, // <2,4,3,4>: Cost 3 vzipr LHS, <4,4,4,4> + 2953627342U, // <2,4,3,5>: Cost 3 vzipr LHS, <2,3,4,5> + 2953625804U, // <2,4,3,6>: Cost 3 vzipr LHS, <0,2,4,6> + 3899868160U, // <2,4,3,7>: Cost 4 vuzpr <1,2,3,4>, <1,3,5,7> + 2953625806U, // <2,4,3,u>: Cost 3 vzipr LHS, <0,2,4,u> + 2710916266U, // <2,4,4,0>: Cost 3 vext3 <4,4,0,2>, <4,4,0,2> + 3899869648U, // <2,4,4,1>: Cost 4 vuzpr <1,2,3,4>, <3,4,0,1> + 3899869658U, // <2,4,4,2>: Cost 4 vuzpr <1,2,3,4>, <3,4,1,2> + 3899868930U, // <2,4,4,3>: Cost 4 vuzpr <1,2,3,4>, <2,4,1,3> + 2712833232U, // <2,4,4,4>: Cost 3 vext3 <4,6,u,2>, <4,4,4,4> + 2618756406U, // <2,4,4,5>: Cost 3 vext2 <0,2,2,4>, RHS + 2765737270U, // <2,4,4,6>: Cost 3 vuzpl <2,3,4,5>, RHS + 4168304426U, // <2,4,4,7>: Cost 4 vtrnr <1,2,3,4>, <2,4,5,7> + 2618756649U, // <2,4,4,u>: Cost 3 vext2 <0,2,2,4>, RHS 2551800011U, // <2,4,5,0>: Cost 3 vext1 <0,2,4,5>, <0,2,4,5> 2569716470U, // <2,4,5,1>: Cost 3 vext1 <3,2,4,5>, <1,0,3,2> 2563745405U, // <2,4,5,2>: Cost 3 vext1 <2,2,4,5>, <2,2,4,5> 2569718102U, // <2,4,5,3>: Cost 3 vext1 <3,2,4,5>, <3,2,4,5> 2551803190U, // <2,4,5,4>: Cost 3 vext1 <0,2,4,5>, RHS - 3625545424U, // <2,4,5,5>: Cost 4 vext1 <0,2,4,5>, <5,1,7,3> + 3625545732U, // <2,4,5,5>: Cost 4 vext1 <0,2,4,5>, <5,5,5,5> 1611959606U, // <2,4,5,6>: Cost 2 vext3 <0,2,0,2>, RHS - 3923379918U, // <2,4,5,7>: Cost 4 vuzpr <5,1,7,3>, <2,3,4,5> + 2826128694U, // <2,4,5,7>: Cost 3 vuzpr <1,2,3,4>, RHS 1611959624U, // <2,4,5,u>: Cost 2 vext3 <0,2,0,2>, RHS - 1638501708U, // <2,4,6,0>: Cost 2 vext3 <4,6,0,2>, <4,6,0,2> - 2599584502U, // <2,4,6,1>: Cost 3 vext1 , <1,0,3,2> - 2712391006U, // <2,4,6,2>: Cost 3 vext3 <4,6,2,2>, <4,6,2,2> - 2599585942U, // <2,4,6,3>: Cost 3 vext1 , <3,0,1,2> - 1525845302U, // <2,4,6,4>: Cost 2 vext1 , RHS - 2980497338U, // <2,4,6,5>: Cost 3 vzipr RHS, <2,6,3,7> - 2599588346U, // <2,4,6,6>: Cost 3 vext1 , <6,2,7,3> - 2599588858U, // <2,4,6,7>: Cost 3 vext1 , <7,0,1,2> - 1525847854U, // <2,4,6,u>: Cost 2 vext1 , LHS + 1478066278U, // <2,4,6,0>: Cost 2 vext1 <0,2,4,6>, LHS + 2551808758U, // <2,4,6,1>: Cost 3 vext1 <0,2,4,6>, <1,0,3,2> + 2551809516U, // <2,4,6,2>: Cost 3 vext1 <0,2,4,6>, <2,0,6,4> + 2551810198U, // <2,4,6,3>: Cost 3 vext1 <0,2,4,6>, <3,0,1,2> + 1478069558U, // <2,4,6,4>: Cost 2 vext1 <0,2,4,6>, RHS + 2901888310U, // <2,4,6,5>: Cost 3 vzipl <2,6,3,7>, RHS + 2551812920U, // <2,4,6,6>: Cost 3 vext1 <0,2,4,6>, <6,6,6,6> + 2726251914U, // <2,4,6,7>: Cost 3 vext3 <7,0,1,2>, <4,6,7,1> + 1478072110U, // <2,4,6,u>: Cost 2 vext1 <0,2,4,6>, LHS 2659234821U, // <2,4,7,0>: Cost 3 vext2 <7,0,2,4>, <7,0,2,4> - 3934209742U, // <2,4,7,1>: Cost 4 vuzpr <7,0,1,2>, <2,3,4,5> - 3719042224U, // <2,4,7,2>: Cost 4 vext2 <4,6,2,4>, <7,2,3,4> - 3935700686U, // <2,4,7,3>: Cost 4 vuzpr <7,2,3,4>, <2,3,4,5> - 3719042406U, // <2,4,7,4>: Cost 4 vext2 <4,6,2,4>, <7,4,5,6> - 3937191630U, // <2,4,7,5>: Cost 4 vuzpr <7,4,5,6>, <2,3,4,5> - 3799993809U, // <2,4,7,6>: Cost 4 vext3 <7,0,1,2>, <4,7,6,0> - 3719042668U, // <2,4,7,7>: Cost 4 vext2 <4,6,2,4>, <7,7,7,7> - 2664543885U, // <2,4,7,u>: Cost 3 vext2 <7,u,2,4>, <7,u,2,4> - 1639828974U, // <2,4,u,0>: Cost 2 vext3 <4,u,0,2>, <4,u,0,2> - 2629375790U, // <2,4,u,1>: Cost 3 vext2 <2,0,2,4>, LHS - 2563769984U, // <2,4,u,2>: Cost 3 vext1 <2,2,4,u>, <2,2,4,u> - 2569742681U, // <2,4,u,3>: Cost 3 vext1 <3,2,4,u>, <3,2,4,u> - 1525845302U, // <2,4,u,4>: Cost 2 vext1 , RHS - 2629376154U, // <2,4,u,5>: Cost 3 vext2 <2,0,2,4>, RHS + 3786722726U, // <2,4,7,1>: Cost 4 vext3 <4,7,1,2>, <4,7,1,2> + 3734303911U, // <2,4,7,2>: Cost 4 vext2 <7,2,2,4>, <7,2,2,4> + 3734967544U, // <2,4,7,3>: Cost 4 vext2 <7,3,2,4>, <7,3,2,4> + 3727005030U, // <2,4,7,4>: Cost 4 vext2 <6,0,2,4>, <7,4,5,6> + 2726251976U, // <2,4,7,5>: Cost 3 vext3 <7,0,1,2>, <4,7,5,0> + 2726251986U, // <2,4,7,6>: Cost 3 vext3 <7,0,1,2>, <4,7,6,1> + 3727005292U, // <2,4,7,7>: Cost 4 vext2 <6,0,2,4>, <7,7,7,7> + 2659234821U, // <2,4,7,u>: Cost 3 vext2 <7,0,2,4>, <7,0,2,4> + 1478082662U, // <2,4,u,0>: Cost 2 vext1 <0,2,4,u>, LHS + 2618758958U, // <2,4,u,1>: Cost 3 vext2 <0,2,2,4>, LHS + 2551826024U, // <2,4,u,2>: Cost 3 vext1 <0,2,4,u>, <2,2,2,2> + 2551826582U, // <2,4,u,3>: Cost 3 vext1 <0,2,4,u>, <3,0,1,2> + 1478085942U, // <2,4,u,4>: Cost 2 vext1 <0,2,4,u>, RHS + 2953668302U, // <2,4,u,5>: Cost 3 vzipr LHS, <2,3,4,5> 1611959849U, // <2,4,u,6>: Cost 2 vext3 <0,2,0,2>, RHS - 2599588858U, // <2,4,u,7>: Cost 3 vext1 , <7,0,1,2> + 2826128937U, // <2,4,u,7>: Cost 3 vuzpr <1,2,3,4>, RHS 1611959867U, // <2,4,u,u>: Cost 2 vext3 <0,2,0,2>, RHS - 3893659433U, // <2,5,0,0>: Cost 4 vuzpr <0,2,0,2>, <2,4,5,6> - 2714308168U, // <2,5,0,1>: Cost 3 vext3 <5,0,1,2>, <5,0,1,2> - 3893192808U, // <2,5,0,2>: Cost 4 vuzpr LHS, <2,u,5,1> - 3319746298U, // <2,5,0,3>: Cost 4 vrev <5,2,3,0> + 3691839488U, // <2,5,0,0>: Cost 4 vext2 <0,1,2,5>, <0,0,0,0> + 2618097766U, // <2,5,0,1>: Cost 3 vext2 <0,1,2,5>, LHS + 2620088484U, // <2,5,0,2>: Cost 3 vext2 <0,4,2,5>, <0,2,0,2> + 2619425034U, // <2,5,0,3>: Cost 3 vext2 <0,3,2,5>, <0,3,2,5> 2620088667U, // <2,5,0,4>: Cost 3 vext2 <0,4,2,5>, <0,4,2,5> 2620752300U, // <2,5,0,5>: Cost 3 vext2 <0,5,2,5>, <0,5,2,5> - 3788418677U, // <2,5,0,6>: Cost 4 vext3 <5,0,6,2>, <5,0,6,2> - 3047605142U, // <2,5,0,7>: Cost 3 vtrnl RHS, <1,2,3,0> - 3047613334U, // <2,5,0,u>: Cost 3 vtrnl RHS, <1,2,3,0> - 3625582800U, // <2,5,1,0>: Cost 4 vext1 <0,2,5,1>, <0,2,5,1> - 3643499254U, // <2,5,1,1>: Cost 4 vext1 <3,2,5,1>, <1,0,3,2> + 3693830655U, // <2,5,0,6>: Cost 4 vext2 <0,4,2,5>, <0,6,2,7> + 3094531382U, // <2,5,0,7>: Cost 3 vtrnr <1,2,3,0>, RHS + 2618098333U, // <2,5,0,u>: Cost 3 vext2 <0,1,2,5>, LHS + 3691840246U, // <2,5,1,0>: Cost 4 vext2 <0,1,2,5>, <1,0,3,2> + 3691840308U, // <2,5,1,1>: Cost 4 vext2 <0,1,2,5>, <1,1,1,1> 2626061206U, // <2,5,1,2>: Cost 3 vext2 <1,4,2,5>, <1,2,3,0> - 3643500891U, // <2,5,1,3>: Cost 4 vext1 <3,2,5,1>, <3,2,5,1> + 2618098688U, // <2,5,1,3>: Cost 3 vext2 <0,1,2,5>, <1,3,5,7> 2626061364U, // <2,5,1,4>: Cost 3 vext2 <1,4,2,5>, <1,4,2,5> - 3625586384U, // <2,5,1,5>: Cost 4 vext1 <0,2,5,1>, <5,1,7,3> + 3691840656U, // <2,5,1,5>: Cost 4 vext2 <0,1,2,5>, <1,5,3,7> 3789082310U, // <2,5,1,6>: Cost 4 vext3 <5,1,6,2>, <5,1,6,2> - 2685701840U, // <2,5,1,7>: Cost 3 vext3 <0,2,0,2>, <5,1,7,3> - 2685701849U, // <2,5,1,u>: Cost 3 vext3 <0,2,0,2>, <5,1,u,3> - 2575736934U, // <2,5,2,0>: Cost 3 vext1 <4,2,5,2>, LHS - 3759443696U, // <2,5,2,1>: Cost 4 vext3 <0,2,0,2>, <5,2,1,u> - 2575738472U, // <2,5,2,2>: Cost 3 vext1 <4,2,5,2>, <2,2,2,2> - 3772714750U, // <2,5,2,3>: Cost 4 vext3 <2,4,0,2>, <5,2,3,4> - 2575739957U, // <2,5,2,4>: Cost 3 vext1 <4,2,5,2>, <4,2,5,2> - 3906627283U, // <2,5,2,5>: Cost 4 vuzpr <2,3,5,1>, <2,3,5,1> - 3759443736U, // <2,5,2,6>: Cost 4 vext3 <0,2,0,2>, <5,2,6,3> - 3047604388U, // <2,5,2,7>: Cost 3 vtrnl RHS, <0,2,0,2> - 2575742766U, // <2,5,2,u>: Cost 3 vext1 <4,2,5,2>, LHS - 2575745126U, // <2,5,3,0>: Cost 3 vext1 <4,2,5,3>, LHS - 2909945958U, // <2,5,3,1>: Cost 3 vzipl <4,0,5,1>, LHS + 2712833744U, // <2,5,1,7>: Cost 3 vext3 <4,6,u,2>, <5,1,7,3> + 2628715896U, // <2,5,1,u>: Cost 3 vext2 <1,u,2,5>, <1,u,2,5> + 3693831613U, // <2,5,2,0>: Cost 4 vext2 <0,4,2,5>, <2,0,1,2> + 4026698642U, // <2,5,2,1>: Cost 4 vzipr <0,0,2,2>, <4,0,5,1> + 2632033896U, // <2,5,2,2>: Cost 3 vext2 <2,4,2,5>, <2,2,2,2> + 3691841190U, // <2,5,2,3>: Cost 4 vext2 <0,1,2,5>, <2,3,0,1> + 2632034061U, // <2,5,2,4>: Cost 3 vext2 <2,4,2,5>, <2,4,2,5> + 3691841352U, // <2,5,2,5>: Cost 4 vext2 <0,1,2,5>, <2,5,0,1> + 3691841466U, // <2,5,2,6>: Cost 4 vext2 <0,1,2,5>, <2,6,3,7> + 3088354614U, // <2,5,2,7>: Cost 3 vtrnr <0,2,0,2>, RHS + 3088354615U, // <2,5,2,u>: Cost 3 vtrnr <0,2,0,2>, RHS + 2557829222U, // <2,5,3,0>: Cost 3 vext1 <1,2,5,3>, LHS + 2557830059U, // <2,5,3,1>: Cost 3 vext1 <1,2,5,3>, <1,2,5,3> 2575746766U, // <2,5,3,2>: Cost 3 vext1 <4,2,5,3>, <2,3,4,5> - 3978395750U, // <2,5,3,3>: Cost 4 vzipl <3,1,5,3>, LHS - 2575748150U, // <2,5,3,4>: Cost 3 vext1 <4,2,5,3>, <4,2,5,3> - 2919268454U, // <2,5