From craig.topper at gmail.com Mon Aug 6 01:22:36 2012 From: craig.topper at gmail.com (Craig Topper) Date: Mon, 06 Aug 2012 06:22:36 -0000 Subject: [llvm-commits] [llvm] r161318 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrFragmentsSIMD.td lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/avx-intrinsics-x86.ll Message-ID: <20120806062236.A78C12A6C074@llvm.org> Author: ctopper Date: Mon Aug 6 01:22:36 2012 New Revision: 161318 URL: http://llvm.org/viewvc/llvm-project?rev=161318&view=rev Log: Implement proper handling for pcmpistri/pcmpestri intrinsics. Requires custom handling in DAGISelToDAG due to limitations in TableGen's implicit def handling. Fixes PR11305. Modified: 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/X86InstrFragmentsSIMD.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=161318&r1=161317&r2=161318&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug 6 01:22:36 2012 @@ -2600,6 +2600,85 @@ return Result; } + + // FIXME: Custom handling because TableGen doesn't support multiple implicit + // defs in an instruction pattern + case X86ISD::PCMPESTRI: { + SDValue N0 = Node->getOperand(0); + SDValue N1 = Node->getOperand(1); + SDValue N2 = Node->getOperand(2); + SDValue N3 = Node->getOperand(3); + SDValue N4 = Node->getOperand(4); + + // Make sure last argument is a constant + ConstantSDNode *Cst = dyn_cast(N4); + if (!Cst) + break; + + uint64_t Imm = Cst->getZExtValue(); + + SDValue InFlag = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl, + X86::EAX, N1, SDValue()).getValue(1); + InFlag = CurDAG->getCopyToReg(CurDAG->getEntryNode(), dl, X86::EDX, + N3, InFlag).getValue(1); + + SDValue Ops[] = { N0, N2, getI8Imm(Imm), InFlag }; + unsigned Opc = Subtarget->hasAVX() ? X86::VPCMPESTRIrr : + X86::PCMPESTRIrr; + InFlag = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Glue, Ops, + array_lengthof(Ops)), 0); + + if (!SDValue(Node, 0).use_empty()) { + SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, + X86::ECX, NVT, InFlag); + InFlag = Result.getValue(2); + ReplaceUses(SDValue(Node, 0), Result); + } + if (!SDValue(Node, 1).use_empty()) { + SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, + X86::EFLAGS, NVT, InFlag); + InFlag = Result.getValue(2); + ReplaceUses(SDValue(Node, 1), Result); + } + + return NULL; + } + + // FIXME: Custom handling because TableGen doesn't support multiple implicit + // defs in an instruction pattern + case X86ISD::PCMPISTRI: { + SDValue N0 = Node->getOperand(0); + SDValue N1 = Node->getOperand(1); + SDValue N2 = Node->getOperand(2); + + // Make sure last argument is a constant + ConstantSDNode *Cst = dyn_cast(N2); + if (!Cst) + break; + + uint64_t Imm = Cst->getZExtValue(); + + SDValue Ops[] = { N0, N1, getI8Imm(Imm) }; + unsigned Opc = Subtarget->hasAVX() ? X86::VPCMPISTRIrr : + X86::PCMPISTRIrr; + SDValue InFlag = SDValue(CurDAG->getMachineNode(Opc, dl, MVT::Glue, Ops, + array_lengthof(Ops)), 0); + + if (!SDValue(Node, 0).use_empty()) { + SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, + X86::ECX, NVT, InFlag); + InFlag = Result.getValue(2); + ReplaceUses(SDValue(Node, 0), Result); + } + if (!SDValue(Node, 1).use_empty()) { + SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl, + X86::EFLAGS, NVT, InFlag); + InFlag = Result.getValue(2); + ReplaceUses(SDValue(Node, 1), Result); + } + + return NULL; + } } SDNode *ResNode = SelectCode(Node); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=161318&r1=161317&r2=161318&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 6 01:22:36 2012 @@ -9845,6 +9845,83 @@ DAG.getConstant(NewIntNo, MVT::i32), Op.getOperand(1), ShAmt); } + case Intrinsic::x86_sse42_pcmpistria128: + case Intrinsic::x86_sse42_pcmpestria128: + case Intrinsic::x86_sse42_pcmpistric128: + case Intrinsic::x86_sse42_pcmpestric128: + case Intrinsic::x86_sse42_pcmpistrio128: + case Intrinsic::x86_sse42_pcmpestrio128: + case Intrinsic::x86_sse42_pcmpistris128: + case Intrinsic::x86_sse42_pcmpestris128: + case Intrinsic::x86_sse42_pcmpistriz128: + case Intrinsic::x86_sse42_pcmpestriz128: { + unsigned Opcode; + unsigned X86CC; + switch (IntNo) { + default: llvm_unreachable("Impossible intrinsic"); // Can't reach here. + case Intrinsic::x86_sse42_pcmpistria128: + Opcode = X86ISD::PCMPISTRI; + X86CC = X86::COND_A; + break; + case Intrinsic::x86_sse42_pcmpestria128: + Opcode = X86ISD::PCMPESTRI; + X86CC = X86::COND_A; + break; + case Intrinsic::x86_sse42_pcmpistric128: + Opcode = X86ISD::PCMPISTRI; + X86CC = X86::COND_B; + break; + case Intrinsic::x86_sse42_pcmpestric128: + Opcode = X86ISD::PCMPESTRI; + X86CC = X86::COND_B; + break; + case Intrinsic::x86_sse42_pcmpistrio128: + Opcode = X86ISD::PCMPISTRI; + X86CC = X86::COND_O; + break; + case Intrinsic::x86_sse42_pcmpestrio128: + Opcode = X86ISD::PCMPESTRI; + X86CC = X86::COND_O; + break; + case Intrinsic::x86_sse42_pcmpistris128: + Opcode = X86ISD::PCMPISTRI; + X86CC = X86::COND_S; + break; + case Intrinsic::x86_sse42_pcmpestris128: + Opcode = X86ISD::PCMPESTRI; + X86CC = X86::COND_S; + break; + case Intrinsic::x86_sse42_pcmpistriz128: + Opcode = X86ISD::PCMPISTRI; + X86CC = X86::COND_E; + break; + case Intrinsic::x86_sse42_pcmpestriz128: + Opcode = X86ISD::PCMPESTRI; + X86CC = X86::COND_E; + break; + } + SmallVector NewOps; + NewOps.append(Op->op_begin()+1, Op->op_end()); + SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::i32); + SDValue PCMP = DAG.getNode(Opcode, dl, VTs, NewOps.data(), NewOps.size()); + SDValue SetCC = DAG.getNode(X86ISD::SETCC, dl, MVT::i8, + DAG.getConstant(X86CC, MVT::i8), + SDValue(PCMP.getNode(), 1)); + return DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, SetCC); + } + case Intrinsic::x86_sse42_pcmpistri128: + case Intrinsic::x86_sse42_pcmpestri128: { + unsigned Opcode; + if (IntNo == Intrinsic::x86_sse42_pcmpistri128) + Opcode = X86ISD::PCMPISTRI; + else + Opcode = X86ISD::PCMPESTRI; + + SmallVector NewOps; + NewOps.append(Op->op_begin()+1, Op->op_end()); + SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::i32); + return DAG.getNode(Opcode, dl, VTs, NewOps.data(), NewOps.size()); + } } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=161318&r1=161317&r2=161318&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Aug 6 01:22:36 2012 @@ -333,6 +333,10 @@ // RDRAND - Get a random integer and indicate whether it is valid in CF. RDRAND, + // PCMP*STRI + PCMPISTRI, + PCMPESTRI, + // ATOMADD64_DAG, ATOMSUB64_DAG, ATOMOR64_DAG, ATOMAND64_DAG, // ATOMXOR64_DAG, ATOMNAND64_DAG, ATOMSWAP64_DAG - // Atomic 64-bit binary operations. Modified: llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td?rev=161318&r1=161317&r2=161318&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFragmentsSIMD.td Mon Aug 6 01:22:36 2012 @@ -173,6 +173,17 @@ def X86Fmaddsub : SDNode<"X86ISD::FMSUBADD", SDTFma>; def X86Fmsubadd : SDNode<"X86ISD::FMADDSUB", SDTFma>; +def SDT_PCMPISTRI : SDTypeProfile<2, 3, [SDTCisVT<0, i32>, SDTCisVT<1, i32>, + SDTCisVT<2, v16i8>, SDTCisVT<3, v16i8>, + SDTCisVT<4, i8>]>; +def SDT_PCMPESTRI : SDTypeProfile<2, 5, [SDTCisVT<0, i32>, SDTCisVT<1, i32>, + SDTCisVT<2, v16i8>, SDTCisVT<3, i32>, + SDTCisVT<4, v16i8>, SDTCisVT<5, i32>, + SDTCisVT<6, i8>]>; + +def X86pcmpistri : SDNode<"X86ISD::PCMPISTRI", SDT_PCMPISTRI>; +def X86pcmpestri : SDNode<"X86ISD::PCMPESTRI", SDT_PCMPESTRI>; + //===----------------------------------------------------------------------===// // SSE Complex Patterns //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=161318&r1=161317&r2=161318&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Mon Aug 6 01:22:36 2012 @@ -6841,81 +6841,42 @@ } // Packed Compare Implicit Length Strings, Return Index -let Defs = [ECX, EFLAGS] in { - multiclass SS42AI_pcmpistri { +let Defs = [ECX, EFLAGS], neverHasSideEffects = 1 in { + multiclass SS42AI_pcmpistri { def rr : SS42AI<0x63, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2, i8imm:$src3), !strconcat(asm, "\t{$src3, $src2, $src1|$src1, $src2, $src3}"), - [(set ECX, (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), - (implicit EFLAGS)]>, OpSize; + []>, OpSize; + let mayLoad = 1 in def rm : SS42AI<0x63, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src2, i8imm:$src3), !strconcat(asm, "\t{$src3, $src2, $src1|$src1, $src2, $src3}"), - [(set ECX, (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)), - (implicit EFLAGS)]>, OpSize; + []>, OpSize; } } -let Predicates = [HasAVX] in { -defm VPCMPISTRI : SS42AI_pcmpistri, - VEX; -defm VPCMPISTRIA : SS42AI_pcmpistri, - VEX; -defm VPCMPISTRIC : SS42AI_pcmpistri, - VEX; -defm VPCMPISTRIO : SS42AI_pcmpistri, - VEX; -defm VPCMPISTRIS : SS42AI_pcmpistri, - VEX; -defm VPCMPISTRIZ : SS42AI_pcmpistri, - VEX; -} - -defm PCMPISTRI : SS42AI_pcmpistri; -defm PCMPISTRIA : SS42AI_pcmpistri; -defm PCMPISTRIC : SS42AI_pcmpistri; -defm PCMPISTRIO : SS42AI_pcmpistri; -defm PCMPISTRIS : SS42AI_pcmpistri; -defm PCMPISTRIZ : SS42AI_pcmpistri; +let Predicates = [HasAVX] in +defm VPCMPISTRI : SS42AI_pcmpistri<"vpcmpistri">, VEX; +defm PCMPISTRI : SS42AI_pcmpistri<"pcmpistri">; // Packed Compare Explicit Length Strings, Return Index -let Defs = [ECX, EFLAGS], Uses = [EAX, EDX] in { - multiclass SS42AI_pcmpestri { +let Defs = [ECX, EFLAGS], Uses = [EAX, EDX], neverHasSideEffects = 1 in { + multiclass SS42AI_pcmpestri { def rr : SS42AI<0x61, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src3, i8imm:$src5), !strconcat(asm, "\t{$src5, $src3, $src1|$src1, $src3, $src5}"), - [(set ECX, (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)), - (implicit EFLAGS)]>, OpSize; + []>, OpSize; + let mayLoad = 1 in def rm : SS42AI<0x61, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src3, i8imm:$src5), !strconcat(asm, "\t{$src5, $src3, $src1|$src1, $src3, $src5}"), - [(set ECX, - (IntId128 VR128:$src1, EAX, (load addr:$src3), EDX, imm:$src5)), - (implicit EFLAGS)]>, OpSize; + []>, OpSize; } } -let Predicates = [HasAVX] in { -defm VPCMPESTRI : SS42AI_pcmpestri, - VEX; -defm VPCMPESTRIA : SS42AI_pcmpestri, - VEX; -defm VPCMPESTRIC : SS42AI_pcmpestri, - VEX; -defm VPCMPESTRIO : SS42AI_pcmpestri, - VEX; -defm VPCMPESTRIS : SS42AI_pcmpestri, - VEX; -defm VPCMPESTRIZ : SS42AI_pcmpestri, - VEX; -} - -defm PCMPESTRI : SS42AI_pcmpestri; -defm PCMPESTRIA : SS42AI_pcmpestri; -defm PCMPESTRIC : SS42AI_pcmpestri; -defm PCMPESTRIO : SS42AI_pcmpestri; -defm PCMPESTRIS : SS42AI_pcmpestri; -defm PCMPESTRIZ : SS42AI_pcmpestri; +let Predicates = [HasAVX] in +defm VPCMPESTRI : SS42AI_pcmpestri<"vpcmpestri">, VEX; +defm PCMPESTRI : SS42AI_pcmpestri<"pcmpestri">; //===----------------------------------------------------------------------===// // SSE4.2 - CRC Instructions Modified: llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll?rev=161318&r1=161317&r2=161318&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll (original) +++ llvm/trunk/test/CodeGen/X86/avx-intrinsics-x86.ll Mon Aug 6 01:22:36 2012 @@ -1154,7 +1154,7 @@ ; CHECK: movl ; CHECK: movl ; CHECK: vpcmpestri - ; CHECK: movl + ; CHECK: seta %res = call i32 @llvm.x86.sse42.pcmpestria128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; [#uses=1] ret i32 %res } @@ -1165,7 +1165,7 @@ ; CHECK: movl ; CHECK: movl ; CHECK: vpcmpestri - ; CHECK: movl + ; CHECK: sbbl %res = call i32 @llvm.x86.sse42.pcmpestric128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; [#uses=1] ret i32 %res } @@ -1176,7 +1176,7 @@ ; CHECK: movl ; CHECK: movl ; CHECK: vpcmpestri - ; CHECK: movl + ; CHECK: seto %res = call i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; [#uses=1] ret i32 %res } @@ -1187,7 +1187,7 @@ ; CHECK: movl ; CHECK: movl ; CHECK: vpcmpestri - ; CHECK: movl + ; CHECK: sets %res = call i32 @llvm.x86.sse42.pcmpestris128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; [#uses=1] ret i32 %res } @@ -1198,7 +1198,7 @@ ; CHECK: movl ; CHECK: movl ; CHECK: vpcmpestri - ; CHECK: movl + ; CHECK: sete %res = call i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; [#uses=1] ret i32 %res } @@ -1227,7 +1227,7 @@ define i32 @test_x86_sse42_pcmpistria128(<16 x i8> %a0, <16 x i8> %a1) { ; CHECK: vpcmpistri - ; CHECK: movl + ; CHECK: seta %res = call i32 @llvm.x86.sse42.pcmpistria128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; [#uses=1] ret i32 %res } @@ -1236,7 +1236,7 @@ define i32 @test_x86_sse42_pcmpistric128(<16 x i8> %a0, <16 x i8> %a1) { ; CHECK: vpcmpistri - ; CHECK: movl + ; CHECK: sbbl %res = call i32 @llvm.x86.sse42.pcmpistric128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; [#uses=1] ret i32 %res } @@ -1245,7 +1245,7 @@ define i32 @test_x86_sse42_pcmpistrio128(<16 x i8> %a0, <16 x i8> %a1) { ; CHECK: vpcmpistri - ; CHECK: movl + ; CHECK: seto %res = call i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; [#uses=1] ret i32 %res } @@ -1254,7 +1254,7 @@ define i32 @test_x86_sse42_pcmpistris128(<16 x i8> %a0, <16 x i8> %a1) { ; CHECK: vpcmpistri - ; CHECK: movl + ; CHECK: sets %res = call i32 @llvm.x86.sse42.pcmpistris128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; [#uses=1] ret i32 %res } @@ -1263,7 +1263,7 @@ define i32 @test_x86_sse42_pcmpistriz128(<16 x i8> %a0, <16 x i8> %a1) { ; CHECK: vpcmpistri - ; CHECK: movl + ; CHECK: sete %res = call i32 @llvm.x86.sse42.pcmpistriz128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; [#uses=1] ret i32 %res } From samsonov at google.com Mon Aug 6 03:37:18 2012 From: samsonov at google.com (Alexey Samsonov) Date: Mon, 6 Aug 2012 12:37:18 +0400 Subject: [llvm-commits] PATCH: [ASan] Add support for running unit tests by lit (as a part of 'make check-asan' command) In-Reply-To: References: Message-ID: (ping) On Wed, Aug 1, 2012 at 5:51 PM, Alexey Samsonov wrote: > Hi! > > This patch adds the basic support for running ASan unit tests (compiled in > a very hacky way) by llvm-lit tool, as a part of "make check-asan" command > from build tree. > Even though all tests are linked into a single "AsanTest" binary, they are > sharded by llvm-lit tool and 119 tests pass in 6.47 seconds on my > workstation (in 12 threads). > The patch also disables ASan output tests (that use clang compiler from > build tree) for cross-compilation. > > Code review: http://codereview.appspot.com/6454079/ > > -- > Alexey Samsonov, MSK > -- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/50016d34/attachment-0001.html From samsonov at google.com Mon Aug 6 03:39:50 2012 From: samsonov at google.com (Alexey Samsonov) Date: Mon, 6 Aug 2012 12:39:50 +0400 Subject: [llvm-commits] PATCH: DebugInfo lib: fix instruction address lookup in line table In-Reply-To: References: Message-ID: Benjamin, Could you take a look at this? (or redirect me to someone else for review). On Wed, Jul 25, 2012 at 9:15 PM, Alexey Samsonov wrote: > Could you please take a look? > > (re-attaching the patch just in case) > > On Fri, Jul 20, 2012 at 4:35 PM, Alexey Samsonov wrote: > >> Hi! >> >> This patch fixes the representation of debug line table in DebugInfo LLVM >> library. Instead of just collection of rows, debug line table for >> compilation unit is now >> treated as the number of row ranges, describing sequences [1]. The >> sequences are not always listed in the order of increasing address, so >> the previously used std::lower_bound() sometimes produced wrong results. >> Now the instruction address lookup consists of two stages: finding the >> correct sequence, and searching for address in range of rows for this >> sequence. >> >> [1] dwarfstd: "Sequence - A series of contiguous target machine >> instructions. One compilation unit may emit multiple sequences >> (that is, not all instructions within a compilation unit are assumed to >> be contiguous)" >> >> Code review: http://codereview.appspot.com/6423064/ >> > > -- > Alexey Samsonov, MSK > > -- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/8b0e5ecd/attachment.html From benny.kra at gmail.com Mon Aug 6 05:50:20 2012 From: benny.kra at gmail.com (Benjamin Kramer) Date: Mon, 6 Aug 2012 12:50:20 +0200 Subject: [llvm-commits] PATCH: DebugInfo lib: fix instruction address lookup in line table In-Reply-To: References: Message-ID: On 06.08.2012, at 10:39, Alexey Samsonov wrote: > Benjamin, > > Could you take a look at this? (or redirect me to someone else for review). Sorry, for the delay, been crazy busy over the last weeks. This looks good to me. I'm a bit worried because the lookup code was taken pretty much 1:1 from lldb (see source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp). Does it have the same bugs? - Ben > > On Wed, Jul 25, 2012 at 9:15 PM, Alexey Samsonov wrote: > Could you please take a look? > > (re-attaching the patch just in case) > > On Fri, Jul 20, 2012 at 4:35 PM, Alexey Samsonov wrote: > Hi! > > This patch fixes the representation of debug line table in DebugInfo LLVM library. Instead of just collection of rows, debug line table for compilation unit is now > treated as the number of row ranges, describing sequences [1]. The sequences are not always listed in the order of increasing address, so > the previously used std::lower_bound() sometimes produced wrong results. Now the instruction address lookup consists of two stages: finding the > correct sequence, and searching for address in range of rows for this sequence. > > [1] dwarfstd: "Sequence - A series of contiguous target machine instructions. One compilation unit may emit multiple sequences > (that is, not all instructions within a compilation unit are assumed to be contiguous)" > > Code review: http://codereview.appspot.com/6423064/ > > -- > Alexey Samsonov, MSK > > > > > -- > Alexey Samsonov, MSK > From samsonov at google.com Mon Aug 6 07:00:05 2012 From: samsonov at google.com (Alexey Samsonov) Date: Mon, 6 Aug 2012 16:00:05 +0400 Subject: [llvm-commits] PATCH: DebugInfo lib: fix instruction address lookup in line table In-Reply-To: References: Message-ID: On Mon, Aug 6, 2012 at 2:50 PM, Benjamin Kramer wrote: > > On 06.08.2012, at 10:39, Alexey Samsonov wrote: > > > Benjamin, > > > > Could you take a look at this? (or redirect me to someone else for > review). > > Sorry, for the delay, been crazy busy over the last weeks. > > This looks good to me. I'm a bit worried because the lookup code was taken > pretty much 1:1 from lldb (see > source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp). Does it have the same > bugs? > Yeah, I took a look at LLDB code, but it doesn't seem to have this bug: instead of storing parsed line table rows in a vector it passes them as an argument to callback, and can't search in this table. > > - Ben > > > > > On Wed, Jul 25, 2012 at 9:15 PM, Alexey Samsonov > wrote: > > Could you please take a look? > > > > (re-attaching the patch just in case) > > > > On Fri, Jul 20, 2012 at 4:35 PM, Alexey Samsonov > wrote: > > Hi! > > > > This patch fixes the representation of debug line table in DebugInfo > LLVM library. Instead of just collection of rows, debug line table for > compilation unit is now > > treated as the number of row ranges, describing sequences [1]. The > sequences are not always listed in the order of increasing address, so > > the previously used std::lower_bound() sometimes produced wrong results. > Now the instruction address lookup consists of two stages: finding the > > correct sequence, and searching for address in range of rows for this > sequence. > > > > [1] dwarfstd: "Sequence - A series of contiguous target machine > instructions. One compilation unit may emit multiple sequences > > (that is, not all instructions within a compilation unit are assumed to > be contiguous)" > > > > Code review: http://codereview.appspot.com/6423064/ > > > > -- > > Alexey Samsonov, MSK > > > > > > > > > > -- > > Alexey Samsonov, MSK > > > > -- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/f67e2ee3/attachment.html From glider at google.com Mon Aug 6 07:24:39 2012 From: glider at google.com (Alexander Potapenko) Date: Mon, 06 Aug 2012 12:24:39 -0000 Subject: [llvm-commits] [compiler-rt] r161320 - /compiler-rt/trunk/lib/asan/asan_allocator.cc Message-ID: <20120806122439.E7FE82A6C073@llvm.org> Author: glider Date: Mon Aug 6 07:24:39 2012 New Revision: 161320 URL: http://llvm.org/viewvc/llvm-project?rev=161320&view=rev Log: AllocationSize(ptr) should check that |ptr| actually points to the beginning of the chunk it belongs to. Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=86 Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=161320&r1=161319&r2=161320&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/asan_allocator.cc (original) +++ compiler-rt/trunk/lib/asan/asan_allocator.cc Mon Aug 6 07:24:39 2012 @@ -377,10 +377,11 @@ if (!ptr) return 0; ScopedLock lock(&mu_); - // first, check if this is our memory - PageGroup *g = FindPageGroupUnlocked(ptr); - if (!g) return 0; - AsanChunk *m = PtrToChunk(ptr); + // Make sure this is our chunk and |ptr| actually points to the beginning + // of the allocated memory. + AsanChunk *m = FindChunkByAddr(ptr); + if (!m || m->Beg() != ptr) return 0; + if (m->chunk_state == CHUNK_ALLOCATED) { return m->used_size; } else { From samsonov at google.com Mon Aug 6 08:00:22 2012 From: samsonov at google.com (Alexey Samsonov) Date: Mon, 06 Aug 2012 13:00:22 -0000 Subject: [llvm-commits] [compiler-rt] r161321 - in /compiler-rt/trunk/lib/asan: asan_flags.h asan_rtl.cc asan_stack.cc output_tests/test_output.sh output_tests/use-after-free.c Message-ID: <20120806130022.27EE22A6C073@llvm.org> Author: samsonov Date: Mon Aug 6 08:00:21 2012 New Revision: 161321 URL: http://llvm.org/viewvc/llvm-project?rev=161321&view=rev Log: [ASan] add new ASan option 'strip_path_prefix' to remove useless prefices from filenames in stack traces Modified: compiler-rt/trunk/lib/asan/asan_flags.h compiler-rt/trunk/lib/asan/asan_rtl.cc compiler-rt/trunk/lib/asan/asan_stack.cc compiler-rt/trunk/lib/asan/output_tests/test_output.sh compiler-rt/trunk/lib/asan/output_tests/use-after-free.c Modified: compiler-rt/trunk/lib/asan/asan_flags.h URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.h?rev=161321&r1=161320&r2=161321&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/asan_flags.h (original) +++ compiler-rt/trunk/lib/asan/asan_flags.h Mon Aug 6 08:00:21 2012 @@ -87,6 +87,8 @@ // By default, disable core dumper on 64-bit - it makes little sense // to dump 16T+ core. bool disable_core; + // Strips this prefix from file paths in error reports. + const char *strip_path_prefix; }; Flags *flags(); Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=161321&r1=161320&r2=161321&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/asan_rtl.cc (original) +++ compiler-rt/trunk/lib/asan/asan_rtl.cc Mon Aug 6 08:00:21 2012 @@ -35,7 +35,7 @@ while (1) { } } if (flags()->sleep_before_dying) { - Report("Sleeping for %zd second(s)\n", flags()->sleep_before_dying); + Report("Sleeping for %d second(s)\n", flags()->sleep_before_dying); SleepForSeconds(flags()->sleep_before_dying); } if (flags()->unmap_shadow_on_exit) @@ -96,6 +96,7 @@ ParseFlag(str, &f->abort_on_error, "abort_on_error"); ParseFlag(str, &f->atexit, "atexit"); ParseFlag(str, &f->disable_core, "disable_core"); + ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix"); } extern "C" { @@ -128,6 +129,7 @@ f->abort_on_error = false; f->atexit = false; f->disable_core = (__WORDSIZE == 64); + f->strip_path_prefix = ""; // Override from user-specified string. ParseFlagsFromString(f, __asan_default_options()); Modified: compiler-rt/trunk/lib/asan/asan_stack.cc URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_stack.cc?rev=161321&r1=161320&r2=161321&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/asan_stack.cc (original) +++ compiler-rt/trunk/lib/asan/asan_stack.cc Mon Aug 6 08:00:21 2012 @@ -26,6 +26,13 @@ namespace __asan { +static const char *StripPathPrefix(const char *filepath) { + const char *path_prefix = flags()->strip_path_prefix; + if (filepath == internal_strstr(filepath, path_prefix)) + return filepath + internal_strlen(path_prefix); + return filepath; +} + // ----------------------- AsanStackTrace ----------------------------- {{{1 // PCs in stack traces are actually the return addresses, that is, // addresses of the next instructions after the call. That's why we @@ -46,7 +53,10 @@ pc = patch_pc(pc); char buff[4096]; ASAN_USE_EXTERNAL_SYMBOLIZER((void*)pc, buff, sizeof(buff)); - AsanPrintf(" #%zu 0x%zx %s\n", i, pc, buff); + // We can't know anything about the string returned by external + // symbolizer, but if it starts with filename, try to strip path prefix + // from it. + AsanPrintf(" #%zu 0x%zx %s\n", i, pc, StripPathPrefix(buff)); } } @@ -72,9 +82,11 @@ AsanPrintf(" in %s", info.function); } if (info.file) { - AsanPrintf(" %s:%d:%d", info.file, info.line, info.column); + AsanPrintf(" %s:%d:%d", StripPathPrefix(info.file), info.line, + info.column); } else if (info.module) { - AsanPrintf(" (%s+0x%zx)", info.module, info.module_offset); + AsanPrintf(" (%s+0x%zx)", StripPathPrefix(info.module), + info.module_offset); } AsanPrintf("\n"); info.Clear(); @@ -85,8 +97,8 @@ char filename[4096]; if (proc_maps.GetObjectNameAndOffset(pc, &offset, filename, sizeof(filename))) { - AsanPrintf(" #%zu 0x%zx (%s+0x%zx)\n", frame_num, pc, filename, - offset); + AsanPrintf(" #%zu 0x%zx (%s+0x%zx)\n", + frame_num, pc, StripPathPrefix(filename), offset); } else { AsanPrintf(" #%zu 0x%zx\n", frame_num, pc); } Modified: compiler-rt/trunk/lib/asan/output_tests/test_output.sh URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/test_output.sh?rev=161321&r1=161320&r2=161321&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/output_tests/test_output.sh (original) +++ compiler-rt/trunk/lib/asan/output_tests/test_output.sh Mon Aug 6 08:00:21 2012 @@ -39,6 +39,13 @@ export ASAN_OPTIONS="" rm ./a.out +echo "Checking strip_path_prefix option" +$CC -g -faddress-sanitizer -O2 $C_TEST.c +export ASAN_OPTIONS="strip_path_prefix='/'" +./a.out 2>&1 | $FILE_CHECK $C_TEST.c --check-prefix=CHECKSTRIP +export ASAN_OPTIONS="" +rm ./a.out + # FIXME: some tests do not need to be ran for all the combinations of arch # and optimization mode. for t in *.cc; do Modified: compiler-rt/trunk/lib/asan/output_tests/use-after-free.c URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/use-after-free.c?rev=161321&r1=161320&r2=161321&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/output_tests/use-after-free.c (original) +++ compiler-rt/trunk/lib/asan/output_tests/use-after-free.c Mon Aug 6 08:00:21 2012 @@ -7,3 +7,4 @@ // CHECK: heap-use-after-free // CHECKSLEEP: Sleeping for 1 second +// CHECKSTRIP-NOT: #0 0x{{.*}} ({{[/].*}}) From hkultala at cs.tut.fi Mon Aug 6 09:39:11 2012 From: hkultala at cs.tut.fi (Heikki Kultala) Date: Mon, 06 Aug 2012 17:39:11 +0300 Subject: [llvm-commits] [PATCH] Adding v*i1 MVTs In-Reply-To: <20120803160336.47e1633e@sapling2> References: <20120803144537.17e4b0e1@sapling2> <384BDE00-BFB0-4FB7-8128-8F2B75FA8112@apple.com> <20120803160336.47e1633e@sapling2> Message-ID: <501FD70F.7060103@cs.tut.fi> On 08/04/2012 12:03 AM, Hal Finkel wrote: > On Fri, 03 Aug 2012 13:50:26 -0700 > Chris Lattner wrote: > >> >> On Aug 3, 2012, at 12:45 PM, Hal Finkel wrote: >> >>> Please review the attached patch which adds v*i1 MVTs. I need these >>> for properly representing the output of vectorized selects and >>> boolean operations on the BG/Q supercomputer (v4i1 specifically). >>> As others have also expressed an interest in these, and in the name >>> of limiting the number of renumbering patches, this patch adds v2i1 >>> through v64i1. >>> >>> Heikki, will this meet your needs as well? >>> >>> Micah, this patch obviously affects the same renumbering as your<2 >>> x [i8|i16]> patch. Maybe we should combine them? >> >> I'm not opposed to this, but please only add the specific VTs you >> need. We don't want to preemptively add dead code. > > Fair enough. > > Heikki had specifically mentioned wanting v2 through v16i1. I can > certainly stick to those (or I can just add v4i1, which I need, and > let the TCE folks propose their own patch). Currently TCE supports 8-wide vectors so we need v2i1, v4i1, v8i1, but we are planning to experiment with 16-wide vectors which would mean need for also v16i1, v16f32. Adding support for just v2i1, v4i1, v8i1 will make us happy for the next couple of months ;) From samsonov at google.com Mon Aug 6 10:13:22 2012 From: samsonov at google.com (Alexey Samsonov) Date: Mon, 06 Aug 2012 15:13:22 -0000 Subject: [llvm-commits] [compiler-rt] r161322 - /compiler-rt/trunk/lib/asan/asan_malloc_linux.cc Message-ID: <20120806151322.8227B2A6C073@llvm.org> Author: samsonov Date: Mon Aug 6 10:13:22 2012 New Revision: 161322 URL: http://llvm.org/viewvc/llvm-project?rev=161322&view=rev Log: [ASan] fix names of malloc/free replacements on Android Modified: compiler-rt/trunk/lib/asan/asan_malloc_linux.cc Modified: compiler-rt/trunk/lib/asan/asan_malloc_linux.cc URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_linux.cc?rev=161322&r1=161321&r2=161322&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/asan_malloc_linux.cc (original) +++ compiler-rt/trunk/lib/asan/asan_malloc_linux.cc Mon Aug 6 10:13:22 2012 @@ -21,6 +21,12 @@ #include "asan_stack.h" #ifdef ANDROID +DECLARE_REAL_AND_INTERCEPTOR(void*, malloc, uptr size); +DECLARE_REAL_AND_INTERCEPTOR(void, free, void *ptr); +DECLARE_REAL_AND_INTERCEPTOR(void*, calloc, uptr nmemb, uptr size); +DECLARE_REAL_AND_INTERCEPTOR(void*, realloc, void *ptr, uptr size); +DECLARE_REAL_AND_INTERCEPTOR(void*, memalign, uptr boundary, uptr size); + struct MallocDebug { void* (*malloc)(uptr bytes); void (*free)(void* mem); @@ -30,7 +36,7 @@ }; const MallocDebug asan_malloc_dispatch ALIGNED(32) = { - malloc, free, calloc, realloc, memalign + WRAP(malloc), WRAP(free), WRAP(calloc), WRAP(realloc), WRAP(memalign) }; extern "C" const MallocDebug* __libc_malloc_dispatch; From dhill at mindcry.org Mon Aug 6 11:20:14 2012 From: dhill at mindcry.org (David Hill) Date: Mon, 6 Aug 2012 12:20:14 -0400 Subject: [llvm-commits] [PATCH] Add support for Bitrig, an OpenBSD fork. In-Reply-To: <20120804132239.GA14539@545b10c9a28a38e43c5f6dc54dff98b1e3766b5781c7c992> References: <20120801143059.GA19699@2b4c76bd04465534c8dd11d37c4fced523619b32ed53713f> <20120804132239.GA14539@545b10c9a28a38e43c5f6dc54dff98b1e3766b5781c7c992> Message-ID: <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> On Sat, Aug 04, 2012 at 09:22:40AM -0400, David Hill wrote: > On Wed, Aug 01, 2012 at 05:05:22PM -0700, Eli Friedman wrote: > >On Wed, Aug 1, 2012 at 7:30 AM, David Hill wrote: > >> Hello, > >> > >> The attached patch allows LLVM to recognize Bitrig, an OpenBSD fork. > >> Clang bits to come after this has been accepted. > >> > >> Please review. > > > >I can't really review the autoconf changes. > > > >+ // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split > >+ // into two .words. > >+ if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && > >+ T.getArch() == Triple::x86) > > > >Does Bitrig actually have this bug? If so, why don't you just fix it? > > > >-Eli > > Ping > Any objections to this going in? > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From marco at peereboom.us Mon Aug 6 11:43:08 2012 From: marco at peereboom.us (Marco Peereboom) Date: Mon, 06 Aug 2012 11:43:08 -0500 Subject: [llvm-commits] [PATCH] Add support for Bitrig, an OpenBSD fork. In-Reply-To: <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> References: <20120801143059.GA19699@2b4c76bd04465534c8dd11d37c4fced523619b32ed53713f> <20120804132239.GA14539@545b10c9a28a38e43c5f6dc54dff98b1e3766b5781c7c992> <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> Message-ID: <501FF41C.1040304@peereboom.us> On 08/06/12 11:20, David Hill wrote: > > On Sat, Aug 04, 2012 at 09:22:40AM -0400, David Hill wrote: >> On Wed, Aug 01, 2012 at 05:05:22PM -0700, Eli Friedman wrote: >>> On Wed, Aug 1, 2012 at 7:30 AM, David Hill wrote: >>>> Hello, >>>> >>>> The attached patch allows LLVM to recognize Bitrig, an OpenBSD fork. >>>> Clang bits to come after this has been accepted. >>>> >>>> Please review. >>> >>> I can't really review the autoconf changes. >>> >>> + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split >>> + // into two .words. >>> + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && >>> + T.getArch() == Triple::x86) >>> >>> Does Bitrig actually have this bug? If so, why don't you just fix it? >>> >>> -Eli >> >> Ping >> > > Any objections to this going in? I'd love to see this getting committed so that we can move on to the clang bits. From ganna at apple.com Mon Aug 6 12:29:33 2012 From: ganna at apple.com (Anna Zaks) Date: Mon, 06 Aug 2012 10:29:33 -0700 Subject: [llvm-commits] PATCH: Inserting LLVM code inside compiler-rt libraries In-Reply-To: References: Message-ID: <88FFE83D-1AE0-4BBF-84A7-D944EE805298@apple.com> On Aug 2, 2012, at 11:09 AM, Chandler Carruth wrote: > On Thu, Aug 2, 2012 at 10:59 AM, Alexey Samsonov wrote: > Hi, llvm-commits > > Here: http://codereview.appspot.com/6458066/ is the short experimental FYI-patch that allows LLVM sources to be "compiled into" static compiler-rt libraries in CMake build system. Any plans on updating the autoconf+make build system as well? > (I'm not sure that is smart enough to capture all dependencies, though). > With something that simple we can: > 1) directly use LLVM code from compiler-rt libraries. > 2) workaround the unavailable compilation of llvm libraries for several targets: each static compiler-rt lib will contain its own private copy of LLVM libs, compiled for necessary target and with necessary compile flags. > > I've not looked at the patch yet, but some initial points... I'm a bit sad to start *another* thread, much of this was discussed in my RFC thread from some time ago, but here is a re-cap: > > And there are multiple drawbacks: > 1) License issues (LLVM code has binary redistribution clause, right? So everything built with "clang -faddress-sanitizer" would attribute LLVM license, gr-r-r). > > We are looking into fixing this, I'm fairly confident that in one form or another, this will largely be a temporary issue. Let's not discuss that to death here. > > 2) Static ASan runtime is now 10x larger (2,5M vs 250K), while most of its functionality (various stuff from LLVMSupport) is not needed. > > This is simply poor structuring of the library, or misbehavior by the linker. We should figure out what's causing it and fix this. > > 3) Symbol name clashes - suppose one want to build something with ASan and link against "normal" version of LLVMSupport. (can compiling the code with -fvisibility=hidden, as we currently do, help with this?) > > -fvisibility=hidden won't help at all. > > This is what my RFC was about, specifically solving this problem. Perhaps we should actually go that route? ;] It keeps coming up, and there is a fairly direct solution that is a "small matter of code" to achieve. > > Does this direction look promising to you? > > Yes. > > Maybe, we should turn to using DSO instead? > > We could in theory, but I was under the distinct impression that DSO-s were a non-starter for several different reasons: > > 1) Introduces complex rpath requirements into binaries, making distribution even harder. > 2) Introduces small performance overhead into the runtime library in all cases... Maybe we could live with this though. > 3) Introduces dramatic performance overhead into TLS for the runtime library, a likely deal-breaker for tsan. Suppose only LLVMSupport is pulled out into a separate DSO. Would the overhead be the same as making all of compiler-rt a separate dynamic library? If we only use it to symbolicate the trace after an error is hit, the performance overhead could be much smaller. > > To elaborate on #1 a bit, I'm not very enthusiastic about a strategy that *precludes* a statically linked binary from using the full runtime library. It also will limit the reach of asan on platforms which don't have a good DSO story or where it would be infeasible to get the DSO in place.... We have very real world use cases that fall into this category. > > > The drawbacks of the DSO approach seem fundamental to the technology used. The drawbacks to the static library seem like solvable technical challenges we need to write some code to deal with. There is an advantage to using a dynamic library for compiler-rt on Darwin. To ensure there is only one copy of asan_init (and the data structures used by it) around, we link the compiler-rt library only into the executable. The current solution does not allow instrumenting a dynamic library (without instrumenting an executable as well). This is a major limitation and complicating the distribution(#1) seems like a reasonable price to pay at least for ASan, where the performance overhead should not be substantial. > _______________________________________________ > 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/20120806/ffe0c81a/attachment.html From echristo at apple.com Mon Aug 6 12:46:04 2012 From: echristo at apple.com (Eric Christopher) Date: Mon, 06 Aug 2012 10:46:04 -0700 Subject: [llvm-commits] [PATCH] Add support for Bitrig, an OpenBSD fork. In-Reply-To: <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> References: <20120801143059.GA19699@2b4c76bd04465534c8dd11d37c4fced523619b32ed53713f> <20120804132239.GA14539@545b10c9a28a38e43c5f6dc54dff98b1e3766b5781c7c992> <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> Message-ID: On Aug 6, 2012, at 9:20 AM, David Hill wrote: > > On Sat, Aug 04, 2012 at 09:22:40AM -0400, David Hill wrote: >> On Wed, Aug 01, 2012 at 05:05:22PM -0700, Eli Friedman wrote: >>> On Wed, Aug 1, 2012 at 7:30 AM, David Hill wrote: >>>> Hello, >>>> >>>> The attached patch allows LLVM to recognize Bitrig, an OpenBSD fork. >>>> Clang bits to come after this has been accepted. >>>> >>>> Please review. >>> >>> I can't really review the autoconf changes. >>> >>> + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split >>> + // into two .words. >>> + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && >>> + T.getArch() == Triple::x86) >>> >>> Does Bitrig actually have this bug? If so, why don't you just fix it? >>> >>> -Eli >> >> Ping >> > > Any objections to this going in? Seems like not, send me an up to date patch and I'll commit it. -eric From chandlerc at google.com Mon Aug 6 12:46:28 2012 From: chandlerc at google.com (Chandler Carruth) Date: Mon, 6 Aug 2012 10:46:28 -0700 Subject: [llvm-commits] PATCH: Inserting LLVM code inside compiler-rt libraries In-Reply-To: <88FFE83D-1AE0-4BBF-84A7-D944EE805298@apple.com> References: <88FFE83D-1AE0-4BBF-84A7-D944EE805298@apple.com> Message-ID: On Mon, Aug 6, 2012 at 10:29 AM, Anna Zaks wrote: > > On Aug 2, 2012, at 11:09 AM, Chandler Carruth wrote: > > On Thu, Aug 2, 2012 at 10:59 AM, Alexey Samsonov wrote: > >> Hi, llvm-commits >> >> Here: http://codereview.appspot.com/6458066/ is the short experimental >> FYI-patch that allows LLVM sources to be "compiled into" static compiler-rt >> libraries in CMake build system. >> > > Any plans on updating the autoconf+make build system as well? > I cannot even read the makefiles of compiler-rt. I don't want to touch them, and have encouraged others not to touch them as a consequence. I think you'll need to talk to ddunbar, last time I complained about the poor readability and maintainability of that make system he told me he would just implement whatever we needed.... > > (I'm not sure that is smart enough to capture all dependencies, though). >> With something that simple we can: >> 1) directly use LLVM code from compiler-rt libraries. >> 2) workaround the unavailable compilation of llvm libraries for several >> targets: each static compiler-rt lib will contain its own private copy of >> LLVM libs, compiled for necessary target and with necessary compile flags. >> > > I've not looked at the patch yet, but some initial points... I'm a bit sad > to start *another* thread, much of this was discussed in my RFC thread from > some time ago, but here is a re-cap: > > >> And there are multiple drawbacks: >> 1) License issues (LLVM code has binary redistribution clause, right? So >> everything built with "clang -faddress-sanitizer" would attribute LLVM >> license, gr-r-r). >> > > We are looking into fixing this, I'm fairly confident that in one form or > another, this will largely be a temporary issue. Let's not discuss that to > death here. > > >> 2) Static ASan runtime is now 10x larger (2,5M vs 250K), while most of >> its functionality (various stuff from LLVMSupport) is not needed. >> > > This is simply poor structuring of the library, or misbehavior by the > linker. We should figure out what's causing it and fix this. > > >> 3) Symbol name clashes - suppose one want to build something with ASan >> and link against "normal" version of LLVMSupport. (can compiling the code >> with -fvisibility=hidden, as we currently do, help with this?) >> > > -fvisibility=hidden won't help at all. > > This is what my RFC was about, specifically solving this problem. Perhaps > we should actually go that route? ;] It keeps coming up, and there is a > fairly direct solution that is a "small matter of code" to achieve. > > Does this direction look promising to you? >> > > Yes. > > >> Maybe, we should turn to using DSO instead? >> > > We could in theory, but I was under the distinct impression that DSO-s > were a non-starter for several different reasons: > > 1) Introduces complex rpath requirements into binaries, making > distribution even harder. > 2) Introduces small performance overhead into the runtime library in all > cases... Maybe we could live with this though. > 3) Introduces dramatic performance overhead into TLS for the runtime > library, a likely deal-breaker for tsan. > > > Suppose only LLVMSupport is pulled out into a separate DSO. Would the > overhead be the same as making all of compiler-rt a separate dynamic > library? If we only use it to symbolicate the trace after an error is hit, > the performance overhead could be much smaller. > This might work for asan, but my impression is it would not work for tsan. There, we need to filter errors based on the symbolized backtrace, so it won't just be in the error-path. Also, this is a short term solution rather than a long term solution. We will want to share more code further down the road, so I would like to continue to push for a better long-term solution. > > > To elaborate on #1 a bit, I'm not very enthusiastic about a strategy that > *precludes* a statically linked binary from using the full runtime library. > It also will limit the reach of asan on platforms which don't have a good > DSO story or where it would be infeasible to get the DSO in place.... We > have very real world use cases that fall into this category. > > > The drawbacks of the DSO approach seem fundamental to the technology used. > The drawbacks to the static library seem like solvable technical challenges > we need to write some code to deal with. > > > There is an advantage to using a dynamic library for compiler-rt on > Darwin. To ensure there is only one copy of asan_init (and the data > structures used by it) around, we link the compiler-rt library only into > the executable. The current solution does not allow instrumenting a dynamic > library (without instrumenting an executable as well). This is a major > limitation and complicating the distribution(#1) seems like a reasonable > price to pay at least for ASan, where the performance overhead should not > be substantial. > Sorry, I should have been more clear. I very much like preserving the ability to do *both* DSO and static library. It's precluding either strategy that seems bad to me because, as you point out, they both have their time, place, and purpose. As it happens, if we can solve the problem for a statically linked runtime library, I believe building a single DSO for the entire runtime will be straight forward. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/ff78da84/attachment.html From rdivacky at freebsd.org Mon Aug 6 13:14:18 2012 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 06 Aug 2012 18:14:18 -0000 Subject: [llvm-commits] [llvm] r161328 - in /llvm/trunk/lib/Target: Sparc/SparcRegisterInfo.cpp XCore/XCoreFrameLowering.cpp XCore/XCoreFrameLowering.h Message-ID: <20120806181418.E2AD52A6C073@llvm.org> Author: rdivacky Date: Mon Aug 6 13:14:18 2012 New Revision: 161328 URL: http://llvm.org/viewvc/llvm-project?rev=161328&view=rev Log: Remove empty overrides of processFunctionBeforeFrameFinalized(). Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp llvm/trunk/lib/Target/XCore/XCoreFrameLowering.h Modified: llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp?rev=161328&r1=161327&r2=161328&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcRegisterInfo.cpp Mon Aug 6 13:14:18 2012 @@ -109,9 +109,6 @@ } } -void SparcRegisterInfo:: -processFunctionBeforeFrameFinalized(MachineFunction &MF) const {} - unsigned SparcRegisterInfo::getFrameRegister(const MachineFunction &MF) const { return SP::I6; } Modified: llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp?rev=161328&r1=161327&r2=161328&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp (original) +++ llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp Mon Aug 6 13:14:18 2012 @@ -371,8 +371,3 @@ false)); } } - -void XCoreFrameLowering:: -processFunctionBeforeFrameFinalized(MachineFunction &MF) const { - -} Modified: llvm/trunk/lib/Target/XCore/XCoreFrameLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreFrameLowering.h?rev=161328&r1=161327&r2=161328&view=diff ============================================================================== --- llvm/trunk/lib/Target/XCore/XCoreFrameLowering.h (original) +++ llvm/trunk/lib/Target/XCore/XCoreFrameLowering.h Mon Aug 6 13:14:18 2012 @@ -44,8 +44,6 @@ void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, RegScavenger *RS = NULL) const; - void processFunctionBeforeFrameFinalized(MachineFunction &MF) const; - //! Stack slot size (4 bytes) static int stackSlotSize() { return 4; From azanella at linux.vnet.ibm.com Mon Aug 6 13:11:57 2012 From: azanella at linux.vnet.ibm.com (Adhemerval Zanella) Date: Mon, 06 Aug 2012 15:11:57 -0300 Subject: [llvm-commits] [RFC] PPC64 TOC and MCJIT support Message-ID: <502008ED.3000703@linux.vnet.ibm.com> Although the patch is still WIP and requires a lot of work, I'd appreciate some advices and feedback for my modifications. As I stated em previous emails, although llvm generates working code for PPC32, it lacks some functionality for PPC64, mainly the TOC usage for PIC and PIE generation. This patch is based on previous email and feedback I got to add support for TOC and the PPC64 relocation needed for both JIT and assembly. Currently the assembly generated creates the @toc relocation correctly instead of @ha/@lo, that works on mostly cases, but are not full PIC and PIE. The testcase result remains the same, so next step I add PPC64 toc testcase to fully test the TOC code generation. --- Index: include/llvm/Object/ELF.h =================================================================== --- include/llvm/Object/ELF.h (revision 161325) +++ include/llvm/Object/ELF.h (working copy) @@ -2015,6 +2015,8 @@ return "ELF32-arm"; case ELF::EM_HEXAGON: return "ELF32-hexagon"; + case ELF::EM_PPC: + return "ELF32-ppc"; default: return "ELF32-unknown"; } @@ -2024,6 +2026,8 @@ return "ELF64-i386"; case ELF::EM_X86_64: return "ELF64-x86-64"; + case ELF::EM_PPC64: + return "ELF64-ppc64"; default: return "ELF64-unknown"; } @@ -2044,6 +2048,10 @@ return Triple::arm; case ELF::EM_HEXAGON: return Triple::hexagon; + case ELF::EM_PPC: + return Triple::ppc; + case ELF::EM_PPC64: + return Triple::ppc64; default: return Triple::UnknownArch; } Index: include/llvm/Support/ELF.h =================================================================== --- include/llvm/Support/ELF.h (revision 161325) +++ include/llvm/Support/ELF.h (working copy) @@ -441,6 +441,7 @@ R_MICROBLAZE_COPY = 21 }; +// ELF Relocation types for PPC32 enum { R_PPC_NONE = 0, /* No relocation. */ R_PPC_ADDR32 = 1, @@ -459,6 +460,19 @@ R_PPC_REL32 = 26 }; +// ELF Relocation types for PPC64 +enum { + R_PPC64_ADDR16_LO = 4, + R_PPC64_ADDR16_HA = 6, + R_PPC64_ADDR14 = 7, + R_PPC64_REL24 = 10, + R_PPC64_ADDR64 = 38, + R_PPC64_TOC16_LO = 48, + R_PPC64_TOC16_HI = 49, + R_PPC64_TOC16_HA = 50, + R_PPC64_TOC16_DS = 63 +}; + // ARM Specific e_flags enum { EF_ARM_EABIMASK = 0xFF000000U }; Index: lib/Target/PowerPC/PPCCodeEmitter.cpp =================================================================== --- lib/Target/PowerPC/PPCCodeEmitter.cpp (revision 161325) +++ lib/Target/PowerPC/PPCCodeEmitter.cpp (working copy) @@ -66,8 +66,12 @@ unsigned getHA16Encoding(const MachineInstr &MI, unsigned OpNo) const; unsigned getLO16Encoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getTOCHA16Encoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getTOCLO16Encoding(const MachineInstr &MI, unsigned OpNo) const; unsigned getMemRIEncoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getMemRITOCEncoding(const MachineInstr &MI, unsigned OpNo) const; unsigned getMemRIXEncoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getMemRIXTOCEncoding(const MachineInstr &MI, unsigned OpNo) const; const char *getPassName() const { return "PowerPC Machine Code Emitter"; } @@ -211,6 +215,24 @@ return 0; } +unsigned PPCCodeEmitter::getTOCHA16Encoding(const MachineInstr &MI, + unsigned OpNo) const { + const MachineOperand &MO = MI.getOperand(OpNo); + if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO); + + MCE.addRelocation(GetRelocation(MO, PPC::reloc_toc_high)); + return 0; +} + +unsigned PPCCodeEmitter::getTOCLO16Encoding(const MachineInstr &MI, + unsigned OpNo) const { + const MachineOperand &MO = MI.getOperand(OpNo); + if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO); + + MCE.addRelocation(GetRelocation(MO, PPC::reloc_toc_low)); + return 0; +} + unsigned PPCCodeEmitter::getMemRIEncoding(const MachineInstr &MI, unsigned OpNo) const { // Encode (imm, reg) as a memri, which has the low 16-bits as the @@ -227,6 +249,21 @@ return RegBits; } +unsigned PPCCodeEmitter::getMemRITOCEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // Encode (imm, reg) as TOC base memri, which might generated a TOC relocation + assert(MI.getOperand(OpNo+1).isReg()); + unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo+1)) << 14; + + const MachineOperand &MO = MI.getOperand(OpNo); + if (MO.isImm()) + return (getMachineOpValue(MI, MO) & 0xFFFF) | RegBits; + + // Add a fixup for the displacement field. + MCE.addRelocation(GetRelocation(MO, PPC::reloc_toc_low)); + return RegBits; +} + unsigned PPCCodeEmitter::getMemRIXEncoding(const MachineInstr &MI, unsigned OpNo) const { // Encode (imm, reg) as a memrix, which has the low 14-bits as the @@ -242,6 +279,20 @@ return RegBits; } +unsigned PPCCodeEmitter::getMemRIXTOCEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // Encode (imm, reg) as a memrix, which has the low 14-bits as the + // displacement and the next 5 bits as the register #. + assert(MI.getOperand(OpNo+1).isReg()); + unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo+1)) << 14; + + const MachineOperand &MO = MI.getOperand(OpNo); + if (MO.isImm()) + return (getMachineOpValue(MI, MO) & 0x3FFF) | RegBits; + + MCE.addRelocation(GetRelocation(MO, PPC::reloc_toc_low_ix)); + return RegBits; +} unsigned PPCCodeEmitter::getMachineOpValue(const MachineInstr &MI, const MachineOperand &MO) const { Index: lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp =================================================================== --- lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp (revision 161325) +++ lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp (working copy) @@ -43,10 +43,18 @@ SmallVectorImpl &Fixups) const; unsigned getLO16Encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const; + unsigned getTOCHA16Encoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const; + unsigned getTOCLO16Encoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const; unsigned getMemRIEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const; + unsigned getMemRITOCEncoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const; unsigned getMemRIXEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const; + unsigned getMemRIXTOCEncoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const; unsigned get_crbitm_encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const; @@ -128,6 +136,26 @@ return 0; } +unsigned PPCMCCodeEmitter::getTOCHA16Encoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const { + const MCOperand &MO = MI.getOperand(OpNo); + if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups); + + Fixups.push_back(MCFixup::Create(0, MO.getExpr(), + (MCFixupKind)PPC::fixup_ppc_toc_ha16)); + return 0; +} + +unsigned PPCMCCodeEmitter::getTOCLO16Encoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const { + const MCOperand &MO = MI.getOperand(OpNo); + if (MO.isReg() || MO.isImm()) return getMachineOpValue(MI, MO, Fixups); + + Fixups.push_back(MCFixup::Create(0, MO.getExpr(), + (MCFixupKind)PPC::fixup_ppc_toc_lo16)); + return 0; +} + unsigned PPCMCCodeEmitter::getMemRIEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const { // Encode (imm, reg) as a memri, which has the low 16-bits as the @@ -145,6 +173,21 @@ return RegBits; } +unsigned PPCMCCodeEmitter::getMemRITOCEncoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const { + // Encode (imm, reg) as TOC base memri, which might generated a TOC relocation + assert(MI.getOperand(OpNo+1).isReg()); + unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo+1), Fixups) << 14; + + const MCOperand &MO = MI.getOperand(OpNo); + if (MO.isImm()) + return (getMachineOpValue(MI, MO, Fixups) & 0xFFFF) | RegBits; + + // Add a fixup for the displacement field. + Fixups.push_back(MCFixup::Create(0, MO.getExpr(), + (MCFixupKind)PPC::fixup_ppc_toc_lo16)); + return RegBits; +} unsigned PPCMCCodeEmitter::getMemRIXEncoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const { @@ -163,7 +206,23 @@ return RegBits; } +unsigned PPCMCCodeEmitter::getMemRIXTOCEncoding(const MCInst &MI, unsigned OpNo, + SmallVectorImpl &Fixups) const { + // Encode (imm, reg) as TOC base memri, which might generated a TOC relocation + assert(MI.getOperand(OpNo+1).isReg()); + unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo+1), Fixups) << 14; + + const MCOperand &MO = MI.getOperand(OpNo); + if (MO.isImm()) + return (getMachineOpValue(MI, MO, Fixups) & 0x3FFF) | RegBits; + + // Add a fixup for the displacement field. + Fixups.push_back(MCFixup::Create(0, MO.getExpr(), + (MCFixupKind)PPC::fixup_ppc_toc_lo14)); + return RegBits; +} + unsigned PPCMCCodeEmitter:: get_crbitm_encoding(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups) const { Index: lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp =================================================================== --- lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp (revision 161325) +++ lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp (working copy) @@ -29,7 +29,11 @@ case FK_Data_1: case FK_Data_2: case FK_Data_4: + case FK_Data_8: return Value; + case PPC::fixup_ppc_lo14: + case PPC::fixup_ppc_toc_lo14: + return (Value & 0xffff) >> 2; case PPC::fixup_ppc_brcond14: return Value & 0x3ffc; case PPC::fixup_ppc_br24: @@ -41,6 +45,7 @@ case PPC::fixup_ppc_ha16: return ((Value >> 16) + ((Value & 0x8000) ? 1 : 0)) & 0xffff; case PPC::fixup_ppc_lo16: + case PPC::fixup_ppc_toc_lo16: return Value & 0xffff; } } @@ -72,7 +77,9 @@ { "fixup_ppc_brcond14", 16, 14, MCFixupKindInfo::FKF_IsPCRel }, { "fixup_ppc_lo16", 16, 16, 0 }, { "fixup_ppc_ha16", 16, 16, 0 }, - { "fixup_ppc_lo14", 16, 14, 0 } + { "fixup_ppc_lo14", 16, 14, 0 }, + { "fixup_ppc_toc_lo16", 16, 16, 0 }, + { "fixup_ppc_toc_ha16", 16, 16, 0 } }; if (Kind < FirstTargetFixupKind) Index: lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h =================================================================== --- lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h (revision 161325) +++ lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h (working copy) @@ -34,6 +34,16 @@ /// fixup_ppc_lo14 - A 14-bit fixup corresponding to lo16(_foo) for instrs /// like 'std'. fixup_ppc_lo14, + + /// fixup_ppc_toc_ha16 - A 16-bit fixup based on TOC value to ha16(symbol) + fixup_ppc_toc_ha16, + + /// fixup_ppc_toc_lo16 - A 16-bit fixup based on TOC value to lo16(symbol) + fixup_ppc_toc_lo16, + + /// fixup_ppc_toc_lo14 - A 14-bit fixup based on TOC value to lo16(symbol) + /// with implicity 2 zero bits + fixup_ppc_toc_lo14, // Marker LastTargetFixupKind, Index: lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp =================================================================== --- lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp (revision 161325) +++ lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp (working copy) @@ -72,6 +72,15 @@ case PPC::fixup_ppc_lo14: Type = ELF::R_PPC_ADDR14; break; + case PPC::fixup_ppc_toc_lo16: + Type = ELF::R_PPC64_TOC16_LO; + break; + case PPC::fixup_ppc_toc_lo14: + Type = ELF::R_PPC64_TOC16_DS; + break; + case FK_Data_8: + Type = ELF::R_PPC64_ADDR64; + break; case FK_Data_4: Type = ELF::R_PPC_ADDR32; break; Index: lib/Target/PowerPC/PPCRelocations.h =================================================================== --- lib/Target/PowerPC/PPCRelocations.h (revision 161325) +++ lib/Target/PowerPC/PPCRelocations.h (working copy) @@ -48,7 +48,21 @@ // reloc_absolute_low_ix - Absolute relocation for the 64-bit load/store // instruction which have two implicit zero bits. - reloc_absolute_low_ix + reloc_absolute_low_ix, + + // reloc_toc_high - TOC relative relocation for 64-bit loadhi instruction + // Add the high 16-bits of the relative TOC address into the low 16-bits + // of the instruction + reloc_toc_high, + + // reloc_toc_low - TOC relative relocation for 64-bit la instruction + // Add the high 16-bits of the relative TOC address into the low 16-bits + // of the instruction + reloc_toc_low, + + // reloc_toc_low_ix - TOC relative relocation for 64-bit load/store + // instruction which have two implicet zero bits. + reloc_toc_low_ix }; } } Index: lib/Target/PowerPC/PPCInstr64Bit.td =================================================================== --- lib/Target/PowerPC/PPCInstr64Bit.td (revision 161325) +++ lib/Target/PowerPC/PPCInstr64Bit.td (working copy) @@ -23,12 +23,22 @@ } def symbolHi64 : Operand { let PrintMethod = "printSymbolHi"; - let EncoderMethod = "getHA16Encoding"; + let EncoderMethod = "getTOCHA16Encoding"; } def symbolLo64 : Operand { let PrintMethod = "printSymbolLo"; - let EncoderMethod = "getLO16Encoding"; + let EncoderMethod = "getTOCLO16Encoding"; } +def memrtoci : Operand { // memrtoci is toc based imm access + let PrintMethod = "printMemRegImm"; + let MIOperandInfo = (ops i32imm:$imm, ptr_rc:$reg); + let EncoderMethod = "getMemRITOCEncoding"; +} +def memrtocix : Operand { // memrtoci is toc based imm with shifted 2 bits. + let PrintMethod = "printMemRegImmShifted"; + let MIOperandInfo = (ops i32imm:$imm, ptr_rc:$reg); + let EncoderMethod = "getMemRIXTOCEncoding"; +} //===----------------------------------------------------------------------===// // 64-bit transformation functions. @@ -271,7 +281,7 @@ PPC970_DGroup_First, PPC970_Unit_FXU; let Defs = [X1], Uses = [X1] in -def DYNALLOC8 : Pseudo<(outs G8RC:$result), (ins G8RC:$negsize, memri:$fpsi),"", +def DYNALLOC8 : Pseudo<(outs G8RC:$result), (ins G8RC:$negsize, memrtoci:$fpsi),"", [(set G8RC:$result, (PPCdynalloc G8RC:$negsize, iaddr:$fpsi))]>; @@ -516,11 +526,11 @@ // Sign extending loads. let canFoldAsLoad = 1, PPC970_Unit = 2 in { -def LHA8: DForm_1<42, (outs G8RC:$rD), (ins memri:$src), +def LHA8: DForm_1<42, (outs G8RC:$rD), (ins memrtoci:$src), "lha $rD, $src", LdStLHA, [(set G8RC:$rD, (sextloadi16 iaddr:$src))]>, PPC970_DGroup_Cracked; -def LWA : DSForm_1<58, 2, (outs G8RC:$rD), (ins memrix:$src), +def LWA : DSForm_1<58, 2, (outs G8RC:$rD), (ins memrtocix:$src), "lwa $rD, $src", LdStLWA, [(set G8RC:$rD, (sextloadi32 ixaddr:$src))]>, isPPC64, PPC970_DGroup_Cracked; @@ -556,13 +566,13 @@ // Zero extending loads. let canFoldAsLoad = 1, PPC970_Unit = 2 in { -def LBZ8 : DForm_1<34, (outs G8RC:$rD), (ins memri:$src), +def LBZ8 : DForm_1<34, (outs G8RC:$rD), (ins memrtoci:$src), "lbz $rD, $src", LdStLoad, [(set G8RC:$rD, (zextloadi8 iaddr:$src))]>; -def LHZ8 : DForm_1<40, (outs G8RC:$rD), (ins memri:$src), +def LHZ8 : DForm_1<40, (outs G8RC:$rD), (ins memrtoci:$src), "lhz $rD, $src", LdStLoad, [(set G8RC:$rD, (zextloadi16 iaddr:$src))]>; -def LWZ8 : DForm_1<32, (outs G8RC:$rD), (ins memri:$src), +def LWZ8 : DForm_1<32, (outs G8RC:$rD), (ins memrtoci:$src), "lwz $rD, $src", LdStLoad, [(set G8RC:$rD, (zextloadi32 iaddr:$src))]>, isPPC64; @@ -579,15 +589,15 @@ // Update forms. let mayLoad = 1 in { -def LBZU8 : DForm_1<35, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memri:$addr), +def LBZU8 : DForm_1<35, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memrtoci:$addr), "lbzu $rD, $addr", LdStLoad, []>, RegConstraint<"$addr.reg = $ea_result">, NoEncode<"$ea_result">; -def LHZU8 : DForm_1<41, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memri:$addr), +def LHZU8 : DForm_1<41, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memrtoci:$addr), "lhzu $rD, $addr", LdStLoad, []>, RegConstraint<"$addr.reg = $ea_result">, NoEncode<"$ea_result">; -def LWZU8 : DForm_1<33, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memri:$addr), +def LWZU8 : DForm_1<33, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memrtoci:$addr), "lwzu $rD, $addr", LdStLoad, []>, RegConstraint<"$addr.reg = $ea_result">, NoEncode<"$ea_result">; @@ -613,13 +623,21 @@ // Full 8-byte loads. let canFoldAsLoad = 1, PPC970_Unit = 2 in { -def LD : DSForm_1<58, 0, (outs G8RC:$rD), (ins memrix:$src), +def LD : DSForm_1<58, 0, (outs G8RC:$rD), (ins memrtocix:$src), "ld $rD, $src", LdStLD, [(set G8RC:$rD, (load ixaddr:$src))]>, isPPC64; def LDtoc: Pseudo<(outs G8RC:$rD), (ins tocentry:$disp, G8RC:$reg), "", [(set G8RC:$rD, (PPCtoc_entry tglobaladdr:$disp, G8RC:$reg))]>, isPPC64; +def LDtocJTI: Pseudo<(outs G8RC:$rD), (ins tocentry:$disp, G8RC:$reg), + "", + [(set G8RC:$rD, + (PPCtoc_entry tjumptable:$disp, G8RC:$reg))]>, isPPC64; +def LDtocCPT: Pseudo<(outs G8RC:$rD), (ins tocentry:$disp, G8RC:$reg), + "", + [(set G8RC:$rD, + (PPCtoc_entry tconstpool:$disp, G8RC:$reg))]>, isPPC64; let hasSideEffects = 1 in { let RST = 2, DS_RA = 0 in // FIXME: Should be a pseudo. @@ -637,7 +655,7 @@ [(set G8RC:$rD, (load xaddr:$src))]>, isPPC64; let mayLoad = 1 in -def LDU : DSForm_1<58, 1, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memrix:$addr), +def LDU : DSForm_1<58, 1, (outs G8RC:$rD, ptr_rc:$ea_result), (ins memrtocix:$addr), "ldu $rD, $addr", LdStLD, []>, RegConstraint<"$addr.reg = $ea_result">, isPPC64, NoEncode<"$ea_result">; @@ -656,13 +674,13 @@ let PPC970_Unit = 2 in { // Truncating stores. -def STB8 : DForm_1<38, (outs), (ins G8RC:$rS, memri:$src), +def STB8 : DForm_1<38, (outs), (ins G8RC:$rS, memrtoci:$src), "stb $rS, $src", LdStStore, [(truncstorei8 G8RC:$rS, iaddr:$src)]>; -def STH8 : DForm_1<44, (outs), (ins G8RC:$rS, memri:$src), +def STH8 : DForm_1<44, (outs), (ins G8RC:$rS, memrtoci:$src), "sth $rS, $src", LdStStore, [(truncstorei16 G8RC:$rS, iaddr:$src)]>; -def STW8 : DForm_1<36, (outs), (ins G8RC:$rS, memri:$src), +def STW8 : DForm_1<36, (outs), (ins G8RC:$rS, memrtoci:$src), "stw $rS, $src", LdStStore, [(truncstorei32 G8RC:$rS, iaddr:$src)]>; def STBX8 : XForm_8<31, 215, (outs), (ins G8RC:$rS, memrr:$dst), @@ -678,7 +696,7 @@ [(truncstorei32 G8RC:$rS, xaddr:$dst)]>, PPC970_DGroup_Cracked; // Normal 8-byte stores. -def STD : DSForm_1<62, 0, (outs), (ins G8RC:$rS, memrix:$dst), +def STD : DSForm_1<62, 0, (outs), (ins G8RC:$rS, memrtocix:$dst), "std $rS, $dst", LdStSTD, [(store G8RC:$rS, ixaddr:$dst)]>, isPPC64; def STDX : XForm_8<31, 149, (outs), (ins G8RC:$rS, memrr:$dst), @@ -757,7 +775,7 @@ PPC970_DGroup_Cracked, isPPC64; // STD_32/STDX_32 - Just like STD/STDX, but uses a '32-bit' input register. -def STD_32 : DSForm_1<62, 0, (outs), (ins GPRC:$rT, memrix:$dst), +def STD_32 : DSForm_1<62, 0, (outs), (ins GPRC:$rT, memrtocix:$dst), "std $rT, $dst", LdStSTD, [(PPCstd_32 GPRC:$rT, ixaddr:$dst)]>, isPPC64; def STDX_32 : XForm_8<31, 149, (outs), (ins GPRC:$rT, memrr:$dst), Index: lib/Target/PowerPC/PPCISelLowering.cpp =================================================================== --- lib/Target/PowerPC/PPCISelLowering.cpp (revision 161325) +++ lib/Target/PowerPC/PPCISelLowering.cpp (working copy) @@ -106,7 +106,7 @@ // from FP_ROUND: that rounds to nearest, this rounds to zero. setOperationAction(ISD::FP_ROUND_INREG, MVT::ppcf128, Custom); - // We do not currently implment this libm ops for PowerPC. + // We do not currently implement this libm ops for PowerPC. setOperationAction(ISD::FFLOOR, MVT::ppcf128, Expand); setOperationAction(ISD::FCEIL, MVT::ppcf128, Expand); setOperationAction(ISD::FTRUNC, MVT::ppcf128, Expand); @@ -1204,6 +1204,14 @@ ConstantPoolSDNode *CP = cast(Op); const Constant *C = CP->getConstVal(); + // 64-bit SVR4 ABI code is always position-independent. + // The actual address of the GlobalValue is stored in the TOC. + if (PPCSubTarget.isSVR4ABI() && PPCSubTarget.isPPC64()) { + SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0); + return DAG.getNode(PPCISD::TOC_ENTRY, CP->getDebugLoc(), MVT::i64, GA, + DAG.getRegister(PPC::X2, MVT::i64)); + } + unsigned MOHiFlag, MOLoFlag; bool isPIC = GetLabelAccessInfo(DAG.getTarget(), MOHiFlag, MOLoFlag); SDValue CPIHi = @@ -1217,6 +1225,14 @@ EVT PtrVT = Op.getValueType(); JumpTableSDNode *JT = cast(Op); + // 64-bit SVR4 ABI code is always position-independent. + // The actual address of the GlobalValue is stored in the TOC. + if (PPCSubTarget.isSVR4ABI() && PPCSubTarget.isPPC64()) { + SDValue GA = DAG.getTargetJumpTable(JT->getIndex(), PtrVT); + return DAG.getNode(PPCISD::TOC_ENTRY, JT->getDebugLoc(), MVT::i64, GA, + DAG.getRegister(PPC::X2, MVT::i64)); + } + unsigned MOHiFlag, MOLoFlag; bool isPIC = GetLabelAccessInfo(DAG.getTarget(), MOHiFlag, MOLoFlag); SDValue JTIHi = DAG.getTargetJumpTable(JT->getIndex(), PtrVT, MOHiFlag); Index: lib/Target/PowerPC/PPCAsmPrinter.cpp =================================================================== --- lib/Target/PowerPC/PPCAsmPrinter.cpp (revision 161325) +++ lib/Target/PowerPC/PPCAsmPrinter.cpp (working copy) @@ -345,6 +345,29 @@ OutStreamer.EmitLabel(PICBase); return; } + case PPC::LDtocJTI: + case PPC::LDtocCPT: { + // Transform %X3 = LDtoc , %X2 + LowerPPCMachineInstrToMCInst(MI, TmpInst, *this, Subtarget.isDarwin()); + + // Change the opcode to LD, and the global address operand to be a + // reference to the TOC entry we will synthesize later. + TmpInst.setOpcode(PPC::LD); + const MachineOperand &MO = MI->getOperand(1); + assert(MO.isCPI() || MO.isJTI()); + + // Map symbol -> label of TOC entry + MCSymbol *&TOCEntry = TOC[GetCPISymbol(MO.getIndex())]; + if (TOCEntry == 0) + TOCEntry = GetTempSymbol("C", TOCLabelID++); + + const MCExpr *Exp = + MCSymbolRefExpr::Create(TOCEntry, MCSymbolRefExpr::VK_PPC_TOC, + OutContext); + TmpInst.getOperand(1) = MCOperand::CreateExpr(Exp); + OutStreamer.EmitInstruction(TmpInst); + return; + } case PPC::LDtoc: { // Transform %X3 = LDtoc , %X2 LowerPPCMachineInstrToMCInst(MI, TmpInst, *this, Subtarget.isDarwin()); @@ -423,7 +446,7 @@ bool isPPC64 = TD->getPointerSizeInBits() == 64; - if (isPPC64 && !TOC.empty()) { + if (isPPC64 && !TOC.empty() && OutStreamer.hasRawTextSupport()) { const MCSectionELF *Section = OutStreamer.getContext().getELFSection(".toc", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC, SectionKind::getReadOnly()); Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp =================================================================== --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (revision 161325) +++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (working copy) @@ -306,6 +306,85 @@ } } + +static inline +uint16_t ppc_lo (uint64_t value) +{ + return value & 0xffff; +} + +static inline +uint16_t ppc_hi (uint64_t value) +{ + return (value >> 16) & 0xffff; +} + +static inline +uint16_t ppc_ha (uint64_t value) +{ + return ppc_hi (value) + 0x8000; +} + +static inline +uint64_t ppc_bit_insert (uint64_t var, uint64_t val, uint64_t mask) +{ + return (var & ~mask) | (val & mask); +} + +void RuntimeDyldELF::resolvePPC64Relocation(uint8_t *LocalAddress, + uint64_t FinalAddress, + uint64_t Value, + uint32_t Type, + int64_t Addend) { + switch (Type) { + default: + llvm_unreachable("Relocation type not implemented yet!"); + break; + case ELF::R_PPC64_ADDR16_LO : + *(uint16_t*)(LocalAddress) = ppc_lo (Value); + break; + case ELF::R_PPC64_ADDR16_HA : + *(uint16_t*)(LocalAddress) = ppc_ha (Value); + break; + case ELF::R_PPC64_ADDR14 : + { + if (((Value + 0x8000) >= 0x10000) || ((Value & 3) != 0)) + llvm_unreachable("Relocation R_PPC64_ADDR14 overflow"); + int64_t insn = *(int64_t*)(LocalAddress); + // Performs (insn & FFFFFFFFFFFF0003) | (Value & 0xFFFC) + // On branch, bit 62 and 63 are ignoned + insn = ppc_bit_insert (insn, Value, 0xFFFC); + insn &= ~(1 << 21); + // insn & (0x14 << 21) checks is 'a' bit in branch is set + // 0 means no hint is given + if ((insn & (0x14 << 21)) == (0x04 << 21)) + // Sets the branch is very likely to be taken + insn |= 0x02 << 21; + else if ((insn & (0x14 << 21)) == (0x10 << 21)) + // Sets the branch is very likely to not be taken + insn |= 0x08 << 21; + *(int64_t*)(LocalAddress) = insn; + } break; + case ELF::R_PPC64_REL24 : + { + int32_t delta = static_cast(FinalAddress - Value); + if (delta << 6 >> 6 != delta) + llvm_unreachable("Relocation R_PPC64_REL24 overflow"); + uint32_t *Target = (uint32_t*)(LocalAddress); + *Target = (*Target & 0xFC000003) | (delta & 0x3FFFFFC); + } break; + case ELF::R_PPC64_ADDR64 : + *(uint64_t*)(LocalAddress) = Value; + break; + case ELF::R_PPC64_TOC16_LO: + // TODO + break; + case ELF::R_PPC64_TOC16_DS: + // TODO + break; + } +} + void RuntimeDyldELF::resolveRelocation(uint8_t *LocalAddress, uint64_t FinalAddress, uint64_t Value, @@ -326,6 +405,9 @@ (uint32_t)(Value & 0xffffffffL), Type, (uint32_t)(Addend & 0xffffffffL)); break; + case Triple::ppc64: + resolvePPC64Relocation(LocalAddress, FinalAddress, Value, Type, Addend); + break; default: llvm_unreachable("Unsupported CPU type!"); } } @@ -350,6 +432,8 @@ RelocationValueRef Value; // First search for the symbol in the local symbol table SymbolTableMap::const_iterator lsi = Symbols.find(TargetName.data()); + SymbolRef::Type SymType; + Symbol.getType(SymType); if (lsi != Symbols.end()) { Value.SectionID = lsi->second.first; Value.Addend = lsi->second.second; @@ -361,8 +445,6 @@ Value.SectionID = gsi->second.first; Value.Addend = gsi->second.second; } else { - SymbolRef::Type SymType; - Symbol.getType(SymType); switch (SymType) { case SymbolRef::ST_Debug: { // TODO: Now ELF SymbolRef::ST_Debug = STT_SECTION, it's not obviously @@ -423,6 +505,17 @@ Section.StubOffset, RelType, 0); Section.StubOffset += getMaxStubSize(); } + } else if (Arch == Triple::ppc64) { + if (RelType == ELF::R_PPC64_TOC16_LO) { + // This is a TOC based relocation - the final relocation values is based + // on Value minus TOC for the section. + } else { + RelocationEntry RE(Rel.SectionID, Rel.Offset, RelType, Value.Addend); + if (Value.SymbolName && (SymType == SymbolRef::ST_Function)) + addRelocationForSymbol(RE, Value.SymbolName); + else + addRelocationForSection(RE, Value.SectionID); + } } else { RelocationEntry RE(Rel.SectionID, Rel.Offset, RelType, Value.Addend); if (Value.SymbolName) Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h =================================================================== --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h (revision 161325) +++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h (working copy) @@ -42,6 +42,12 @@ uint32_t Type, int32_t Addend); + void resolvePPC64Relocation(uint8_t *LocalAddress, + uint64_t FinalAddress, + uint64_t Value, + uint32_t Type, + int64_t Addend); + virtual void resolveRelocation(uint8_t *LocalAddress, uint64_t FinalAddress, uint64_t Value, -- Adhemerval Zanella Netto Software Engineer Linux Technology Center Brazil Toolchain / GLIBC on Power Architecture azanella at linux.vnet.ibm.com / azanella at br.ibm.com +55 61 8642-9890 From ganna at apple.com Mon Aug 6 13:35:49 2012 From: ganna at apple.com (Anna Zaks) Date: Mon, 06 Aug 2012 11:35:49 -0700 Subject: [llvm-commits] PATCH: Inserting LLVM code inside compiler-rt libraries In-Reply-To: References: <88FFE83D-1AE0-4BBF-84A7-D944EE805298@apple.com> Message-ID: On Aug 6, 2012, at 10:46 AM, Chandler Carruth wrote: > On Mon, Aug 6, 2012 at 10:29 AM, Anna Zaks wrote: > > On Aug 2, 2012, at 11:09 AM, Chandler Carruth wrote: > >> On Thu, Aug 2, 2012 at 10:59 AM, Alexey Samsonov wrote: >> Hi, llvm-commits >> >> Here: http://codereview.appspot.com/6458066/ is the short experimental FYI-patch that allows LLVM sources to be "compiled into" static compiler-rt libraries in CMake build system. > > Any plans on updating the autoconf+make build system as well? > > I cannot even read the makefiles of compiler-rt. I don't want to touch them, and have encouraged others not to touch them as a consequence. I think you'll need to talk to ddunbar, last time I complained about the poor readability and maintainability of that make system he told me he would just implement whatever we needed.... > > >> (I'm not sure that is smart enough to capture all dependencies, though). >> With something that simple we can: >> 1) directly use LLVM code from compiler-rt libraries. >> 2) workaround the unavailable compilation of llvm libraries for several targets: each static compiler-rt lib will contain its own private copy of LLVM libs, compiled for necessary target and with necessary compile flags. >> >> I've not looked at the patch yet, but some initial points... I'm a bit sad to start *another* thread, much of this was discussed in my RFC thread from some time ago, but here is a re-cap: >> >> And there are multiple drawbacks: >> 1) License issues (LLVM code has binary redistribution clause, right? So everything built with "clang -faddress-sanitizer" would attribute LLVM license, gr-r-r). >> >> We are looking into fixing this, I'm fairly confident that in one form or another, this will largely be a temporary issue. Let's not discuss that to death here. >> >> 2) Static ASan runtime is now 10x larger (2,5M vs 250K), while most of its functionality (various stuff from LLVMSupport) is not needed. >> >> This is simply poor structuring of the library, or misbehavior by the linker. We should figure out what's causing it and fix this. >> >> 3) Symbol name clashes - suppose one want to build something with ASan and link against "normal" version of LLVMSupport. (can compiling the code with -fvisibility=hidden, as we currently do, help with this?) >> >> -fvisibility=hidden won't help at all. >> >> This is what my RFC was about, specifically solving this problem. Perhaps we should actually go that route? ;] It keeps coming up, and there is a fairly direct solution that is a "small matter of code" to achieve. >> >> Does this direction look promising to you? >> >> Yes. >> >> Maybe, we should turn to using DSO instead? >> >> We could in theory, but I was under the distinct impression that DSO-s were a non-starter for several different reasons: >> >> 1) Introduces complex rpath requirements into binaries, making distribution even harder. >> 2) Introduces small performance overhead into the runtime library in all cases... Maybe we could live with this though. >> 3) Introduces dramatic performance overhead into TLS for the runtime library, a likely deal-breaker for tsan. > > Suppose only LLVMSupport is pulled out into a separate DSO. Would the overhead be the same as making all of compiler-rt a separate dynamic library? If we only use it to symbolicate the trace after an error is hit, the performance overhead could be much smaller. > > This might work for asan, but my impression is it would not work for tsan. There, we need to filter errors based on the symbolized backtrace, so it won't just be in the error-path. I ment: you hit a "possible" error, symbolicate it, and filter out if it's blacklisted. It should be possible (at least in theory) not to require symbolication on every memory access and hopefully the number of times you hit a possible error is much smaller. That said, I did not look at how this is actually implemented in TSan. > > Also, this is a short term solution rather than a long term solution. We will want to share more code further down the road, so I would like to continue to push for a better long-term solution. > > > >> >> To elaborate on #1 a bit, I'm not very enthusiastic about a strategy that *precludes* a statically linked binary from using the full runtime library. It also will limit the reach of asan on platforms which don't have a good DSO story or where it would be infeasible to get the DSO in place.... We have very real world use cases that fall into this category. >> >> >> The drawbacks of the DSO approach seem fundamental to the technology used. The drawbacks to the static library seem like solvable technical challenges we need to write some code to deal with. > > There is an advantage to using a dynamic library for compiler-rt on Darwin. To ensure there is only one copy of asan_init (and the data structures used by it) around, we link the compiler-rt library only into the executable. The current solution does not allow instrumenting a dynamic library (without instrumenting an executable as well). This is a major limitation and complicating the distribution(#1) seems like a reasonable price to pay at least for ASan, where the performance overhead should not be substantial. > > Sorry, I should have been more clear. > > I very much like preserving the ability to do *both* DSO and static library. It's precluding either strategy that seems bad to me because, as you point out, they both have their time, place, and purpose. As it happens, if we can solve the problem for a statically linked runtime library, I believe building a single DSO for the entire runtime will be straight forward. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/a1975997/attachment.html From azanella at linux.vnet.ibm.com Mon Aug 6 13:39:33 2012 From: azanella at linux.vnet.ibm.com (Adhemerval Zanella) Date: Mon, 06 Aug 2012 15:39:33 -0300 Subject: [llvm-commits] [llvm] r161302 - in /llvm/trunk: include/llvm/Target/TargetSelectionDAG.td lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCInstr64Bit.td test/CodeGen/PowerPC/ppc64-cyclecounter.ll In-Reply-To: <20120804141046.807242A6C074@llvm.org> References: <20120804141046.807242A6C074@llvm.org> Message-ID: <50200F65.1000903@linux.vnet.ibm.com> Hi Hal, On 08/04/2012 11:10 AM, Hal Finkel wrote: > +let Pattern = [(set G8RC:$rT, readcyclecounter)] in > +def MFTB8 : XFXForm_1_ext<31, 371, 268, (outs G8RC:$rT), (ins), > + "mftb $rT", SprMFTB>, > + PPC970_DGroup_First, PPC970_Unit_FXU; > + > let Defs = [X1], Uses = [X1] in > def DYNALLOC8 : Pseudo<(outs G8RC:$result), (ins G8RC:$negsize, memri:$fpsi),"", > [(set G8RC:$result, The 'mftb/mftbu' are deprecated on PowerISA 2.06 (indicated as Phased-Out) and currently they are defined as mnemonics to 'mftb Rx,268/mfspr Rx,268". So I would suggest a change to use 'mfspr Rx, 268' instead of relying on 'mftb' for PPC64. -- Adhemerval Zanella Netto Software Engineer Linux Technology Center Brazil Toolchain / GLIBC on Power Architecture azanella at linux.vnet.ibm.com / azanella at br.ibm.com +55 61 8642-9890 From wendling at apple.com Mon Aug 6 13:42:18 2012 From: wendling at apple.com (Bill Wendling) Date: Mon, 06 Aug 2012 11:42:18 -0700 Subject: [llvm-commits] [patch] Add dominance computation for edges In-Reply-To: References: Message-ID: <085840EE-2DCB-4CEE-8720-4DB83ABC3354@apple.com> On Aug 5, 2012, at 5:20 PM, Rafael Esp?ndola wrote: > In LLVM the only value that is defined in an edge is the return value > of an invoke. There are cases however where a fact is true only in > areas dominated by and edge. For example, in > > define i32 @f(i32 %x) { > bb0: > %cmp = icmp eq i32 %x, 0 > br i1 %cmp, label %bb2, label %bb1 > bb1: > br label %bb2 > bb2: > %cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ] > %foo = add i32 %cond, %x > ret i32 %foo > } > > We can replace x with 0 in cond, but not in foo. > > The attached patch refactors the code we have to handle invoke so that > it is available to clients that want to know if a use is dominated by > an edge. > I don't understand this at all. I don't see an 'invoke' in the example. And the '%x' in '%foo' cannot be replaced by '0' because it may not be '0' (i.e., it took the 'bb1' route to 'bb2). -bw From stoklund at 2pi.dk Mon Aug 6 13:48:43 2012 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 06 Aug 2012 18:48:43 -0000 Subject: [llvm-commits] [llvm] r161329 - /llvm/trunk/include/llvm/CodeGen/MachineOperand.h Message-ID: <20120806184843.4C01B2A6C073@llvm.org> Author: stoklund Date: Mon Aug 6 13:48:43 2012 New Revision: 161329 URL: http://llvm.org/viewvc/llvm-project?rev=161329&view=rev Log: Put up warning signs around MO::getNextOperandForReg(). Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=161329&r1=161328&r2=161329&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Mon Aug 6 13:48:43 2012 @@ -302,8 +302,10 @@ return !isUndef() && !isInternalRead() && (isUse() || getSubReg()); } - /// getNextOperandForReg - Return the next MachineOperand in the function that - /// uses or defines this register. + /// getNextOperandForReg - Return the next MachineOperand in the linked list + /// of operands that use or define the same register. + /// Don't call this function directly, see the def-use iterators in + /// MachineRegisterInfo instead. MachineOperand *getNextOperandForReg() const { assert(isReg() && "This is not a register operand!"); return Contents.Reg.Next; From rdivacky at freebsd.org Mon Aug 6 13:49:33 2012 From: rdivacky at freebsd.org (Roman Divacky) Date: Mon, 6 Aug 2012 20:49:33 +0200 Subject: [llvm-commits] [RFC] PPC64 TOC and MCJIT support In-Reply-To: <502008ED.3000703@linux.vnet.ibm.com> References: <502008ED.3000703@linux.vnet.ibm.com> Message-ID: <20120806184933.GA23404@freebsd.org> Wow, this looks awesome, some parts of this (adding of enums and handling them) can be committed as is. Maybe you can split them into logical chunks? Ie. "Handle ELF::PPC{64} in ELF" etc. The TOC handling changes look fine to me. The LDtoc* stuff too. I cant comment on the JIT part. Also, please send the patches as attachments, not inline. One more additional comments at the end. Anyway, really nice work! Roman Divacky On Mon, Aug 06, 2012 at 03:11:57PM -0300, Adhemerval Zanella wrote: > Although the patch is still WIP and requires a lot of work, I'd appreciate some > advices and feedback for my modifications. As I stated em previous emails, although > llvm generates working code for PPC32, it lacks some functionality for PPC64, > mainly the TOC usage for PIC and PIE generation. > > This patch is based on previous email and feedback I got to add support for TOC > and the PPC64 relocation needed for both JIT and assembly. Currently the assembly > generated creates the @toc relocation correctly instead of @ha/@lo, that works > on mostly cases, but are not full PIC and PIE. > > The testcase result remains the same, so next step I add PPC64 toc testcase > to fully test the TOC code generation. > > --- > > - if (isPPC64 && !TOC.empty()) { > + if (isPPC64 && !TOC.empty() && OutStreamer.hasRawTextSupport()) { > const MCSectionELF *Section = OutStreamer.getContext().getELFSection(".toc", > ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC, > SectionKind::getReadOnly()); the OutStreamer.hasRawTextSupport() is needed because we emit ".tc" would this be a right thing to do? - OutStreamer.EmitRawText("\t.tc " + Twine(I->first->getName()) + - "[TC]," + I->first->getName()); + MCSymbol *S = OutContext.GetOrCreateSymbol(I->first->getName()); + OutStreamer.EmitValue(MCSymbolRefExpr::Create(S, OutContext), + Subtarget.isPPC64() ? 8 : 4/*size*/, 0/*addrspace*/); From rafael.espindola at gmail.com Mon Aug 6 14:15:49 2012 From: rafael.espindola at gmail.com (=?UTF-8?Q?Rafael_Esp=C3=ADndola?=) Date: Mon, 6 Aug 2012 15:15:49 -0400 Subject: [llvm-commits] [patch] Add dominance computation for edges In-Reply-To: <085840EE-2DCB-4CEE-8720-4DB83ABC3354@apple.com> References: <085840EE-2DCB-4CEE-8720-4DB83ABC3354@apple.com> Message-ID: > I don't understand this at all. I don't see an 'invoke' in the example. And the '%x' in '%foo' cannot be replaced by '0' because it may not be '0' (i.e., it took the 'bb1' route to 'bb2). Exactly and exactly :-) Sorry if it wasn't clear. The idea of the refactoring is to allow the new methods to be used in cases where we *don't* have an invoke, but we have a case where some information is available about an area dominated by an edge. I want GVN to know that it can replace the 'x' in 'cond', but not the 'x' in 'foo', which is exactly what this analysis tells it (once GVN is modified to use it). > -bw > Cheers, Rafael From dhill at mindcry.org Mon Aug 6 14:15:48 2012 From: dhill at mindcry.org (David Hill) Date: Mon, 6 Aug 2012 15:15:48 -0400 Subject: [llvm-commits] [PATCH] Add support for Bitrig, an OpenBSD fork. In-Reply-To: References: <20120801143059.GA19699@2b4c76bd04465534c8dd11d37c4fced523619b32ed53713f> <20120804132239.GA14539@545b10c9a28a38e43c5f6dc54dff98b1e3766b5781c7c992> <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> Message-ID: <20120806191548.GA6079@a683b33e3c0c17bda72c088feae84dbfff13d13cec5dd3d1> On Mon, Aug 06, 2012 at 10:46:04AM -0700, Eric Christopher wrote: > >On Aug 6, 2012, at 9:20 AM, David Hill wrote: > >> >> On Sat, Aug 04, 2012 at 09:22:40AM -0400, David Hill wrote: >>> On Wed, Aug 01, 2012 at 05:05:22PM -0700, Eli Friedman wrote: >>>> On Wed, Aug 1, 2012 at 7:30 AM, David Hill wrote: >>>>> Hello, >>>>> >>>>> The attached patch allows LLVM to recognize Bitrig, an OpenBSD fork. >>>>> Clang bits to come after this has been accepted. >>>>> >>>>> Please review. >>>> >>>> I can't really review the autoconf changes. >>>> >>>> + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split >>>> + // into two .words. >>>> + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && >>>> + T.getArch() == Triple::x86) >>>> >>>> Does Bitrig actually have this bug? If so, why don't you just fix it? >>>> >>>> -Eli >>> >>> Ping >>> >> >> Any objections to this going in? > >Seems like not, send me an up to date patch and I'll commit it. > >-eric Here you go: diff --git a/autoconf/config.guess b/autoconf/config.guess index f7dd69e..dd6dcb3 100755 --- a/autoconf/config.guess +++ b/autoconf/config.guess @@ -206,6 +206,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; diff --git a/autoconf/ltmain.sh b/autoconf/ltmain.sh index 2455278..21ace01 100644 --- a/autoconf/ltmain.sh +++ b/autoconf/ltmain.sh @@ -1560,7 +1560,7 @@ EOF # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; @@ -1580,7 +1580,7 @@ EOF esac elif test "X$arg" = "X-lc_r"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | -*-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -3464,7 +3464,7 @@ EOF *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) diff --git a/autoconf/m4/libtool.m4 b/autoconf/m4/libtool.m4 index 36ac3d1..05af7a2 100644 --- a/autoconf/m4/libtool.m4 +++ b/autoconf/m4/libtool.m4 @@ -176,7 +176,7 @@ old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in - openbsd*) + openbsd* | bitrig*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) @@ -729,7 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly* | bitrig*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -1631,7 +1631,7 @@ nto-qnx*) shlibpath_overrides_runpath=yes ;; -openbsd*) +openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no @@ -3382,7 +3382,7 @@ case $host_os in # C++ shared libraries are fairly broken _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - openbsd*) + openbsd* | bitrig*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' @@ -6003,7 +6003,7 @@ _LT_EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - openbsd*) + openbsd* | bitrig*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index a080200..7f7061a 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -98,7 +98,8 @@ public: Minix, RTEMS, NativeClient, - CNK // BG/P Compute-Node Kernel + CNK, // BG/P Compute-Node Kernel + Bitrig }; enum EnvironmentType { UnknownEnvironment, diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp index da5baab..4e4a026 100644 --- a/lib/Support/Mutex.cpp +++ b/lib/Support/Mutex.cpp @@ -59,7 +59,8 @@ MutexImpl::MutexImpl( bool recursive) errorcode = pthread_mutexattr_settype(&attr, kind); assert(errorcode == 0); -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \ + !defined(__DragonFly__) && !defined(__Bitrig__) // Make it a process local mutex errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); assert(errorcode == 0); diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 7b26ea9..cca549d 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -124,6 +124,7 @@ const char *Triple::getOSTypeName(OSType Kind) { case RTEMS: return "rtems"; case NativeClient: return "nacl"; case CNK: return "cnk"; + case Bitrig: return "bitrig"; } llvm_unreachable("Invalid OSType"); @@ -293,6 +294,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("rtems", Triple::RTEMS) .StartsWith("nacl", Triple::NativeClient) .StartsWith("cnk", Triple::CNK) + .StartsWith("bitrig", Triple::Bitrig) .Default(Triple::UnknownOS); } diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index b41390a..6bddbdf 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -260,7 +260,7 @@ Path::GetCurrentDirectory() { return Path(pathname); } -#if defined(__FreeBSD__) || defined (__NetBSD__) || \ +#if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) static int test_dir(char buf[PATH_MAX], char ret[PATH_MAX], @@ -329,7 +329,7 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { if (realpath(exe_path, link_path)) return Path(link_path); } -#elif defined(__FreeBSD__) || defined (__NetBSD__) || \ +#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) char exe_path[PATH_MAX]; diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index 174112e..5204147 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -20,9 +20,10 @@ #ifdef HAVE_SYS_RESOURCE_H #include #endif -// DragonFly BSD has deprecated for instead, -// Unix.h includes this for us already. -#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) +// DragonFlyBSD, OpenBSD, and Bitrig have deprecated for +// instead. Unix.h includes this for us already. +#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) && \ + !defined(__OpenBSD__) && !defined(__Bitrig__) #include #endif #ifdef HAVE_MALLOC_MALLOC_H diff --git a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp index 49c07f3..b0acd7d 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp @@ -91,9 +91,10 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) { // Exceptions handling ExceptionsType = ExceptionHandling::DwarfCFI; - // OpenBSD has buggy support for .quad in 32-bit mode, just split into two - // .words. - if (T.getOS() == Triple::OpenBSD && T.getArch() == Triple::x86) + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split + // into two .words. + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && + T.getArch() == Triple::x86) Data64bitsDirective = 0; } diff --git a/tools/llvm-shlib/Makefile b/tools/llvm-shlib/Makefile index 75bee07..6d6c6e9 100644 --- a/tools/llvm-shlib/Makefile +++ b/tools/llvm-shlib/Makefile @@ -63,7 +63,7 @@ ifeq ($(HOST_OS),Darwin) endif endif -ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU Bitrig)) # Include everything from the .a's into the shared library. LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ -Wl,--no-whole-archive From kledzik at apple.com Mon Aug 6 14:17:39 2012 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 06 Aug 2012 12:17:39 -0700 Subject: [llvm-commits] [PATCH] YAML I/O Message-ID: <48EFD0FD-51F0-4154-9730-9540BAA811A0@apple.com> Attached is a patch for review which implements the Yaml I/O library I proposed on llvm-dev July 25th. -------------- next part -------------- A non-text attachment was scrubbed... Name: yamlio.patch Type: application/octet-stream Size: 69623 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/c771c628/attachment-0003.obj -------------- next part -------------- The patch includes the implementation, test cases, and documentation. I've included a PDF of the documentation, so you don't have to install the patch and run sphinx to read it. -------------- next part -------------- A non-text attachment was scrubbed... Name: YAMLIO.pdf Type: application/pdf Size: 144445 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/c771c628/attachment-0001.pdf -------------- next part -------------- There are probably more aspects of yaml we can support in YAML I/O, but the current patch is enough to support my needs for encoding mach-o as yaml for lld test cases. I was initially planning on just adding this code to lld, but I've had two requests to push it down into llvm. Again, here are examples of the mach-o schema and an example mach-o document: -------------- next part -------------- A non-text attachment was scrubbed... Name: example.yaml Type: application/octet-stream Size: 2987 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/c771c628/attachment-0004.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: ObjectIO.h Type: application/octet-stream Size: 6124 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/c771c628/attachment-0005.obj -------------- next part -------------- -Nick From satanasyan at mips.com Mon Aug 6 14:47:47 2012 From: satanasyan at mips.com (Simon Atanasyan) Date: Mon, 06 Aug 2012 19:47:47 -0000 Subject: [llvm-commits] [llvm] r161332 - /llvm/trunk/include/llvm/IntrinsicsMips.td Message-ID: <20120806194747.D05392A6C073@llvm.org> Author: atanasyan Date: Mon Aug 6 14:47:47 2012 New Revision: 161332 URL: http://llvm.org/viewvc/llvm-project?rev=161332&view=rev Log: Fix MIPS DSP Rev1 intrinsics memory properties. The patch reviewed by Akira Hatanaka. Modified: llvm/trunk/include/llvm/IntrinsicsMips.td Modified: llvm/trunk/include/llvm/IntrinsicsMips.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsMips.td?rev=161332&r1=161331&r2=161332&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsMips.td (original) +++ llvm/trunk/include/llvm/IntrinsicsMips.td Mon Aug 6 14:47:47 2012 @@ -22,26 +22,22 @@ // Addition/subtraction def int_mips_addu_qb : GCCBuiltin<"__builtin_mips_addu_qb">, - Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_addu_s_qb : GCCBuiltin<"__builtin_mips_addu_s_qb">, - Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_subu_qb : GCCBuiltin<"__builtin_mips_subu_qb">, - Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem]>; + Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], []>; def int_mips_subu_s_qb : GCCBuiltin<"__builtin_mips_subu_s_qb">, - Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem]>; + Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], []>; def int_mips_addq_ph : GCCBuiltin<"__builtin_mips_addq_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_addq_s_ph : GCCBuiltin<"__builtin_mips_addq_s_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_subq_ph : GCCBuiltin<"__builtin_mips_subq_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_subq_s_ph : GCCBuiltin<"__builtin_mips_subq_s_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_madd: GCCBuiltin<"__builtin_mips_madd">, Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty], @@ -58,17 +54,14 @@ [IntrNoMem]>; def int_mips_addq_s_w: GCCBuiltin<"__builtin_mips_addq_s_w">, - Intrinsic<[mips_q31_ty], [mips_q31_ty, mips_q31_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[mips_q31_ty], [mips_q31_ty, mips_q31_ty], [Commutative]>; def int_mips_subq_s_w: GCCBuiltin<"__builtin_mips_subq_s_w">, - Intrinsic<[mips_q31_ty], [mips_q31_ty, mips_q31_ty], [IntrNoMem]>; + Intrinsic<[mips_q31_ty], [mips_q31_ty, mips_q31_ty], []>; def int_mips_addsc: GCCBuiltin<"__builtin_mips_addsc">, - Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [Commutative]>; def int_mips_addwc: GCCBuiltin<"__builtin_mips_addwc">, - Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [Commutative]>; def int_mips_modsub: GCCBuiltin<"__builtin_mips_modsub">, Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>; @@ -80,9 +73,9 @@ // Absolute value def int_mips_absq_s_ph: GCCBuiltin<"__builtin_mips_absq_s_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty], []>; def int_mips_absq_s_w: GCCBuiltin<"__builtin_mips_absq_s_w">, - Intrinsic<[mips_q31_ty], [mips_q31_ty], [IntrNoMem]>; + Intrinsic<[mips_q31_ty], [mips_q31_ty], []>; //===----------------------------------------------------------------------===// // Precision reduce/expand @@ -90,11 +83,11 @@ def int_mips_precrq_qb_ph: GCCBuiltin<"__builtin_mips_precrq_qb_ph">, Intrinsic<[llvm_v4i8_ty], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem]>; def int_mips_precrqu_s_qb_ph: GCCBuiltin<"__builtin_mips_precrqu_s_qb_ph">, - Intrinsic<[llvm_v4i8_ty], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[llvm_v4i8_ty], [mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_precrq_ph_w: GCCBuiltin<"__builtin_mips_precrq_ph_w">, Intrinsic<[mips_v2q15_ty], [mips_q31_ty, mips_q31_ty], [IntrNoMem]>; def int_mips_precrq_rs_ph_w: GCCBuiltin<"__builtin_mips_precrq_rs_ph_w">, - Intrinsic<[mips_v2q15_ty], [mips_q31_ty, mips_q31_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_q31_ty, mips_q31_ty], []>; def int_mips_preceq_w_phl: GCCBuiltin<"__builtin_mips_preceq_w_phl">, Intrinsic<[mips_q31_ty], [mips_v2q15_ty], [IntrNoMem]>; def int_mips_preceq_w_phr: GCCBuiltin<"__builtin_mips_preceq_w_phr">, @@ -120,19 +113,19 @@ // Shift def int_mips_shll_qb: GCCBuiltin<"__builtin_mips_shll_qb">, - Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_i32_ty], []>; def int_mips_shrl_qb: GCCBuiltin<"__builtin_mips_shrl_qb">, Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_i32_ty], [IntrNoMem]>; def int_mips_shll_ph: GCCBuiltin<"__builtin_mips_shll_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, llvm_i32_ty], []>; def int_mips_shll_s_ph: GCCBuiltin<"__builtin_mips_shll_s_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, llvm_i32_ty], []>; def int_mips_shra_ph: GCCBuiltin<"__builtin_mips_shra_ph">, Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, llvm_i32_ty], [IntrNoMem]>; def int_mips_shra_r_ph: GCCBuiltin<"__builtin_mips_shra_r_ph">, Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, llvm_i32_ty], [IntrNoMem]>; def int_mips_shll_s_w: GCCBuiltin<"__builtin_mips_shll_s_w">, - Intrinsic<[mips_q31_ty], [mips_q31_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[mips_q31_ty], [mips_q31_ty, llvm_i32_ty], []>; def int_mips_shra_r_w: GCCBuiltin<"__builtin_mips_shra_r_w">, Intrinsic<[mips_q31_ty], [mips_q31_ty, llvm_i32_ty], [IntrNoMem]>; def int_mips_shilo: GCCBuiltin<"__builtin_mips_shilo">, @@ -142,33 +135,25 @@ // Multiplication def int_mips_muleu_s_ph_qbl: GCCBuiltin<"__builtin_mips_muleu_s_ph_qbl">, - Intrinsic<[mips_v2q15_ty], [llvm_v4i8_ty, mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [llvm_v4i8_ty, mips_v2q15_ty], []>; def int_mips_muleu_s_ph_qbr: GCCBuiltin<"__builtin_mips_muleu_s_ph_qbr">, - Intrinsic<[mips_v2q15_ty], [llvm_v4i8_ty, mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [llvm_v4i8_ty, mips_v2q15_ty], []>; def int_mips_mulq_rs_ph: GCCBuiltin<"__builtin_mips_mulq_rs_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_muleq_s_w_phl: GCCBuiltin<"__builtin_mips_muleq_s_w_phl">, - Intrinsic<[mips_q31_ty], [mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[mips_q31_ty], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_muleq_s_w_phr: GCCBuiltin<"__builtin_mips_muleq_s_w_phr">, - Intrinsic<[mips_q31_ty], [mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[mips_q31_ty], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_mulsaq_s_w_ph: GCCBuiltin<"__builtin_mips_mulsaq_s_w_ph">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_maq_s_w_phl: GCCBuiltin<"__builtin_mips_maq_s_w_phl">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_maq_s_w_phr: GCCBuiltin<"__builtin_mips_maq_s_w_phr">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_maq_sa_w_phl: GCCBuiltin<"__builtin_mips_maq_sa_w_phl">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_maq_sa_w_phr: GCCBuiltin<"__builtin_mips_maq_sa_w_phr">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_mult: GCCBuiltin<"__builtin_mips_mult">, Intrinsic<[llvm_i64_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem, Commutative]>; @@ -192,69 +177,62 @@ Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem]>; def int_mips_dpaq_s_w_ph: GCCBuiltin<"__builtin_mips_dpaq_s_w_ph">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_dpsq_s_w_ph: GCCBuiltin<"__builtin_mips_dpsq_s_w_ph">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_v2q15_ty, mips_v2q15_ty], []>; def int_mips_dpaq_sa_l_w: GCCBuiltin<"__builtin_mips_dpaq_sa_l_w">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_q31_ty, mips_q31_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_q31_ty, mips_q31_ty], []>; def int_mips_dpsq_sa_l_w: GCCBuiltin<"__builtin_mips_dpsq_sa_l_w">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_q31_ty, mips_q31_ty], - [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, mips_q31_ty, mips_q31_ty], []>; //===----------------------------------------------------------------------===// // Comparison def int_mips_cmpu_eq_qb: GCCBuiltin<"__builtin_mips_cmpu_eq_qb">, - Intrinsic<[], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem, Commutative]>; + Intrinsic<[], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_cmpu_lt_qb: GCCBuiltin<"__builtin_mips_cmpu_lt_qb">, - Intrinsic<[], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem, Commutative]>; + Intrinsic<[], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_cmpu_le_qb: GCCBuiltin<"__builtin_mips_cmpu_le_qb">, - Intrinsic<[], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem, Commutative]>; + Intrinsic<[], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_cmpgu_eq_qb: GCCBuiltin<"__builtin_mips_cmpgu_eq_qb">, - Intrinsic<[llvm_i32_ty], [llvm_v4i8_ty, llvm_v4i8_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_i32_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_cmpgu_lt_qb: GCCBuiltin<"__builtin_mips_cmpgu_lt_qb">, - Intrinsic<[llvm_i32_ty], [llvm_v4i8_ty, llvm_v4i8_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_i32_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_cmpgu_le_qb: GCCBuiltin<"__builtin_mips_cmpgu_le_qb">, - Intrinsic<[llvm_i32_ty], [llvm_v4i8_ty, llvm_v4i8_ty], - [IntrNoMem, Commutative]>; + Intrinsic<[llvm_i32_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [Commutative]>; def int_mips_cmp_eq_ph: GCCBuiltin<"__builtin_mips_cmp_eq_ph">, - Intrinsic<[], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem, Commutative]>; + Intrinsic<[], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_cmp_lt_ph: GCCBuiltin<"__builtin_mips_cmp_lt_ph">, - Intrinsic<[], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem, Commutative]>; + Intrinsic<[], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; def int_mips_cmp_le_ph: GCCBuiltin<"__builtin_mips_cmp_le_ph">, - Intrinsic<[], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem, Commutative]>; + Intrinsic<[], [mips_v2q15_ty, mips_v2q15_ty], [Commutative]>; //===----------------------------------------------------------------------===// // Extracting def int_mips_extr_s_h: GCCBuiltin<"__builtin_mips_extr_s_h">, - Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], []>; def int_mips_extr_w: GCCBuiltin<"__builtin_mips_extr_w">, - Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], []>; def int_mips_extr_rs_w: GCCBuiltin<"__builtin_mips_extr_rs_w">, - Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], []>; def int_mips_extr_r_w: GCCBuiltin<"__builtin_mips_extr_r_w">, - Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], []>; def int_mips_extp: GCCBuiltin<"__builtin_mips_extp">, - Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], []>; def int_mips_extpdp: GCCBuiltin<"__builtin_mips_extpdp">, - Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i64_ty, llvm_i32_ty], []>; //===----------------------------------------------------------------------===// // Misc def int_mips_wrdsp: GCCBuiltin<"__builtin_mips_wrdsp">, - Intrinsic<[], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[], [llvm_i32_ty, llvm_i32_ty], []>; def int_mips_rddsp: GCCBuiltin<"__builtin_mips_rddsp">, - Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrReadMem]>; def int_mips_insv: GCCBuiltin<"__builtin_mips_insv">, - Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrReadMem]>; def int_mips_bitrev: GCCBuiltin<"__builtin_mips_bitrev">, Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>; @@ -267,15 +245,15 @@ Intrinsic<[mips_v2q15_ty], [llvm_i32_ty], [IntrNoMem]>; def int_mips_pick_qb: GCCBuiltin<"__builtin_mips_pick_qb">, - Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrNoMem]>; + Intrinsic<[llvm_v4i8_ty], [llvm_v4i8_ty, llvm_v4i8_ty], [IntrReadMem]>; def int_mips_pick_ph: GCCBuiltin<"__builtin_mips_pick_ph">, - Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [IntrNoMem]>; + Intrinsic<[mips_v2q15_ty], [mips_v2q15_ty, mips_v2q15_ty], [IntrReadMem]>; def int_mips_mthlip: GCCBuiltin<"__builtin_mips_mthlip">, - Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i32_ty], []>; def int_mips_bposge32: GCCBuiltin<"__builtin_mips_bposge32">, - Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [], [IntrReadMem]>; def int_mips_lbux: GCCBuiltin<"__builtin_mips_lbux">, Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrReadArgMem]>; From evan.cheng at apple.com Mon Aug 6 15:02:18 2012 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 06 Aug 2012 13:02:18 -0700 Subject: [llvm-commits] [PATCH 1/2] Fix PR12312 In-Reply-To: <1344023615.2999.11.camel@snbox> References: <1343850417.3953.41.camel@snbox> <1344023615.2999.11.camel@snbox> Message-ID: <8CF32707-4840-49F3-BDE5-F8B61E71E4BF@apple.com> The patch looks fine. But this part looks funny to me: + // Skip all 'zext' nodes. + while (SetCC.getOpcode() == ISD::ZERO_EXTEND) + SetCC = SetCC.getOperand(0); + Why is a loop needed? Evan On Aug 3, 2012, at 12:53 PM, Michael Liao wrote: > Hi > > Just ping after 2 days. Does this patch looks good? > > Yours > - Michael > > On Wed, 2012-08-01 at 12:46 -0700, Michael Liao wrote: >> Hi >> >> This patch is to fix http://llvm.org/bugs/show_bug.cgi?id=12312, where a >> special use of i128 needs efficient code generation with PTEST from >> SSE4.1. >> >> To fix this issue, 2 patches are developed. The first part is to >> simplify a common pattern introduced by most intrinsics generating >> boolean values. Their boolean result are re-evaluated again to get >> EFLAGS updated for BRCOND/CMOV or even SETCC again to consume. The >> attached patch adds a X86-specific DAG optimzation to simplify this >> common pattern by directly consuming the EFLAGS updated from the >> original intrinsics, e.g. llvm.x86.sse41.ptest, if we found that integer >> result is checked as a boolean value. >> >> Yours >> - Michael >> >> >> >> _______________________________________________ >> 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 Mon Aug 6 15:02:45 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:02:45 -0000 Subject: [llvm-commits] [LNT] r161334 - in /lnt/trunk/lnt/server: config.py ui/templates/browse.html ui/templates/machine.html ui/templates/run.html ui/templates/simple_graph.html ui/templates/simple_machine.html ui/templates/simple_order_aggregate_report.html ui/templates/simple_overview.html ui/templates/simple_run.html ui/templates/simple_utils.html ui/templates/test.html ui/views.py Message-ID: <20120806200245.201E62A6C073@llvm.org> Author: ddunbar Date: Mon Aug 6 15:02:44 2012 New Revision: 161334 URL: http://llvm.org/viewvc/llvm-project?rev=161334&view=rev Log: Remove UI support for v0.3 databases. Removed: lnt/trunk/lnt/server/ui/templates/browse.html lnt/trunk/lnt/server/ui/templates/machine.html lnt/trunk/lnt/server/ui/templates/run.html lnt/trunk/lnt/server/ui/templates/simple_graph.html lnt/trunk/lnt/server/ui/templates/simple_machine.html lnt/trunk/lnt/server/ui/templates/simple_order_aggregate_report.html lnt/trunk/lnt/server/ui/templates/simple_overview.html lnt/trunk/lnt/server/ui/templates/simple_run.html lnt/trunk/lnt/server/ui/templates/simple_utils.html lnt/trunk/lnt/server/ui/templates/test.html Modified: lnt/trunk/lnt/server/config.py lnt/trunk/lnt/server/ui/views.py Modified: lnt/trunk/lnt/server/config.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=161334&r1=161333&r2=161334&view=diff ============================================================================== --- lnt/trunk/lnt/server/config.py (original) +++ lnt/trunk/lnt/server/config.py Mon Aug 6 15:02:44 2012 @@ -121,10 +121,8 @@ return None # Instantiate the appropriate database version. - if db_entry.db_version == '0.3': - return lnt.db.perfdb.PerfDB(db_entry.path, echo=echo) if db_entry.db_version == '0.4': return lnt.server.db.v4db.V4DB(db_entry.path, echo=echo) - raise NotImplementedError,"unable to import to version %r database" % ( + raise NotImplementedError,"unable to load version %r database" % ( db_entry.db_version,) Removed: lnt/trunk/lnt/server/ui/templates/browse.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/browse.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/browse.html (original) +++ lnt/trunk/lnt/server/ui/templates/browse.html (removed) @@ -1,59 +0,0 @@ -{% extends "layout.html" %} -{% set components = [] %} -{% block title %}Database Browser{% endblock %} -{% block body %} - -{% set db = request.get_db() %} -

Machines

- - - - - - -{% for m in db.machines() %} - - - -{% endfor %} -
Name
{{m.name}}:{{m.number}}
- -{# List runs. #} -

Run List

- - - - - - - - - -{% for r,m in db.query(perfdb.Run, perfdb.Machine).join(perfdb.Machine) %} - - - - - - -{% endfor %} -
IDMachineStart TimeEnd Time
{{r.id}}{{m.name}}:{{m.number}}{{r.start_time}}{{r.end_time}}
- -{# List tests. #} -

Test List

- - - - - - - -{% for id,name in db.query(perfdb.Test.id, perfdb.Test.name) %} - - - - -{% endfor %} -
IDTest
{{id}}{{name}}
- -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/machine.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/machine.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/machine.html (original) +++ lnt/trunk/lnt/server/ui/templates/machine.html (removed) @@ -1,43 +0,0 @@ -{% set db = request.get_db() %} -{% set machine = db.getMachine(id) %} - -{% extends "layout.html" %} -{% set components = [("browse", db_url_for("browse"))] %} -{% block title %}Machine: {{machine.name}}:{{machine.number}}{% endblock %} -{% block body %} - -{# Show the machine info dictionary. #} - - - - - - -{% for mi in machine.info.values() %} - - - - -{% endfor %} -
KeyValue
{{mi.key}}{{mi.value}}
- -{# List associated runs. #} -

Associated Runs

- - - - - - - - -{% for r in db.runs(machine=machine) %} - - - - - -{% endfor %} -
Run IDStart TimeEnd Time
{{r.id}}{{r.start_time}}{{r.end_time}}
- -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/run.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/run.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/run.html (original) +++ lnt/trunk/lnt/server/ui/templates/run.html (removed) @@ -1,41 +0,0 @@ -{% set db = request.get_db() %} -{% set run = db.getRun(id) %} -{% set machine = db.getMachine(run.machine_id) %} - -{% extends "layout.html" %} -{% set components = [("browse", db_url_for("browse"))] %} -{% block title %}Run: {{run.id}}{% endblock %} -{% block body %} - - - - - - - - - - - - - -
MachineStart TimeEnd Time
{{ - machine.name}}{{machine.number}}{{run.start_time}}{{run.end_time}}
- -{# Show the run info dictionary. #} -

Run Info

- - - - - - -{% for mi in run.info.values() %} - - - - -{% endfor %} -
KeyValue
{{mi.key}}{{mi.value}}
- -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/simple_graph.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/simple_graph.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/simple_graph.html (original) +++ lnt/trunk/lnt/server/ui/templates/simple_graph.html (removed) @@ -1,147 +0,0 @@ -{% import "simple_utils.html" as simple_utils %} -{% import "utils.html" as utils %} - -{% set db = request.get_db() %} -{% set run = db.getRun(id) %} -{% set machine = run.machine %} - -{% extends "layout.html" %} -{% set components = [(tag, db_url_for("simple_overview", tag=tag)), - ('machine', db_url_for("simple_machine", - tag=tag, id=machine.id)), - ('run', db_url_for("simple_run", - tag=tag, id=machine.id))] %} -{% block head %} - - - -{% endblock %} - -{% block title %}Run Results{% endblock %} - -{# Add JS to initialize the graph. #} -{% block onload %}init(){% endblock %} -{% block javascript %} -function init() { - graph = new Graph2D("graph"); - graph.clearColor = [1, 1, 1]; - - {{ graph_plots }} - - graph.xAxis.format = graph.xAxis.formats.normal; - graph.draw(); -} -{% endblock %} - -{% block body %} - -{% call simple_utils.simple_run_page(tag, machine, run, compare_to, - neighboring_runs) %} - -{{ utils.render_popup_begin('view_options', 'View Options', true) }} -
-Show Median Absolute Deviation: -
- -Show Standard Deviation: -
- -Show Linear Regression: -
- -{# Add all the hidden fields. #} -{% for name,value in request.args.items() %} - {% if name.startswith('test.') or name.startswith('pset.') %} -
- {% endif %} -{% endfor %} - - -
-{{ utils.render_popup_end() }} - -

Graph

- - - - - -
- - - - -{% for name,col in legend %} - - -{% endfor %} -
Test
 {{name}}
-
- -Shift-Left Mouse: Pan
-Alt/Meta-Left Mouse: Zoom
-Wheel: Zoom (Shift Slows)
-
-
-

-Plots: {{ num_plots }}
-Num Points: {{ num_points }}
- -

Deltas

-{% for deltas in plot_deltas %} - {% set (name,col) = legend[loop.index0] %} -

{{name}}

- - - - - - - - - - - - - - - - - - - - - - - -{% for (pct,(r0,t0,mad0,med0),(r1,t1,mad1,med1)) in deltas %} - - - - {{pct|aspctcell(delta=true)|safe}} - - - - - - -{% endfor %} - -
Revision ValueMADMed - Min
CurrentPreviousDelta (%)CurrentPrevious# Revs CurrentPreviousCurrentPrevious
{{r1}}{{r0}}{{ "%.4f" % t1 }}{{ "%.4f" % t0}}{{ r1 - r0 }} {{ "%.4f" % mad1 }}{{ "%.4f" % mad0 }}{{ "%.4f" % (med1-t1) }}{{ "%.4f" % (med0-t0) }}
-{% endfor %} - -

Revisions to Sample

-{% for rev in new_sample_list %} - {{ rev }} -{% endfor %} -

-

Revisions to Resample

-{% for rev in resample_list|sort %} - {{ rev }} -{% endfor %} -

- -{% endcall %} - -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/simple_machine.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/simple_machine.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/simple_machine.html (original) +++ lnt/trunk/lnt/server/ui/templates/simple_machine.html (removed) @@ -1,82 +0,0 @@ -{% import "utils.html" as utils %} - -{% set db = request.get_db() %} -{% set machine = db.getMachine(id) %} - -{% extends "layout.html" %} -{% set components = [(tag, db_url_for("simple_overview", tag=tag))] %} -{% block head %} - -{% endblock %} -{% block title %}Machine: {{machine.name}}:{{machine.number}}{% endblock %} -{% block body %} - - - - - - -
- Homepage -

Relatives:

-
    - -{# List all machines with this name. #} -{% for m in db.machines(name=machine.name) %} -
  • {{ - m.name}}:{{m.number}}
  • -{% endfor %} -
-
- - - - - - - - - -
Nickname {{machine.name}}
Machine ID {{machine.id}}
- - -{{ utils.render_popup_begin('machine_info', 'Machine Info', true, 1) }} - -{% for key,item in machine.info|dictsort %} - - - - -{% endfor %} -
{{key}} {{item.value}}
-{{ utils.render_popup_end() }} - -

- - - - - - - - - -{% for order,runs in associated_runs|sort|reverse %} -{% for run in runs %} - -{% if loop.first %} - -{% endif %} - - - - -{% endfor %} -{% endfor %} -
Run OrderStart TimeEnd Time 
{{order}}{{ run.start_time }}{{ run.end_time }}s - View Results
- - -

- -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/simple_order_aggregate_report.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/simple_order_aggregate_report.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/simple_order_aggregate_report.html (original) +++ lnt/trunk/lnt/server/ui/templates/simple_order_aggregate_report.html (removed) @@ -1,77 +0,0 @@ -{% import "simple_utils.html" as simple_utils %} -{% import "utils.html" as utils %} - -{% set db = request.get_db() %} - -{% extends "layout.html" %} -{% set components = [(tag, db_url_for("simple_overview", tag=tag))] %} - -{% block title %}Order Aggregate Report{% endblock %} - -{% block head %} - - - - -{% endblock %} -{% block javascript %} -var g = {}; - -g.data_table = {{data_table|tojson|safe}}; -g.test_subsets = {{test_subsets|tojson|safe}}; -g.available_machines = {{available_machine_info|tojson|safe}}; -g.orders_to_aggregate = {{orders_to_aggregate|tojson|safe}}; - -// Register initialization. -window.onload = function() { - new OrderAggregateReport("order_aggregate_report_ui", g).init(); -} -{% endblock %} - -{% block body %} - -

- -{# Template code for dumping the data table, for use in debugging. #} -{# - -

Order Aggregate Data

- -{% for subset_name,subset_table in data_table|dictsort %} -

{{ subset_name }}

- - - - - - -{% for order in orders_to_aggregate %} - -{% endfor %} - - - -{% set num_machines = available_machines|length %} -{% for test_name,test_data in subset_table|dictsort %} -{% for machine in available_machines %} -{% set machine_idx = loop.index0 %} - -{% if loop.index0 == 0 %} - -{% endif %} - -{% for order in orders_to_aggregate %} - -{% endfor %} - - -{% endfor %} -{% endfor %} -
Test NameMachine{{ order }}
{{ test_name }}{{ machine.name }}{{ test_data[loop.index0][machine_idx] }}
- -{% endfor %} - -#} - -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/simple_overview.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/simple_overview.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/simple_overview.html (original) +++ lnt/trunk/lnt/server/ui/templates/simple_overview.html (removed) @@ -1,73 +0,0 @@ -{% set db = request.get_db() %} - -{% extends "layout.html" %} -{% set components = [(tag, db_url_for("simple_overview", tag=tag))] %} -{% block title %}Overview{% endblock %} -{% block body %} - -{# Find recent runs. #} -

Submission Overview

- - - - - -
-
-

Active Machines

- - - - - - - - - -{# Show the most active machines. #} -{% for machine_name,r in active_machines|dictsort %} - - - - - -{% endfor %} - -
Latest SubmissionMachineResults
{{r.start_time}}{{ - r.machine.name}}:{{r.machine.number}} - View Results
-
-
-
-

Recent Submissions

- - - - - - - - - - - -{# Show the active submissions. #} -{% for r,run_order in active_submissions %} -{% set m = r.machine %} - - - - - - - -{% endfor %} -
Run OrderStart TimeEnd TimeMachineResults
{{run_order}}{{r.start_time}}{{r.end_time}}{{ - m.name}}:{{m.number}} - View Results
-
-
- -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/simple_run.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/simple_run.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/simple_run.html (original) +++ lnt/trunk/lnt/server/ui/templates/simple_run.html (removed) @@ -1,264 +0,0 @@ -{% import "simple_utils.html" as simple_utils %} -{% import "utils.html" as utils %} - -{% set db = request.get_db() %} -{% set run = db.getRun(id) %} -{% set machine = run.machine %} - -{% extends "layout.html" %} -{% set components = [(tag, db_url_for("simple_overview", tag=tag)), - ('machine', db_url_for("simple_machine", - tag=tag, id=machine.id))] %} -{% block head %} - - - -{% endblock %} - -{% block title %}Run Results{% endblock %} - -{# Add JS to run the init_report function, if embedded. #} -{% block onload %}init(){% endblock %} -{% block javascript %} -function init() { - if (init_report) { - init_report(); - } -} -{% endblock %} - -{% block body %} - -{% macro get_cell_value(cr) %} -{% set test_status = cr.get_test_status() %} -{% set value_status = cr.get_value_status() %} -{% set run_cell_value = "-" if cr.current is none else "%.4f" % cr.current %} - -{% if options.show_previous %} -{% set prev_cell_value = "-" if cr.previous is none else "%.4f" % cr.previous %} - {{prev_cell_value}} -{% endif %} - -{% set cell_color = none %} -{% if test_status == runinfo.REGRESSED %} - {% set cell_color = (233,128,128) %} -{% elif test_status == runinfo.IMPROVED %} - {% set cell_color = (143,223,95) %} -{% elif test_status == runinfo.UNCHANGED_FAIL %} - {% set cell_color = (255,195,67) %} -{% endif %} - -{% if cell_color %} - {{ - run_cell_value}} -{% else %} - {{run_cell_value}} -{% endif %} - -{% if (options.show_all or - value_status == runinfo.REGRESSED or - value_status == runinfo.IMPROVED) %} - {{ cr.pct_delta|aspctcell|safe }} -{% else %} - - -{% endif %} - -{% if options.show_delta %} - {{ "-" if cr.delta is none else "%.4f" % cr.delta }} -{% endif %} -{% if options.show_stddev %} - {{ "-" if cr.stddev is none else "%.4f" % cr.stddev }} -{% endif %} -{% if options.show_mad %} - {{ "-" if cr.MAD is none else "%.4f" % cr.MAD }} -{% endif %} -{% if options.show_all_samples %} - [ - {%- for v in cr.get_samples() -%} - {{ ", " if not loop.first else "" }} - {{ "%.4f" % v }} - {%- endfor -%}] -{% endif %} - -{% if options.show_sample_counts %} - {{cr.get_samples()|length}} -{% endif %} - -{% endmacro %} - -{% call simple_utils.simple_run_page(tag, machine, run, compare_to, - neighboring_runs) %} - -{{ utils.render_popup_begin('view_options', 'View Options', true) }} -
-Show Delta: -
- -Show Previous Value: -
- -Show Standard Deviation: -
- -Show Median Absolute Deviation: -
- -Show All Values: -
- -Show All Samples: -
- -Show Sample Counts: -
- -Number of Comparison Runs: -
- -Show Report Graphs: -
- -Show Data Table: -
- -Hide Report By Default: -
- -Test Filter (regexp): -
- - -
-{{ utils.render_popup_end() }} - -{{ utils.render_popup_begin('text_report', 'Report (Text)', true) }} -
{{ text_report }}
-{{ utils.render_popup_end() }} - -{{ utils.render_popup_begin('html_report', 'Report (HTML)', - options.hide_report_by_default) }} -{{html_report|safe}} -{{ utils.render_popup_end() }} - -

Parameter Sets

- - - - - - -{% for key in ts_summary.parameter_keys %} - -{% endfor %} - - -{% for pmap in ts_summary.parameter_maps %} - - - {% for key in ts_summary.parameter_keys %} - {% set item = pmap.get(key) %} - - {% endfor %} - -{% endfor %} -
NameParameters
{{key}}
P{{loop.index0}}{{ "-" if item is none else item }}
- -

Tests

- -{% set pset_cols = ( - 2 + options.show_previous + options.show_delta + options.show_stddev + - options.show_mad + options.show_all_samples + options.show_sample_counts) %} - -
- - - - - -{% for key in ts_summary.parameter_sets %} - -{% endfor %} - - - - -{% for key in ts_summary.parameter_sets %} - {% if options.show_previous %} - - {% endif %} - - - {% if options.show_delta %} - - {% endif %} - {% if options.show_stddev %} - - {% endif %} - {% if options.show_mad %} - - {% endif %} - {% if options.show_all_samples %} - - {% endif %} - {% if options.show_sample_counts %} - - {% endif %} -{% endfor %} - - - -{% for name in test_names|sort %} - - - - {% for pset in ts_summary.parameter_sets %} - {% set cr = simple_run_info.get_run_comparison_result( - run, run_status_kind, compare_to, compare_to_status_kind, - name, pset, comparison_window) %} - {{ get_cell_value(cr) }} - {% endfor %} - -{% endfor %} -
NameP{{loop.index0}}
Prev%ΔσMADSamplesN
{{name}}
- -
- -{% if options.show_data_table %} - -

Test Data

- -
-Name{% for key in ts_summary.parameter_sets
-%}	P{{loop.index0}}	P{{loop.index0}}	P{{loop.index0}}{%
- endfor %}
--{% for key in ts_summary.parameter_sets
-%}	Prev	Value	%{% endfor %}
-{% for name in test_names|sort %}
-{{name}}{%
-for pset in ts_summary.parameter_sets %}{%
-  set cr = simple_run_info.get_run_comparison_result(
-            run, run_status_kind, compare_to, compare_to_status_kind,
-            name, pset, comparison_window)
-%}	{{cr.previous}}	{{cr.current}}	{{cr.pct_delta}}{% endfor %}{%
-endfor %}
-
-
-{% endif %} - -{% endcall %} - -{% endblock %} Removed: lnt/trunk/lnt/server/ui/templates/simple_utils.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/simple_utils.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/simple_utils.html (original) +++ lnt/trunk/lnt/server/ui/templates/simple_utils.html (removed) @@ -1,85 +0,0 @@ -{% import "utils.html" as utils %} - -{% macro simple_run_page(tag, machine, run, compare_to, - neighboring_runs) %} - -
- - - - - - - - - -{% if compare_to %} - - - - -{% endif %} -
Machine:{{machine.name}}:{{machine.number}}
Run:{{run.start_time}} ({{ - run.info['run_order'].value}})
Compare To:{{compare_to.start_time}} ({{ - compare_to.info['run_order'].value}})
-
-

- - - - - - -
- Homepage -

Machine:

- {{ - machine.name}}:{{machine.number}} -

Runs:

-
    - -{# Show a small number of neighboring runs. #} -{% for r in neighboring_runs %} -
  • {{ "

    "|safe if r.id == run.id else "" }} - {{ - r.start_time}}{{ - "

    "|safe if r.id == run.id else "" }} -{% endfor %} -
-
- - - - - - - - - -
Nickname {{machine.name}}
Machine ID {{machine.id}}
-{{ utils.render_popup_begin('machine_info', 'Machine Info', true) }} - -{% for key,item in machine.info|dictsort(true) %} - - - - -{% endfor %} -
{{key}} {{item.value}}
-{{ utils.render_popup_end() }} - -{{ utils.render_popup_begin('run_info', 'Run Info', true) }} - -{% for key,item in run.info|dictsort(true) %} - - - - -{% endfor %} -
{{key}} {{item.value.replace("\n","
")|safe}}
-{{ utils.render_popup_end() }} -{{ caller() }} - -
- -{% endmacro %} Removed: lnt/trunk/lnt/server/ui/templates/test.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/test.html?rev=161333&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/templates/test.html (original) +++ lnt/trunk/lnt/server/ui/templates/test.html (removed) @@ -1,42 +0,0 @@ -{% set db = request.get_db() %} -{% set test = db.getTest(id) %} - -{% extends "layout.html" %} -{% set components = [("browse", db_url_for("browse"))] %} -{% block title %}Test: {{test.name}}{% endblock %} -{% block body %} - -{# Show the test info dictionary. #} -

Test Info

- - - - - - -{% for key,value in test.info|dictsort %} - - - - -{% endfor %} -
KeyValue
{{key}}{{value}}
- -{# List samples. #} -

Associated Samples

- - - - - - - -{% for s in db.samples(test=test) %} - - - - -{% endfor %} -
Run IDValue
{{s.run_id}}{{s.value}}
- -{% endblock %} Modified: lnt/trunk/lnt/server/ui/views.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161334&r1=161333&r2=161334&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/views.py (original) +++ lnt/trunk/lnt/server/ui/views.py Mon Aug 6 15:02:44 2012 @@ -20,6 +20,7 @@ from lnt.db import perfdb from lnt.server.ui.globals import db_url_for, v4_url_for import lnt.server.reporting.analysis +from lnt.db import runinfo from lnt.server.ui.decorators import frontend, db_route, v4_route ### @@ -57,10 +58,6 @@ ### # Database Actions - at db_route('/browse') -def browse(): - return render_template("browse.html") - @db_route('/submitRun', only_v3=False, methods=('GET', 'POST')) def submit_run(): if request.method == 'POST': @@ -119,525 +116,6 @@ return render_template("submit_run.html") ### -# Generic Database Views - - at db_route("/machines//") -def machine(id): - return render_template("machine.html", id=id) - - at db_route("/runs//") -def run(id): - return render_template("run.html", id=id) - - at db_route("/tests//") -def test(id): - return render_template("test.html", id=id) - -### -# Simple LNT Schema Viewer - -from lnt.db.perfdb import Machine, Run, RunInfo, Sample -from lnt.db import runinfo -from lnt.db import perfdbsummary -from lnt.util import NTEmailReport - - at db_route("/simple//", only_v3=False) -def simple_overview(tag): - # If this is a v0.4 database, redirect. - if g.db_info.db_version != '0.3': - return redirect(db_url_for("v4_overview", testsuite_name=tag)) - - db = request.get_db() - - # Get the most recent runs in this tag, we just arbitrarily limit to looking - # at the last 100 submission. - recent_runs = db.query(Run).\ - join(RunInfo).\ - order_by(Run.start_time.desc()).\ - filter(RunInfo.key == "tag").\ - filter(RunInfo.value == tag).limit(100) - recent_runs = list(recent_runs) - - # Compute the active machine list. - active_machines = dict((run.machine.name, run) - for run in recent_runs[::-1]) - - # Compute the active submission list. - N = 30 - active_run_orders = dict( - db.query(RunInfo.run_id, RunInfo.value).\ - filter(RunInfo.key == "run_order").\ - filter(RunInfo.run_id.in_(s.id for s in recent_runs[:N]))) - active_submissions = [(r, active_run_orders.get(r.id)) - for r in recent_runs[:N]] - - return render_template("simple_overview.html", tag=tag, - active_machines=active_machines, - active_submissions=active_submissions) - - at db_route("/simple//machines/") -def simple_machine(tag, id): - db = request.get_db() - - # Get the run summary. - run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag) - - # Compute the list of associated runs, grouped by order. - from lnt.server.ui import util - grouped_runs = util.multidict( - (run_summary.get_run_order(run_id), run_id) - for run_id in run_summary.get_runs_on_machine(id)) - - associated_runs = [(order, [db.getRun(run_id) - for run_id in runs]) - for order,runs in grouped_runs.items()] - - return render_template("simple_machine.html", tag=tag, id=id, - associated_runs=associated_runs) - -def get_simple_run_info(tag, id): - db = request.get_db() - - run = db.getRun(id) - - # Get the run summary. - run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag) - - # Get the comparison run. - compare_to = None - compare_to_id = request.args.get('compare') - if compare_to_id is not None: - try: - compare_to = db.getRun(int(compare_to_id)) - except: - pass - if compare_to is None: - prev_id = run_summary.get_previous_run_on_machine(run.id) - if prev_id is not None: - compare_to = db.getRun(prev_id) - - return db, run, run_summary, compare_to - - at db_route("/simple///report") -def simple_report(tag, id): - db, run, run_summary, compare_to = get_simple_run_info(tag, id) - - show_graphs = bool(request.args.get('show_graphs')) - _, _, html_report = NTEmailReport.getSimpleReport( - None, db, run, url_for('index', db_name=g.db_name), - True, True, show_graphs = show_graphs) - - return make_response(html_report) - - at db_route("/simple///text_report") -def simple_text_report(tag, id): - db, run, run_summary, compare_to = get_simple_run_info(tag, id) - - _, text_report, _ = NTEmailReport.getSimpleReport( - None, db, run, url_for('index', db_name=g.db_name), - True, True) - - response = make_response(text_report) - response.mimetype = "text/plain" - return response - - at db_route("/simple///", only_v3=False) -def simple_run(tag, id): - # If this is a v0.4 database, redirect. - if g.db_info.db_version != '0.3': - # Attempt to find a V4 run which declares that it matches this simple - # run ID. - - # Get the expected test suite. - db = request.get_db() - ts = db.testsuite[tag] - - # Look for a matched run. - matched_run = ts.query(ts.Run).\ - filter(ts.Run.simple_run_id == id).\ - first() - - # If we found one, redirect to it's report. - if matched_run is not None: - return redirect(db_url_for("v4_run", testsuite_name=tag, - id=matched_run.id)) - - # Otherwise, report an error. - return render_template("error.html", message="""\ -Unable to find a v0.4 run for this ID. Please use the native v0.4 URL interface -(instead of the /simple/... URL schema).""") - - db, run, run_summary, compare_to = get_simple_run_info(tag, id) - - # Get additional summaries. - ts_summary = perfdbsummary.get_simple_suite_summary(db, tag) - sri = runinfo.SimpleRunInfo(db, ts_summary) - - # Get the neighboring runs. - cur_id = run.id - for i in range(3): - next_id = run_summary.get_next_run_on_machine(cur_id) - if not next_id: - break - cur_id = next_id - neighboring_runs = [] - for i in range(6): - neighboring_runs.append(db.getRun(cur_id)) - cur_id = run_summary.get_previous_run_on_machine(cur_id) - if cur_id is None: - break - - # Parse the view options. - options = {} - options['show_delta'] = bool(request.args.get('show_delta')) - options['show_previous'] = bool(request.args.get('show_previous')) - options['show_stddev'] = bool(request.args.get('show_stddev')) - options['show_mad'] = bool(request.args.get('show_mad')) - options['show_all'] = bool(request.args.get('show_all')) - options['show_all_samples'] = bool(request.args.get('show_all_samples')) - options['show_sample_counts'] = bool(request.args.get('show_sample_counts')) - options['show_graphs'] = show_graphs = bool(request.args.get('show_graphs')) - options['show_data_table'] = bool(request.args.get('show_data_table')) - options['hide_report_by_default'] = bool( - request.args.get('hide_report_by_default')) - try: - num_comparison_runs = int(request.args.get('num_comparison_runs')) - except: - num_comparison_runs = 10 - options['num_comparison_runs'] = num_comparison_runs - options['test_filter'] = test_filter_str = request.args.get( - 'test_filter', '') - if test_filter_str: - test_filter_re = re.compile(test_filter_str) - else: - test_filter_re = None - - _, text_report, html_report = NTEmailReport.getSimpleReport( - None, db, run, url_for('index', db_name=g.db_name), - True, True, only_html_body = True, show_graphs = show_graphs, - num_comparison_runs = num_comparison_runs) - - # Get the test status style used in each run. - run_status_kind = run_summary.get_run_status_kind(db, run.id) - if compare_to: - compare_to_status_kind = run_summary.get_run_status_kind( - db, compare_to.id) - else: - compare_to_status_kind = None - - # Get the list of tests we are interest in. - interesting_runs = [run.id] - if compare_to: - interesting_runs.append(compare_to.id) - test_names = ts_summary.get_test_names_in_runs(db, interesting_runs) - - # Filter the list of tests, if requested. - if test_filter_re: - test_names = [test - for test in test_names - if test_filter_re.search(test)] - - # Gather the runs to use for statistical data, if enabled. - cur_id = run.id - comparison_window = [] - for i in range(num_comparison_runs): - cur_id = run_summary.get_previous_run_on_machine(cur_id) - if not cur_id: - break - comparison_window.append(cur_id) - - return render_template("simple_run.html", tag=tag, id=id, - compare_to=compare_to, - compare_to_status_kind=compare_to_status_kind, - run_summary=run_summary, ts_summary=ts_summary, - simple_run_info=sri, test_names=test_names, - neighboring_runs=neighboring_runs, - text_report=text_report, html_report=html_report, - options=options, runinfo=runinfo, - comparison_window=comparison_window, - run_status_kind=run_status_kind) - - at db_route("/simple///graph", only_v3=False) -def simple_graph(tag, id): - from lnt.server.ui import graphutil - from lnt.server.ui import util - # If this is a v0.4 database, redirect. - if g.db_info.db_version != '0.3': - # Attempt to find a V4 run which declares that it matches this simple - # run ID. - - # Get the expected test suite. - db = request.get_db() - ts = db.testsuite[tag] - - # Look for a matched run. - matched_run = ts.query(ts.Run).\ - filter(ts.Run.simple_run_id == id).\ - first() - - # If we found one, redirect to it's report. - if matched_run is not None: - # We need to translate all of the graph parameters. - v4_graph_args = {} - - for name,value in request.args.items(): - if name.startswith("pset."): - # We don't use psets anymore, just ignore. - continue - if name.startswith("test."): - # Rewrite test arguments to point at the correct new test. - # - # The old style encoded tests to print as: - # test.=on - # where the name is the mangled form. - if value != "on": - continue - - # Strip the prefix. - test_name = name[5:] - - # Determine the sample field. - for sample_index,item in enumerate(ts.sample_fields): - if test_name.endswith(item.info_key): - test_name = test_name[:-len(item.info_key)] - break - else: - # We didn't recognize this test parameter. Just bail. - return render_template("error.html", message="""\ -Unexpected query argument %r""" % (name,)) - - # Find the test id for that test name. - test = ts.query(ts.Test).\ - filter(ts.Test.name == test_name).first() - if test is None: - return render_template("error.html", message="""\ -Unknown test %r""" % (test_name,)) - - # Add the query argument in the manner that v4_graph - # expects. - v4_graph_args["test.%d" % test.id] = sample_index - else: - # Otherwise, assume this is a view parameter and we can - # forward as is. - v4_graph_args[name] = value - - return redirect(db_url_for("v4_graph", testsuite_name=tag, - id=matched_run.id, **v4_graph_args)) - - # Otherwise, report an error. - return render_template("error.html", message="""\ -Unable to find a v0.4 run for this ID. Please use the native v0.4 URL interface -(instead of the /simple/... URL schema).""") - - db, run, run_summary, compare_to = get_simple_run_info(tag, id) - - # Get additional summaries. - ts_summary = perfdbsummary.get_simple_suite_summary(db, tag) - - # Get the neighboring runs. - cur_id = run.id - for i in range(3): - next_id = run_summary.get_next_run_on_machine(cur_id) - if not next_id: - break - cur_id = next_id - neighboring_runs = [] - for i in range(6): - neighboring_runs.append(db.getRun(cur_id)) - cur_id = run_summary.get_previous_run_on_machine(cur_id) - if cur_id is None: - break - - # Parse the view options. - options = {} - show_mad = bool(request.args.get('show_mad', True)) - show_stddev = bool(request.args.get('show_stddev')) - show_linear_regression = bool( - request.args.get('show_linear_regression', True)) - - # Load the graph parameters. - graph_tests = [] - graph_psets = [] - for name,value in request.args.items(): - if name.startswith(str('test.')): - graph_tests.append(name[5:]) - elif name.startswith(str('pset.')): - graph_psets.append(ts_summary.parameter_sets[int(name[5:])]) - - # Get the test ids we want data for. - test_ids = [ts_summary.test_id_map[(name,pset)] - for name in graph_tests - for pset in graph_psets] - - # Build the graph data - pset_id_map = dict([(pset,i) - for i,pset in enumerate(ts_summary.parameter_sets)]) - legend = [] - num_points = 0 - plot_points = [] - plots = "" - plots_iter = graphutil.get_test_plots( - db, run.machine, test_ids, run_summary, ts_summary, - show_mad_error = show_mad, show_stddev = show_stddev, - show_linear_regression = show_linear_regression, show_points = True) - for test_id, plot_js, col, points, ext_points in plots_iter: - test = db.getTest(test_id) - name = test.name - pset = test.get_parameter_set() - - num_points += len(points) - legend.append(("%s : P%d" % (name, pset_id_map[pset]), tuple(col))) - plots += plot_js - plot_points.append(ext_points) - - # Build the sample info. - resample_list = set() - new_sample_list = [] - plot_deltas = [] - for (name,col),points in zip(legend,plot_points): - points.sort() - deltas = [(util.safediv(p1[1], p0[1]), p0, p1) - for p0,p1 in util.pairs(points)] - deltas.sort() - deltas.reverse() - plot_deltas.append(deltas[:20]) - for (pct,(r0,t0,mad0,med0),(r1,t1,mad1,med1)) in deltas[:20]: - # Find the best next revision to sample, unless we have - # sampled to the limit. To conserve resources, we try to - # align to the largest "nice" revision boundary that we can, - # so that we tend to sample the same revisions, even as we - # drill down. - assert r0 < r1 and r0 != r1 - if r0 + 1 != r1: - for align in [scale * boundary - for scale in (100000,10000,1000,100,10,1) - for boundary in (5, 1)]: - r = r0 + 1 + (r1 - r0)//2 - r = (r // align) * align - if r0 < r < r1: - new_sample_list.append(r) - break - - resample_list.add(r0) - resample_list.add(r1) - - return render_template("simple_graph.html", tag=tag, id=id, - compare_to=compare_to, - neighboring_runs=neighboring_runs, - run_summary=run_summary, ts_summary=ts_summary, - graph_plots=plots, legend=legend, - num_plots=len(test_ids), num_points=num_points, - new_sample_list=new_sample_list, - resample_list=resample_list, - plot_deltas=plot_deltas) - - at db_route("/simple//order_aggregate_report") -def simple_order_aggregate_report(tag): - from lnt.server.ui import util - - db = request.get_db() - - # Get the run summary. - run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag) - # Load the test suite summary. - ts_summary = perfdbsummary.get_simple_suite_summary(db, tag) - # Get the run pass/fail information. - sri = runinfo.SimpleRunInfo(db, ts_summary) - - # Get this list of orders we are aggregating over. - orders_to_aggregate = request.args.get('orders', '') - orders_to_aggregate = orders_to_aggregate.split(',') - - # Collect the runs, aggregated by order and machine. - runs_to_summarize = [] - runs_by_machine_and_order = util.multidict() - available_machine_ids = set() - for order in orders_to_aggregate: - for id in run_summary.runs_by_order["%7s" % order]: - r = db.getRun(id) - runs_to_summarize.append(r) - available_machine_ids.add(r.machine_id) - runs_by_machine_and_order[(r.machine_id, order)] = r - available_machine_ids = list(available_machine_ids) - available_machine_ids.sort() - available_machines = [db.getMachine(id) - for id in available_machine_ids] - - # We currently only compare the null pset. - pset = () - - # Get the list of tests we are interested in. - test_names = ts_summary.get_test_names_in_runs(db, ( - r.id for r in runs_to_summarize)) - - # Create test subsets, by name. - test_subsets = util.multidict() - for test_name in test_names: - if '.' in test_name: - subset = test_name.rsplit('.', 1)[1] - else: - subset = test_name, '' - test_subsets[subset] = test_name - - # Convert subset names to pretty form. - def convert((subset, tests)): - subset_name = { "compile" : "Compile Time", - "exec" : "Execution Time" }.get(subset, subset) - return (subset_name, tests) - test_subsets = dict(convert(item) for item in test_subsets.items()) - - # Batch load all the samples for all the runs we are interested in. - start_time = time.time() - all_samples = db.session.query(Sample.run_id, Sample.test_id, - Sample.value).\ - filter(Sample.run_id.in_( - r.id for r in runs_to_summarize)) - all_samples = list(all_samples) - - # Aggregate samples for easy lookup. - aggregate_samples = util.multidict() - for run_id, test_id, value in all_samples: - aggregate_samples[(run_id, test_id)] = value - - # Create the data table as: - # data_table[subset_name][test_name][order index][machine index] = ( - # status samples, samples) - def get_test_samples(machine_id, test_name, order): - status_name = test_name + '.status' - status_test_id = ts_summary.test_id_map.get( - (status_name, pset)) - test_id = ts_summary.test_id_map.get( - (test_name, pset)) - - status_samples = [] - samples = [] - for run in runs_by_machine_and_order.get((machine_id,order), []): - status_samples.extend(aggregate_samples.get( - (run.id, status_test_id), [])) - samples.extend(aggregate_samples.get( - (run.id, test_id), [])) - - # For now, return simplified sample set. We can return all the data if - # we find a use for it. - if status_samples or not samples: - return None - return min(samples) - data_table = {} - for subset_name,tests_in_subset in test_subsets.items(): - data_table[subset_name] = subset_table = {} - for test_name in tests_in_subset: - subset_table[test_name] = test_data = [ - [get_test_samples(id, test_name, order) - for id in available_machine_ids] - for order in orders_to_aggregate] - - # Create some other data tables of serializable info. - available_machine_info = [(m.id, m.name) - for m in available_machines] - - return render_template("simple_order_aggregate_report.html", **locals()) - -### # V4 Schema Viewer @v4_route("/") @@ -773,6 +251,35 @@ response.mimetype = "text/plain" return response +# Compatilibity route for old run pages. + at db_route("/simple///", only_v3=False) +def simple_run(tag, id): + # Attempt to find a V4 run which declares that it matches this simple run + # ID. We do this so we can preserve some URL compatibility for old + # databases. + if g.db_info.db_version != '0.4': + return render_template("error.html", message="""\ +Invalid URL for version %r database.""" % (g.db_info.db_version,)) + + # Get the expected test suite. + db = request.get_db() + ts = db.testsuite[tag] + + # Look for a matched run. + matched_run = ts.query(ts.Run).\ + filter(ts.Run.simple_run_id == id).\ + first() + + # If we found one, redirect to it's report. + if matched_run is not None: + return redirect(db_url_for("v4_run", testsuite_name=tag, + id=matched_run.id)) + + # Otherwise, report an error. + return render_template("error.html", message="""\ +Unable to find a v0.4 run for this ID. Please use the native v0.4 URL interface +(instead of the /simple/... URL schema).""") + @v4_route("/") def v4_run(id): info = V4RequestInfo(id) From daniel at zuster.org Mon Aug 6 15:02:49 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:02:49 -0000 Subject: [llvm-commits] [LNT] r161335 - in /lnt/trunk/lnt: db/perfdb.py db/perfdbsummary.py db/runinfo.py lnttool/import_data.py lnttool/main.py lnttool/report.py server/config.py server/ui/app.py server/ui/graphutil.py server/ui/views.py util/ImportData.py util/NTEmailReport.py util/NTUtil.py Message-ID: <20120806200249.B89EB2A6C073@llvm.org> Author: ddunbar Date: Mon Aug 6 15:02:49 2012 New Revision: 161335 URL: http://llvm.org/viewvc/llvm-project?rev=161335&view=rev Log: Remove v0.3 database (PerfDB) itself and associated code (like reporting). Removed: lnt/trunk/lnt/db/perfdb.py lnt/trunk/lnt/db/perfdbsummary.py lnt/trunk/lnt/lnttool/report.py lnt/trunk/lnt/server/ui/graphutil.py lnt/trunk/lnt/util/NTUtil.py Modified: lnt/trunk/lnt/db/runinfo.py lnt/trunk/lnt/lnttool/import_data.py lnt/trunk/lnt/lnttool/main.py lnt/trunk/lnt/server/config.py lnt/trunk/lnt/server/ui/app.py lnt/trunk/lnt/server/ui/views.py lnt/trunk/lnt/util/ImportData.py lnt/trunk/lnt/util/NTEmailReport.py Removed: lnt/trunk/lnt/db/perfdb.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/db/perfdb.py?rev=161334&view=auto ============================================================================== --- lnt/trunk/lnt/db/perfdb.py (original) +++ lnt/trunk/lnt/db/perfdb.py (removed) @@ -1,495 +0,0 @@ -#!/usr/bin/python - -### -# SQLAlchemy database layer - -import sqlalchemy -import sqlalchemy.ext.declarative -import sqlalchemy.orm -from sqlalchemy import * -from sqlalchemy.schema import Index -from sqlalchemy.orm import relation, backref -from sqlalchemy.orm.collections import attribute_mapped_collection - -Base = sqlalchemy.ext.declarative.declarative_base() -class Revision(Base): - __tablename__ = 'Revision' - - id = Column("ID", Integer, primary_key=True) - name = Column("Name", String(256)) - number = Column("Number", Integer) - - def __init__(self, name, number): - self.name = name - self.number = number - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, (self.name, self.number)) - -class Machine(Base): - __tablename__ = 'Machine' - - id = Column("ID", Integer, primary_key=True) - name = Column("Name", String(256)) - number = Column("Number", Integer) - - info = relation('MachineInfo', - collection_class=attribute_mapped_collection('key'), - backref=backref('machine')) - - def __init__(self, name, number): - self.name = name - self.number = number - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, (self.name, self.number)) - -class MachineInfo(Base): - __tablename__ = 'MachineInfo' - - id = Column("ID", Integer, primary_key=True) - machine_id = Column("Machine", Integer, ForeignKey('Machine.ID')) - key = Column("Key", String(256)) - value = Column("Value", String(4096)) - - def __init__(self, machine, key, value): - self.machine = machine - self.key = key - self.value = value - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, - (self.machine, self.key, self.value)) - -class Run(Base): - __tablename__ = 'Run' - - id = Column("ID", Integer, primary_key=True) - machine_id = Column("MachineID", Integer, ForeignKey('Machine.ID')) - start_time = Column("StartTime", DateTime) - end_time = Column("EndTime", DateTime) - - machine = relation(Machine) - - info = relation('RunInfo', - collection_class=attribute_mapped_collection('key'), - backref=backref('run')) - - def __init__(self, machine, start_time, end_time): - self.machine = machine - self.start_time = start_time - self.end_time = end_time - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, - (self.machine, self.start_time, self.end_time)) - -class RunInfo(Base): - __tablename__ = 'RunInfo' - - id = Column("ID", Integer, primary_key=True) - run_id = Column("Run", Integer, ForeignKey('Run.ID')) - key = Column("Key", String(256), index=True) - value = Column("Value", String(4096)) - - def __init__(self, run, key, value): - self.run = run - self.key = key - self.value = value - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, - (self.run, self.key, self.value)) - -class Test(Base): - __tablename__ = 'Test' - - id = Column("ID", Integer, primary_key=True) - name = Column("Name", String(512)) - - info = relation('TestInfo', - collection_class=attribute_mapped_collection('key'), - backref=backref('test')) - - def __init__(self, name): - self.name = name - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, - (self.name,)) - - def get_parameter_set(self): - items = [(k,v.value) for k,v in self.info.items()] - items.sort() - return tuple(items) - -class TestInfo(Base): - __tablename__ = 'TestInfo' - - id = Column("ID", Integer, primary_key=True) - test_id = Column("Test", Integer, ForeignKey('Test.ID')) - key = Column("Key", String(256)) - value = Column("Value", String(4096)) - - def __init__(self, test, key, value): - self.test = test - self.key = key - self.value = value - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, - (self.test, self.key, self.value)) - -class Sample(Base): - __tablename__ = 'Sample' - - id = Column("ID", Integer, primary_key=True) - run_id = Column("RunID", Integer, ForeignKey('Run.ID'), index=True) - test_id = Column("TestID", Integer, ForeignKey('Test.ID'), index=True) - value = Column("Value", Float) - - run = relation(Run) - test = relation(Test) - - def __init__(self, run, test, value): - self.run = run - self.test = test - self.value = value - - def __repr__(self): - return '%s%r' % (self.__class__.__name__, - (self.run, self.test, self.value)) - -# Define an additonal index on (RunID, TestID). -Index("ix_Sample_RunID_TestID", Sample.run_id, Sample.test_id) - -### -# PerfDB wrapper, to avoid direct SA dependency when possible. - -def info_eq(a, b): - a = list(a) - b = list(b) - a.sort() - b.sort() - return a == b - -class PerfDB: - def __init__(self, path, echo=False): - if (not path.startswith('mysql://') and - not path.startswith('sqlite://')): - path = 'sqlite:///' + path - self.path = path - self.engine = sqlalchemy.create_engine(path, echo=echo) - - # Create the tables in case this is a new database. - Base.metadata.create_all(self.engine) - - self.session = sqlalchemy.orm.sessionmaker(self.engine)() - self.modified_machine = self.modified_run = self.modified_test = False - - # Make sure revision numbers exists. - for r in ("Machine","MachineInfo","Run","RunInfo","Test","TestInfo"): - self.get_revision(r) - self.commit() - - # Add shortcut alias. - self.query = self.session.query - - def get_revision(self, name): - for r in self.session.query(Revision).filter_by(name=name): - return r - r = Revision(name, 0) - self.session.add(r) - return r - def get_revision_number(self, name): - return self.get_revision(name).number - - def machines(self, name=None): - q = self.session.query(Machine) - if name: - q = q.filter_by(name=name) - return q - - def tests(self, name=None): - q = self.session.query(Test) - if name: - q = q.filter_by(name=name) - return q - - def runs(self, machine=None): - q = self.session.query(Run) - if machine: - q = q.filter_by(machine=machine) - return q - - def samples(self, run=None, test=None): - q = self.session.query(Sample) - if run: - q = q.filter_by(run_id=run.id) - if test: - q = q.filter_by(test_id=test.id) - return q - - def getNumMachines(self): - return self.machines().count() - - def getNumRuns(self): - return self.runs().count() - - def getNumTests(self): - return self.tests().count() - - def getNumSamples(self): - return self.samples().count() - - def getMachine(self, id): - return self.session.query(Machine).filter_by(id=id).one() - - def getRun(self, id): - return self.session.query(Run).filter_by(id=id).one() - - def getTest(self, id): - return self.session.query(Test).filter_by(id=id).one() - - def getOrCreateMachine(self, name, info): - # FIXME: Not really the right way... - number = 1 - for m in self.machines(name=name): - if info_eq([(i.key, i.value) for i in m.info.values()], info): - return m,False - number += 1 - - # Make a new record - m = Machine(name, number) - m.info = dict((k,MachineInfo(m,k,v)) for k,v in info) - self.session.add(m) - self.modified_machine = True - return m,True - - def getOrCreateTest(self, name, info): - # FIXME: Not really the right way... - for t in self.tests(name): - if info_eq([(i.key, i.value) for i in t.info.values()], info): - return t,False - - t = Test(name) - t.info = dict((k,TestInfo(t,k,v)) for k,v in info) - self.session.add(t) - self.modified_test = True - return t,True - - def getOrCreateRun(self, machine, start_time, end_time, info): - from datetime import datetime - start_time = datetime.strptime(start_time, - "%Y-%m-%d %H:%M:%S") - end_time = datetime.strptime(end_time, - "%Y-%m-%d %H:%M:%S") - - # FIXME: Not really the right way... - for r in self.session.query(Run).filter_by(machine=machine): - # FIXME: Execute this filter in SQL, but resolve the - # normalization issue w.r.t. SQLAlchemy first. I think we - # may be running afoul of SQLite not normalizing the - # datetime. If I don't do this then sqlalchemy issues a - # query in the format YYYY-MM-DD HH:MM:SS.ssss which - # doesn't work. - if r.start_time != start_time or r.end_time != end_time: - continue - if info_eq([(i.key, i.value) for i in r.info.values()], info): - return r,False - - # Make a new record - r = Run(machine, start_time, end_time) - r.info = dict((k,RunInfo(r,k,v)) for k,v in info) - self.session.add(r) - self.modified_run = True - return r,True - - def addSample(self, run, test, value): - s = Sample(run, test, value) - self.session.add(s) - return s - - def addSamples(self, samples): - """addSamples([(run_id, test_id, value), ...]) -> None - - Batch insert a list of samples.""" - - # Flush to keep session consistent. - self.session.flush() - - for run_id,test_id,value in samples: - q = Sample.__table__.insert().values(RunID = run_id, - TestID = test_id, - Value = value) - self.session.execute(q) - - def commit(self): - if self.modified_machine: - self.get_revision("Machine").number += 1 - self.get_revision("MachineInfo").number += 1 - if self.modified_run: - self.get_revision("Run").number += 1 - self.get_revision("RunInfo").number += 1 - if self.modified_test: - self.get_revision("Test").number += 1 - self.get_revision("TestInfo").number += 1 - self.session.commit() - self.modified_machine = self.modified_test = self.modified_run = False - - def rollback(self): - self.session.rollback() - self.modified_machine = self.modified_test = self.modified_run = False - - def importDataFromDict(self, data, config=None): - return importDataFromDict(self, data) - - def get_db_summary(self): - import perfdbsummary - return perfdbsummary.PerfDBSummary.fromdb(self) - -def importDataFromDict(db, data): - # FIXME: Validate data - machineData = data['Machine'] - runData = data['Run'] - testsData = data['Tests'] - - # Get the machine - # FIXME: Validate machine - machine,_ = db.getOrCreateMachine(machineData['Name'], - machineData['Info'].items()) - - # Accept 'Time' as an alias for 'Start Time' - if 'Start Time' not in runData and 'Time' in runData: - import time - t = time.strptime(runData['Time'], - "%a, %d %b %Y %H:%M:%S -0700 (PDT)") - runData['Start Time'] = time.strftime('%Y-%m-%d %H:%M', t) - - # Create the run. - run,inserted = db.getOrCreateRun(machine, - runData.get('Start Time',''), - runData.get('End Time',''), - runData.get('Info',{}).items()) - if not inserted: - return False,run - - # Batch load the set of tests instead of repeatedly querying to unique. - # - # FIXME: Add explicit config object. - test_info = {} - for id,k,v in db.session.query(TestInfo.test_id, TestInfo.key, - TestInfo.value): - info = test_info[id] = test_info.get(id,{}) - info[str(k)] = str(v) - - testMap = {} - for test_id,test_name in db.session.query(Test.id, Test.name): - info = test_info.get(test_id,{}).items() - info.sort() - testMap[(str(test_name),tuple(info))] = test_id - - # Create the tests up front, so we can resolve IDs. - test_ids = [] - late_ids = [] - for i,testData in enumerate(testsData): - name = str(testData['Name']) - info = [(str(k),str(v)) for k,v in testData['Info'].items()] - info.sort() - test_id = testMap.get((name,tuple(info))) - if test_id is None: - test,created = db.getOrCreateTest(testData['Name'],info) - late_ids.append((i,test)) - test_ids.append(test_id) - - # Flush now to resolve test and run ids. - # - # FIXME: Surely there is a cleaner way to handle this? - db.session.flush() - - if late_ids: - for i,t in late_ids: - test_ids[i] = t.id - - db.addSamples([(run.id, test_id, value) - for test_id,testData in zip(test_ids, testsData) - for value in testData['Data']]) - return True,run - -def test_sa_db(dbpath): - if not dbpath.startswith('mysql://'): - dbpath = 'sqlite:///' + dbpath - engine = sqlalchemy.create_engine(dbpath) - - Session = sqlalchemy.orm.sessionmaker(engine) - Session.configure(bind=engine) - - session = Session() - - m = session.query(Machine).first() - print m - print m.info - - r = session.query(Run).first() - print r - print r.info - - t = session.query(Test)[20] - print t - print t.info - - s = session.query(Sample)[20] - print s - - import time - start = time.time() - print - q = session.query(Sample) - q = q.filter(Sample.run_id == 994) - print - res = session.execute(q) - print res - N = 0 - for row in res: - if N == 1: - print row - N += 1 - print N, time.time() - start - print - - start = time.time() - N = 0 - for row in q: - if N == 1: - print row - N += 1 - print N, time.time() - start - -def main(): - global opts - from optparse import OptionParser - parser = OptionParser("usage: %prog dbpath") - opts,args = parser.parse_args() - - if len(args) != 1: - parser.error("incorrect number of argments") - - dbpath, = args - - # Test the SQLAlchemy layer. - test_sa_db(dbpath) - - # Test the PerfDB wrapper. - db = PerfDB(dbpath) - - print "Opened %r" % dbpath - - for m in db.machines(): - print m - for r in db.runs(m): - print ' run - id:%r, start:%r,'\ - ' # samples: %d.' % (r.id, r.start_time, - db.samples(run=r).count()) - -if __name__ == '__main__': - main() Removed: lnt/trunk/lnt/db/perfdbsummary.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/db/perfdbsummary.py?rev=161334&view=auto ============================================================================== --- lnt/trunk/lnt/db/perfdbsummary.py (original) +++ lnt/trunk/lnt/db/perfdbsummary.py (removed) @@ -1,241 +0,0 @@ -""" -Classes for caching metadata about a PerfDB instance. -""" - -from lnt.db.perfdb import Run, RunInfo, Sample, Test - -class SuiteSummary: - def __init__(self, name, path): - self.name = name - self.path = path - -class PerfDBSummary: - @staticmethod - def fromdb(db): - revision = db.get_revision_number("Run") - - # Look for all the run tags and use them to identify the available - # suites. - q = db.session.query(RunInfo.value.distinct()) - q = q.filter(RunInfo.key == "tag") - - suites = [SuiteSummary("Nightlytest", ("nightlytest",))] - for tag, in q: - if tag == 'nightlytest': - continue - suites.append(SuiteSummary(tag, ("simple",tag))) - - suites.sort(key=lambda s: s.name) - return PerfDBSummary(revision, suites) - - def __init__(self, revision, suites): - self.revision = revision - self.suites = suites - - def is_up_to_date(self, db): - return (not db.modified_run and - self.revision == db.get_revision_number("Run")) - -class SimpleSuiteSummary(object): - @staticmethod - def fromdb(db, tag): - revision = db.get_revision_number("Test") - - # Find all test names. - q = db.session.query(Test) - q = q.filter(Test.name.startswith(tag)) - tests = list(q) - - # Collect all the test data. - test_names = set() - parameter_sets = set() - test_id_map = {} - for t in tests: - name = t.name.split('.', 1)[1] - - key = t.get_parameter_set() - - parameter_sets.add(key) - test_id_map[(name, key)] = t.id - - if name.endswith('.success'): - test_name = name.rsplit('.', 1)[0] - elif name.endswith('.status'): - test_name = name.rsplit('.', 1)[0] - else: - test_name = name - - test_names.add(test_name) - - # Order the test names. - test_names = list(test_names) - test_names.sort() - - # Collect the set of all parameter keys. - parameter_keys = list(set([k for pset in parameter_sets - for k,v in pset])) - parameter_keys.sort() - - # Order the parameter sets and convert to dictionaries. - parameter_sets = list(parameter_sets) - parameter_sets.sort() - - return SimpleSuiteSummary(revision, tag, test_names, - test_id_map, parameter_keys, parameter_sets) - - def __init__(self, revision, tag, test_names, - test_id_map, parameter_keys, parameter_sets): - self.revision = revision - self.tag = tag - self.test_names = test_names - self.test_id_map = test_id_map - self.parameter_keys = parameter_keys - self.parameter_sets = parameter_sets - self.parameter_maps = map(dict, parameter_sets) - self.test_info_map = dict([(v,k) for k,v in test_id_map.items()]) - - def is_up_to_date(self, db): - return (not db.modified_test and - self.revision == db.get_revision_number("Test")) - - def get_test_names_in_runs(self, db, runs): - # Load the distinct test ids for these runs. - test_ids = db.session.query(Sample.test_id)\ - .filter(Sample.run_id.in_(runs)).distinct() - - # Get the test names for the test ids. - test_names = [self.test_info_map[id][0] - for id, in test_ids] - - # Limit to the tests we actually report. - test_names = list(set(test_names) & set(self.test_names)) - test_names.sort() - - return test_names - -_cache = {} -def get_simple_suite_summary(db, tag): - key = (db.path, tag) - entry = _cache.get(key) - if entry is None or not entry.is_up_to_date(db): - _cache[key] = entry = SimpleSuiteSummary.fromdb(db, tag) - return entry - -class SimpleSuiteRunSummary(object): - _cache = {} - @staticmethod - def get_summary(db, tag): - key = (db.path, tag) - entry = SimpleSuiteRunSummary._cache.get(key) - if entry is None or not entry.is_up_to_date(db): - entry = SimpleSuiteRunSummary.fromdb(db, tag) - SimpleSuiteRunSummary._cache[key] = entry - return entry - - @staticmethod - def fromdb(db, tag): - revision = db.get_revision_number("RunInfo") - - # Find all run_orders for runs with this tag, ordered by run time so - # that runs are ordered by both (run_order, time) in the final ordering. - all_run_orders = db.session.query(RunInfo.value, RunInfo.run_id, - Run.machine_id).\ - join(Run).\ - order_by(Run.start_time.desc()).\ - filter(RunInfo.key == "run_order").\ - filter(RunInfo.run_id.in_( - db.session.query(RunInfo.run_id).\ - filter(RunInfo.key == "tag").\ - filter(RunInfo.value == tag).subquery())) - all_run_orders = list(all_run_orders) - - order_by_run = dict((run_id,order) - for order,run_id,machine_id in all_run_orders) - machine_id_by_run = dict((run_id,machine_id) - for order,run_id,machine_id in all_run_orders) - - # Create a mapping from run_order to the available runs with that order. - runs_by_order = {} - for order,run_id,_ in all_run_orders: - runs = runs_by_order.get(order) - if runs is None: - runs = runs_by_order[order] = [] - runs.append(run_id) - - # Get all available run_orders, in order. - def order_key(run_order): - return run_order - run_orders = runs_by_order.keys() - run_orders.sort(key = order_key) - run_orders.reverse() - - # Construct the total order of runs. - runs_in_order = [] - for order in run_orders: - runs_in_order.extend(runs_by_order[order]) - - return SimpleSuiteRunSummary( - revision, tag, run_orders, runs_by_order, runs_in_order, - order_by_run, machine_id_by_run) - - def __init__(self, revision, tag, run_orders, runs_by_order, runs_in_order, - order_by_run, machine_id_by_run): - self.revision = revision - self.tag = tag - self.run_orders = run_orders - self.runs_by_order = runs_by_order - self.runs_in_order = runs_in_order - self.order_by_run = order_by_run - self.machine_id_by_run = machine_id_by_run - self.run_status_kinds = {} - - def is_up_to_date(self, db): - return (not db.modified_run and - self.revision == db.get_revision_number("RunInfo")) - - def contains_run(self, run_id): - return run_id in self.machine_id_by_run - - def get_run_order(self, run_id): - return self.order_by_run.get(run_id) - - def get_runs_on_machine(self, machine_id): - return [k for k,v in self.machine_id_by_run.items() - if v == machine_id] - - def get_run_ordered_index(self, run_id): - try: - return self.runs_in_order.index(run_id) - except: - print run_id - print self.runs_in_order - raise - - def get_previous_run_on_machine(self, run_id): - machine_id = self.machine_id_by_run[run_id] - index = self.get_run_ordered_index(run_id) - for i in range(index + 1, len(self.runs_in_order)): - id = self.runs_in_order[i] - if machine_id == self.machine_id_by_run[id]: - return id - - def get_next_run_on_machine(self, run_id): - machine_id = self.machine_id_by_run[run_id] - index = self.get_run_ordered_index(run_id) - for i in range(0, index)[::-1]: - id = self.runs_in_order[i] - if machine_id == self.machine_id_by_run[id]: - return id - - def get_run_status_kind(self, db, run_id): - kind = self.run_status_kinds.get(run_id) - if kind is None: - # Compute the status kind by for .success tests in this run. - if db.session.query(Test.name).join(Sample)\ - .filter(Sample.run_id == run_id)\ - .filter(Test.name.endswith(".success")).first() is not None: - kind = False - else: - kind = True - self.run_status_kinds[run_id] = kind - return kind Modified: lnt/trunk/lnt/db/runinfo.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/db/runinfo.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/db/runinfo.py (original) +++ lnt/trunk/lnt/db/runinfo.py Mon Aug 6 15:02:49 2012 @@ -1,8 +1,3 @@ -from lnt.util import stats -from lnt.server.ui import util -from lnt.db.perfdb import Sample -from lnt.testing import PASS, FAIL, XFAIL - REGRESSED = 'REGRESSED' IMPROVED = 'IMPROVED' UNCHANGED_PASS = 'UNCHANGED_PASS' @@ -106,154 +101,3 @@ return REGRESSED else: return UNCHANGED_PASS - -class SimpleRunInfo: - def __init__(self, db, test_suite_summary): - self.db = db - self.test_suite_summary = test_suite_summary - - self.sample_map = util.multidict() - self.loaded_samples = set() - - def get_test_status_in_run(self, run_id, status_kind, test_name, pset): - if status_kind == False: # .success - status_name = test_name + '.success' - status_test_id = self.test_suite_summary.test_id_map.get( - (status_name, pset)) - run_status = self.sample_map.get((run_id, status_test_id)) - if run_status and int(run_status[0]) == 1: - return PASS - else: - return FAIL - else: - status_name = test_name + '.status' - status_test_id = self.test_suite_summary.test_id_map.get( - (status_name, pset)) - run_status = self.sample_map.get((run_id, status_test_id)) - if not run_status: - return PASS - else: - # FIXME: What to do about the multiple entries here. We could - # start by just treating non-matching samples as errors. - return int(run_status[0]) - - def get_run_comparison_result(self, run, run_status_kind, - compare_to, compare_to_status_kind, - test_name, pset, comparison_window=[]): - # Get the test. - test_id = self.test_suite_summary.test_id_map.get((test_name, pset)) - if test_id is None: - return ComparisonResult(run_value=None, prev_value=None, delta=None, - pct_delta=None, stddev=None, MAD=None, - cur_failed=None, prev_failed=None, - samples=[]) - - # Load the sample data for the current and previous runs and the - # comparison window. - if compare_to is None: - compare_id = None - else: - compare_id = compare_to.id - runs_to_load = set(comparison_window) - runs_to_load.add(run.id) - if compare_id is not None: - runs_to_load.add(compare_id) - self._load_samples_for_runs(runs_to_load) - - # Lookup the current and previous values. - run_values = self.sample_map.get((run.id, test_id)) - prev_values = self.sample_map.get((compare_id, test_id)) - - # Determine whether this (test,pset) passed or failed in the current and - # previous runs. - run_failed = prev_failed = False - run_status = prev_status = None - run_status = self.get_test_status_in_run( - run.id, run_status_kind, test_name, pset) - if compare_to: - prev_status = self.get_test_status_in_run( - compare_to.id, compare_to_status_kind, test_name, pset) - else: - prev_status = None - - # FIXME: Support XFAILs better. - run_failed = run_status == FAIL - prev_failed = prev_status == FAIL - - # Get the current and previous values. - if run_values: - run_value = min(run_values) - else: - run_value = None - if prev_values: - prev_value = min(prev_values) - else: - prev_value = None - - # If we have multiple values for this run, use that to estimate the - # distribution. - if run_values and len(run_values) > 1: - stddev = stats.standard_deviation(run_values) - MAD = stats.median_absolute_deviation(run_values) - stddev_mean = stats.mean(run_values) - stddev_is_estimated = False - else: - stddev = None - MAD = None - stddev_mean = None - stddev_is_estimated = False - - # If we are missing current or comparison values we are done. - if run_value is None or prev_value is None: - return ComparisonResult( - run_value, prev_value, delta=None, - pct_delta = None, stddev = stddev, MAD = MAD, - cur_failed = run_failed, prev_failed = prev_failed, - samples = run_values) - - # Compute the comparison status for the test value. - delta = run_value - prev_value - if prev_value != 0: - pct_delta = delta / prev_value - else: - pct_delta = 0.0 - - # If we don't have an estimate for the distribution, attempt to "guess" - # it using the comparison window. - # - # FIXME: We can substantially improve the algorithm for guessing the - # noise level from a list of values. Probably better to just find a way - # to kill this code though. - if stddev is None: - # Get all previous values in the comparison window, for passing - # runs. - # - # FIXME: This is using the wrong status kind. :/ - prev_values = [v for run_id in comparison_window - for v in self.sample_map.get((run_id, test_id), ()) - if self.get_test_status_in_run( - run_id, run_status_kind, test_name, pset) == PASS] - if prev_values: - stddev = stats.standard_deviation(prev_values) - MAD = stats.median_absolute_deviation(prev_values) - stddev_mean = stats.mean(prev_values) - stddev_is_estimated = True - - return ComparisonResult(run_value, prev_value, delta, - pct_delta, stddev, MAD, - run_failed, prev_failed, run_values, - stddev_mean, stddev_is_estimated) - - def _load_samples_for_runs(self, runs): - # Find the set of new runs to load. - to_load = set(runs) - self.loaded_samples - if not to_load: - return - - q = self.db.session.query(Sample.value, Sample.run_id, Sample.test_id) - q = q.filter(Sample.run_id.in_(to_load)) - for value,run_id,test_id in q: - self.sample_map[(run_id,test_id)] = value - - self.loaded_samples |= to_load - Modified: lnt/trunk/lnt/lnttool/import_data.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/import_data.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/lnttool/import_data.py (original) +++ lnt/trunk/lnt/lnttool/import_data.py Mon Aug 6 15:02:49 2012 @@ -1,9 +1,6 @@ import os, pprint, sys, time -import lnt.db.perfdb -from lnt import formats -import lnt.server.config -import lnt.server.db.v4db +import lnt.formats import lnt.util.ImportData import lnt.server.instance @@ -16,7 +13,7 @@ parser.add_option("", "--database", dest="database", default="default", help="database to write to [%default]") parser.add_option("", "--format", dest="format", - choices=formats.format_names + [''], + choices=lnt.formats.format_names + [''], default='') parser.add_option("", "--commit", dest="commit", type=int, default=False) Modified: lnt/trunk/lnt/lnttool/main.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/main.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/lnttool/main.py (original) +++ lnt/trunk/lnt/lnttool/main.py Mon Aug 6 15:02:49 2012 @@ -12,7 +12,6 @@ import lnt import lnt.util.ImportData from lnt import testing -from lnt.db import perfdb from lnt.testing.util.commands import note, warning, error, fatal def action_runserver(name, args): @@ -90,7 +89,6 @@ from create import action_create from convert import action_convert from import_data import action_import -from report import action_report from updatedb import action_updatedb def action_checkformat(name, args): Removed: lnt/trunk/lnt/lnttool/report.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/report.py?rev=161334&view=auto ============================================================================== --- lnt/trunk/lnt/lnttool/report.py (original) +++ lnt/trunk/lnt/lnttool/report.py (removed) @@ -1,217 +0,0 @@ -from optparse import OptionParser, OptionGroup - -from lnt import testing -from lnt.db import perfdb -from lnt.db import perfdbsummary, runinfo -from lnt.db.perfdb import Run, RunInfo, Machine, Sample, Test -from lnt.testing.util.commands import note, warning, error, fatal -from lnt.util import stats - -def print_table(rows): - def format_cell(value): - if isinstance(value, str): - return value - elif isinstance(value, int): - return str(value) - elif isinstance(value, float): - return "%.4f" % value - else: - return str(value) - - N = len(rows[0]) - for row in rows: - if len(row) != N: - raise ValueError,"Invalid table" - - print "\t".join(map(format_cell, row)) - -def action_report(name, args): - """performance reporting tools""" - - parser = OptionParser("""\ -%%prog %s [options] """ % name) - parser.add_option("-v", "--verbose", dest="verbose", - help="show verbose test results", - action="store_true", default=False) - parser.add_option("", "--run-order", dest="run_order", - help="run order to select on", - type=int, default=None) - parser.add_option("", "--arch", dest="arch", - help="arch field to select on", - type=str, default=None) - parser.add_option("", "--optflags", dest="optflags", - help="optimization flags field to select on", - type=str, default=None) - parser.add_option("", "--machine", dest="machine_name", - help="machine name to select on", - type=str, default=None) - - (opts, args) = parser.parse_args(args) - if len(args) != 1: - parser.error("incorrect number of argments") - - path, = args - db = perfdb.PerfDB('sqlite:///%s' % path) - tag = 'nts' - - if opts.run_order is None: - parser.error("--run-order is required") - - # First, find all runs with the desired order. - q = db.session.query(Run).\ - join(RunInfo).\ - order_by(Run.start_time.desc()).\ - filter(RunInfo.key == "run_order").\ - filter(RunInfo.value == "% 7d" % opts.run_order) - matching_runs = list(q) - - # Try to help user if nothing was found. - if not matching_runs: - available_orders = set( - db.session.query(RunInfo.value).\ - filter(RunInfo.key == "run_order")) - fatal("no runs found matching --run-order %d, available orders: %s" % ( - opts.run_order, str(sorted(int(x) - for x, in available_orders)))) - - # Match based on the machine name, if given. - if opts.machine_name: - selected = [r for r in matching_runs - if r.machine.name == opts.machine_name] - if not selected: - available_names = set(r.machine.name - for r in matching_runs) - fatal( - "no runs found matching --machine %s, available names: [%s]" %( - opts.machine_name, ", ".join(sorted(available_names)))) - matching_runs = selected - - # Match based on the architecture, if given. - if opts.arch: - selected = [r for r in matching_runs - if 'ARCH' in r.info - if r.info['ARCH'].value == opts.arch] - if not selected: - available_archs = set(r.info['ARCH'].value - for r in matching_runs - if 'ARCH' in r.info) - fatal("no runs found matching --arch %s, available archs: [%s]" % ( - opts.arch, ", ".join(sorted(available_archs)))) - matching_runs = selected - - # Match based on the optflags, if given. - if opts.optflags: - selected = [r for r in matching_runs - if 'OPTFLAGS' in r.info - if r.info['OPTFLAGS'].value == opts.optflags] - if not selected: - available_flags = set(r.info['OPTFLAGS'].value - for r in matching_runs - if 'OPTFLAGS' in r.info) - fatal( - "no runs found matching --optflags %s, available flags: [%s]" %( - opts.optflags, ", ".join(sorted(available_flags)))) - matching_runs = selected - - # Inform the user of the final list of selected runs. - note("selection arguments resulted in %d runs" % (len(matching_runs),)) - for run in matching_runs: - note("Run: % 5d, Start Time: %s, Machine: %s:%d" % ( - run.id, run.start_time.strftime('%Y-%m-%d %H:%M:%S'), - run.machine.name, run.machine.number)) - - # Take only the first matched run, for now. This will be the latest, by the - # original ordering clause. - note("selecting newest run for reporting...") - matching_runs = [matching_runs[0]] - - # Inform the user of the final list of selected runs. - note("reporting over %d total runs" % (len(matching_runs),)) - for run in matching_runs: - note("Run: % 5d, Start Time: %s, Machine: %s:%d" % ( - run.id, run.start_time.strftime('%Y-%m-%d %H:%M:%S'), - run.machine.name, run.machine.number)) - - # Get the run summary which has run ordering information. - run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag) - - # Load the test suite summary. - ts_summary = perfdbsummary.get_simple_suite_summary(db, tag) - - # Gather the names of all tests across these runs, for more normalized - # reporting. - test_names = ts_summary.get_test_names_in_runs( - db, [r.id for r in matching_runs]) - test_components = sorted(set(t.rsplit('.',1)[1] for t in test_names)) - test_base_names = sorted(set(t.rsplit('.',1)[0] for t in test_names)) - - # Load all the data. - items = {} - for test_component in test_components: - for name,value in get_test_passes(db, run_summary, ts_summary, - test_component, test_base_names, - matching_runs): - items[(test_component, name)] = value - - # Dump the results. - print "%s\t%s\t%s\t%s\t%s\t%s\t%s" % ( - "Test", "Mean Compile Time", "Mean Execution Time", - "Std.Dev. Compile Time", "Std.Dev. Execution Time", - "Num. Compile Time Samples", "Num. Execution Time Samples") - for name in test_base_names: - compile_results = items.get(('compile', name), []) - exec_results = items.get(('exec', name), []) - if compile_results: - compile_value = "%.4f" % stats.mean(compile_results) - compile_stddev = "%.4f" % stats.standard_deviation(compile_results) - else: - compile_value = compile_stddev = "" - if exec_results: - exec_value = "%.4f" % stats.mean(exec_results) - exec_stddev = "%.4f" % stats.standard_deviation(exec_results) - else: - exec_value = exec_stddev = "" - print "%s\t%s\t%s\t%s\t%s\t%d\t%d" % ( - name, compile_value, exec_value, - compile_stddev, exec_stddev, - len(compile_results), len(exec_results)) - -def get_test_passes(db, run_summary, ts_summary, - test_component, test_base_names, runs): - if not runs: - return - - sri = runinfo.SimpleRunInfo(db, ts_summary) - sri._load_samples_for_runs([r.id for r in runs]) - - run_status_info = [(r, run_summary.get_run_status_kind(db, r.id)) - for r in runs] - - pset = () - for test_base_name in test_base_names: - test_name = "%s.%s" % (test_base_name, test_component) - test_id = ts_summary.test_id_map.get((test_name, pset)) - if test_id is None: - continue - - run_values = sum((sri.sample_map.get((run.id, test_id)) - for run in runs - if (run.id, test_id) in sri.sample_map), []) - # Ignore tests that weren't reported in some runs (e.g., -disable-cxx). - if not run_values: - continue - - # Find the test status, treat any non-determinism as a FAIL. - run_status = list(set([sri.get_test_status_in_run( - r.id, rsk, test_name, pset) - for (r,rsk) in run_status_info])) - if len(run_status) == 1: - status_kind = run_status[0] - else: - status_kind = testing.FAIL - - # Ignore failing methods. - if status_kind == testing.FAIL: - continue - - yield (test_base_name, run_values) Modified: lnt/trunk/lnt/server/config.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/server/config.py (original) +++ lnt/trunk/lnt/server/config.py Mon Aug 6 15:02:49 2012 @@ -5,7 +5,6 @@ import os import re -import lnt.db.perfdb import lnt.server.db.v4db class EmailConfig: Modified: lnt/trunk/lnt/server/ui/app.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/app.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/app.py (original) +++ lnt/trunk/lnt/server/ui/app.py Mon Aug 6 15:02:49 2012 @@ -16,9 +16,6 @@ import lnt.server.ui.globals import lnt.server.ui.views -from lnt.db import perfdbsummary -from lnt.db import perfdb - class RootSlashPatchMiddleware(object): def __init__(self, app): self.app = app @@ -127,7 +124,6 @@ self.jinja_env.globals.update( app=current_app, - perfdb=perfdb, old_config=self.old_config) lnt.server.ui.globals.register(self) Removed: lnt/trunk/lnt/server/ui/graphutil.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/graphutil.py?rev=161334&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/graphutil.py (original) +++ lnt/trunk/lnt/server/ui/graphutil.py (removed) @@ -1,131 +0,0 @@ -""" -Helper functions for graphing test results. -""" - -from lnt.server.ui import util -from lnt.util import stats -from lnt.external.stats import stats as ext_stats - -from lnt.db.perfdb import Machine, Run, RunInfo, Sample, Test - -def get_test_plots(db, machine, test_ids, run_summary, ts_summary, - show_mad_error = False, show_points = False, - show_all_points = False, show_stddev = False, - show_linear_regression = False): - # Load all the samples for these tests and this machine. - q = db.session.query(Sample.run_id,Sample.test_id, - Sample.value).join(Run) - q = q.filter(Run.machine_id == machine.id) - q = q.filter(Sample.test_id.in_(test_ids)) - samples = list(q) - - # Aggregate by test id and then run key. - # - # FIXME: Pretty expensive. - samples_by_test_id = {} - for run_id,test_id,value in samples: - d = samples_by_test_id.get(test_id) - if d is None: - d = samples_by_test_id[test_id] = util.multidict() - run_key = run_summary.get_run_order(run_id) - if run_key is None: - continue - - # FIXME: What to do on failure? - run_key = int(run_key) - d[run_key] = value - - # Build the graph data - pset_id_map = dict([(pset,i) - for i,pset in enumerate(ts_summary.parameter_sets)]) - num_plots = len(test_ids) - for index,test_id in enumerate(test_ids): - test = db.getTest(test_id) - pset = test.get_parameter_set() - name = test.name - - # Get the plot for this test. - # - # FIXME: Support order by something other than time. - errorbar_data = [] - points_data = [] - data = [] - points = [] - for x,values in samples_by_test_id.get(test_id,{}).items(): - min_value = min(values) - data.append((x, min_value)) - if show_points: - if show_all_points: - for v in values: - points_data.append((x, v)) - else: - points_data.append((x, min_value)) - if show_stddev: - mean = stats.mean(values) - sigma = stats.standard_deviation(values) - errorbar_data.append((x, mean - sigma, mean + sigma)) - if show_mad_error: - med = stats.median(values) - mad = stats.median_absolute_deviation(values, med) - errorbar_data.append((x, med - mad, med + mad)) - points.append((x, min_value, mad, med)) - data.sort() - points.sort() - - plot_js = "" - - # Determine the base plot color. - col = list(util.makeDarkColor(float(index) / num_plots)) - - # Add regression line, if requested. - if show_linear_regression: - xs = [t for t,v in data] - ys = [v for t,v in data] - - # We compute the regression line in terms of a normalized X scale. - x_min, x_max = min(xs), max(xs) - try: - norm_xs = [(x - x_min) / (x_max - x_min) - for x in xs] - except ZeroDivisionError: - norm_xs = xs - - try: - info = ext_stats.linregress(norm_xs, ys) - except ZeroDivisionError: - info = None - except ValueError: - info = None - - if info is not None: - slope, intercept,_,_,_ = info - - reglin_col = [c*.5 for c in col] - pts = ','.join('[%.4f,%.4f]' % pt - for pt in [(x_min, 0.0 * slope + intercept), - (x_max, 1.0 * slope + intercept)]) - style = "new Graph2D_LinePlotStyle(4, %r)" % ([.7, .7, .7],) - plot_js += " graph.addPlot([%s], %s);\n" % (pts,style) - style = "new Graph2D_LinePlotStyle(2, %r)" % (reglin_col,) - plot_js += " graph.addPlot([%s], %s);\n" % (pts,style) - - pts = ','.join(['[%.4f,%.4f]' % (t,v) - for t,v in data]) - style = "new Graph2D_LinePlotStyle(1, %r)" % col - plot_js += " graph.addPlot([%s], %s);\n" % (pts,style) - - if points_data: - pts_col = (0,0,0) - pts = ','.join(['[%.4f,%.4f]' % (t,v) - for t,v in points_data]) - style = "new Graph2D_PointPlotStyle(1, %r)" % (pts_col,) - plot_js += " graph.addPlot([%s], %s);\n" % (pts,style) - - if errorbar_data: - bar_col = [c*.7 for c in col] - pts = ','.join(['[%.4f,%.4f,%.4f]' % (x,y_min,y_max) - for x,y_min,y_max in errorbar_data]) - style = "new Graph2D_ErrorBarPlotStyle(1, %r)" % (bar_col,) - plot_js += " graph.addPlot([%s], %s);\n" % (pts,style) - - yield (test_id, plot_js, col, data, points) Modified: lnt/trunk/lnt/server/ui/views.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/views.py (original) +++ lnt/trunk/lnt/server/ui/views.py Mon Aug 6 15:02:49 2012 @@ -17,7 +17,6 @@ import lnt.util import lnt.util.ImportData import lnt.util.stats -from lnt.db import perfdb from lnt.server.ui.globals import db_url_for, v4_url_for import lnt.server.reporting.analysis from lnt.db import runinfo Modified: lnt/trunk/lnt/util/ImportData.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ImportData.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/util/ImportData.py (original) +++ lnt/trunk/lnt/util/ImportData.py Mon Aug 6 15:02:49 2012 @@ -1,9 +1,8 @@ import os, re, time -import lnt.db.perfdb import lnt.testing -from lnt import formats -from lnt.db import runinfo +import lnt.formats +import lnt.db.runinfo from lnt.util import NTEmailReport def import_and_report(config, db_name, db, file, format, commit=False, @@ -37,7 +36,7 @@ startTime = time.time() try: - data = formats.read_any(file, format) + data = lnt.formats.read_any(file, format) except KeyboardInterrupt: raise except: @@ -223,20 +222,20 @@ # # FIXME: Think longer about mapping to test codes. result_info = None - if test_status == runinfo.REGRESSED: + if test_status == lnt.db.runinfo.REGRESSED: result_string = 'FAIL' - elif test_status == runinfo.IMPROVED: + elif test_status == lnt.db.runinfo.IMPROVED: result_string = 'IMPROVED' result_info = "Test started passing." - elif test_status == runinfo.UNCHANGED_FAIL: + elif test_status == lnt.db.runinfo.UNCHANGED_FAIL: result_string = 'XFAIL' elif perf_status == None: # Missing perf status means test was just added or removed. result_string = 'PASS' - elif perf_status == runinfo.REGRESSED: + elif perf_status == lnt.db.runinfo.REGRESSED: result_string = 'REGRESSED' result_info = 'Performance regressed.' - elif perf_status == runinfo.IMPROVED: + elif perf_status == lnt.db.runinfo.IMPROVED: result_string = 'IMPROVED' result_info = 'Performance improved.' else: Modified: lnt/trunk/lnt/util/NTEmailReport.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/NTEmailReport.py?rev=161335&r1=161334&r2=161335&view=diff ============================================================================== --- lnt/trunk/lnt/util/NTEmailReport.py (original) +++ lnt/trunk/lnt/util/NTEmailReport.py Mon Aug 6 15:02:49 2012 @@ -4,17 +4,9 @@ import urllib import StringIO -from lnt.db import runinfo -from lnt.db import perfdbsummary -from lnt.server.ui import graphutil -from lnt.server.ui import util -from lnt.db import perfdb -from lnt.util.NTUtil import * import lnt.server.db.v4db import lnt.server.reporting.runs -from lnt.db.perfdb import Run, Sample - def emailReport(result, db, run, baseurl, email_config, to, was_added=True, will_commit=True): import email.mime.multipart @@ -51,575 +43,12 @@ s.sendmail(email_config.from_address, [to], msg.as_string()) s.quit() -def findPreceedingRun(query, run): - """findPreceedingRun - Find the most recent run in query which - preceeds run.""" - best = None - for r in query: - # Restrict to nightlytest runs. - if 'tag' in r.info and r.info['tag'].value != 'nightlytest': - continue - - # Select most recent run prior to the one we are reporting on. - if (r.start_time < run.start_time and - (best is None or r.start_time > best.start_time)): - best = r - return best - -def getSimpleReport(result, db, run, baseurl, was_added, will_commit, - only_html_body = False, show_graphs = False, - num_comparison_runs = 10): - machine = run.machine - tag = run.info['tag'].value - - # Get the run summary. - run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag) - - # Ignore run's which don't appear in the summary, for whatever reason. - if not run_summary.contains_run(run.id): - return ("No report for run", "No report for run", None) - - # Load the test suite summary. - ts_summary = perfdbsummary.get_simple_suite_summary(db, tag) - - # Get the run pass/fail information. - sri = runinfo.SimpleRunInfo(db, ts_summary) - - # Gather the runs to use for statistical data. - cur_id = run.id - comparison_window = [] - for i in range(num_comparison_runs): - cur_id = run_summary.get_previous_run_on_machine(cur_id) - if not cur_id: - break - comparison_window.append(cur_id) - - # Find previous run to compare to. - id = run_summary.get_previous_run_on_machine(run.id) - if id is not None: - compare_to = db.getRun(id) - else: - # FIXME: Look for run across machine. - compare_to = None - - # Get the test status style used in each run. - run_status_kind = run_summary.get_run_status_kind(db, run.id) - if compare_to: - compare_to_status_kind = run_summary.get_run_status_kind( - db, compare_to.id) - else: - compare_to_status_kind = None - - # Get the list of tests we are interested in. - interesting_runs = [run.id] - if compare_to: - interesting_runs.append(compare_to.id) - test_names = ts_summary.get_test_names_in_runs(db, interesting_runs) - - # Gather the changes to report, mapped by parameter set. - new_failures = util.multidict() - new_passes = util.multidict() - perf_regressions = util.multidict() - perf_improvements = util.multidict() - added_tests = util.multidict() - removed_tests = util.multidict() - existing_failures = util.multidict() - unchanged_tests = util.multidict() - num_total_tests = len(test_names) * len(ts_summary.parameter_sets) - for name in test_names: - for pset in ts_summary.parameter_sets: - cr = sri.get_run_comparison_result( - run, run_status_kind, compare_to, compare_to_status_kind, - name, pset, comparison_window) - test_status = cr.get_test_status() - perf_status = cr.get_value_status() - if test_status == runinfo.REGRESSED: - new_failures[pset] = (name, cr) - elif test_status == runinfo.IMPROVED: - new_passes[pset] = (name, cr) - elif cr.current is None and cr.previous is not None: - removed_tests[pset] = (name, cr) - elif cr.current is not None and cr.previous is None: - added_tests[pset] = (name, cr) - elif test_status == runinfo.UNCHANGED_FAIL: - existing_failures[pset] = (name, cr) - elif perf_status == runinfo.REGRESSED: - perf_regressions[pset] = (name, cr) - elif perf_status == runinfo.IMPROVED: - perf_improvements[pset] = (name, cr) - else: - unchanged_tests[pset] = (name, cr) - - # Collect the simplified results, if desired, for sending back to clients. - if result is not None: - test_results = result['test_results'] = [] - for pset in ts_summary.parameter_sets: - pset_results = [] - for name in test_names: - cr = sri.get_run_comparison_result( - run, run_status_kind, compare_to, compare_to_status_kind, - name, pset, comparison_window) - test_status = cr.get_test_status() - perf_status = cr.get_value_status() - # FIXME: Include additional information about performance - # changes. - pset_results.append( (name, test_status, perf_status) ) - test_results.append({ 'pset' : pset, 'results' : pset_results }) - - # Generate the report. - report = StringIO.StringIO() - html_report = StringIO.StringIO() - - machine = run.machine - subject = """%s nightly tester results""" % machine.name - - - # Generate the report header. - if baseurl[-1] == '/': - baseurl = baseurl[:-1] - - report_url = """%s/simple/%s/%d/""" % (baseurl, tag, run.id) - print >>report, report_url - print >>report, """Nickname: %s:%d""" % (machine.name, machine.number) - if 'name' in machine.info: - print >>report, """Name: %s""" % (machine.info['name'].value,) - print >>report, """Comparing:""" - print >>report, """ Run: %d, Order: %s, Start Time: %s, End Time: %s""" % ( - run.id, run.info['run_order'].value, run.start_time, run.end_time) - if compare_to: - print >>report, (""" To: %d, Order: %s, """ - """Start Time: %s, End Time: %s""") % ( - compare_to.id, compare_to.info['run_order'].value, - compare_to.start_time, compare_to.end_time) - if run.machine != compare_to.machine: - print >>report, """*** WARNING ***:""", - print >>report, """comparison is against a different machine""", - print >>report, """(%s:%d)""" % (compare_to.machine.name, - compare_to.machine.number) - else: - print >>report, """ To: (none)""" - print >>report - - # Generate the HTML report header. - print >>html_report, """\ -

%s

-""" % subject - print >>html_report, """\ -""" % (report_url, report_url) - print >>html_report, "" % ( - machine.name, machine.number) - if 'name' in machine.info: - print >>html_report, """""" % ( - machine.info['name'].value,) - print >>html_report, """
URL%s
Nickname%s:%d
Name%s
""" - print >>html_report, """\ -

- - - - - - - - """ - print >>html_report, """\ -""" % ( - run.id, run.info['run_order'].value, run.start_time, run.end_time) - if compare_to: - print >>html_report, """\ -""" % ( - compare_to.id, compare_to.info['run_order'].value, - compare_to.start_time, compare_to.end_time) - else: - print >>html_report, """""" - print >>html_report, """
RunIDOrderStart TimeEnd Time
Current%d%s%s%s
Previous%d%s%s%s
No Previous Run
""" - if compare_to and run.machine != compare_to.machine: - print >>html_report, """

*** WARNING ***:""", - print >>html_report, """comparison is against a different machine""", - print >>html_report, """(%s:%d)

""" % (compare_to.machine.name, - compare_to.machine.number) - - # Generate the summary of the changes. - items_info = (('New Failures', new_failures, False), - ('New Passes', new_passes, False), - ('Performance Regressions', perf_regressions, True), - ('Performance Improvements', perf_improvements, True), - ('Removed Tests', removed_tests, False), - ('Added Tests', added_tests, False), - ('Existing Failures', existing_failures, False), - ('Unchanged Tests', unchanged_tests, False)) - total_changes = sum([sum(map(len, items.values())) - for name,items,_ in items_info - if name != 'Unchanged Tests']) - graphs = [] - print >>report, """===============""" - print >>report, """Tests Summary""" - print >>report, """===============""" - print >>report - print >>html_report, """ -
-

Tests Summary

- - -""" - for name,items,_ in items_info: - if items: - num_items = sum(map(len, items.values())) - print >>report, '%s: %d' % (name, num_items) - print >>html_report, """ -""" % (name, num_items) - print >>report, """Total Tests: %d""" % num_total_tests - print >>report - print >>html_report, """ - - - -
Status Group#
%s%d
Total Tests%d
-""" % num_total_tests - - if total_changes: - print >>report, """==============""" - print >>report, """Changes Detail""" - print >>report, """==============""" - print >>html_report, """ -

-

Changes Detail

""" - for test_name,items,show_perf in items_info: - if not items or test_name == 'Unchanged Tests': - continue - - show_pset = items.items()[0][0] or len(items) > 1 - pset_names = dict( - (pset, 'pset.%d' % i) - for i,pset in enumerate(ts_summary.parameter_sets)) - print >>report - print >>report, test_name - print >>report, '-' * len(test_name) - for pset,tests in items.items(): - if show_perf: - tests.sort(key = lambda (_,cr): -abs(cr.pct_delta)) - - # Group tests by final component. - def get_last_component(t): - name = t[0] - if '.' in name: - return name.rsplit('.', 1)[1] - return '' - grouped = util.multidict( - (get_last_component(t), t) - for t in tests) - - for group,grouped_tests in util.sorted(grouped.items()): - group_name = { - "" : "(ungrouped)", - "exec" : "Execution", - "compile" : "Compile" }.get(group, group) - if show_pset: - table_name = "%s - %s" % (test_name, pset) - else: - table_name = test_name - print >>report, "%s - %s" % (table_name, group_name) - print >>html_report, """ -

- - """ % (table_name, group_name) - if show_perf: - print >>html_report, """ - """ - print >>html_report, """""" - for i,(name,cr) in enumerate(grouped_tests): - if show_perf: - if cr.stddev is not None: - print >>report, ( - ' %s: %.2f%%' - '(%.4f => %.4f, std. dev.: %.4f)') % ( - name, 100. * cr.pct_delta, - cr.previous, cr.current, cr.stddev) - else: - print >>report, ( - ' %s: %.2f%%' - '(%.4f => %.4f)') % ( - name, 100. * cr.pct_delta, - cr.previous, cr.current) - - # Show inline charts for top 10 changes. - if show_graphs and i < 10: - graph_name = "graph.%d" % len(graphs) - graphs.append( (graph_name,name,pset) ) - extra_cell_value = """ -
- """ % (graph_name) - else: - extra_cell_value = "" - - # Link the regression to the chart of its - # performance. - pset_name = pset_names[pset] - form_data = urllib.urlencode([(pset_name, 'on'), - ('test.'+name, 'on')]) - linked_name = '%s' % ( - os.path.join(report_url, "graph"), - form_data, name) - - pct_value = util.PctCell(cr.pct_delta).render() - if cr.stddev is not None: - print >>html_report, """ - %s""" %( - linked_name, extra_cell_value, pct_value, - cr.previous, cr.current, cr.stddev) - else: - print >>html_report, """ - %s""" %( - name, extra_cell_value, pct_value, - cr.previous, cr.current) - else: - print >>report, ' %s' % (name,) - print >>html_report, """ - """ % (name,) - print >>html_report, """ -
%s - %s ΔPreviousCurrent σ
%s%s%.4f%.4f%.4f
%s%s%.4f%.4f-
%s
""" - - # Finish up the HTML report. - if graphs: - # Get the test ids we want data for. - test_ids = [ts_summary.test_id_map[(name,pset)] - for _,name,pset in graphs] - - plots_iter = graphutil.get_test_plots(db, machine, test_ids, - run_summary, ts_summary, - show_mad_error = True, - show_points = True) - - print >>html_report, """ -""" - - html_report = html_report.getvalue() - if not only_html_body: - # We embed the additional resources, so that the message is self - # contained. - static_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), - "server", "ui", "static") - style_css = open(os.path.join(static_path, - "style.css")).read() - header = """ - """ % style_css - if graphs: - view2d_js = open(os.path.join(static_path, - "View2D.js")).read() - header += """ - """ % locals() - - html_report = """ - - -%(header)s - %(subject)s - - -%(html_report)s - -""" % locals() - - return subject, report.getvalue(), html_report - def getReport(result, db, run, baseurl, was_added, will_commit, only_html_body = False, compare_to = None): + assert isinstance(db, lnt.server.db.v4db.V4DB) report = StringIO.StringIO() - # We haven't implemented V4DB support yet in reports. - if isinstance(db, lnt.server.db.v4db.V4DB): - reports = lnt.server.reporting.runs.generate_run_report( - run, baseurl=baseurl, only_html_body=only_html_body, - result=result, compare_to=compare_to) - return reports[:3] - - # Use a simple report unless the tag indicates this is an old style nightly - # test run. - if 'tag' in run.info and run.info['tag'].value != 'nightlytest': - return getSimpleReport(result, db, run, baseurl, was_added, will_commit, - only_html_body) - - machine = run.machine - compareTo = None - - # Find comparison run. - # FIXME: Share this code with similar stuff in the server UI. - # FIXME: Scalability. - compareCrossesMachine = False - compareTo = findPreceedingRun(db.runs(machine=machine), run) - - # If we didn't find a comparison run against this machine, look - # for a comparison run against the same machine name, and warn the - # user we are crosses machines. - if compareTo is None: - compareCrossesMachine = True - q = db.session.query(perfdb.Run).join(perfdb.Machine) - q = q.filter_by(name=machine.name) - compareTo = findPreceedingRun(q, run) - - summary = RunSummary() - summary.addRun(db, run) - if compareTo: - summary.addRun(db, compareTo) - - def getTestValue(run, testname, keyname): - fullname = 'nightlytest.' + testname + '.' + keyname - t = summary.testMap.get(str(fullname)) - if t is None: - return None - samples = summary.getRunSamples(run).get(t.id) - if not samples: - return None - return samples[0] - def getTestSuccess(run, testname, keyname): - res = getTestValue(run, testname, keyname + '.success') - if res is None: - return res - return not not res - - newPasses = util.multidict() - newFailures = util.multidict() - addedTests = util.multidict() - removedTests = util.multidict() - allTests = set() - allFailures = set() - allFailuresByKey = util.multidict() - for keyname,title in kTSKeys.items(): - for testname in summary.testNames: - curResult = getTestSuccess(run, testname, keyname) - prevResult = getTestSuccess(compareTo, testname, keyname) - - if curResult is not None: - allTests.add((testname,keyname)) - if curResult is False: - allFailures.add((testname,keyname)) - allFailuresByKey[title] = testname - - # Count as new pass if it passed, and previous result was failure. - if curResult and prevResult == False: - newPasses[testname] = title - - # Count as new failure if it failed, and previous result was not - # failure. - if curResult == False and prevResult != False: - newFailures[testname] = title - - if curResult is not None and prevResult is None: - addedTests[testname] = title - if curResult is None and prevResult is not None: - removedTests[testname] = title - - changes = util.multidict() - for i,(name,key) in enumerate(kComparisonKinds): - if not key: - # FIXME: File Size - continue - - for testname in summary.testNames: - curValue = getTestValue(run, testname, key) - prevValue = getTestValue(compareTo, testname, key) - - # Skip missing tests. - if curValue is None or prevValue is None: - continue - - pct = util.safediv(curValue, prevValue) - if pct is None: - continue - pctDelta = pct - 1. - if abs(pctDelta) < .05: - continue - if min(prevValue, curValue) <= .2: - continue - - changes[name] = (testname, curValue, prevValue, pctDelta) - - if will_commit: - if not was_added: - print >>report, ("*** NOTE ***: This was a duplicate submission, " - "and did not modify the database.\n") - else: - if was_added: - print >>report, ("*** NOTE ***: This is a test submission, " - "it will not be committed to the database.\n") - else: - print >>report, ("*** NOTE ***: This is a test submission, " - "and was a duplicate of an existing run.\n") - - if baseurl[-1] == '/': - baseurl = baseurl[:-1] - print >>report, """%s/nightlytest/%d/""" % (baseurl, run.id) - print >>report, """Nickname: %s:%d""" % (machine.name, machine.number) - if 'name' in machine.info: - print >>report, """Name: %s""" % (machine.info['name'].value,) - print >>report - print >>report, """Run: %d, Start Time: %s, End Time: %s""" % ( - run.id, run.start_time, run.end_time) - if compareTo: - print >>report, """Comparing To: %d, Start Time: %s, End Time: %s""" % ( - compareTo.id, compareTo.start_time, compareTo.end_time) - if compareCrossesMachine: - print >>report, """*** WARNING ***:""", - print >>report, """comparison is against a different machine""", - print >>report, """(%s:%d)""" % (compareTo.machine.name, - compareTo.machine.number) - else: - print >>report, """Comparing To: (none)""" - print >>report - - print >>report, """--- Changes Summary ---""" - for title,elts in (('New Test Passes', newPasses), - ('New Test Failures', newFailures), - ('Added Tests', addedTests), - ('Removed Tests', removedTests)): - print >>report, """%s: %d""" % (title, - sum([len(values) - for key,values in elts.items()])) - numSignificantChanges = sum([len(changelist) - for name,changelist in changes.items()]) - print >>report, """Significant Changes: %d""" % (numSignificantChanges,) - print >>report - print >>report, """--- Tests Summary ---""" - print >>report, """Total Tests: %d""" % (len(allTests),) - print >>report, """Total Test Failures: %d""" % (len(allFailures),) - print >>report - print >>report, """Total Test Failures By Type:""" - for name,items in util.sorted(allFailuresByKey.items()): - print >>report, """ %s: %d""" % (name, len(set(items))) - - print >>report - print >>report, """--- Changes Detail ---""" - for title,elts in (('New Test Passes', newPasses), - ('New Test Failures', newFailures), - ('Added Tests', addedTests), - ('Removed Tests', removedTests)): - print >>report, """%s:""" % (title,) - print >>report, "".join("%s [%s]\n" % (key, ", ".join(values)) - for key,values in util.sorted(elts.items())) - print >>report, """Significant Changes in Test Results:""" - for name,changelist in changes.items(): - print >>report, """%s:""" % name - for name,curValue,prevValue,delta in util.sorted(changelist): - print >>report, """ %s: %.2f%% (%.4f => %.4f)""" % ( - name, delta*100, prevValue, curValue) - - # FIXME: Where is the old mailer getting the arch from? - subject = """%s nightly tester results""" % machine.name - return subject, report.getvalue(), None + reports = lnt.server.reporting.runs.generate_run_report( + run, baseurl=baseurl, only_html_body=only_html_body, + result=result, compare_to=compare_to) + return reports[:3] Removed: lnt/trunk/lnt/util/NTUtil.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/NTUtil.py?rev=161334&view=auto ============================================================================== --- lnt/trunk/lnt/util/NTUtil.py (original) +++ lnt/trunk/lnt/util/NTUtil.py (removed) @@ -1,113 +0,0 @@ -from lnt.server.ui import util -from lnt.db.perfdb import Run, Sample, Test - -kPrefix = 'nightlytest' - -# FIXME: We shouldn't need this. -kSentinelKeyName = 'bc.compile.success' - -kComparisonKinds = [('File Size',None), - ('CBE','cbe.exec.time'), - ('LLC','llc.exec.time'), - ('JIT','jit.exec.time'), - ('GCCAS','gcc.compile.time'), - ('Bitcode','bc.compile.size'), - ('LLC compile','llc.compile.time'), - ('LLC-BETA compile','llc-beta.compile.time'), - ('JIT codegen','jit.compile.time'), - ('LLC-BETA','llc-beta.exec.time')] - -kTSKeys = { 'gcc.compile' : 'GCCAS', - 'bc.compile' : 'Bitcode', - 'llc.compile' : 'LLC compile', - 'llc-beta.compile' : 'LLC_BETA compile', - 'jit.compile' : 'JIT codegen', - 'cbe.exec' : 'CBE', - 'llc.exec' : 'LLC', - 'llc-beta.exec' : 'LLC-BETA', - 'jit.exec' : 'JIT' } - -# This isn't very fast, compute a summary if querying the same run -# repeatedly. -def getTestValueInRun(db, r, t, default=None, coerce=None): - for value, in db.session.query(Sample.value).\ - filter(Sample.test == t).\ - filter(Sample.run == r): - if coerce is not None: - return coerce(value) - return value - return default - -def getTestNameValueInRun(db, r, testname, default=None, coerce=None): - for value, in db.session.query(Sample.value).join(Test).\ - filter(Test.name == testname).\ - filter(Sample.run == r): - if coerce is not None: - return coerce(value) - return value - return default - -class RunSummary: - def __init__(self): - # The union of test names seen. - self.testNames = set() - # Map of test ids to test instances. - self.testIds = {} - # Map of test names to test instances - self.testMap = {} - # Map of run to multimap of test ID to sample list. - self.runSamples = {} - - # FIXME: Should we worry about the info parameters on a - # nightlytest test? - - def testMatchesPredicates(self, db, t, testPredicate, infoPredicates): - if testPredicate: - if not testPredicate(t): - return False - if infoPredicates: - info = dict((i.key,i.value) for i in t.info.values()) - for key,predicate in infoPredicates: - value = info.get(key) - if not predicate(t, key, value): - return False - return True - - def addRun(self, db, run, testPredicate=None, infoPredicates=None): - sampleMap = self.runSamples.get(run.id) - if sampleMap is None: - sampleMap = self.runSamples[run.id] = util.multidict() - - q = db.session.query(Sample.value,Test).join(Test) - q = q.filter(Sample.run == run) - for s_value,t in q: - if not self.testMatchesPredicates(db, t, testPredicate, infoPredicates): - continue - - sampleMap[t.id] = s_value - self.testMap[t.name] = t - self.testIds[t.id] = t - - # Filter out summary things in name lists by only looking - # for things which have a .success entry. - if t.name.endswith('.success'): - self.testNames.add(t.name.split('.', 3)[1]) - - def getRunSamples(self, run): - if run is None: - return {} - return self.runSamples.get(run.id, {}) - - def getTestValueByName(self, run, testName, default, coerce=None): - t = self.testMap.get(testName) - if t is None: - return default - sampleMap = self.runSamples.get(run.id, {}) - samples = sampleMap.get(t.id) - if sampleMap is None or samples is None: - return default - # FIXME: Multiple samples? - if coerce: - return coerce(samples[0].value) - else: - return samples[0].value From daniel at zuster.org Mon Aug 6 15:02:58 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:02:58 -0000 Subject: [llvm-commits] [LNT] r161338 - /lnt/trunk/lnt/testing/util/compilers.py Message-ID: <20120806200258.60BD32A6C073@llvm.org> Author: ddunbar Date: Mon Aug 6 15:02:58 2012 New Revision: 161338 URL: http://llvm.org/viewvc/llvm-project?rev=161338&view=rev Log: Don't crash if the cc1_binary we infer doesn't exist. Modified: lnt/trunk/lnt/testing/util/compilers.py Modified: lnt/trunk/lnt/testing/util/compilers.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/util/compilers.py?rev=161338&r1=161337&r2=161338&view=diff ============================================================================== --- lnt/trunk/lnt/testing/util/compilers.py (original) +++ lnt/trunk/lnt/testing/util/compilers.py Mon Aug 6 15:02:58 2012 @@ -192,7 +192,7 @@ 'cc_ld_version' : cc_ld_version, 'cc_target_assembly' : cc_target_assembly, } - if cc1_binary is not None: + if cc1_binary is not None and os.path.exists(cc1_binary): cc1_exec_hash = hashlib.sha1() cc1_exec_hash.update(open(cc1_binary,'rb').read()) info['cc1_exec_hash'] = cc1_exec_hash.hexdigest() From daniel at zuster.org Mon Aug 6 15:02:52 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:02:52 -0000 Subject: [llvm-commits] [LNT] r161336 - in /lnt/trunk/lnt/server: config.py db/testsuitedb.py Message-ID: <20120806200252.52A272A6C074@llvm.org> Author: ddunbar Date: Mon Aug 6 15:02:52 2012 New Revision: 161336 URL: http://llvm.org/viewvc/llvm-project?rev=161336&view=rev Log: Eliminate code for determining SimpleRunID in V4 databases. Modified: lnt/trunk/lnt/server/config.py lnt/trunk/lnt/server/db/testsuitedb.py Modified: lnt/trunk/lnt/server/config.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=161336&r1=161335&r2=161336&view=diff ============================================================================== --- lnt/trunk/lnt/server/config.py (original) +++ lnt/trunk/lnt/server/config.py Mon Aug 6 15:02:52 2012 @@ -52,11 +52,10 @@ bool(dict.get('showSimple')), str(dict.get('db_version', '0.3')), dict.get('shadow_import', None), - dict.get('simple_run_source', None), email_config) def __init__(self, path, showNightlytest, showGeneral, showSimple, - db_version, shadow_import, simple_run_source, email_config): + db_version, shadow_import, email_config): self.config = None self.path = path self.showGeneral = showGeneral @@ -64,7 +63,6 @@ self.showSimple = showSimple self.db_version = db_version self.shadow_import = shadow_import - self.simple_run_source = simple_run_source self.email_config = email_config class Config: Modified: lnt/trunk/lnt/server/db/testsuitedb.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=161336&r1=161335&r2=161336&view=diff ============================================================================== --- lnt/trunk/lnt/server/db/testsuitedb.py (original) +++ lnt/trunk/lnt/server/db/testsuitedb.py Mon Aug 6 15:02:52 2012 @@ -619,40 +619,8 @@ self._importSampleValues(data['Tests'], run, tag) - # If we have a config object and we have a database which we are - # supposed to link simple/ runs from, attempt to find the matching run - # in that database. - if config and config.simple_run_source: - self.find_and_set_simple_run_id(run, data, config) - return True, run - - def find_and_set_simple_run_id(self, run, data, config): - # Get the database we are supposed to match run IDs in. - db = config.config.get_database(config.simple_run_source) - - # Figure out the matching machine. - simple_machine,created = db.getOrCreateMachine( - data['Machine']['Name'], data['Machine']['Info'].items()) - if created: - # Obviously missing, rollback and abort. - db.rollback() - return - - run_data = data['Run'] - simple_run,created = db.getOrCreateRun( - simple_machine, - run_data.get('Start Time',''), run_data.get('End Time',''), - run_data['Info'].items()) - if created: - # Obviously missing, rollback and abort. - db.rollback() - return - - # Otherwise, we found the run. - run.simple_run_id = simple_run.id - # Simple query support (mostly used by templates) def machines(self, name=None): From daniel at zuster.org Mon Aug 6 15:02:55 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:02:55 -0000 Subject: [llvm-commits] [LNT] r161337 - in /lnt/trunk/lnt: db/__init__.py db/runinfo.py server/reporting/analysis.py server/reporting/runs.py server/ui/templates/v4_run.html server/ui/views.py util/ImportData.py Message-ID: <20120806200256.0DA012A6C075@llvm.org> Author: ddunbar Date: Mon Aug 6 15:02:55 2012 New Revision: 161337 URL: http://llvm.org/viewvc/llvm-project?rev=161337&view=rev Log: Integrate lnt.db.runinfo into lnt.server.reporting.analysis. Removed: lnt/trunk/lnt/db/__init__.py lnt/trunk/lnt/db/runinfo.py Modified: lnt/trunk/lnt/server/reporting/analysis.py lnt/trunk/lnt/server/reporting/runs.py lnt/trunk/lnt/server/ui/templates/v4_run.html lnt/trunk/lnt/server/ui/views.py lnt/trunk/lnt/util/ImportData.py Removed: lnt/trunk/lnt/db/__init__.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/db/__init__.py?rev=161336&view=auto ============================================================================== --- lnt/trunk/lnt/db/__init__.py (original) +++ lnt/trunk/lnt/db/__init__.py (removed) @@ -1 +0,0 @@ -__all__ = [] Removed: lnt/trunk/lnt/db/runinfo.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/db/runinfo.py?rev=161336&view=auto ============================================================================== --- lnt/trunk/lnt/db/runinfo.py (original) +++ lnt/trunk/lnt/db/runinfo.py (removed) @@ -1,103 +0,0 @@ -REGRESSED = 'REGRESSED' -IMPROVED = 'IMPROVED' -UNCHANGED_PASS = 'UNCHANGED_PASS' -UNCHANGED_FAIL = 'UNCHANGED_FAIL' - -class ComparisonResult: - def __init__(self, cur_value, prev_value, delta, pct_delta, stddev, MAD, - cur_failed, prev_failed, samples, stddev_mean = None, - stddev_is_estimated = False): - self.current = cur_value - self.previous = prev_value - self.delta = delta - self.pct_delta = pct_delta - self.stddev = stddev - self.MAD = MAD - self.failed = cur_failed - self.prev_failed = prev_failed - self.samples = samples - self.stddev_mean = stddev_mean - self.stddev_is_estimated = stddev_is_estimated - - def get_samples(self): - return self.samples - - def get_test_status(self): - # Compute the comparison status for the test success. - if self.failed: - if self.prev_failed: - return UNCHANGED_FAIL - else: - return REGRESSED - else: - if self.prev_failed: - return IMPROVED - else: - return UNCHANGED_PASS - - def get_value_status(self, confidence_interval=2.576, - value_precision=0.0001, ignore_small=True): - if self.current is None or self.previous is None: - return None - - # Don't report value errors for tests which fail, or which just started - # passing. - # - # FIXME: One bug here is that we risk losing performance data on tests - # which flop to failure then back. What would be nice to do here is to - # find the last value in a passing run, or to move to using proper keyed - # reference runs. - if self.failed: - return UNCHANGED_FAIL - elif self.prev_failed: - return UNCHANGED_PASS - - # Ignore tests whose delt is too small relative to the precision we can - # sample at; otherwise quantization means that we can't measure the - # standard deviation with enough accuracy. - if abs(self.delta) <= 2 * value_precision * confidence_interval: - return UNCHANGED_PASS - - # Always ignore percentage changes below 1%, for now, we just don't have - # enough time to investigate that level of stuff. - if ignore_small and abs(self.pct_delta) < .01: - return UNCHANGED_PASS - - # Always ignore changes with small deltas. There is no mathematical - # basis for this, it should be obviated by appropriate statistical - # checks, but practical evidence indicates what we currently have isn't - # good enough (for reasons I do not yet understand). - if ignore_small and abs(self.delta) < .01: - return UNCHANGED_PASS - - # If we have a comparison window, then measure using a symmetic - # confidence interval. - if self.stddev is not None: - is_significant = abs(self.delta) > (self.stddev * - confidence_interval) - - # If the stddev is estimated, then it is also only significant if - # the delta from the estimate mean is above the confidence interval. - if self.stddev_is_estimated: - is_significant &= (abs(self.current - self.stddev_mean) > - self.stddev * confidence_interval) - - # If the delta is significant, return - if is_significant: - if self.delta < 0: - return IMPROVED - else: - return REGRESSED - else: - return UNCHANGED_PASS - - # Otherwise, report any changes above 0.2%, which is a rough - # approximation for the smallest change we expect "could" be measured - # accurately. - if abs(self.pct_delta) >= .002: - if self.pct_delta < 0: - return IMPROVED - else: - return REGRESSED - else: - return UNCHANGED_PASS Modified: lnt/trunk/lnt/server/reporting/analysis.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=161337&r1=161336&r2=161337&view=diff ============================================================================== --- lnt/trunk/lnt/server/reporting/analysis.py (original) +++ lnt/trunk/lnt/server/reporting/analysis.py Mon Aug 6 15:02:55 2012 @@ -4,9 +4,112 @@ from lnt.util import stats from lnt.server.ui import util -from lnt.db.runinfo import ComparisonResult from lnt.testing import PASS, FAIL, XFAIL +REGRESSED = 'REGRESSED' +IMPROVED = 'IMPROVED' +UNCHANGED_PASS = 'UNCHANGED_PASS' +UNCHANGED_FAIL = 'UNCHANGED_FAIL' + +class ComparisonResult: + def __init__(self, cur_value, prev_value, delta, pct_delta, stddev, MAD, + cur_failed, prev_failed, samples, stddev_mean = None, + stddev_is_estimated = False): + self.current = cur_value + self.previous = prev_value + self.delta = delta + self.pct_delta = pct_delta + self.stddev = stddev + self.MAD = MAD + self.failed = cur_failed + self.prev_failed = prev_failed + self.samples = samples + self.stddev_mean = stddev_mean + self.stddev_is_estimated = stddev_is_estimated + + def get_samples(self): + return self.samples + + def get_test_status(self): + # Compute the comparison status for the test success. + if self.failed: + if self.prev_failed: + return UNCHANGED_FAIL + else: + return REGRESSED + else: + if self.prev_failed: + return IMPROVED + else: + return UNCHANGED_PASS + + def get_value_status(self, confidence_interval=2.576, + value_precision=0.0001, ignore_small=True): + if self.current is None or self.previous is None: + return None + + # Don't report value errors for tests which fail, or which just started + # passing. + # + # FIXME: One bug here is that we risk losing performance data on tests + # which flop to failure then back. What would be nice to do here is to + # find the last value in a passing run, or to move to using proper keyed + # reference runs. + if self.failed: + return UNCHANGED_FAIL + elif self.prev_failed: + return UNCHANGED_PASS + + # Ignore tests whose delt is too small relative to the precision we can + # sample at; otherwise quantization means that we can't measure the + # standard deviation with enough accuracy. + if abs(self.delta) <= 2 * value_precision * confidence_interval: + return UNCHANGED_PASS + + # Always ignore percentage changes below 1%, for now, we just don't have + # enough time to investigate that level of stuff. + if ignore_small and abs(self.pct_delta) < .01: + return UNCHANGED_PASS + + # Always ignore changes with small deltas. There is no mathematical + # basis for this, it should be obviated by appropriate statistical + # checks, but practical evidence indicates what we currently have isn't + # good enough (for reasons I do not yet understand). + if ignore_small and abs(self.delta) < .01: + return UNCHANGED_PASS + + # If we have a comparison window, then measure using a symmetic + # confidence interval. + if self.stddev is not None: + is_significant = abs(self.delta) > (self.stddev * + confidence_interval) + + # If the stddev is estimated, then it is also only significant if + # the delta from the estimate mean is above the confidence interval. + if self.stddev_is_estimated: + is_significant &= (abs(self.current - self.stddev_mean) > + self.stddev * confidence_interval) + + # If the delta is significant, return + if is_significant: + if self.delta < 0: + return IMPROVED + else: + return REGRESSED + else: + return UNCHANGED_PASS + + # Otherwise, report any changes above 0.2%, which is a rough + # approximation for the smallest change we expect "could" be measured + # accurately. + if abs(self.pct_delta) >= .002: + if self.pct_delta < 0: + return IMPROVED + else: + return REGRESSED + else: + return UNCHANGED_PASS + class RunInfo(object): def __init__(self, testsuite, runs_to_load, aggregation_fn = min): Modified: lnt/trunk/lnt/server/reporting/runs.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/runs.py?rev=161337&r1=161336&r2=161337&view=diff ============================================================================== --- lnt/trunk/lnt/server/reporting/runs.py (original) +++ lnt/trunk/lnt/server/reporting/runs.py Mon Aug 6 15:02:55 2012 @@ -10,7 +10,6 @@ import lnt.server.reporting.analysis import lnt.server.ui.util import lnt.util.stats -from lnt.db import runinfo def generate_run_report(run, baseurl, only_html_body = False, num_comparison_runs = 10, result = None, @@ -365,19 +364,19 @@ comparison_results[(name,field)] = cr test_status = cr.get_test_status() perf_status = cr.get_value_status() - if test_status == runinfo.REGRESSED: + if test_status == lnt.server.reporting.analysis.REGRESSED: bucket = new_failures - elif test_status == runinfo.IMPROVED: + elif test_status == lnt.server.reporting.analysis.IMPROVED: bucket = new_passes elif cr.current is None and cr.previous is not None: bucket = removed_tests elif cr.current is not None and cr.previous is None: bucket = added_tests - elif test_status == runinfo.UNCHANGED_FAIL: + elif test_status == lnt.server.reporting.analysis.UNCHANGED_FAIL: bucket = existing_failures - elif perf_status == runinfo.REGRESSED: + elif perf_status == lnt.server.reporting.analysis.REGRESSED: bucket = perf_regressions - elif perf_status == runinfo.IMPROVED: + elif perf_status == lnt.server.reporting.analysis.IMPROVED: bucket = perf_improvements else: bucket = unchanged_tests Modified: lnt/trunk/lnt/server/ui/templates/v4_run.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_run.html?rev=161337&r1=161336&r2=161337&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/templates/v4_run.html (original) +++ lnt/trunk/lnt/server/ui/templates/v4_run.html Mon Aug 6 15:02:55 2012 @@ -30,11 +30,11 @@ {% endif %} {% set cell_color = none %} -{% if test_status == runinfo.REGRESSED %} +{% if test_status == analysis.REGRESSED %} {% set cell_color = (233,128,128) %} -{% elif test_status == runinfo.IMPROVED %} +{% elif test_status == analysis.IMPROVED %} {% set cell_color = (143,223,95) %} -{% elif test_status == runinfo.UNCHANGED_FAIL %} +{% elif test_status == analysis.UNCHANGED_FAIL %} {% set cell_color = (255,195,67) %} {% endif %} @@ -46,8 +46,8 @@ {% endif %} {% if (options.show_all or - value_status == runinfo.REGRESSED or - value_status == runinfo.IMPROVED) %} + value_status == analysis.REGRESSED or + value_status == analysis.IMPROVED) %} {{ cr.pct_delta|aspctcell|safe }} {% else %} - Modified: lnt/trunk/lnt/server/ui/views.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161337&r1=161336&r2=161337&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/views.py (original) +++ lnt/trunk/lnt/server/ui/views.py Mon Aug 6 15:02:55 2012 @@ -19,7 +19,7 @@ import lnt.util.stats from lnt.server.ui.globals import db_url_for, v4_url_for import lnt.server.reporting.analysis -from lnt.db import runinfo +import lnt.server.reporting.runs from lnt.server.ui.decorators import frontend, db_route, v4_route ### @@ -328,7 +328,7 @@ return render_template( "v4_run.html", ts=ts, options=options, primary_fields=list(ts.Sample.get_primary_fields()), - test_info=test_info, runinfo=runinfo, + test_info=test_info, analysis=lnt.server.reporting.analysis, test_min_value_filter=test_min_value_filter, request_info=info) Modified: lnt/trunk/lnt/util/ImportData.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ImportData.py?rev=161337&r1=161336&r2=161337&view=diff ============================================================================== --- lnt/trunk/lnt/util/ImportData.py (original) +++ lnt/trunk/lnt/util/ImportData.py Mon Aug 6 15:02:55 2012 @@ -2,7 +2,8 @@ import lnt.testing import lnt.formats -import lnt.db.runinfo +import lnt.server.reporting.analysis + from lnt.util import NTEmailReport def import_and_report(config, db_name, db, file, format, commit=False, @@ -222,20 +223,20 @@ # # FIXME: Think longer about mapping to test codes. result_info = None - if test_status == lnt.db.runinfo.REGRESSED: + if test_status == lnt.server.reporting.analysis.REGRESSED: result_string = 'FAIL' - elif test_status == lnt.db.runinfo.IMPROVED: + elif test_status == lnt.server.reporting.analysis.IMPROVED: result_string = 'IMPROVED' result_info = "Test started passing." - elif test_status == lnt.db.runinfo.UNCHANGED_FAIL: + elif test_status == lnt.server.reporting.analysis.UNCHANGED_FAIL: result_string = 'XFAIL' elif perf_status == None: # Missing perf status means test was just added or removed. result_string = 'PASS' - elif perf_status == lnt.db.runinfo.REGRESSED: + elif perf_status == lnt.server.reporting.analysis.REGRESSED: result_string = 'REGRESSED' result_info = 'Performance regressed.' - elif perf_status == lnt.db.runinfo.IMPROVED: + elif perf_status == lnt.server.reporting.analysis.IMPROVED: result_string = 'IMPROVED' result_info = 'Performance improved.' else: From daniel at zuster.org Mon Aug 6 15:03:01 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:03:01 -0000 Subject: [llvm-commits] [LNT] r161339 - in /lnt/trunk/lnt/server: db/v4db.py ui/app.py ui/templates/index.html Message-ID: <20120806200301.5CA162A6C073@llvm.org> Author: ddunbar Date: Mon Aug 6 15:03:01 2012 New Revision: 161339 URL: http://llvm.org/viewvc/llvm-project?rev=161339&view=rev Log: Eliminate DB summary objects. Modified: lnt/trunk/lnt/server/db/v4db.py lnt/trunk/lnt/server/ui/app.py lnt/trunk/lnt/server/ui/templates/index.html Modified: lnt/trunk/lnt/server/db/v4db.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/v4db.py?rev=161339&r1=161338&r2=161339&view=diff ============================================================================== --- lnt/trunk/lnt/server/db/v4db.py (original) +++ lnt/trunk/lnt/server/db/v4db.py Mon Aug 6 15:03:01 2012 @@ -152,28 +152,3 @@ db_name) return db.importDataFromDict(data, config) - - def get_db_summary(self): - return V4DBSummary(self) - -class V4DBSummary(object): - class SuiteSummary(object): - def __init__(self, name, path): - self.name = name - self.path = path - - def __init__(self, db): - self.db = db - # Load all the test suite names now so that we don't attempt to reuse a - # cursor later. - # - # FIXME: Really, we just need to eliminate this object. - self.testsuites = list(self.db.testsuite) - - @property - def suites(self): - for name in self.testsuites: - yield V4DBSummary.SuiteSummary(name, ("v4", name)) - - def is_up_to_date(self, db): - return True Modified: lnt/trunk/lnt/server/ui/app.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/app.py?rev=161339&r1=161338&r2=161339&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/app.py (original) +++ lnt/trunk/lnt/server/ui/app.py Mon Aug 6 15:03:01 2012 @@ -32,7 +32,6 @@ self.request_time = time.time() self.db = None - self.db_summary = None self.testsuite = None def elapsed_time(self): @@ -80,9 +79,6 @@ return self.testsuite - def get_db_summary(self): - return current_app.get_db_summary(g.db_name, self.get_db()) - class App(flask.Flask): @staticmethod def create_standalone(config_path): @@ -106,7 +102,6 @@ def __init__(self, name): super(App, self).__init__(name) self.start_time = time.time() - self.db_summaries = {} # Override the request class. self.request_class = Request @@ -130,11 +125,3 @@ # Set the application secret key. self.secret_key = self.old_config.secretKey - - def get_db_summary(self, db_name, db): - # FIXME/v3removal: Eliminate this, V4DB style has no need for summary - # abstraction. - db_summary = self.db_summaries.get(db_name) - if db_summary is None or not db_summary.is_up_to_date(db): - self.db_summaries[db_name] = db_summary = db.get_db_summary() - return db_summary Modified: lnt/trunk/lnt/server/ui/templates/index.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/index.html?rev=161339&r1=161338&r2=161339&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/templates/index.html (original) +++ lnt/trunk/lnt/server/ui/templates/index.html Mon Aug 6 15:03:01 2012 @@ -4,10 +4,9 @@ {% block body %} {# Display available test result suites. #} -{% set summary = request.get_db_summary() %}

Test Suites

-{% for suite in summary.suites %} - {{suite.name}}
+{% for name in request.get_db().testsuite %} + {{name}}
{% endfor %} {% if g.db_info.db_version == '0.3' and g.db_info.showGeneral %} From daniel at zuster.org Mon Aug 6 15:03:06 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:03:06 -0000 Subject: [llvm-commits] [LNT] r161340 - in /lnt/trunk: lnt/lnttool/create.py lnt/server/config.py lnt/server/ui/templates/index.html tests/SharedInputs/SmallInstance/lnt.cfg tests/server/db/Inputs/lnt_v0.4.0_basic_instance/lnt.cfg tests/server/db/Inputs/lnt_v0.4.0_filled_instance/lnt.cfg Message-ID: <20120806200306.3E1D32A6C073@llvm.org> Author: ddunbar Date: Mon Aug 6 15:03:05 2012 New Revision: 161340 URL: http://llvm.org/viewvc/llvm-project?rev=161340&view=rev Log: Remove references to some config keys that are no longer used. Modified: lnt/trunk/lnt/lnttool/create.py lnt/trunk/lnt/server/config.py lnt/trunk/lnt/server/ui/templates/index.html lnt/trunk/tests/SharedInputs/SmallInstance/lnt.cfg lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_basic_instance/lnt.cfg lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_filled_instance/lnt.cfg Modified: lnt/trunk/lnt/lnttool/create.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/create.py?rev=161340&r1=161339&r2=161340&view=diff ============================================================================== --- lnt/trunk/lnt/lnttool/create.py (original) +++ lnt/trunk/lnt/lnttool/create.py Mon Aug 6 15:03:05 2012 @@ -39,9 +39,6 @@ # should be a 'default' entry for the default database. databases = { 'default' : { 'path' : %(default_db)r, - 'showGeneral' : 1, - 'showNightlytest' : 1, - 'showSimple' : 1, 'db_version' : %(default_db_version)r }, } Modified: lnt/trunk/lnt/server/config.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=161340&r1=161339&r2=161340&view=diff ============================================================================== --- lnt/trunk/lnt/server/config.py (original) +++ lnt/trunk/lnt/server/config.py Mon Aug 6 15:03:05 2012 @@ -47,20 +47,14 @@ email_config = EmailConfig.fromData(dict['emailer']) return DBInfo(dbPath, - bool(dict.get('showNightlytest')), - bool(dict.get('showGeneral')), - bool(dict.get('showSimple')), str(dict.get('db_version', '0.3')), dict.get('shadow_import', None), email_config) - def __init__(self, path, showNightlytest, showGeneral, showSimple, + def __init__(self, path, db_version, shadow_import, email_config): self.config = None self.path = path - self.showGeneral = showGeneral - self.showNightlytest = showNightlytest - self.showSimple = showSimple self.db_version = db_version self.shadow_import = shadow_import self.email_config = email_config Modified: lnt/trunk/lnt/server/ui/templates/index.html URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/index.html?rev=161340&r1=161339&r2=161340&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/templates/index.html (original) +++ lnt/trunk/lnt/server/ui/templates/index.html Mon Aug 6 15:03:05 2012 @@ -9,12 +9,4 @@ {{name}}
{% endfor %} -{% if g.db_info.db_version == '0.3' and g.db_info.showGeneral %} -
- -

General Database Access

-

Browse DB -

Submit Run -{% endif %} - {% endblock %} Modified: lnt/trunk/tests/SharedInputs/SmallInstance/lnt.cfg URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/SharedInputs/SmallInstance/lnt.cfg?rev=161340&r1=161339&r2=161340&view=diff ============================================================================== --- lnt/trunk/tests/SharedInputs/SmallInstance/lnt.cfg (original) +++ lnt/trunk/tests/SharedInputs/SmallInstance/lnt.cfg Mon Aug 6 15:03:05 2012 @@ -28,9 +28,6 @@ # should be a 'default' entry for the default database. databases = { 'default' : { 'path' : 'lnt.db', - 'showGeneral' : 1, - 'showNightlytest' : 1, - 'showSimple' : 1, 'db_version' : '0.4' }, } Modified: lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_basic_instance/lnt.cfg URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_basic_instance/lnt.cfg?rev=161340&r1=161339&r2=161340&view=diff ============================================================================== --- lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_basic_instance/lnt.cfg (original) +++ lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_basic_instance/lnt.cfg Mon Aug 6 15:03:05 2012 @@ -25,9 +25,6 @@ # should be a 'default' entry for the default database. databases = { 'default' : { 'path' : 'lnt.db', - 'showGeneral' : 1, - 'showNightlytest' : 1, - 'showSimple' : 1, 'db_version' : '0.4' }, } Modified: lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_filled_instance/lnt.cfg URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_filled_instance/lnt.cfg?rev=161340&r1=161339&r2=161340&view=diff ============================================================================== --- lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_filled_instance/lnt.cfg (original) +++ lnt/trunk/tests/server/db/Inputs/lnt_v0.4.0_filled_instance/lnt.cfg Mon Aug 6 15:03:05 2012 @@ -25,9 +25,6 @@ # should be a 'default' entry for the default database. databases = { 'default' : { 'path' : 'lnt.db', - 'showGeneral' : 1, - 'showNightlytest' : 1, - 'showSimple' : 1, 'db_version' : '0.4' }, } From daniel at zuster.org Mon Aug 6 15:03:08 2012 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 06 Aug 2012 20:03:08 -0000 Subject: [llvm-commits] [LNT] r161341 - /lnt/trunk/tests/.coveragerc Message-ID: <20120806200308.294E52A6C073@llvm.org> Author: ddunbar Date: Mon Aug 6 15:03:07 2012 New Revision: 161341 URL: http://llvm.org/viewvc/llvm-project?rev=161341&view=rev Log: tests: Ignore templates in coverage report. Modified: lnt/trunk/tests/.coveragerc Modified: lnt/trunk/tests/.coveragerc URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/.coveragerc?rev=161341&r1=161340&r2=161341&view=diff ============================================================================== --- lnt/trunk/tests/.coveragerc (original) +++ lnt/trunk/tests/.coveragerc Mon Aug 6 15:03:07 2012 @@ -7,7 +7,11 @@ [html] directory = coverage_html_report +[report] # Exclude external code from the coverage report. Note that this is relative to # our location. -[report] -omit = ../lnt/external/* \ No newline at end of file +# +# We also exclude Jinja templates from the coverage report, the coverage module +# isn't equipped to handle them. +omit = ../lnt/external/* + ../lnt/server/ui/templates/* From evan.cheng at apple.com Mon Aug 6 15:05:55 2012 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 06 Aug 2012 13:05:55 -0700 Subject: [llvm-commits] [PATCH] Review request: Test case for indirect argument with X86FastISel In-Reply-To: <0983E6C011D2DC4188F8761B533492DE077CF82E@ORSMSX105.amr.corp.intel.com> References: <0983E6C011D2DC4188F8761B533492DE077CBD20@ORSMSX105.amr.corp.intel.com> <0983E6C011D2DC4188F8761B533492DE077CF82E@ORSMSX105.amr.corp.intel.com> Message-ID: <61D643B1-921E-46DB-9B4C-259A0A86C8A8@apple.com> The RUN line doesn't specify target arch or triple. That's going to break some buildbots. Also, please significantly reduce the test to include only the functionality it is intended to test. Right now it includes main() and other parts that are not needed. You also don't have patterns that tell us what it is you are testing. Evan On Aug 3, 2012, at 10:20 AM, "Kaylor, Andrew" wrote: > Ping. > > From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Kaylor, Andrew > Sent: Friday, July 27, 2012 1:12 PM > To: llvm-commits at cs.uiuc.edu > Subject: [llvm-commits] [PATCH] Test case for indirect argument with X86FastISel > > Hi everyone, > > The attached patch adds an X86 CodeGen test for the case where an indirect argument is used while FastISel was enabled. This is the test case for a patch I previously posted here: > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120709/146224.html > > which was committed in r16055. > > I?ve only seen the indirect argument being generated on Windows, but the test will pass on other platforms without the indirect argument being generated. > > -Andy > > _______________________________________________ > 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/20120806/a05383ae/attachment.html From spop at codeaurora.org Mon Aug 6 15:10:06 2012 From: spop at codeaurora.org (Sebastian Pop) Date: Mon, 6 Aug 2012 15:10:06 -0500 Subject: [llvm-commits] Fix cmake for Hexagon cross compilers In-Reply-To: References: Message-ID: Ping^4. Hi, I'm waiting for a month now for an OK to commit. It seems that really nobody except me cares for this change. Does it really matter to somebody if I'm pushing this change out to svn? How should I proceed in timeout cases like this? Thanks, Sebastian On Fri, Aug 3, 2012 at 11:34 AM, Sebastian Pop wrote: > Ping^3 > > Thanks, > Sebastian > > On Wed, Aug 1, 2012 at 10:42 AM, Sebastian Pop wrote: >> Ping^2. >> >> Looks like nobody finds anything to say about this patch: >> could then somebody ok the patch? >> >> Thanks, >> Sebastian >> >> On Wed, Jul 18, 2012 at 10:54 PM, Sebastian Pop wrote: >>> On Tue, Jul 3, 2012 at 10:42 PM, Sebastian Pop wrote: >>>> Hi, >>>> >>>> here is a patch that allows us to use cmake to specify a cross >>>> compiler for Hexagon. >>>> >>>> In particular, the patch adds a missing case for the target Hexagon in >>>> cmake/config-ix.cmake, and it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE >>>> variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them >>>> available at configure time. Here is the command line that I have used to test >>>> my patches: >>>> >>>> $ cmake -G Ninja -D BUILD_SHARED_LIBS:BOOL=ON -D >>>> LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D >>>> TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D >>>> LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D >>>> LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu -D >>>> LLVM_ENABLE_PIC:BOOL=OFF .. >>>> $ ninja check >>>> >>>> Ok to commit the attached patch? >>>> >>> >>> Ping patch. >>> >>> Thanks, >>> Sebastian >>> >>> -- >>> Qualcomm Innovation Center, Inc is a member of Code Aurora Forum >> >> >> >> -- >> Qualcomm Innovation Center, Inc is a member of Code Aurora Forum > > > > -- > Qualcomm Innovation Center, Inc is a member of Code Aurora Forum -- Qualcomm Innovation Center, Inc is a member of Code Aurora Forum -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-enable-Hexagon-target-from-cmake.patch Type: application/octet-stream Size: 3095 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/5d8aa3a9/attachment.obj From spop at codeaurora.org Mon Aug 6 15:11:44 2012 From: spop at codeaurora.org (Sebastian Pop) Date: Mon, 6 Aug 2012 15:11:44 -0500 Subject: [llvm-commits] Fix cmake for Hexagon cross compilers In-Reply-To: References: Message-ID: Ping^4. Hi, I'm waiting for a month now for an OK to commit. It seems that really nobody except me cares for this change. Does it really matter to somebody if I'm pushing this change out to svn? How should I proceed in timeout cases like this? Thanks, Sebastian On Wed, Aug 1, 2012 at 10:43 AM, Sebastian Pop wrote: > Ping^2. > > Looks like nobody finds anything to say about this patch: > could then somebody ok the patch? > > Thanks, > Sebastian > > On Wed, Jul 18, 2012 at 10:55 PM, Sebastian Pop wrote: >> On Tue, Jul 3, 2012 at 11:51 PM, Sebastian Pop wrote: >>> On Tue, Jul 3, 2012 at 10:42 PM, Sebastian Pop wrote: >>>> Hi, >>>> >>>> here is a patch that allows us to use cmake to specify a cross >>>> compiler for Hexagon. >>>> >>>> In particular, the patch adds a missing case for the target Hexagon in >>>> cmake/config-ix.cmake, and it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE >>>> variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them >>>> available at configure time. Here is the command line that I have used to test >>>> my patches: >>>> >>>> $ cmake -G Ninja -D BUILD_SHARED_LIBS:BOOL=ON -D >>>> LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D >>>> TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D >>>> LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D >>>> LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu -D >>>> LLVM_ENABLE_PIC:BOOL=OFF .. >>>> $ ninja check >>>> >>> >>> With this cmake command, building clang fails for two programs >>> c-arcmt-test and c-index-test like this: >>> >>> [102/649] Linking CXX executable bin/c-index-test >>> FAILED: : && /usr/bin/c++ -fno-common -Woverloaded-virtual >>> -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W >>> -Wno-unused-parameter -Wwrite-strings -fno-rtti >>> tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o >>> -o bin/c-index-test -rdynamic lib/libLLVMMC.so lib/libLLVMObject.so >>> lib/libLLVMSupport.so -ldl -lpthread -llibclang >>> -Wl,-rpath,/home/spop/llvm/svn-git-llvm/ninja.build/lib: && : >>> /usr/bin/ld: cannot find -llibclang >>> >>> We are trying to link against a static libclang even when we explicitly asked >>> cmake -D BUILD_SHARED_LIBS:BOOL=ON >>> >>> The attached patch fixes the compilation of these two programs by generating >>> the static libclang.a even when BUILD_SHARED_LIBS is ON. >>> >>> Ok to commit the attached patch, or is there a better way to fix the cmake >>> compilations by avoiding the static link against libclang? >> >> Ping second patch. >> >> Thanks, >> Sebastian >> -- >> Qualcomm Innovation Center, Inc is a member of Code Aurora Forum > > > > -- > Qualcomm Innovation Center, Inc is a member of Code Aurora Forum -- Qualcomm Innovation Center, Inc is a member of Code Aurora Forum -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-build-a-static-libclang.a-even-for-BUILD_SHARED_LIBS.patch Type: application/octet-stream Size: 1368 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/6ae16324/attachment.obj From lhames at gmail.com Mon Aug 6 15:20:27 2012 From: lhames at gmail.com (Lang Hames) Date: Mon, 6 Aug 2012 13:20:27 -0700 Subject: [llvm-commits] [llvm] r161258 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp In-Reply-To: <20120803205932.95B7E2A6C073@llvm.org> References: <20120803205932.95B7E2A6C073@llvm.org> Message-ID: This is great! - Lang. On Fri, Aug 3, 2012 at 1:59 PM, Jakob Stoklund Olesen wrote: > Author: stoklund > Date: Fri Aug 3 15:59:32 2012 > New Revision: 161258 > > URL: http://llvm.org/viewvc/llvm-project?rev=161258&view=rev > Log: > Completely eliminate VNInfo flags. > > The 'unused' state of a value number can be represented as an invalid > def SlotIndex. This also exposed code that shouldn't have been looking > at unused value VNInfos. > > Modified: > llvm/trunk/include/llvm/CodeGen/LiveInterval.h > llvm/trunk/lib/CodeGen/LiveInterval.cpp > llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=161258&r1=161257&r2=161258&view=diff > > ============================================================================== > --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) > +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Fri Aug 3 15:59:32 2012 > @@ -40,13 +40,6 @@ > /// definition and use points. > /// > class VNInfo { > - private: > - enum { > - IS_UNUSED = 1 > - }; > - > - unsigned char flags; > - > public: > typedef BumpPtrAllocator Allocator; > > @@ -58,29 +51,19 @@ > > /// VNInfo constructor. > VNInfo(unsigned i, SlotIndex d) > - : flags(0), id(i), def(d) > + : id(i), def(d) > { } > > /// VNInfo construtor, copies values from orig, except for the value > number. > VNInfo(unsigned i, const VNInfo &orig) > - : flags(orig.flags), id(i), def(orig.def) > + : id(i), def(orig.def) > { } > > /// Copy from the parameter into this VNInfo. > void copyFrom(VNInfo &src) { > - flags = src.flags; > def = src.def; > } > > - /// Used for copying value number info. > - unsigned getFlags() const { return flags; } > - void setFlags(unsigned flags) { this->flags = flags; } > - > - /// Merge flags from another VNInfo > - void mergeFlags(const VNInfo *VNI) { > - flags = (flags | VNI->flags) & ~IS_UNUSED; > - } > - > /// Returns true if this value is defined by a PHI instruction (or > was, > /// PHI instrucions may have been eliminated). > /// PHI-defs begin at a block boundary, all other defs begin at > register or > @@ -88,14 +71,10 @@ > bool isPHIDef() const { return def.isBlock(); } > > /// Returns true if this value is unused. > - bool isUnused() const { return flags & IS_UNUSED; } > - /// Set the "is unused" flag on this value. > - void setIsUnused(bool unused) { > - if (unused) > - flags |= IS_UNUSED; > - else > - flags &= ~IS_UNUSED; > - } > + bool isUnused() const { return !def.isValid(); } > + > + /// Mark this value as unused. > + void markUnused() { def = SlotIndex(); } > }; > > /// LiveRange structure - This represents a simple register range in the > > Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=161258&r1=161257&r2=161258&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Fri Aug 3 15:59:32 2012 > @@ -160,7 +160,7 @@ > valnos.pop_back(); > } while (!valnos.empty() && valnos.back()->isUnused()); > } else { > - ValNo->setIsUnused(true); > + ValNo->markUnused(); > } > } > > @@ -667,9 +667,6 @@ > } > } > > - // Merge the relevant flags. > - V2->mergeFlags(V1); > - > // Now that V1 is dead, remove it. > markValNoForDeletion(V1); > > > Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=161258&r1=161257&r2=161258&view=diff > > ============================================================================== > --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) > +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Aug 3 15:59:32 > 2012 > @@ -706,7 +706,7 @@ > continue; > if (VNI->isPHIDef()) { > // This is a dead PHI. Remove it. > - VNI->setIsUnused(true); > + VNI->markUnused(); > NewLI.removeRange(*LII); > DEBUG(dbgs() << "Dead PHI at " << VNI->def << " may separate > interval\n"); > CanSeparate = true; > > > _______________________________________________ > 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/20120806/c44ba658/attachment.html From stoklund at 2pi.dk Mon Aug 6 15:51:40 2012 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 06 Aug 2012 13:51:40 -0700 Subject: [llvm-commits] [llvm] r161258 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp In-Reply-To: References: <20120803205932.95B7E2A6C073@llvm.org> Message-ID: On Aug 6, 2012, at 1:20 PM, Lang Hames wrote: > Completely eliminate VNInfo flags. I think we can soon eliminate the VNInfo class entirely, and just put a SlotIndex array in LiveInterval: class LiveInterval { struct Segment { SlotIndex start; SlotIndex end; unsigned valno; }; SmallVector Ranges; SmallVector Defs; } This would save all the memory previously used by the VNInfo allocator. /jakob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/829107e2/attachment.html From echristo at apple.com Mon Aug 6 15:52:18 2012 From: echristo at apple.com (Eric Christopher) Date: Mon, 06 Aug 2012 20:52:18 -0000 Subject: [llvm-commits] [llvm] r161344 - in /llvm/trunk: autoconf/config.guess autoconf/ltmain.sh autoconf/m4/libtool.m4 configure include/llvm/ADT/Triple.h lib/Support/Mutex.cpp lib/Support/Triple.cpp lib/Support/Unix/Path.inc lib/Support/Unix/Process.inc lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp tools/llvm-shlib/Makefile Message-ID: <20120806205218.D492F2A6C073@llvm.org> Author: echristo Date: Mon Aug 6 15:52:18 2012 New Revision: 161344 URL: http://llvm.org/viewvc/llvm-project?rev=161344&view=rev Log: Add support for the OpenBSD for Bitrig. Patch by David Hill. Modified: llvm/trunk/autoconf/config.guess llvm/trunk/autoconf/ltmain.sh llvm/trunk/autoconf/m4/libtool.m4 llvm/trunk/configure llvm/trunk/include/llvm/ADT/Triple.h llvm/trunk/lib/Support/Mutex.cpp llvm/trunk/lib/Support/Triple.cpp llvm/trunk/lib/Support/Unix/Path.inc llvm/trunk/lib/Support/Unix/Process.inc llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp llvm/trunk/tools/llvm-shlib/Makefile Modified: llvm/trunk/autoconf/config.guess URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/config.guess?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/autoconf/config.guess (original) +++ llvm/trunk/autoconf/config.guess Mon Aug 6 15:52:18 2012 @@ -206,6 +206,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; Modified: llvm/trunk/autoconf/ltmain.sh URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/ltmain.sh?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== Binary files - no diff available. Modified: llvm/trunk/autoconf/m4/libtool.m4 URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/libtool.m4?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/autoconf/m4/libtool.m4 (original) +++ llvm/trunk/autoconf/m4/libtool.m4 Mon Aug 6 15:52:18 2012 @@ -176,7 +176,7 @@ if test -n "$RANLIB"; then case $host_os in - openbsd*) + openbsd* | bitrig*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) @@ -729,7 +729,7 @@ lt_cv_sys_max_cmd_len=8192; ;; - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly* | bitrig*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -1631,7 +1631,7 @@ shlibpath_overrides_runpath=yes ;; -openbsd*) +openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no @@ -3382,7 +3382,7 @@ # C++ shared libraries are fairly broken _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - openbsd*) + openbsd* | bitrig*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' @@ -6003,7 +6003,7 @@ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - openbsd*) + openbsd* | bitrig*) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Aug 6 15:52:18 2012 @@ -8947,7 +8947,7 @@ shlibpath_overrides_runpath=yes ;; -openbsd*) +openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no Modified: llvm/trunk/include/llvm/ADT/Triple.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Triple.h (original) +++ llvm/trunk/include/llvm/ADT/Triple.h Mon Aug 6 15:52:18 2012 @@ -98,7 +98,8 @@ Minix, RTEMS, NativeClient, - CNK // BG/P Compute-Node Kernel + CNK, // BG/P Compute-Node Kernel + Bitrig }; enum EnvironmentType { UnknownEnvironment, Modified: llvm/trunk/lib/Support/Mutex.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Mutex.cpp?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/lib/Support/Mutex.cpp (original) +++ llvm/trunk/lib/Support/Mutex.cpp Mon Aug 6 15:52:18 2012 @@ -59,7 +59,8 @@ errorcode = pthread_mutexattr_settype(&attr, kind); assert(errorcode == 0); -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \ + !defined(__DragonFly__) && !defined(__Bitrig__) // Make it a process local mutex errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); assert(errorcode == 0); Modified: llvm/trunk/lib/Support/Triple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/lib/Support/Triple.cpp (original) +++ llvm/trunk/lib/Support/Triple.cpp Mon Aug 6 15:52:18 2012 @@ -124,6 +124,7 @@ case RTEMS: return "rtems"; case NativeClient: return "nacl"; case CNK: return "cnk"; + case Bitrig: return "bitrig"; } llvm_unreachable("Invalid OSType"); @@ -293,6 +294,7 @@ .StartsWith("rtems", Triple::RTEMS) .StartsWith("nacl", Triple::NativeClient) .StartsWith("cnk", Triple::CNK) + .StartsWith("bitrig", Triple::Bitrig) .Default(Triple::UnknownOS); } Modified: llvm/trunk/lib/Support/Unix/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/lib/Support/Unix/Path.inc (original) +++ llvm/trunk/lib/Support/Unix/Path.inc Mon Aug 6 15:52:18 2012 @@ -260,7 +260,7 @@ return Path(pathname); } -#if defined(__FreeBSD__) || defined (__NetBSD__) || \ +#if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) static int test_dir(char buf[PATH_MAX], char ret[PATH_MAX], @@ -329,7 +329,7 @@ if (realpath(exe_path, link_path)) return Path(link_path); } -#elif defined(__FreeBSD__) || defined (__NetBSD__) || \ +#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) char exe_path[PATH_MAX]; Modified: llvm/trunk/lib/Support/Unix/Process.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Process.inc?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/lib/Support/Unix/Process.inc (original) +++ llvm/trunk/lib/Support/Unix/Process.inc Mon Aug 6 15:52:18 2012 @@ -20,9 +20,10 @@ #ifdef HAVE_SYS_RESOURCE_H #include #endif -// DragonFly BSD has deprecated for instead, -// Unix.h includes this for us already. -#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) +// DragonFlyBSD, OpenBSD, and Bitrig have deprecated for +// instead. Unix.h includes this for us already. +#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) && \ + !defined(__OpenBSD__) && !defined(__Bitrig__) #include #endif #ifdef HAVE_MALLOC_MALLOC_H Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp Mon Aug 6 15:52:18 2012 @@ -91,9 +91,10 @@ // Exceptions handling ExceptionsType = ExceptionHandling::DwarfCFI; - // OpenBSD has buggy support for .quad in 32-bit mode, just split into two - // .words. - if (T.getOS() == Triple::OpenBSD && T.getArch() == Triple::x86) + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split + // into two .words. + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && + T.getArch() == Triple::x86) Data64bitsDirective = 0; } Modified: llvm/trunk/tools/llvm-shlib/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-shlib/Makefile?rev=161344&r1=161343&r2=161344&view=diff ============================================================================== --- llvm/trunk/tools/llvm-shlib/Makefile (original) +++ llvm/trunk/tools/llvm-shlib/Makefile Mon Aug 6 15:52:18 2012 @@ -63,7 +63,7 @@ endif endif -ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU Bitrig)) # Include everything from the .a's into the shared library. LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ -Wl,--no-whole-archive From echristo at apple.com Mon Aug 6 15:53:32 2012 From: echristo at apple.com (Eric Christopher) Date: Mon, 06 Aug 2012 13:53:32 -0700 Subject: [llvm-commits] [PATCH] Add support for Bitrig, an OpenBSD fork. In-Reply-To: <20120806201209.GB6079@63a5e772f7ad9cc78a4852a104e4f05de5260a0fbaa18cfe> References: <20120801143059.GA19699@2b4c76bd04465534c8dd11d37c4fced523619b32ed53713f> <20120804132239.GA14539@545b10c9a28a38e43c5f6dc54dff98b1e3766b5781c7c992> <20120806162013.GA17527@379e5099a4ff51acff9830970d0c7a6b1590bbc63e07352f> <20120806191548.GA6079@a683b33e3c0c17bda72c088feae84dbfff13d13cec5dd3d1> <8FED7270-B4BD-4992-96E1-4C4F811A4F77@apple.com> <20120806201209.GB6079@63a5e772f7ad9cc78a4852a104e4f05de5260a0fbaa18cfe> Message-ID: Committed here: M autoconf/config.guess M autoconf/ltmain.sh M autoconf/m4/libtool.m4 M configure M include/llvm/ADT/Triple.h M lib/Support/Mutex.cpp M lib/Support/Triple.cpp M lib/Support/Unix/Path.inc M lib/Support/Unix/Process.inc M lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp M tools/llvm-shlib/Makefile Committed r161344 thanks! -eric >> On Aug 6, 2012, at 12:15 PM, David Hill wrote: >> >>> On Mon, Aug 06, 2012 at 10:46:04AM -0700, Eric Christopher wrote: >>>> >>>> On Aug 6, 2012, at 9:20 AM, David Hill wrote: >>>> >>>>> >>>>> On Sat, Aug 04, 2012 at 09:22:40AM -0400, David Hill wrote: >>>>>> On Wed, Aug 01, 2012 at 05:05:22PM -0700, Eli Friedman wrote: >>>>>>> On Wed, Aug 1, 2012 at 7:30 AM, David Hill wrote: >>>>>>>> Hello, >>>>>>>> >>>>>>>> The attached patch allows LLVM to recognize Bitrig, an OpenBSD fork. >>>>>>>> Clang bits to come after this has been accepted. >>>>>>>> >>>>>>>> Please review. >>>>>>> >>>>>>> I can't really review the autoconf changes. >>>>>>> >>>>>>> + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split >>>>>>> + // into two .words. >>>>>>> + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && >>>>>>> + T.getArch() == Triple::x86) >>>>>>> >>>>>>> Does Bitrig actually have this bug? If so, why don't you just fix it? >>>>>>> >>>>>>> -Eli >>>>>> >>>>>> Ping >>>>>> >>>>> >>>>> Any objections to this going in? >>>> >>>> Seems like not, send me an up to date patch and I'll commit it. >>>> >>>> -eric >>> >>> Here you go: >>> >>> diff --git a/autoconf/config.guess b/autoconf/config.guess >>> index f7dd69e..dd6dcb3 100755 >>> --- a/autoconf/config.guess >>> +++ b/autoconf/config.guess >>> @@ -206,6 +206,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in >>> UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` >>> echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} >>> exit ;; >>> + *:Bitrig:*:*) >>> + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` >>> + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} >>> + exit ;; >>> *:ekkoBSD:*:*) >>> echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} >>> exit ;; >>> diff --git a/autoconf/ltmain.sh b/autoconf/ltmain.sh >>> index 2455278..21ace01 100644 >>> --- a/autoconf/ltmain.sh >>> +++ b/autoconf/ltmain.sh >>> @@ -1560,7 +1560,7 @@ EOF >>> # These systems don't actually have a C library (as such) >>> test "X$arg" = "X-lc" && continue >>> ;; >>> - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) >>> + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) >>> # Do not include libc due to us having libc/libc_r. >>> test "X$arg" = "X-lc" && continue >>> ;; >>> @@ -1580,7 +1580,7 @@ EOF >>> esac >>> elif test "X$arg" = "X-lc_r"; then >>> case $host in >>> - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) >>> + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | -*-*-bitrig*) >>> # Do not include libc_r directly, use -pthread flag. >>> continue >>> ;; >>> @@ -3464,7 +3464,7 @@ EOF >>> *-*-netbsd*) >>> # Don't link with libc until the a.out ld.so is fixed. >>> ;; >>> - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) >>> + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) >>> # Do not include libc due to us having libc/libc_r. >>> ;; >>> *-*-sco3.2v5* | *-*-sco5v6*) >>> diff --git a/autoconf/m4/libtool.m4 b/autoconf/m4/libtool.m4 >>> index 36ac3d1..05af7a2 100644 >>> --- a/autoconf/m4/libtool.m4 >>> +++ b/autoconf/m4/libtool.m4 >>> @@ -176,7 +176,7 @@ old_postuninstall_cmds= >>> >>> if test -n "$RANLIB"; then >>> case $host_os in >>> - openbsd*) >>> + openbsd* | bitrig*) >>> old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" >>> ;; >>> *) >>> @@ -729,7 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl >>> lt_cv_sys_max_cmd_len=8192; >>> ;; >>> >>> - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) >>> + netbsd* | freebsd* | openbsd* | darwin* | dragonfly* | bitrig*) >>> # This has been around since 386BSD, at least. Likely further. >>> if test -x /sbin/sysctl; then >>> lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` >>> @@ -1631,7 +1631,7 @@ nto-qnx*) >>> shlibpath_overrides_runpath=yes >>> ;; >>> >>> -openbsd*) >>> +openbsd* | bitrig*) >>> version_type=sunos >>> sys_lib_dlsearch_path_spec="/usr/lib" >>> need_lib_prefix=no >>> @@ -3382,7 +3382,7 @@ case $host_os in >>> # C++ shared libraries are fairly broken >>> _LT_AC_TAGVAR(ld_shlibs, $1)=no >>> ;; >>> - openbsd*) >>> + openbsd* | bitrig*) >>> _LT_AC_TAGVAR(hardcode_direct, $1)=yes >>> _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no >>> _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' >>> @@ -6003,7 +6003,7 @@ _LT_EOF >>> _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no >>> ;; >>> >>> - openbsd*) >>> + openbsd* | bitrig*) >>> _LT_AC_TAGVAR(hardcode_direct, $1)=yes >>> _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no >>> if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then >>> diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h >>> index a080200..7f7061a 100644 >>> --- a/include/llvm/ADT/Triple.h >>> +++ b/include/llvm/ADT/Triple.h >>> @@ -98,7 +98,8 @@ public: >>> Minix, >>> RTEMS, >>> NativeClient, >>> - CNK // BG/P Compute-Node Kernel >>> + CNK, // BG/P Compute-Node Kernel >>> + Bitrig >>> }; >>> enum EnvironmentType { >>> UnknownEnvironment, >>> diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp >>> index da5baab..4e4a026 100644 >>> --- a/lib/Support/Mutex.cpp >>> +++ b/lib/Support/Mutex.cpp >>> @@ -59,7 +59,8 @@ MutexImpl::MutexImpl( bool recursive) >>> errorcode = pthread_mutexattr_settype(&attr, kind); >>> assert(errorcode == 0); >>> >>> -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) >>> +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \ >>> + !defined(__DragonFly__) && !defined(__Bitrig__) >>> // Make it a process local mutex >>> errorcode = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE); >>> assert(errorcode == 0); >>> diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp >>> index 7b26ea9..cca549d 100644 >>> --- a/lib/Support/Triple.cpp >>> +++ b/lib/Support/Triple.cpp >>> @@ -124,6 +124,7 @@ const char *Triple::getOSTypeName(OSType Kind) { >>> case RTEMS: return "rtems"; >>> case NativeClient: return "nacl"; >>> case CNK: return "cnk"; >>> + case Bitrig: return "bitrig"; >>> } >>> >>> llvm_unreachable("Invalid OSType"); >>> @@ -293,6 +294,7 @@ static Triple::OSType parseOS(StringRef OSName) { >>> .StartsWith("rtems", Triple::RTEMS) >>> .StartsWith("nacl", Triple::NativeClient) >>> .StartsWith("cnk", Triple::CNK) >>> + .StartsWith("bitrig", Triple::Bitrig) >>> .Default(Triple::UnknownOS); >>> } >>> >>> diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc >>> index b41390a..6bddbdf 100644 >>> --- a/lib/Support/Unix/Path.inc >>> +++ b/lib/Support/Unix/Path.inc >>> @@ -260,7 +260,7 @@ Path::GetCurrentDirectory() { >>> return Path(pathname); >>> } >>> >>> -#if defined(__FreeBSD__) || defined (__NetBSD__) || \ >>> +#if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ >>> defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) >>> static int >>> test_dir(char buf[PATH_MAX], char ret[PATH_MAX], >>> @@ -329,7 +329,7 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { >>> if (realpath(exe_path, link_path)) >>> return Path(link_path); >>> } >>> -#elif defined(__FreeBSD__) || defined (__NetBSD__) || \ >>> +#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ >>> defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) >>> char exe_path[PATH_MAX]; >>> >>> diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc >>> index 174112e..5204147 100644 >>> --- a/lib/Support/Unix/Process.inc >>> +++ b/lib/Support/Unix/Process.inc >>> @@ -20,9 +20,10 @@ >>> #ifdef HAVE_SYS_RESOURCE_H >>> #include >>> #endif >>> -// DragonFly BSD has deprecated for instead, >>> -// Unix.h includes this for us already. >>> -#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) >>> +// DragonFlyBSD, OpenBSD, and Bitrig have deprecated for >>> +// instead. Unix.h includes this for us already. >>> +#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) && \ >>> + !defined(__OpenBSD__) && !defined(__Bitrig__) >>> #include >>> #endif >>> #ifdef HAVE_MALLOC_MALLOC_H >>> diff --git a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp >>> index 49c07f3..b0acd7d 100644 >>> --- a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp >>> +++ b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp >>> @@ -91,9 +91,10 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) { >>> // Exceptions handling >>> ExceptionsType = ExceptionHandling::DwarfCFI; >>> >>> - // OpenBSD has buggy support for .quad in 32-bit mode, just split into two >>> - // .words. >>> - if (T.getOS() == Triple::OpenBSD && T.getArch() == Triple::x86) >>> + // OpenBSD and Bitrig have buggy support for .quad in 32-bit mode, just split >>> + // into two .words. >>> + if ((T.getOS() == Triple::OpenBSD || T.getOS() == Triple::Bitrig) && >>> + T.getArch() == Triple::x86) >>> Data64bitsDirective = 0; >>> } >>> >>> diff --git a/tools/llvm-shlib/Makefile b/tools/llvm-shlib/Makefile >>> index 75bee07..6d6c6e9 100644 >>> --- a/tools/llvm-shlib/Makefile >>> +++ b/tools/llvm-shlib/Makefile >>> @@ -63,7 +63,7 @@ ifeq ($(HOST_OS),Darwin) >>> endif >>> endif >>> >>> -ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU)) >>> +ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD OpenBSD GNU Bitrig)) >>> # Include everything from the .a's into the shared library. >>> LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ >>> -Wl,--no-whole-archive >> > From bigcheesegs at gmail.com Mon Aug 6 16:00:47 2012 From: bigcheesegs at gmail.com (Michael Spencer) Date: Mon, 6 Aug 2012 14:00:47 -0700 Subject: [llvm-commits] [PATCH] Add mapped_file_region for read/write mapped files. Message-ID: The attached patch adds mapped_file_region based on boost::iostreams::mapped_file. This is a replacement for map_file_pages/unmap_file_pages to work properly on Windows. This can also be used by MemoryBuffer to finally have memory mapped files on Windows. The reason the previous APIs do not work for Windows is that there are 3 different handles that need to be kept track of to properly unmap a region. For munmap there is only 1. - Michael Spencer -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-PathV2-Add-mapped_file_region.-Implementation-for-Wi.patch Type: application/octet-stream Size: 18128 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/6ee9a186/attachment.obj From lhames at gmail.com Mon Aug 6 16:12:35 2012 From: lhames at gmail.com (Lang Hames) Date: Mon, 6 Aug 2012 14:12:35 -0700 Subject: [llvm-commits] [llvm] r161258 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp In-Reply-To: References: <20120803205932.95B7E2A6C073@llvm.org> Message-ID: Excellent. It'd be great to see all those VNInfo::Allocator parameters in the LiveInterval API go away. - Lang. On Mon, Aug 6, 2012 at 1:51 PM, Jakob Stoklund Olesen wrote: > > On Aug 6, 2012, at 1:20 PM, Lang Hames wrote: > > Completely eliminate VNInfo flags. >> > > I think we can soon eliminate the VNInfo class entirely, and just put a > SlotIndex array in LiveInterval: > > class LiveInterval { > struct Segment { > SlotIndex start; > SlotIndex end; > unsigned valno; > }; > SmallVector Ranges; > SmallVector Defs; > } > > This would save all the memory previously used by the VNInfo allocator. > > /jakob > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/7642a964/attachment.html From hfinkel at anl.gov Mon Aug 6 16:21:44 2012 From: hfinkel at anl.gov (Hal Finkel) Date: Mon, 06 Aug 2012 21:21:44 -0000 Subject: [llvm-commits] [llvm] r161346 - in /llvm/trunk: lib/Target/PowerPC/PPCInstr64Bit.td test/CodeGen/PowerPC/ppc64-cyclecounter.ll Message-ID: <20120806212144.649A32A6C073@llvm.org> Author: hfinkel Date: Mon Aug 6 16:21:44 2012 New Revision: 161346 URL: http://llvm.org/viewvc/llvm-project?rev=161346&view=rev Log: MFTB on PPC64 should really be encoded using MFSPR. The MFTB instruction itself is being phased out, and its functionality is provided by MFSPR. According to the ISA docs, using MFSPR works on all known chips except for the 601 (which did not have a timebase register anyway) and the POWER3. Thanks to Adhemerval Zanella for pointing this out! Modified: llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td llvm/trunk/test/CodeGen/PowerPC/ppc64-cyclecounter.ll Modified: llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td?rev=161346&r1=161345&r2=161346&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td Mon Aug 6 16:21:44 2012 @@ -266,8 +266,8 @@ } let Pattern = [(set G8RC:$rT, readcyclecounter)] in -def MFTB8 : XFXForm_1_ext<31, 371, 268, (outs G8RC:$rT), (ins), - "mftb $rT", SprMFTB>, +def MFTB8 : XFXForm_1_ext<31, 339, 268, (outs G8RC:$rT), (ins), + "mfspr $rT, 268", SprMFTB>, PPC970_DGroup_First, PPC970_Unit_FXU; let Defs = [X1], Uses = [X1] in Modified: llvm/trunk/test/CodeGen/PowerPC/ppc64-cyclecounter.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc64-cyclecounter.ll?rev=161346&r1=161345&r2=161346&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/ppc64-cyclecounter.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/ppc64-cyclecounter.ll Mon Aug 6 16:21:44 2012 @@ -9,7 +9,7 @@ } ; CHECK: @test1 -; CHECK: mftb +; CHECK: mfspr 3, 268 declare i64 @llvm.readcyclecounter() From hfinkel at anl.gov Mon Aug 6 16:22:48 2012 From: hfinkel at anl.gov (Hal Finkel) Date: Mon, 6 Aug 2012 16:22:48 -0500 Subject: [llvm-commits] [llvm] r161302 - in /llvm/trunk: include/llvm/Target/TargetSelectionDAG.td lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCInstr64Bit.td test/CodeGen/PowerPC/ppc64-cyclecounter.ll In-Reply-To: <50200F65.1000903@linux.vnet.ibm.com> References: <20120804141046.807242A6C074@llvm.org> <50200F65.1000903@linux.vnet.ibm.com> Message-ID: <20120806162248.072cd878@sapling2> On Mon, 06 Aug 2012 15:39:33 -0300 Adhemerval Zanella wrote: > Hi Hal, > > On 08/04/2012 11:10 AM, Hal Finkel wrote: > > > +let Pattern = [(set G8RC:$rT, readcyclecounter)] in > > +def MFTB8 : XFXForm_1_ext<31, 371, 268, (outs G8RC:$rT), (ins), > > + "mftb $rT", SprMFTB>, > > + PPC970_DGroup_First, PPC970_Unit_FXU; > > + > > let Defs = [X1], Uses = [X1] in > > def DYNALLOC8 : Pseudo<(outs G8RC:$result), (ins G8RC:$negsize, > > memri:$fpsi),"", [(set G8RC:$result, > > The 'mftb/mftbu' are deprecated on PowerISA 2.06 (indicated as > Phased-Out) and currently they are defined as mnemonics to 'mftb > Rx,268/mfspr Rx,268". So I would suggest a change to use 'mfspr Rx, > 268' instead of relying on 'mftb' for PPC64. Thanks! r161344. -Hal > -- Hal Finkel Postdoctoral Appointee Leadership Computing Facility Argonne National Laboratory From jcarter at mips.com Mon Aug 6 16:26:04 2012 From: jcarter at mips.com (Jack Carter) Date: Mon, 06 Aug 2012 21:26:04 -0000 Subject: [llvm-commits] [llvm] r161348 - in /llvm/trunk: lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp test/MC/Mips/higher_highest.ll Message-ID: <20120806212604.50B972A6C073@llvm.org> Author: jacksprat Date: Mon Aug 6 16:26:03 2012 New Revision: 161348 URL: http://llvm.org/viewvc/llvm-project?rev=161348&view=rev Log: Mips relocations R_MIPS_HIGHER and R_MIPS_HIGHEST. These 2 relocations gain access to the highest and the second highest 16 bits of a 64 bit object. R_MIPS_HIGHER %higher(A+S) The %higher(x) function is [ (((long long) x + 0x80008000LL) >> 32) & 0xffff ]. R_MIPS_HIGHEST %highest(A+S) The %highest(x) function is [ (((long long) x + 0x800080008000LL) >> 48) & 0xffff ]. Added: llvm/trunk/test/MC/Mips/higher_highest.ll Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp?rev=161348&r1=161347&r2=161348&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp (original) +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp Mon Aug 6 16:26:03 2012 @@ -59,9 +59,17 @@ break; case Mips::fixup_Mips_HI16: case Mips::fixup_Mips_GOT_Local: - // Get the higher 16-bits. Also add 1 if bit 15 is 1. + // Get the 2nd 16-bits. Also add 1 if bit 15 is 1. Value = ((Value + 0x8000) >> 16) & 0xffff; break; + case Mips::fixup_Mips_HIGHER: + // Get the 3rd 16-bits. + Value = ((Value + 0x80008000LL) >> 32) & 0xffff; + break; + case Mips::fixup_Mips_HIGHEST: + // Get the 4th 16-bits. + Value = ((Value + 0x800080008000LL) >> 48) & 0xffff; + break; } return Value; @@ -168,7 +176,9 @@ { "fixup_Mips_GPOFF_LO", 0, 16, 0 }, { "fixup_Mips_GOT_PAGE", 0, 16, 0 }, { "fixup_Mips_GOT_OFST", 0, 16, 0 }, - { "fixup_Mips_GOT_DISP", 0, 16, 0 } + { "fixup_Mips_GOT_DISP", 0, 16, 0 }, + { "fixup_Mips_HIGHER", 0, 16, 0 }, + { "fixup_Mips_HIGHEST", 0, 16, 0 } }; if (Kind < FirstTargetFixupKind) Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=161348&r1=161347&r2=161348&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Mon Aug 6 16:26:03 2012 @@ -169,6 +169,12 @@ Type = setRType2((unsigned)ELF::R_MIPS_SUB, Type); Type = setRType3((unsigned)ELF::R_MIPS_LO16, Type); break; + case Mips::fixup_Mips_HIGHER: + Type = ELF::R_MIPS_HIGHER; + break; + case Mips::fixup_Mips_HIGHEST: + Type = ELF::R_MIPS_HIGHEST; + break; } return Type; } Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h?rev=161348&r1=161347&r2=161348&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h (original) +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h Mon Aug 6 16:26:03 2012 @@ -110,6 +110,12 @@ // resulting in - R_MIPS_GOT_DISP fixup_Mips_GOT_DISP, + // resulting in - R_MIPS_GOT_HIGHER + fixup_Mips_HIGHER, + + // resulting in - R_MIPS_HIGHEST + fixup_Mips_HIGHEST, + // Marker LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp?rev=161348&r1=161347&r2=161348&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp Mon Aug 6 16:26:03 2012 @@ -255,6 +255,12 @@ case MCSymbolRefExpr::VK_Mips_TPREL_LO: FixupKind = Mips::fixup_Mips_TPREL_LO; break; + case MCSymbolRefExpr::VK_Mips_HIGHER: + FixupKind = Mips::fixup_Mips_HIGHER; + break; + case MCSymbolRefExpr::VK_Mips_HIGHEST: + FixupKind = Mips::fixup_Mips_HIGHEST; + break; } // switch Fixups.push_back(MCFixup::Create(0, MO.getExpr(), MCFixupKind(FixupKind))); Added: llvm/trunk/test/MC/Mips/higher_highest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/higher_highest.ll?rev=161348&view=auto ============================================================================== --- llvm/trunk/test/MC/Mips/higher_highest.ll (added) +++ llvm/trunk/test/MC/Mips/higher_highest.ll Mon Aug 6 16:26:03 2012 @@ -0,0 +1,27 @@ +; RUN: llc -march=mips64el -mcpu=mips64 -mattr=n64 -force-mips-long-branch -filetype=obj < %s -o - | elf-dump --dump-section-data | FileCheck %s + +; Check that the R_MIPS_HIGHER and R_MIPS_HIGHEST relocations were created. + +; CHECK: ('r_type', 0x1d) +; CHECK: ('r_type', 0x1d) +; CHECK: ('r_type', 0x1c) +; CHECK: ('r_type', 0x1c) + + at g0 = external global i32 + +define void @foo1(i32 %s) nounwind { +entry: + + %tobool = icmp eq i32 %s, 0 + br i1 %tobool, label %if.end, label %if.then + +if.then: ; preds = %entry + %0 = load i32* @g0, align 4 + %add = add nsw i32 %0, 12 + store i32 %add, i32* @g0, align 4 + br label %if.end + +if.end: ; preds = %entry, %if.then + ret void +} + From silvas at purdue.edu Mon Aug 6 16:34:20 2012 From: silvas at purdue.edu (Sean Silva) Date: Mon, 6 Aug 2012 14:34:20 -0700 Subject: [llvm-commits] [PATCH] Add mapped_file_region for read/write mapped files. In-Reply-To: References: Message-ID: +/// LLVM_EQ_DELETE - Document that a member function should not be callable. +/// This uses = delete where supported. The function should still be private to +/// partially work in C++03. +#if (__has_feature(cxx_deleted_functions) \ + || defined(__GXX_EXPERIMENTAL_CXX0X__)) +#define LLVM_EQ_DELETE = delete +#else +#define LLVM_EQ_DELETE +#endif You seem to be slipping this in rather subtly. I think it would be good to have this be its own patch, so that it can get some discussion. Is the intent that this should be used in place of the classic "// DO NOT IMPLEMENT" comment? If so, I think that awareness of this should be made more widespread (entry in the Coding Standards, maybe?). --Sean Silva On Mon, Aug 6, 2012 at 2:00 PM, Michael Spencer wrote: > The attached patch adds mapped_file_region based on > boost::iostreams::mapped_file. This is a replacement for > map_file_pages/unmap_file_pages to work properly on Windows. This can > also be used by MemoryBuffer to finally have memory mapped files on > Windows. > > The reason the previous APIs do not work for Windows is that there are > 3 different handles that need to be kept track of to properly unmap a > region. For munmap there is only 1. > > - Michael Spencer > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From isanbard at gmail.com Mon Aug 6 16:34:54 2012 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 06 Aug 2012 21:34:54 -0000 Subject: [llvm-commits] [llvm] r161353 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOModule.cpp LTOModule.h Message-ID: <20120806213454.9A61A2A6C073@llvm.org> Author: void Date: Mon Aug 6 16:34:54 2012 New Revision: 161353 URL: http://llvm.org/viewvc/llvm-project?rev=161353&view=rev Log: Add a way to grab the target options from the LTO command line. When the command line target options were removed from the LLVM libraries, LTO lost its ability to specify things like `-disable-fp-elim'. Add this back by adding the command line variables to the `lto' project. Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOModule.cpp llvm/trunk/tools/lto/LTOModule.h Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=161353&r1=161352&r2=161353&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Aug 6 16:34:54 2012 @@ -46,10 +46,12 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; -static cl::opt DisableInline("disable-inlining", cl::init(false), +static cl::opt +DisableInline("disable-inlining", cl::init(false), cl::desc("Do not run the inliner pass")); -static cl::opt DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false), +static cl::opt +DisableGVNLoadPRE("disable-gvn-loadpre", cl::init(false), cl::desc("Do not run the GVN load PRE pass")); const char* LTOCodeGenerator::getVersionString() { @@ -239,6 +241,7 @@ Features.getDefaultSubtargetFeatures(llvm::Triple(Triple)); std::string FeatureStr = Features.getString(); TargetOptions Options; + LTOModule::getTargetOptions(Options); _target = march->createTargetMachine(Triple, _mCpu, FeatureStr, Options, RelocModel, CodeModel::Default, CodeGenOpt::Aggressive); Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=161353&r1=161352&r2=161353&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Mon Aug 6 16:34:54 2012 @@ -26,6 +26,7 @@ #include "llvm/MC/SubtargetFeature.h" #include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/Target/TargetRegisterInfo.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" @@ -37,6 +38,118 @@ #include "llvm/ADT/Triple.h" using namespace llvm; +static cl::opt +EnableFPMAD("enable-fp-mad", + cl::desc("Enable less precise MAD instructions to be generated"), + cl::init(false)); + +static cl::opt +DisableFPElim("disable-fp-elim", + cl::desc("Disable frame pointer elimination optimization"), + cl::init(false)); + +static cl::opt +DisableFPElimNonLeaf("disable-non-leaf-fp-elim", + cl::desc("Disable frame pointer elimination optimization for non-leaf funcs"), + cl::init(false)); + +static cl::opt +EnableUnsafeFPMath("enable-unsafe-fp-math", + cl::desc("Enable optimizations that may decrease FP precision"), + cl::init(false)); + +static cl::opt +EnableNoInfsFPMath("enable-no-infs-fp-math", + cl::desc("Enable FP math optimizations that assume no +-Infs"), + cl::init(false)); + +static cl::opt +EnableNoNaNsFPMath("enable-no-nans-fp-math", + cl::desc("Enable FP math optimizations that assume no NaNs"), + cl::init(false)); + +static cl::opt +EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math", + cl::Hidden, + cl::desc("Force codegen to assume rounding mode can change dynamically"), + cl::init(false)); + +static cl::opt +GenerateSoftFloatCalls("soft-float", + cl::desc("Generate software floating point library calls"), + cl::init(false)); + +static cl::opt +FloatABIForCalls("float-abi", + cl::desc("Choose float ABI type"), + cl::init(FloatABI::Default), + cl::values( + clEnumValN(FloatABI::Default, "default", + "Target default float ABI type"), + clEnumValN(FloatABI::Soft, "soft", + "Soft float ABI (implied by -soft-float)"), + clEnumValN(FloatABI::Hard, "hard", + "Hard float ABI (uses FP registers)"), + clEnumValEnd)); + +static cl::opt +FuseFPOps("fp-contract", + cl::desc("Enable aggresive formation of fused FP ops"), + cl::init(FPOpFusion::Standard), + cl::values( + clEnumValN(FPOpFusion::Fast, "fast", + "Fuse FP ops whenever profitable"), + clEnumValN(FPOpFusion::Standard, "on", + "Only fuse 'blessed' FP ops."), + clEnumValN(FPOpFusion::Strict, "off", + "Only fuse FP ops when the result won't be effected."), + clEnumValEnd)); + +static cl::opt +DontPlaceZerosInBSS("nozero-initialized-in-bss", + cl::desc("Don't place zero-initialized symbols into bss section"), + cl::init(false)); + +static cl::opt +EnableGuaranteedTailCallOpt("tailcallopt", + cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."), + cl::init(false)); + +static cl::opt +DisableTailCalls("disable-tail-calls", + cl::desc("Never emit tail calls"), + cl::init(false)); + +static cl::opt +OverrideStackAlignment("stack-alignment", + cl::desc("Override default stack alignment"), + cl::init(0)); + +static cl::opt +EnableRealignStack("realign-stack", + cl::desc("Realign stack if needed"), + cl::init(true)); + +static cl::opt +TrapFuncName("trap-func", cl::Hidden, + cl::desc("Emit a call to trap function rather than a trap instruction"), + cl::init("")); + +static cl::opt +EnablePIE("enable-pie", + cl::desc("Assume the creation of a position independent executable."), + cl::init(false)); + +static cl::opt +SegmentedStacks("segmented-stacks", + cl::desc("Use segmented stacks if possible."), + cl::init(false)); + +static cl::opt +UseInitArray("use-init-array", + cl::desc("Use .init_array instead of .ctors."), + cl::init(false)); + LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t) : _module(m), _target(t), _context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL), @@ -117,6 +230,30 @@ return makeLTOModule(buffer.take(), errMsg); } +void LTOModule::getTargetOptions(TargetOptions &Options) { + Options.LessPreciseFPMADOption = EnableFPMAD; + Options.NoFramePointerElim = DisableFPElim; + Options.NoFramePointerElimNonLeaf = DisableFPElimNonLeaf; + Options.AllowFPOpFusion = FuseFPOps; + Options.UnsafeFPMath = EnableUnsafeFPMath; + Options.NoInfsFPMath = EnableNoInfsFPMath; + Options.NoNaNsFPMath = EnableNoNaNsFPMath; + Options.HonorSignDependentRoundingFPMathOption = + EnableHonorSignDependentRoundingFPMath; + Options.UseSoftFloat = GenerateSoftFloatCalls; + if (FloatABIForCalls != FloatABI::Default) + Options.FloatABIType = FloatABIForCalls; + Options.NoZerosInBSS = DontPlaceZerosInBSS; + Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; + Options.DisableTailCalls = DisableTailCalls; + Options.StackAlignmentOverride = OverrideStackAlignment; + Options.RealignStack = EnableRealignStack; + Options.TrapFuncName = TrapFuncName; + Options.PositionIndependentExecutable = EnablePIE; + Options.EnableSegmentedStacks = SegmentedStacks; + Options.UseInitArray = UseInitArray; +} + LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer, std::string &errMsg) { static bool Initialized = false; @@ -150,6 +287,7 @@ std::string FeatureStr = Features.getString(); std::string CPU; TargetOptions Options; + getTargetOptions(Options); TargetMachine *target = march->createTargetMachine(Triple, CPU, FeatureStr, Options); LTOModule *Ret = new LTOModule(m.take(), target); Modified: llvm/trunk/tools/lto/LTOModule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.h?rev=161353&r1=161352&r2=161353&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.h (original) +++ llvm/trunk/tools/lto/LTOModule.h Mon Aug 6 16:34:54 2012 @@ -29,6 +29,7 @@ class Function; class GlobalValue; class MemoryBuffer; + class TargetOptions; class Value; } @@ -126,6 +127,10 @@ return _asm_undefines; } + /// getTargetOptions - Fill the TargetOptions object with the options + /// specified on the command line. + static void getTargetOptions(llvm::TargetOptions &Options); + private: /// parseSymbols - Parse the symbols from the module and model-level ASM and /// add them to either the defined or undefined lists. From joerg at britannica.bec.de Mon Aug 6 16:39:13 2012 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Mon, 6 Aug 2012 23:39:13 +0200 Subject: [llvm-commits] [llvm] r161344 - in /llvm/trunk: autoconf/config.guess autoconf/ltmain.sh autoconf/m4/libtool.m4 configure include/llvm/ADT/Triple.h lib/Support/Mutex.cpp lib/Support/Triple.cpp lib/Support/Unix/Path.inc lib/Support/Unix/Process.inc lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp tools/llvm-shlib/Makefile In-Reply-To: <20120806205218.D492F2A6C073@llvm.org> References: <20120806205218.D492F2A6C073@llvm.org> Message-ID: <20120806213913.GA16645@britannica.bec.de> On Mon, Aug 06, 2012 at 08:52:18PM -0000, Eric Christopher wrote: > Modified: > llvm/trunk/autoconf/config.guess > llvm/trunk/autoconf/ltmain.sh > llvm/trunk/autoconf/m4/libtool.m4 Shouldn't those be unmodified original files? Joerg From echristo at apple.com Mon Aug 6 16:40:53 2012 From: echristo at apple.com (Eric Christopher) Date: Mon, 06 Aug 2012 14:40:53 -0700 Subject: [llvm-commits] [llvm] r161344 - in /llvm/trunk: autoconf/config.guess autoconf/ltmain.sh autoconf/m4/libtool.m4 configure include/llvm/ADT/Triple.h lib/Support/Mutex.cpp lib/Support/Triple.cpp lib/Support/Unix/Path.inc lib/Support/Unix/Process.inc lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp tools/llvm-shlib/Makefile In-Reply-To: <20120806213913.GA16645@britannica.bec.de> References: <20120806205218.D492F2A6C073@llvm.org> <20120806213913.GA16645@britannica.bec.de> Message-ID: On Aug 6, 2012, at 2:39 PM, Joerg Sonnenberger wrote: > On Mon, Aug 06, 2012 at 08:52:18PM -0000, Eric Christopher wrote: >> Modified: >> llvm/trunk/autoconf/config.guess >> llvm/trunk/autoconf/ltmain.sh >> llvm/trunk/autoconf/m4/libtool.m4 > > Shouldn't those be unmodified original files? They were forked down quite a while ago. I don't know the last time they were updated. -eric From dblaikie at gmail.com Mon Aug 6 16:54:14 2012 From: dblaikie at gmail.com (David Blaikie) Date: Mon, 6 Aug 2012 14:54:14 -0700 Subject: [llvm-commits] [PATCH][LNT] Add support for selection of timing statistic (user or real time) In-Reply-To: References: Message-ID: Bump and... [+chandler] Chandler - you mentioned on IRC that you thought there might be a way to get higher-granularity user time in Linux? Any pointers/thoughts as to how that might be achieved? (I'm not sure that necessarily invalidates this change - it's probably going to be helpful to be able to plumb more than one result up through more layers of the test suite anyway even if this particular value is very valuable) On Mon, Jul 23, 2012 at 3:13 PM, David Dean wrote: > These LGTM. > > On 23 Jul 2012, at 11:13 AM, David Blaikie wrote: > >> +David Dean who's generously offered to take a look. >> >> Thanks David - 'preciate the help. I realize you might not have the >> context of some of the discussions I had with Daniel months ago about >> these timing issues - so certainly feel free to ask any questions >> about the direction/design/point of this change that I might've failed >> to provide in the original email (visible below) or patch. >> >> On Fri, Jul 20, 2012 at 11:46 AM, David Blaikie wrote: >>> Ping. >>> >>> +Tobias, in case it interests him too >>> +Daniel's other email address, in case that helps >>> >>> Nearly the 3 month anniversary of this patch. >>> >>> On Mon, Jul 2, 2012 at 9:34 AM, David Blaikie wrote: >>>> Bump. [5th ping over 2 months] >>>> >>>> Any feedback would be appreciated - it's by no means a huge change >>>> (both in size and scope/value) but will hopefully make it a little >>>> easier to investigate other timing properties (& paves the way for >>>> collecting more timing data up into LNT at some point, should anyone >>>> feel there's value in that). >>>> >>>> On Tue, Jun 5, 2012 at 10:17 AM, David Blaikie wrote: >>>>> Once more, with feeling: Ping. >>>>> >>>>> On Wed, May 23, 2012 at 11:49 AM, David Blaikie wrote: >>>>>> Ping. >>>>>> >>>>>> On Mon, May 14, 2012 at 8:54 AM, David Blaikie wrote: >>>>>>> Ping. >>>>>>> >>>>>>> On Sun, Apr 29, 2012 at 9:43 PM, David Blaikie wrote: >>>>>>>> Bump. >>>>>>>> >>>>>>>> On Mon, Apr 23, 2012 at 4:26 PM, David Blaikie wrote: >>>>>>>>> Hi Daniel (& others), >>>>>>>>> >>>>>>>>> Here's a couple of patches that add an option to the LNT nt runner to >>>>>>>>> allow the selection of statistic to report (user time or real time) & >>>>>>>>> includes the necessary plumbing through the test-suite to propagate >>>>>>>>> this information (rather than passing a flag down through the >>>>>>>>> test-suite strata, this elevates both stats (we could add sys time for >>>>>>>>> symmetry at some point - and/or, more broadly, we could also stop >>>>>>>>> doing the aggregation (of multisource per-file stats into single >>>>>>>>> per-test stats) down in the test-suite & let LNT have more fine >>>>>>>>> grained information about the sub-parts of a test case's timing) up >>>>>>>>> into the simple report. >>>>>>>>> >>>>>>>>> [I removed one instance of the 'summary' parsing in timeit.c - it >>>>>>>>> seems there were two instances of it. If there's a reason for the >>>>>>>>> apparent duplication I'd love to hear it - then add it back in with a >>>>>>>>> comment explaining that. I also removed the 'program' timing there - >>>>>>>>> the reports currently can just deliberately pick which statistics they >>>>>>>>> want. It seems like only the nightly and simple reports were using >>>>>>>>> these values, so I've updated those. I was wondering if I could also >>>>>>>>> remove the 'exit' lines so the summaries just look like time(1) >>>>>>>>> output, but I haven't got there yet - the exit lines are used from >>>>>>>>> these files in some places. Perhaps there are other sources they could >>>>>>>>> use instead] >>>>>>>>> >>>>>>>>> Anyone have some thoughts on this approach or future work along these lines? >>>>>>>>> >>>>>>>>> - David >> > > -David > > From kledzik at apple.com Mon Aug 6 16:58:00 2012 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 06 Aug 2012 14:58:00 -0700 Subject: [llvm-commits] [PATCH] Add mapped_file_region for read/write mapped files. In-Reply-To: References: Message-ID: > + mapped_file_region(const Twine &path, > + mapmode mode, > + uint64_t length, > + uint64_t offset, > + error_code &ec); Something about constructors that also return an error_code sits wrong with me. In the error case, the constructor succeeds but you are left with a half constructed object. By having the error_code at the end, you can now no longer use default values for the length and offset parameters. Your test case has to pass 0, 0 for them which is non-obvious what is happening. Since mapping the whole file is common, it would be nice if that case could just be called without the offset and length parameters. To support unix and Windows which have different state requirements, you had to create another struct (mapstate) to encapsulate that. So now there are two structs to manage. I would think it solve the above three issues and be cleaner to define an abstract base class and use a factory method for creation. Then the unix and Windows implementations have their own subclasses with the ivars they each need, and the factory method (in the .inc file) just calls the constructor on the concrete subclass. The interface in FileSystem.h would just be the abstract interface: class mapped_file_region { public; mapped_file_region() LLVM_EQ_DELETE; mapped_file_region(mapped_file_region&) LLVM_EQ_DELETE; mapped_file_region &operator =(mapped_file_region&) LLVM_EQ_DELETE; static mapped_file_region* make(const Twine &path, mapmode mode, uint64_t length=0, uint64_t offset=0); virtual error_code error() const; virtual mapmode flags() const; virtual uint64_t size() const; virtual char *data() const; }; > + int flags = mode == mapped_file_region::readwrite ? MAP_SHARED : MAP_PRIVATE; I also found this hard to parse. How about: int flags = ((mode == mapped_file_region::readwrite) ? MAP_SHARED : MAP_PRIVATE); -Nick On Aug 6, 2012, at 2:00 PM, Michael Spencer wrote: > The attached patch adds mapped_file_region based on > boost::iostreams::mapped_file. This is a replacement for > map_file_pages/unmap_file_pages to work properly on Windows. This can > also be used by MemoryBuffer to finally have memory mapped files on > Windows. > > The reason the previous APIs do not work for Windows is that there are > 3 different handles that need to be kept track of to properly unmap a > region. For munmap there is only 1. > > - Michael Spencer > <0001-PathV2-Add-mapped_file_region.-Implementation-for-Wi.patch> From stoklund at 2pi.dk Mon Aug 6 17:34:51 2012 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Mon, 06 Aug 2012 22:34:51 -0000 Subject: [llvm-commits] [llvm] r161354 - /llvm/trunk/include/llvm/MC/MCSchedule.h Message-ID: <20120806223451.72CE82A6C073@llvm.org> Author: stoklund Date: Mon Aug 6 17:34:51 2012 New Revision: 161354 URL: http://llvm.org/viewvc/llvm-project?rev=161354&view=rev Log: Fix typo. Modified: llvm/trunk/include/llvm/MC/MCSchedule.h Modified: llvm/trunk/include/llvm/MC/MCSchedule.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSchedule.h?rev=161354&r1=161353&r2=161354&view=diff ============================================================================== --- llvm/trunk/include/llvm/MC/MCSchedule.h (original) +++ llvm/trunk/include/llvm/MC/MCSchedule.h Mon Aug 6 17:34:51 2012 @@ -90,7 +90,7 @@ // target code can use it in static initializers. The defaults need to be // initialized in this default ctor because some clients directly instantiate // MCSchedModel instead of using a generated itinerary. - MCSchedModel(): IssueWidth(DefaultMinLatency), + MCSchedModel(): IssueWidth(DefaultIssueWidth), MinLatency(DefaultMinLatency), LoadLatency(DefaultLoadLatency), HighLatency(DefaultHighLatency), From bigcheesegs at gmail.com Mon Aug 6 17:37:50 2012 From: bigcheesegs at gmail.com (Michael Spencer) Date: Mon, 6 Aug 2012 15:37:50 -0700 Subject: [llvm-commits] [PATCH] Add mapped_file_region for read/write mapped files. In-Reply-To: References: Message-ID: On Mon, Aug 6, 2012 at 2:58 PM, Nick Kledzik wrote: >> + mapped_file_region(const Twine &path, >> + mapmode mode, >> + uint64_t length, >> + uint64_t offset, >> + error_code &ec); > > Something about constructors that also return an error_code sits wrong with me. In the error case, the constructor succeeds but you are left with a half constructed object. I don't like it either, but the alternatives don't allow RAII. And all of them (except exceptions) require checking a value to make sure the returned mapped_file_region is valid. > By having the error_code at the end, you can now no longer use default values for the length and offset parameters. Your test case has to pass 0, 0 for them which is non-obvious what is happening. Since mapping the whole file is common, it would be nice if that case could just be called without the offset and length parameters. It's easy to just move ec to be the first parameter. > To support unix and Windows which have different state requirements, you had to create another struct (mapstate) to encapsulate that. So now there are two structs to manage. mapstate is an internal implementation detail. Users don't know anything about mapstate. > > > I would think it solve the above three issues and be cleaner to define an abstract base class and use a factory method for creation. Then the unix and Windows implementations have their own subclasses with the ivars they each need, and the factory method (in the .inc file) just calls the constructor on the concrete subclass. The interface in FileSystem.h would just be the abstract interface: > > class mapped_file_region { > public; > mapped_file_region() LLVM_EQ_DELETE; > mapped_file_region(mapped_file_region&) LLVM_EQ_DELETE; > mapped_file_region &operator =(mapped_file_region&) LLVM_EQ_DELETE; > > static mapped_file_region* make(const Twine &path, mapmode mode, uint64_t length=0, uint64_t offset=0); > > virtual error_code error() const; > virtual mapmode flags() const; > virtual uint64_t size() const; > virtual char *data() const; > }; I have two issues with this. The first is that mapped_file_region uses RAII and move semantics to manage its lifetime, this forces users to use delete or wrap it in an OwningPtr. The second is that there is no reason to have virtual functions when only one implementation can ever be used. This also still has the problem of partially constructed objects. - Michael Spencer > >> + int flags = mode == mapped_file_region::readwrite ? MAP_SHARED : MAP_PRIVATE; > I also found this hard to parse. How about: > > int flags = ((mode == mapped_file_region::readwrite) ? MAP_SHARED : MAP_PRIVATE); ok. > -Nick - Michael Spencer > > > On Aug 6, 2012, at 2:00 PM, Michael Spencer wrote: >> The attached patch adds mapped_file_region based on >> boost::iostreams::mapped_file. This is a replacement for >> map_file_pages/unmap_file_pages to work properly on Windows. This can >> also be used by MemoryBuffer to finally have memory mapped files on >> Windows. >> >> The reason the previous APIs do not work for Windows is that there are >> 3 different handles that need to be kept track of to properly unmap a >> region. For munmap there is only 1. >> >> - Michael Spencer >> <0001-PathV2-Add-mapped_file_region.-Implementation-for-Wi.patch> > From wendling at apple.com Mon Aug 6 17:45:40 2012 From: wendling at apple.com (Bill Wendling) Date: Mon, 06 Aug 2012 15:45:40 -0700 Subject: [llvm-commits] [patch] Add dominance computation for edges In-Reply-To: References: <085840EE-2DCB-4CEE-8720-4DB83ABC3354@apple.com> Message-ID: <734AD6D0-975F-4C4E-97E8-CD3CB8004323@apple.com> On Aug 6, 2012, at 12:15 PM, Rafael Esp?ndola wrote: >> I don't understand this at all. I don't see an 'invoke' in the example. And the '%x' in '%foo' cannot be replaced by '0' because it may not be '0' (i.e., it took the 'bb1' route to 'bb2). > > Exactly and exactly :-) > (I need to remember to drink caffeine before responding to emails.) > Sorry if it wasn't clear. The idea of the refactoring is to allow the > new methods to be used in cases where we *don't* have an invoke, but > we have a case where some information is available about an area > dominated by an edge. > > I want GVN to know that it can replace the 'x' in 'cond', but not the > 'x' in 'foo', which is exactly what this analysis tells it (once GVN > is modified to use it). > Okay. That sounds better. :) It looks good to me if no one else objects. -bw From isanbard at gmail.com Mon Aug 6 17:52:46 2012 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 06 Aug 2012 22:52:46 -0000 Subject: [llvm-commits] [llvm] r161356 - in /llvm/trunk/tools/lto: LTOCodeGenerator.cpp LTOModule.cpp Message-ID: <20120806225246.31CD62A6C073@llvm.org> Author: void Date: Mon Aug 6 17:52:45 2012 New Revision: 161356 URL: http://llvm.org/viewvc/llvm-project?rev=161356&view=rev Log: Reduce indentation by early exiting. Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOModule.cpp Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=161356&r1=161355&r2=161356&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Aug 6 17:52:45 2012 @@ -211,41 +211,41 @@ } bool LTOCodeGenerator::determineTarget(std::string& errMsg) { - if ( _target == NULL ) { - std::string Triple = _linker.getModule()->getTargetTriple(); - if (Triple.empty()) - Triple = sys::getDefaultTargetTriple(); - - // create target machine from info for merged modules - const Target *march = TargetRegistry::lookupTarget(Triple, errMsg); - if ( march == NULL ) - return true; - - // The relocation model is actually a static member of TargetMachine and - // needs to be set before the TargetMachine is instantiated. - Reloc::Model RelocModel = Reloc::Default; - switch( _codeModel ) { - case LTO_CODEGEN_PIC_MODEL_STATIC: - RelocModel = Reloc::Static; - break; - case LTO_CODEGEN_PIC_MODEL_DYNAMIC: - RelocModel = Reloc::PIC_; - break; - case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC: - RelocModel = Reloc::DynamicNoPIC; - break; - } - - // construct LTOModule, hand over ownership of module and target - SubtargetFeatures Features; - Features.getDefaultSubtargetFeatures(llvm::Triple(Triple)); - std::string FeatureStr = Features.getString(); - TargetOptions Options; - LTOModule::getTargetOptions(Options); - _target = march->createTargetMachine(Triple, _mCpu, FeatureStr, Options, - RelocModel, CodeModel::Default, - CodeGenOpt::Aggressive); + if ( _target != NULL ) return false; + + std::string Triple = _linker.getModule()->getTargetTriple(); + if (Triple.empty()) + Triple = sys::getDefaultTargetTriple(); + + // create target machine from info for merged modules + const Target *march = TargetRegistry::lookupTarget(Triple, errMsg); + if ( march == NULL ) + return true; + + // The relocation model is actually a static member of TargetMachine and + // needs to be set before the TargetMachine is instantiated. + Reloc::Model RelocModel = Reloc::Default; + switch( _codeModel ) { + case LTO_CODEGEN_PIC_MODEL_STATIC: + RelocModel = Reloc::Static; + break; + case LTO_CODEGEN_PIC_MODEL_DYNAMIC: + RelocModel = Reloc::PIC_; + break; + case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC: + RelocModel = Reloc::DynamicNoPIC; + break; } + + // construct LTOModule, hand over ownership of module and target + SubtargetFeatures Features; + Features.getDefaultSubtargetFeatures(llvm::Triple(Triple)); + std::string FeatureStr = Features.getString(); + TargetOptions Options; + LTOModule::getTargetOptions(Options); + _target = march->createTargetMachine(Triple, _mCpu, FeatureStr, Options, + RelocModel, CodeModel::Default, + CodeGenOpt::Aggressive); return false; } Modified: llvm/trunk/tools/lto/LTOModule.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=161356&r1=161355&r2=161356&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOModule.cpp (original) +++ llvm/trunk/tools/lto/LTOModule.cpp Mon Aug 6 17:52:45 2012 @@ -409,6 +409,9 @@ // Add to list of defined symbols. addDefinedSymbol(v, false); + if (!v->hasSection() /* || !isTargetDarwin */) + return; + // Special case i386/ppc ObjC data structures in magic sections: // The issue is that the old ObjC object format did some strange // contortions to avoid real linker symbols. For instance, the @@ -428,26 +431,25 @@ // a class was missing. // The following synthesizes the implicit .objc_* symbols for the linker // from the ObjC data structures generated by the front end. - if (v->hasSection() /* && isTargetDarwin */) { - // special case if this data blob is an ObjC class definition - if (v->getSection().compare(0, 15, "__OBJC,__class,") == 0) { - if (GlobalVariable *gv = dyn_cast(v)) { - addObjCClass(gv); - } + + // special case if this data blob is an ObjC class definition + if (v->getSection().compare(0, 15, "__OBJC,__class,") == 0) { + if (GlobalVariable *gv = dyn_cast(v)) { + addObjCClass(gv); } + } - // special case if this data blob is an ObjC category definition - else if (v->getSection().compare(0, 18, "__OBJC,__category,") == 0) { - if (GlobalVariable *gv = dyn_cast(v)) { - addObjCCategory(gv); - } + // special case if this data blob is an ObjC category definition + else if (v->getSection().compare(0, 18, "__OBJC,__category,") == 0) { + if (GlobalVariable *gv = dyn_cast(v)) { + addObjCCategory(gv); } + } - // special case if this data blob is the list of referenced classes - else if (v->getSection().compare(0, 18, "__OBJC,__cls_refs,") == 0) { - if (GlobalVariable *gv = dyn_cast(v)) { - addObjCClassRef(gv); - } + // special case if this data blob is the list of referenced classes + else if (v->getSection().compare(0, 18, "__OBJC,__cls_refs,") == 0) { + if (GlobalVariable *gv = dyn_cast(v)) { + addObjCClassRef(gv); } } } From mren at apple.com Mon Aug 6 18:06:16 2012 From: mren at apple.com (Manman Ren) Date: Mon, 06 Aug 2012 16:06:16 -0700 Subject: [llvm-commits] [llvm] r161152 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/PeepholeOptimizer.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h test/CodeGen/X86/2012-05-19-avx2-store.ll test/CodeGen/X86/break-sse-dep.ll test/CodeGen/X86/fold-load.ll test/CodeGen/X86/fold-pcmpeqd-1.ll test/CodeGen/X86/sse-minmax.ll test/CodeGen/X86/vec_compare.ll In-Reply-To: <501CCF87.8050100@free.fr> References: <20120802005642.B43F43524038@llvm.org> <1343892684.12400.7.camel@snbox> <70E112E3-D2A0-4620-9084-93325D33041B@apple.com> <501CCF87.8050100@free.fr> Message-ID: On Aug 4, 2012, at 12:30 AM, Duncan Sands wrote: > Hi Manman, > > On 02/08/12 19:14, Manman Ren wrote: >> >> On Aug 2, 2012, at 12:31 AM, Michael Liao wrote: >> >>> Some cases are considered conflicting with the previous effort to remove >>> partial register update stall by Bruno Cardoso Lopes. >>> >>> For example, sqrtsd with memory operand is such an instruction updating >>> only parts of the registers in SSE. It should be selected if the code is >>> optimized for size. Otherwise, the sequence of movsd + sqrtsd is >>> preferred than sqrtsd with memory operand. >> >> Are you aware of other cases where it is a bad idea to perform memory folding? >> >> This also seems to be breaking >> http://lab.llvm.org:8011/builders/dragonegg-x86_64-linux-gcc-4.6-test/builds/481 >> BUILD FAILED: failed make.check >> >> I will try to limit the scope of this optimization to scalar instructions and >> see whether it can recover the bot. >> Duncan, is it possible for me to duplicate this failure locally on my machine? I >> am not sure what is the best way to debug this. > > these two tests are from the GCC testsuite. If you have a copy of GCC then take > a look in > gcc/testsuite/gcc.target/i386/sse2-cvtsi2sd-1.c > and > gcc/testsuite/gcc.target/i386/sse2-cvtsi2sd-2.c > To reproduce, try building dragonegg on a x86-64 linux machine against gcc-4.6 > (GCC=gcc-4.6 make), then compile these tests at -O1: > gcc-4.6 -fplugin=path/dragonegg.so -S -O1 path/sse2-cvtsi2sd-1.c > gcc-4.6 -fplugin=path/dragonegg.so -S -O1 path/sse2-cvtsi2sd-2.c > If this is too hard, I can try to get you bitcode when I get back from holidays. Thanks for replying to me during the holidays. I will try to build dragonegg if it is not too complicated. Manman > > Ciao, Duncan. > >> >> Thanks, >> Manman >> >>> >>> Yours >>> - Michael >>> >>> On Thu, 2012-08-02 at 00:56 +0000, Manman Ren wrote: >>>> Author: mren >>>> Date: Wed Aug 1 19:56:42 2012 >>>> New Revision: 161152 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=161152&view=rev >>>> Log: >>>> X86 Peephole: fold loads to the source register operand if possible. >>>> >>>> Machine CSE and other optimizations can remove instructions so folding >>>> is possible at peephole while not possible at ISel. >>>> >>>> This patch is a rework of r160919 and was tested on clang self-host on my local >>>> machine. >>>> >>>> rdar://10554090 and rdar://11873276 >>>> >>>> Modified: >>>> llvm/trunk/include/llvm/Target/TargetInstrInfo.h >>>> llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp >>>> llvm/trunk/lib/Target/X86/X86InstrInfo.cpp >>>> llvm/trunk/lib/Target/X86/X86InstrInfo.h >>>> llvm/trunk/test/CodeGen/X86/2012-05-19-avx2-store.ll >>>> llvm/trunk/test/CodeGen/X86/break-sse-dep.ll >>>> llvm/trunk/test/CodeGen/X86/fold-load.ll >>>> llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-1.ll >>>> llvm/trunk/test/CodeGen/X86/sse-minmax.ll >>>> llvm/trunk/test/CodeGen/X86/vec_compare.ll >>>> >>>> Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) >>>> +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Aug 1 19:56:42 2012 >>>> @@ -14,6 +14,7 @@ >>>> #ifndef LLVM_TARGET_TARGETINSTRINFO_H >>>> #define LLVM_TARGET_TARGETINSTRINFO_H >>>> >>>> +#include "llvm/ADT/SmallSet.h" >>>> #include "llvm/MC/MCInstrInfo.h" >>>> #include "llvm/CodeGen/DFAPacketizer.h" >>>> #include "llvm/CodeGen/MachineFunction.h" >>>> @@ -693,6 +694,16 @@ >>>> return false; >>>> } >>>> >>>> + /// optimizeLoadInstr - Try to remove the load by folding it to a register >>>> + /// operand at the use. We fold the load instructions if and only if the >>>> + /// def and use are in the same BB. >>>> + virtual MachineInstr* optimizeLoadInstr(MachineInstr *MI, >>>> + const MachineRegisterInfo *MRI, >>>> + unsigned &FoldAsLoadDefReg, >>>> + MachineInstr *&DefMI) const { >>>> + return 0; >>>> + } >>>> + >>>> /// FoldImmediate - 'Reg' is known to be defined by a move immediate >>>> /// instruction, try to fold the immediate into the use instruction. >>>> virtual bool FoldImmediate(MachineInstr *UseMI, MachineInstr *DefMI, >>>> >>>> Modified: llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp (original) >>>> +++ llvm/trunk/lib/CodeGen/PeepholeOptimizer.cpp Wed Aug 1 19:56:42 2012 >>>> @@ -78,6 +78,7 @@ >>>> STATISTIC(NumBitcasts, "Number of bitcasts eliminated"); >>>> STATISTIC(NumCmps, "Number of compares eliminated"); >>>> STATISTIC(NumImmFold, "Number of move immediate folded"); >>>> +STATISTIC(NumLoadFold, "Number of loads folded"); >>>> >>>> namespace { >>>> class PeepholeOptimizer : public MachineFunctionPass { >>>> @@ -114,6 +115,7 @@ >>>> bool foldImmediate(MachineInstr *MI, MachineBasicBlock *MBB, >>>> SmallSet &ImmDefRegs, >>>> DenseMap &ImmDefMIs); >>>> + bool isLoadFoldable(MachineInstr *MI, unsigned &FoldAsLoadDefReg); >>>> }; >>>> } >>>> >>>> @@ -384,6 +386,29 @@ >>>> return false; >>>> } >>>> >>>> +/// isLoadFoldable - Check whether MI is a candidate for folding into a later >>>> +/// instruction. We only fold loads to virtual registers and the virtual >>>> +/// register defined has a single use. >>>> +bool PeepholeOptimizer::isLoadFoldable(MachineInstr *MI, >>>> + unsigned &FoldAsLoadDefReg) { >>>> + if (MI->canFoldAsLoad()) { >>>> + const MCInstrDesc &MCID = MI->getDesc(); >>>> + if (MCID.getNumDefs() == 1) { >>>> + unsigned Reg = MI->getOperand(0).getReg(); >>>> + // To reduce compilation time, we check MRI->hasOneUse when inserting >>>> + // loads. It should be checked when processing uses of the load, since >>>> + // uses can be removed during peephole. >>>> + if (!MI->getOperand(0).getSubReg() && >>>> + TargetRegisterInfo::isVirtualRegister(Reg) && >>>> + MRI->hasOneUse(Reg)) { >>>> + FoldAsLoadDefReg = Reg; >>>> + return true; >>>> + } >>>> + } >>>> + } >>>> + return false; >>>> +} >>>> + >>>> bool PeepholeOptimizer::isMoveImmediate(MachineInstr *MI, >>>> SmallSet &ImmDefRegs, >>>> DenseMap &ImmDefMIs) { >>>> @@ -441,6 +466,7 @@ >>>> SmallPtrSet LocalMIs; >>>> SmallSet ImmDefRegs; >>>> DenseMap ImmDefMIs; >>>> + unsigned FoldAsLoadDefReg; >>>> for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { >>>> MachineBasicBlock *MBB = &*I; >>>> >>>> @@ -448,6 +474,7 @@ >>>> LocalMIs.clear(); >>>> ImmDefRegs.clear(); >>>> ImmDefMIs.clear(); >>>> + FoldAsLoadDefReg = 0; >>>> >>>> bool First = true; >>>> MachineBasicBlock::iterator PMII; >>>> @@ -456,12 +483,17 @@ >>>> MachineInstr *MI = &*MII; >>>> LocalMIs.insert(MI); >>>> >>>> + // If there exists an instruction which belongs to the following >>>> + // categories, we will discard the load candidate. >>>> if (MI->isLabel() || MI->isPHI() || MI->isImplicitDef() || >>>> MI->isKill() || MI->isInlineAsm() || MI->isDebugValue() || >>>> MI->hasUnmodeledSideEffects()) { >>>> + FoldAsLoadDefReg = 0; >>>> ++MII; >>>> continue; >>>> } >>>> + if (MI->mayStore() || MI->isCall()) >>>> + FoldAsLoadDefReg = 0; >>>> >>>> if (MI->isBitcast()) { >>>> if (optimizeBitcastInstr(MI, MBB)) { >>>> @@ -489,6 +521,31 @@ >>>> Changed |= foldImmediate(MI, MBB, ImmDefRegs, ImmDefMIs); >>>> } >>>> >>>> + // Check whether MI is a load candidate for folding into a later >>>> + // instruction. If MI is not a candidate, check whether we can fold an >>>> + // earlier load into MI. >>>> + if (!isLoadFoldable(MI, FoldAsLoadDefReg) && FoldAsLoadDefReg) { >>>> + // We need to fold load after optimizeCmpInstr, since optimizeCmpInstr >>>> + // can enable folding by converting SUB to CMP. >>>> + MachineInstr *DefMI = 0; >>>> + MachineInstr *FoldMI = TII->optimizeLoadInstr(MI, MRI, >>>> + FoldAsLoadDefReg, DefMI); >>>> + if (FoldMI) { >>>> + // Update LocalMIs since we replaced MI with FoldMI and deleted DefMI. >>>> + LocalMIs.erase(MI); >>>> + LocalMIs.erase(DefMI); >>>> + LocalMIs.insert(FoldMI); >>>> + MI->eraseFromParent(); >>>> + DefMI->eraseFromParent(); >>>> + ++NumLoadFold; >>>> + >>>> + // MI is replaced with FoldMI. >>>> + Changed = true; >>>> + PMII = FoldMI; >>>> + MII = llvm::next(PMII); >>>> + continue; >>>> + } >>>> + } >>>> First = false; >>>> PMII = MII; >>>> ++MII; >>>> >>>> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) >>>> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Aug 1 19:56:42 2012 >>>> @@ -3323,6 +3323,81 @@ >>>> return true; >>>> } >>>> >>>> +/// optimizeLoadInstr - Try to remove the load by folding it to a register >>>> +/// operand at the use. We fold the load instructions if load defines a virtual >>>> +/// register, the virtual register is used once in the same BB, and the >>>> +/// instructions in-between do not load or store, and have no side effects. >>>> +MachineInstr* X86InstrInfo:: >>>> +optimizeLoadInstr(MachineInstr *MI, const MachineRegisterInfo *MRI, >>>> + unsigned &FoldAsLoadDefReg, >>>> + MachineInstr *&DefMI) const { >>>> + if (FoldAsLoadDefReg == 0) >>>> + return 0; >>>> + // To be conservative, if there exists another load, clear the load candidate. >>>> + if (MI->mayLoad()) { >>>> + FoldAsLoadDefReg = 0; >>>> + return 0; >>>> + } >>>> + >>>> + // Check whether we can move DefMI here. >>>> + DefMI = MRI->getVRegDef(FoldAsLoadDefReg); >>>> + assert(DefMI); >>>> + bool SawStore = false; >>>> + if (!DefMI->isSafeToMove(this, 0, SawStore)) >>>> + return 0; >>>> + >>>> + // We try to commute MI if possible. >>>> + unsigned IdxEnd = (MI->isCommutable()) ? 2 : 1; >>>> + for (unsigned Idx = 0; Idx < IdxEnd; Idx++) { >>>> + // Collect information about virtual register operands of MI. >>>> + unsigned SrcOperandId = 0; >>>> + bool FoundSrcOperand = false; >>>> + for (unsigned i = 0, e = MI->getDesc().getNumOperands(); i != e; ++i) { >>>> + MachineOperand &MO = MI->getOperand(i); >>>> + if (!MO.isReg()) >>>> + continue; >>>> + unsigned Reg = MO.getReg(); >>>> + if (Reg != FoldAsLoadDefReg) >>>> + continue; >>>> + // Do not fold if we have a subreg use or a def or multiple uses. >>>> + if (MO.getSubReg() || MO.isDef() || FoundSrcOperand) >>>> + return 0; >>>> + >>>> + SrcOperandId = i; >>>> + FoundSrcOperand = true; >>>> + } >>>> + if (!FoundSrcOperand) return 0; >>>> + >>>> + // Check whether we can fold the def into SrcOperandId. >>>> + SmallVector Ops; >>>> + Ops.push_back(SrcOperandId); >>>> + MachineInstr *FoldMI = foldMemoryOperand(MI, Ops, DefMI); >>>> + if (FoldMI) { >>>> + FoldAsLoadDefReg = 0; >>>> + return FoldMI; >>>> + } >>>> + >>>> + if (Idx == 1) { >>>> + // MI was changed but it didn't help, commute it back! >>>> + commuteInstruction(MI, false); >>>> + return 0; >>>> + } >>>> + >>>> + // Check whether we can commute MI and enable folding. >>>> + if (MI->isCommutable()) { >>>> + MachineInstr *NewMI = commuteInstruction(MI, false); >>>> + // Unable to commute. >>>> + if (!NewMI) return 0; >>>> + if (NewMI != MI) { >>>> + // New instruction. It doesn't need to be kept. >>>> + NewMI->eraseFromParent(); >>>> + return 0; >>>> + } >>>> + } >>>> + } >>>> + return 0; >>>> +} >>>> + >>>> /// Expand2AddrUndef - Expand a single-def pseudo instruction to a two-addr >>>> /// instruction with two undef reads of the register being defined. This is >>>> /// used for mapping: >>>> >>>> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) >>>> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Wed Aug 1 19:56:42 2012 >>>> @@ -387,6 +387,14 @@ >>>> unsigned SrcReg2, int CmpMask, int CmpValue, >>>> const MachineRegisterInfo *MRI) const; >>>> >>>> + /// optimizeLoadInstr - Try to remove the load by folding it to a register >>>> + /// operand at the use. We fold the load instructions if and only if the >>>> + /// def and use are in the same BB. >>>> + virtual MachineInstr* optimizeLoadInstr(MachineInstr *MI, >>>> + const MachineRegisterInfo *MRI, >>>> + unsigned &FoldAsLoadDefReg, >>>> + MachineInstr *&DefMI) const; >>>> + >>>> private: >>>> MachineInstr * convertToThreeAddressWithLEA(unsigned MIOpc, >>>> MachineFunction::iterator &MFI, >>>> >>>> Modified: llvm/trunk/test/CodeGen/X86/2012-05-19-avx2-store.ll >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2012-05-19-avx2-store.ll?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/test/CodeGen/X86/2012-05-19-avx2-store.ll (original) >>>> +++ llvm/trunk/test/CodeGen/X86/2012-05-19-avx2-store.ll Wed Aug 1 19:56:42 2012 >>>> @@ -3,8 +3,7 @@ >>>> define void @double_save(<4 x i32>* %Ap, <4 x i32>* %Bp, <8 x i32>* %P) >>>> nounwind ssp { >>>> entry: >>>> ; CHECK: vmovaps >>>> - ; CHECK: vmovaps >>>> - ; CHECK: vinsertf128 >>>> + ; CHECK: vinsertf128 $1, ([[A0:%rdi|%rsi]]), >>>> ; CHECK: vmovups >>>> %A = load <4 x i32>* %Ap >>>> %B = load <4 x i32>* %Bp >>>> >>>> Modified: llvm/trunk/test/CodeGen/X86/break-sse-dep.ll >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/break-sse-dep.ll?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/test/CodeGen/X86/break-sse-dep.ll (original) >>>> +++ llvm/trunk/test/CodeGen/X86/break-sse-dep.ll Wed Aug 1 19:56:42 2012 >>>> @@ -34,8 +34,7 @@ >>>> define double @squirt(double* %x) nounwind { >>>> entry: >>>> ; CHECK: squirt: >>>> -; CHECK: movsd ([[A0]]), %xmm0 >>>> -; CHECK: sqrtsd %xmm0, %xmm0 >>>> +; CHECK: sqrtsd ([[A0]]), %xmm0 >>>> %z = load double* %x >>>> %t = call double @llvm.sqrt.f64(double %z) >>>> ret double %t >>>> >>>> Modified: llvm/trunk/test/CodeGen/X86/fold-load.ll >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fold-load.ll?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/test/CodeGen/X86/fold-load.ll (original) >>>> +++ llvm/trunk/test/CodeGen/X86/fold-load.ll Wed Aug 1 19:56:42 2012 >>>> @@ -45,3 +45,29 @@ >>>> >>>> } >>>> >>>> +; rdar://10554090 >>>> +; xor in exit block will be CSE'ed and load will be folded to xor in entry. >>>> +define i1 @test3(i32* %P, i32* %Q) nounwind { >>>> +; CHECK: test3: >>>> +; CHECK: movl 8(%esp), %eax >>>> +; CHECK: xorl (%eax), >>>> +; CHECK: j >>>> +; CHECK-NOT: xor >>>> +entry: >>>> + %0 = load i32* %P, align 4 >>>> + %1 = load i32* %Q, align 4 >>>> + %2 = xor i32 %0, %1 >>>> + %3 = and i32 %2, 65535 >>>> + %4 = icmp eq i32 %3, 0 >>>> + br i1 %4, label %exit, label %land.end >>>> + >>>> +exit: >>>> + %shr.i.i19 = xor i32 %1, %0 >>>> + %5 = and i32 %shr.i.i19, 2147418112 >>>> + %6 = icmp eq i32 %5, 0 >>>> + br label %land.end >>>> + >>>> +land.end: >>>> + %7 = phi i1 [ %6, %exit ], [ false, %entry ] >>>> + ret i1 %7 >>>> +} >>>> >>>> Modified: llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-1.ll >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-1.ll?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-1.ll (original) >>>> +++ llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-1.ll Wed Aug 1 19:56:42 2012 >>>> @@ -1,11 +1,14 @@ >>>> -; RUN: llc < %s -march=x86 -mattr=+sse2 > %t >>>> -; RUN: grep pcmpeqd %t | count 1 >>>> -; RUN: grep xor %t | count 1 >>>> -; RUN: not grep LCP %t >>>> +; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s >>>> >>>> define <2 x double> @foo() nounwind { >>>> ret <2 x double> bitcast (<2 x i64> to <2 x double>) >>>> +; CHECK: foo: >>>> +; CHECK: pcmpeqd %xmm{{[0-9]+}}, %xmm{{[0-9]+}} >>>> +; CHECK-NEXT: ret >>>> } >>>> define <2 x double> @bar() nounwind { >>>> ret <2 x double> bitcast (<2 x i64> to <2 x double>) >>>> +; CHECK: bar: >>>> +; CHECK: xorps %xmm{{[0-9]+}}, %xmm{{[0-9]+}} >>>> +; CHECK-NEXT: ret >>>> } >>>> >>>> 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=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/test/CodeGen/X86/sse-minmax.ll (original) >>>> +++ llvm/trunk/test/CodeGen/X86/sse-minmax.ll Wed Aug 1 19:56:42 2012 >>>> @@ -1,6 +1,6 @@ >>>> -; RUN: llc < %s -march=x86-64 -mcpu=nehalem -asm-verbose=false | FileCheck %s >>>> -; RUN: llc < %s -march=x86-64 -mcpu=nehalem -asm-verbose=false >>>> -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck >>>> -check-prefix=UNSAFE %s >>>> -; RUN: llc < %s -march=x86-64 -mcpu=nehalem -asm-verbose=false >>>> -enable-no-nans-fp-math | FileCheck -check-prefix=FINITE %s >>>> +; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem >>>> -asm-verbose=false | FileCheck %s >>>> +; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem >>>> -asm-verbose=false -enable-unsafe-fp-math -enable-no-nans-fp-math | >>>> FileCheck -check-prefix=UNSAFE %s >>>> +; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin -mcpu=nehalem >>>> -asm-verbose=false -enable-no-nans-fp-math | FileCheck -check-prefix=FINITE %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. >>>> @@ -137,16 +137,13 @@ >>>> } >>>> >>>> ; CHECK: ogt_x: >>>> -; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; CHECK-NEXT: maxsd %xmm1, %xmm0 >>>> +; CHECK-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; CHECK-NEXT: ret >>>> ; UNSAFE: ogt_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: maxsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: ogt_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: maxsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @ogt_x(double %x) nounwind { >>>> %c = fcmp ogt double %x, 0.000000e+00 >>>> @@ -155,16 +152,13 @@ >>>> } >>>> >>>> ; CHECK: olt_x: >>>> -; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; CHECK-NEXT: minsd %xmm1, %xmm0 >>>> +; CHECK-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; CHECK-NEXT: ret >>>> ; UNSAFE: olt_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: minsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: olt_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: minsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @olt_x(double %x) nounwind { >>>> %c = fcmp olt double %x, 0.000000e+00 >>>> @@ -217,12 +211,10 @@ >>>> ; CHECK: oge_x: >>>> ; CHECK: ucomisd %xmm1, %xmm0 >>>> ; UNSAFE: oge_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: maxsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: oge_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: maxsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @oge_x(double %x) nounwind { >>>> %c = fcmp oge double %x, 0.000000e+00 >>>> @@ -233,12 +225,10 @@ >>>> ; CHECK: ole_x: >>>> ; CHECK: ucomisd %xmm0, %xmm1 >>>> ; UNSAFE: ole_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: minsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: ole_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: minsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @ole_x(double %x) nounwind { >>>> %c = fcmp ole double %x, 0.000000e+00 >>>> @@ -411,12 +401,10 @@ >>>> ; CHECK: ugt_x: >>>> ; CHECK: ucomisd %xmm0, %xmm1 >>>> ; UNSAFE: ugt_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: maxsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: ugt_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: maxsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @ugt_x(double %x) nounwind { >>>> %c = fcmp ugt double %x, 0.000000e+00 >>>> @@ -427,12 +415,10 @@ >>>> ; CHECK: ult_x: >>>> ; CHECK: ucomisd %xmm1, %xmm0 >>>> ; UNSAFE: ult_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: minsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: ult_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: minsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @ult_x(double %x) nounwind { >>>> %c = fcmp ult double %x, 0.000000e+00 >>>> @@ -482,12 +468,10 @@ >>>> ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 >>>> ; CHECK-NEXT: ret >>>> ; UNSAFE: uge_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: maxsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: uge_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: maxsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @uge_x(double %x) nounwind { >>>> %c = fcmp uge double %x, 0.000000e+00 >>>> @@ -501,12 +485,10 @@ >>>> ; CHECK-NEXT: movap{{[sd]}} %xmm1, %xmm0 >>>> ; CHECK-NEXT: ret >>>> ; UNSAFE: ule_x: >>>> -; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; UNSAFE-NEXT: minsd %xmm1, %xmm0 >>>> +; UNSAFE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; UNSAFE-NEXT: ret >>>> ; FINITE: ule_x: >>>> -; FINITE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; FINITE-NEXT: minsd %xmm1, %xmm0 >>>> +; FINITE-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; FINITE-NEXT: ret >>>> define double @ule_x(double %x) nounwind { >>>> %c = fcmp ule double %x, 0.000000e+00 >>>> @@ -515,8 +497,7 @@ >>>> } >>>> >>>> ; CHECK: uge_inverse_x: >>>> -; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; CHECK-NEXT: minsd %xmm1, %xmm0 >>>> +; CHECK-NEXT: minsd LCP{{.*}}(%rip), %xmm0 >>>> ; CHECK-NEXT: ret >>>> ; UNSAFE: uge_inverse_x: >>>> ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> @@ -535,8 +516,7 @@ >>>> } >>>> >>>> ; CHECK: ule_inverse_x: >>>> -; CHECK-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> -; CHECK-NEXT: maxsd %xmm1, %xmm0 >>>> +; CHECK-NEXT: maxsd LCP{{.*}}(%rip), %xmm0 >>>> ; CHECK-NEXT: ret >>>> ; UNSAFE: ule_inverse_x: >>>> ; UNSAFE-NEXT: xorp{{[sd]}} %xmm1, %xmm1 >>>> >>>> Modified: llvm/trunk/test/CodeGen/X86/vec_compare.ll >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_compare.ll?rev=161152&r1=161151&r2=161152&view=diff >>>> ============================================================================== >>>> --- llvm/trunk/test/CodeGen/X86/vec_compare.ll (original) >>>> +++ llvm/trunk/test/CodeGen/X86/vec_compare.ll Wed Aug 1 19:56:42 2012 >>>> @@ -1,4 +1,4 @@ >>>> -; RUN: llc < %s -march=x86 -mcpu=yonah | FileCheck %s >>>> +; RUN: llc < %s -march=x86 -mcpu=yonah -mtriple=i386-apple-darwin | FileCheck %s >>>> >>>> >>>> define <4 x i32> @test1(<4 x i32> %A, <4 x i32> %B) nounwind { >>>> @@ -14,8 +14,8 @@ >>>> define <4 x i32> @test2(<4 x i32> %A, <4 x i32> %B) nounwind { >>>> ; CHECK: test2: >>>> ; CHECK: pcmp >>>> -; CHECK: pcmp >>>> -; CHECK: pxor >>>> +; CHECK: pxor LCP >>>> +; CHECK: movdqa >>>> ; CHECK: ret >>>> %C = icmp sge <4 x i32> %A, %B >>>> %D = sext <4 x i1> %C to <4 x i32> >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> >> > From jcarter at mips.com Mon Aug 6 18:29:06 2012 From: jcarter at mips.com (Jack Carter) Date: Mon, 06 Aug 2012 23:29:06 -0000 Subject: [llvm-commits] [llvm] r161359 - in /llvm/trunk: lib/Target/Mips/Mips64InstrInfo.td lib/Target/Mips/MipsInstrInfo.td test/MC/Mips/lea_64.ll Message-ID: <20120806232906.E3C6C2A6C073@llvm.org> Author: jacksprat Date: Mon Aug 6 18:29:06 2012 New Revision: 161359 URL: http://llvm.org/viewvc/llvm-project?rev=161359&view=rev Log: The Mips64InstrInfo.td definitions DynAlloc64 LEA_ADDiu64 were using a class defined for 32 bit instructions and thus the instruction was for addiu instead of daddiu. This was corrected by adding the instruction opcode as a field in the base class to be filled in by the defs. Added: llvm/trunk/test/MC/Mips/lea_64.ll Modified: llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Modified: llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td?rev=161359&r1=161358&r2=161359&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td Mon Aug 6 18:29:06 2012 @@ -208,13 +208,11 @@ def DSBH : SubwordSwap<0x24, 0x2, "dsbh", CPU64Regs>; def DSHD : SubwordSwap<0x24, 0x5, "dshd", CPU64Regs>; -def LEA_ADDiu64 : EffectiveAddress<"daddiu\t$rt, $addr", CPU64Regs, mem_ea_64>; +def LEA_ADDiu64 : EffectiveAddress<0x19,"daddiu\t$rt, $addr", CPU64Regs, mem_ea_64>; } let Uses = [SP_64], DecoderNamespace = "Mips64" in -def DynAlloc64 : EffectiveAddress<"daddiu\t$rt, $addr", CPU64Regs, mem_ea_64>, - Requires<[IsN64, HasStandardEncoding]> { - let isCodeGenOnly = 1; -} +def DynAlloc64 : EffectiveAddress<0x19,"daddiu\t$rt, $addr", CPU64Regs, mem_ea_64>, + Requires<[IsN64, HasStandardEncoding]>; let DecoderNamespace = "Mips64" in { def RDHWR64 : ReadHardware; Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=161359&r1=161358&r2=161359&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Mon Aug 6 18:29:06 2012 @@ -722,9 +722,11 @@ let neverHasSideEffects = 1; } -class EffectiveAddress : - FMem<0x09, (outs RC:$rt), (ins Mem:$addr), - instr_asm, [(set RC:$rt, addr:$addr)], IIAlu>; +class EffectiveAddress opc, string instr_asm, RegisterClass RC, Operand Mem> : + FMem { + let isCodeGenOnly = 1; +} // Count Leading Ones/Zeros in Word class CountLeading0 func, string instr_asm, RegisterClass RC>: @@ -1045,17 +1047,13 @@ // instructions. The same not happens for stack address copies, so an // add op with mem ComplexPattern is used and the stack address copy // can be matched. It's similar to Sparc LEA_ADDRi -def LEA_ADDiu : EffectiveAddress<"addiu\t$rt, $addr", CPURegs, mem_ea> { - let isCodeGenOnly = 1; -} +def LEA_ADDiu : EffectiveAddress<0x09,"addiu\t$rt, $addr", CPURegs, mem_ea>; // DynAlloc node points to dynamically allocated stack space. // $sp is added to the list of implicitly used registers to prevent dead code // elimination from removing instructions that modify $sp. let Uses = [SP] in -def DynAlloc : EffectiveAddress<"addiu\t$rt, $addr", CPURegs, mem_ea> { - let isCodeGenOnly = 1; -} +def DynAlloc : EffectiveAddress<0x09,"addiu\t$rt, $addr", CPURegs, mem_ea>; // MADD*/MSUB* def MADD : MArithR<0, "madd", MipsMAdd, 1>; Added: llvm/trunk/test/MC/Mips/lea_64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/lea_64.ll?rev=161359&view=auto ============================================================================== --- llvm/trunk/test/MC/Mips/lea_64.ll (added) +++ llvm/trunk/test/MC/Mips/lea_64.ll Mon Aug 6 18:29:06 2012 @@ -0,0 +1,18 @@ +; RUN: llc -march=mips64el -filetype=obj -mcpu=mips64r2 %s -o - \ +; RUN: | llvm-objdump -disassemble -triple mips64el - \ +; RUN: | FileCheck %s + + at p = external global i32* + +define void @f1() nounwind { +entry: +; CHECK: .text: +; CHECK-NOT: addiu {{[0-9,a-f]+}}, {{[0-9,a-f]+}}, {{[0-9]+}} + + %a = alloca [10 x i32], align 4 + %arraydecay = getelementptr inbounds [10 x i32]* %a, i64 0, i64 0 + store i32* %arraydecay, i32** @p, align 8 + ret void + +; CHECK: jr $ra +} From jcarter at mips.com Mon Aug 6 19:01:14 2012 From: jcarter at mips.com (Jack Carter) Date: Tue, 07 Aug 2012 00:01:14 -0000 Subject: [llvm-commits] [llvm] r161366 - in /llvm/trunk/lib/Target/Mips/MCTargetDesc: MipsAsmBackend.cpp MipsELFObjectWriter.cpp Message-ID: <20120807000114.EFCD62A6C073@llvm.org> Author: jacksprat Date: Mon Aug 6 19:01:14 2012 New Revision: 161366 URL: http://llvm.org/viewvc/llvm-project?rev=161366&view=rev Log: Mips relocation R_MIPS_64 relocates a 64 bit double word. I hit this in a very large program (spirit.cpp), but have not figured out how to make a small make check test for it. Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp?rev=161366&r1=161365&r2=161366&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp (original) +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp Mon Aug 6 19:01:14 2012 @@ -35,6 +35,7 @@ return 0; case FK_GPRel_4: case FK_Data_4: + case FK_Data_8: case Mips::fixup_Mips_LO16: case Mips::fixup_Mips_GPOFF_HI: case Mips::fixup_Mips_GPOFF_LO: Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=161366&r1=161365&r2=161366&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Mon Aug 6 19:01:14 2012 @@ -103,6 +103,9 @@ case FK_Data_4: Type = ELF::R_MIPS_32; break; + case FK_Data_8: + Type = ELF::R_MIPS_64; + break; case FK_GPRel_4: Type = ELF::R_MIPS_GPREL32; break; From grosbach at apple.com Mon Aug 6 19:07:22 2012 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 06 Aug 2012 17:07:22 -0700 Subject: [llvm-commits] [PATCH] Incorrect VFP version supporting ARM Cortex-M4 In-Reply-To: <71F8AFE3-9B1F-4E2D-8E55-840C3CEEE2C8@apple.com> References: <000b01cd60cf$e9b93be0$bd2bb3a0$@arm.com> <059E0A83-5CD3-4F18-9A7F-3480F03B4E3C@apple.com> <45520D6299C11E4588128526465332BB2506990026@SAROVARA.Asiapac.Arm.com> <000201cd6b13$9c80cd90$d58268b0$@arm.com> <000301cd6b9d$44b9b0b0$ce2d1210$@arm.com> <71F8AFE3-9B1F-4E2D-8E55-840C3CEEE2C8@apple.com> Message-ID: <2898A3E3-4174-4CE7-8CF8-39ECB0F66435@apple.com> OK. I looked up the other instructions myself and they're indeed in M4. LGTM. -Jim On Jul 27, 2012, at 12:36 PM, Jim Grosbach wrote: > I'm on vacation at the moment. Will take a closer look when I get back. > > > > On Jul 27, 2012, at 8:29 AM, Renato Golin wrote: > >> On 27 July 2012 16:15, Jiangning Liu wrote: >>> So FeatureVFPOnlySP should already be there. Did I misunderstand your point? >> >> Nope, you're right, I missed that. ;) >> >> If it's fine with Jim, I think it's good to go. >> >> -- >> cheers, >> --renato >> >> http://systemcall.org/ > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From atrick at apple.com Mon Aug 6 19:25:31 2012 From: atrick at apple.com (Andrew Trick) Date: Tue, 07 Aug 2012 00:25:31 -0000 Subject: [llvm-commits] [llvm] r161370 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp Message-ID: <20120807002531.169F42A6C073@llvm.org> Author: atrick Date: Mon Aug 6 19:25:30 2012 New Revision: 161370 URL: http://llvm.org/viewvc/llvm-project?rev=161370&view=rev Log: Allow x86 subtargets to use the GenericModel defined in X86Schedule.td. This allows codegen passes to query properties like InstrItins->SchedModel->IssueWidth. It also ensure's that computeOperandLatency returns the X86 defaults for loads and "high latency ops". This should have no significant impact on existing schedulers because X86 defaults happen to be the same as global defaults. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=161370&r1=161369&r2=161370&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Aug 6 19:25:30 2012 @@ -397,10 +397,10 @@ } } - if (X86ProcFamily == IntelAtom) { + if (X86ProcFamily == IntelAtom) PostRAScheduler = true; - InstrItins = getInstrItineraryForCPU(CPUName); - } + + InstrItins = getInstrItineraryForCPU(CPUName); // It's important to keep the MCSubtargetInfo feature bits in sync with // target data structure which is shared with MC code emitter, etc. From kledzik at apple.com Mon Aug 6 19:26:34 2012 From: kledzik at apple.com (Nick Kledzik) Date: Mon, 06 Aug 2012 17:26:34 -0700 Subject: [llvm-commits] [PATCH] Add mapped_file_region for read/write mapped files. In-Reply-To: References: Message-ID: <7632ED28-671D-47DC-831A-956F4D6FA375@apple.com> On Aug 6, 2012, at 3:37 PM, Michael Spencer wrote: > On Mon, Aug 6, 2012 at 2:58 PM, Nick Kledzik wrote: >>> + mapped_file_region(const Twine &path, >>> + mapmode mode, >>> + uint64_t length, >>> + uint64_t offset, >>> + error_code &ec); >> >> Something about constructors that also return an error_code sits wrong with me. In the error case, the constructor succeeds but you are left with a half constructed object. > > I don't like it either, but the alternatives don't allow RAII. And all > of them (except exceptions) require checking a value to make sure the > returned mapped_file_region is valid. I know, we've had other discussions about this issue. I keep hoping someone will have a clever solution. > >> By having the error_code at the end, you can now no longer use default values for the length and offset parameters. Your test case has to pass 0, 0 for them which is non-obvious what is happening. Since mapping the whole file is common, it would be nice if that case could just be called without the offset and length parameters. > > It's easy to just move ec to be the first parameter. It is nice have return/out parameters at the end... > >> To support unix and Windows which have different state requirements, you had to create another struct (mapstate) to encapsulate that. So now there are two structs to manage. > > mapstate is an internal implementation detail. Users don't know > anything about mapstate. My point was not about clients. It was that the implementation was complicated by the extra class. >> I would think it solve the above three issues and be cleaner to define an abstract base class and use a factory method for creation. Then the unix and Windows implementations have their own subclasses with the ivars they each need, and the factory method (in the .inc file) just calls the constructor on the concrete subclass. The interface in FileSystem.h would just be the abstract interface: >> >> class mapped_file_region { >> public; >> mapped_file_region() LLVM_EQ_DELETE; >> mapped_file_region(mapped_file_region&) LLVM_EQ_DELETE; >> mapped_file_region &operator =(mapped_file_region&) LLVM_EQ_DELETE; >> >> static mapped_file_region* make(const Twine &path, mapmode mode, uint64_t length=0, uint64_t offset=0); >> >> virtual error_code error() const; >> virtual mapmode flags() const; >> virtual uint64_t size() const; >> virtual char *data() const; >> }; > > I have two issues with this. The first is that mapped_file_region uses > RAII and move semantics to manage its lifetime, this forces users to > use delete or wrap it in an OwningPtr. Yes, the factory method idea precludes a client have a local variable that will automatically be destroyed at the end of the function or object. > The second is that there is no > reason to have virtual functions when only one implementation can ever > be used. I think the more general rule is don't use indirection what unnecessary. But your implementation used indirection by having just one ivar that points to the real ivars. So, both have an indirection. The virtual methods are just more obvious as indirection. The point of the indirection is to hide that the unix and Windows implementation are radically different and require different amounts of state. Maybe we should just push the indirection in the pre-processor. That is, in FileSystem.h have: class mapped_file_region { ? void *View; mapmode Mode; uint64_t Size; #if LLVM_ON_WIN32 int FD; HANDLE File; HANDLE FileMapping; #endif ? So the extra ivars show up when building for Windows but not for unix. Then there is no need for indirection! > > This also still has the problem of partially constructed objects. Yes, that is why I had a separate error() method to check for failure. A variation on this is to have the constructor just assign ivars and not actually try to do the mapping, and thus cannot fail. Instead we add a method: error_code map(); which does the mapping and can fail. I think the import part is that all the methods that operate on the object fire an assertion if called on a "partially constructed" object. -Nick > >> >>> + int flags = mode == mapped_file_region::readwrite ? MAP_SHARED : MAP_PRIVATE; >> I also found this hard to parse. How about: >> >> int flags = ((mode == mapped_file_region::readwrite) ? MAP_SHARED : MAP_PRIVATE); > > ok. > >> -Nick > > - Michael Spencer > >> >> >> On Aug 6, 2012, at 2:00 PM, Michael Spencer wrote: >>> The attached patch adds mapped_file_region based on >>> boost::iostreams::mapped_file. This is a replacement for >>> map_file_pages/unmap_file_pages to work properly on Windows. This can >>> also be used by MemoryBuffer to finally have memory mapped files on >>> Windows. >>> >>> The reason the previous APIs do not work for Windows is that there are >>> 3 different handles that need to be kept track of to properly unmap a >>> region. For munmap there is only 1. >>> >>> - Michael Spencer >>> <0001-PathV2-Add-mapped_file_region.-Implementation-for-Wi.patch> >> From isanbard at gmail.com Mon Aug 6 19:26:35 2012 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 07 Aug 2012 00:26:35 -0000 Subject: [llvm-commits] [llvm] r161371 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp Message-ID: <20120807002635.8AE482A6C073@llvm.org> Author: void Date: Mon Aug 6 19:26:35 2012 New Revision: 161371 URL: http://llvm.org/viewvc/llvm-project?rev=161371&view=rev Log: Constify the Type parameter to some methods (which are const anyway). Modified: llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/Target/TargetData.cpp Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=161371&r1=161370&r2=161371&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Mon Aug 6 19:26:35 2012 @@ -100,9 +100,9 @@ void setAlignment(AlignTypeEnum align_type, unsigned abi_align, unsigned pref_align, uint32_t bit_width); unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width, - bool ABIAlign, Type *Ty) const; + bool ABIAlign, const Type *Ty) const; //! Internal helper method that returns requested alignment for type. - unsigned getAlignment(Type *Ty, bool abi_or_pref) const; + unsigned getAlignment(const Type *Ty, bool abi_or_pref) const; /// Valid alignment predicate. /// @@ -223,19 +223,19 @@ /// getTypeSizeInBits - Return the number of bits necessary to hold the /// specified type. For example, returns 36 for i36 and 80 for x86_fp80. - uint64_t getTypeSizeInBits(Type* Ty) const; + uint64_t getTypeSizeInBits(const Type* Ty) const; /// getTypeStoreSize - Return the maximum number of bytes that may be /// overwritten by storing the specified type. For example, returns 5 /// for i36 and 10 for x86_fp80. - uint64_t getTypeStoreSize(Type *Ty) const { + uint64_t getTypeStoreSize(const Type *Ty) const { return (getTypeSizeInBits(Ty)+7)/8; } /// getTypeStoreSizeInBits - Return the maximum number of bits that may be /// overwritten by storing the specified type; always a multiple of 8. For /// example, returns 40 for i36 and 80 for x86_fp80. - uint64_t getTypeStoreSizeInBits(Type *Ty) const { + uint64_t getTypeStoreSizeInBits(const Type *Ty) const { return 8*getTypeStoreSize(Ty); } @@ -243,7 +243,7 @@ /// of the specified type, including alignment padding. This is the amount /// that alloca reserves for this type. For example, returns 12 or 16 for /// x86_fp80, depending on alignment. - uint64_t getTypeAllocSize(Type* Ty) const { + uint64_t getTypeAllocSize(const Type* Ty) const { // Round up to the next alignment boundary. return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty)); } @@ -252,13 +252,13 @@ /// objects of the specified type, including alignment padding; always a /// multiple of 8. This is the amount that alloca reserves for this type. /// For example, returns 96 or 128 for x86_fp80, depending on alignment. - uint64_t getTypeAllocSizeInBits(Type* Ty) const { + uint64_t getTypeAllocSizeInBits(const Type* Ty) const { return 8*getTypeAllocSize(Ty); } /// getABITypeAlignment - Return the minimum ABI-required alignment for the /// specified type. - unsigned getABITypeAlignment(Type *Ty) const; + unsigned getABITypeAlignment(const Type *Ty) const; /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for /// an integer type of the specified bitwidth. @@ -267,17 +267,17 @@ /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment /// for the specified type when it is part of a call frame. - unsigned getCallFrameTypeAlignment(Type *Ty) const; + unsigned getCallFrameTypeAlignment(const Type *Ty) const; /// getPrefTypeAlignment - Return the preferred stack/global alignment for /// the specified type. This is always at least as good as the ABI alignment. - unsigned getPrefTypeAlignment(Type *Ty) const; + unsigned getPrefTypeAlignment(const Type *Ty) const; /// getPreferredTypeAlignmentShift - Return the preferred alignment for the /// specified type, returned as log2 of the value (a shift amount). /// - unsigned getPreferredTypeAlignmentShift(Type *Ty) const; + unsigned getPreferredTypeAlignmentShift(const Type *Ty) const; /// getIntPtrType - Return an unsigned integer type that is the same size or /// greater to the host pointer size. @@ -292,7 +292,7 @@ /// getStructLayout - Return a StructLayout object, indicating the alignment /// of the struct, its size, and the offsets of its fields. Note that this /// information is lazily cached. - const StructLayout *getStructLayout(StructType *Ty) const; + const StructLayout *getStructLayout(const StructType *Ty) const; /// getPreferredAlignment - Return the preferred alignment of the specified /// global. This includes an explicitly requested alignment (if the global @@ -355,7 +355,7 @@ private: friend class TargetData; // Only TargetData can create this class - StructLayout(StructType *ST, const TargetData &TD); + StructLayout(const StructType *ST, const TargetData &TD); }; } // End llvm namespace Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=161371&r1=161370&r2=161371&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Mon Aug 6 19:26:35 2012 @@ -41,7 +41,7 @@ // Support for StructLayout //===----------------------------------------------------------------------===// -StructLayout::StructLayout(StructType *ST, const TargetData &TD) { +StructLayout::StructLayout(const StructType *ST, const TargetData &TD) { assert(!ST->isOpaque() && "Cannot get layout of opaque structs"); StructAlignment = 0; StructSize = 0; @@ -332,7 +332,7 @@ /// preferred if ABIInfo = false) the target wants for the specified datatype. unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType, uint32_t BitWidth, bool ABIInfo, - Type *Ty) const { + const Type *Ty) const { // Check to see if we have an exact match and remember the best match we see. int BestMatchIdx = -1; int LargestInt = -1; @@ -386,7 +386,7 @@ namespace { class StructLayoutMap { - typedef DenseMap LayoutInfoTy; + typedef DenseMap LayoutInfoTy; LayoutInfoTy LayoutInfo; public: @@ -400,7 +400,7 @@ } } - StructLayout *&operator[](StructType *STy) { + StructLayout *&operator[](const StructType *STy) { return LayoutInfo[STy]; } @@ -414,7 +414,7 @@ delete static_cast(LayoutMap); } -const StructLayout *TargetData::getStructLayout(StructType *Ty) const { +const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { if (!LayoutMap) LayoutMap = new StructLayoutMap(); @@ -462,14 +462,14 @@ } -uint64_t TargetData::getTypeSizeInBits(Type *Ty) const { +uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); switch (Ty->getTypeID()) { case Type::LabelTyID: case Type::PointerTyID: return getPointerSizeInBits(); case Type::ArrayTyID: { - ArrayType *ATy = cast(Ty); + const ArrayType *ATy = cast(Ty); return getTypeAllocSizeInBits(ATy->getElementType())*ATy->getNumElements(); } case Type::StructTyID: @@ -508,7 +508,7 @@ Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref == false) for the requested type \a Ty. */ -unsigned TargetData::getAlignment(Type *Ty, bool abi_or_pref) const { +unsigned TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const { int AlignType = -1; assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); @@ -558,7 +558,7 @@ abi_or_pref, Ty); } -unsigned TargetData::getABITypeAlignment(Type *Ty) const { +unsigned TargetData::getABITypeAlignment(const Type *Ty) const { return getAlignment(Ty, true); } @@ -569,7 +569,7 @@ } -unsigned TargetData::getCallFrameTypeAlignment(Type *Ty) const { +unsigned TargetData::getCallFrameTypeAlignment(const Type *Ty) const { for (unsigned i = 0, e = Alignments.size(); i != e; ++i) if (Alignments[i].AlignType == STACK_ALIGN) return Alignments[i].ABIAlign; @@ -577,11 +577,11 @@ return getABITypeAlignment(Ty); } -unsigned TargetData::getPrefTypeAlignment(Type *Ty) const { +unsigned TargetData::getPrefTypeAlignment(const Type *Ty) const { return getAlignment(Ty, false); } -unsigned TargetData::getPreferredTypeAlignmentShift(Type *Ty) const { +unsigned TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const { unsigned Align = getPrefTypeAlignment(Ty); assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); return Log2_32(Align); From jcarter at mips.com Mon Aug 6 19:35:23 2012 From: jcarter at mips.com (Jack Carter) Date: Tue, 07 Aug 2012 00:35:23 -0000 Subject: [llvm-commits] [llvm] r161377 - in /llvm/trunk: lib/Target/Mips/Mips64InstrInfo.td test/MC/Mips/sext_64_32.ll Message-ID: <20120807003523.5D29E2A6C073@llvm.org> Author: jacksprat Date: Mon Aug 6 19:35:22 2012 New Revision: 161377 URL: http://llvm.org/viewvc/llvm-project?rev=161377&view=rev Log: The define for 64 bit sign extension neglected to initialize fields of the class that it used. The result was nonsense code. Before: 0000000000000000 : 0: 00441100 0x441100 4: 03e00008 jr ra 8: 00000000 nop After: 0000000000000000 : 0: 00041000 sll v0,a0,0x0 4: 03e00008 jr ra 8: 00000000 nop Added: llvm/trunk/test/MC/Mips/sext_64_32.ll Modified: llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td Modified: llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td?rev=161377&r1=161376&r2=161377&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td Mon Aug 6 19:35:22 2012 @@ -219,13 +219,14 @@ def DEXT : ExtBase<3, "dext", CPU64Regs>; def DINS : InsBase<7, "dins", CPU64Regs>; -def DSLL64_32 : FR<0x3c, 0x00, (outs CPU64Regs:$rd), (ins CPURegs:$rt), - "dsll\t$rd, $rt, 32", [], IIAlu>; -def SLL64_32 : FR<0x0, 0x00, (outs CPU64Regs:$rd), (ins CPURegs:$rt), - "sll\t$rd, $rt, 0", [], IIAlu>; -let isCodeGenOnly = 1 in -def SLL64_64 : FR<0x0, 0x00, (outs CPU64Regs:$rd), (ins CPU64Regs:$rt), - "sll\t$rd, $rt, 0", [], IIAlu>; +let isCodeGenOnly = 1, rs = 0, shamt = 0 in { + def DSLL64_32 : FR<0x3c, 0x00, (outs CPU64Regs:$rd), (ins CPURegs:$rt), + "dsll\t$rd, $rt, 32", [], IIAlu>; + def SLL64_32 : FR<0x0, 0x00, (outs CPU64Regs:$rd), (ins CPURegs:$rt), + "sll\t$rd, $rt, 0", [], IIAlu>; + def SLL64_64 : FR<0x0, 0x00, (outs CPU64Regs:$rd), (ins CPU64Regs:$rt), + "sll\t$rd, $rt, 0", [], IIAlu>; +} } //===----------------------------------------------------------------------===// // Arbitrary patterns that map to one or more instructions Added: llvm/trunk/test/MC/Mips/sext_64_32.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/sext_64_32.ll?rev=161377&view=auto ============================================================================== --- llvm/trunk/test/MC/Mips/sext_64_32.ll (added) +++ llvm/trunk/test/MC/Mips/sext_64_32.ll Mon Aug 6 19:35:22 2012 @@ -0,0 +1,15 @@ +; RUN: llc -march=mips64el -filetype=obj -mcpu=mips64r2 %s -o - | llvm-objdump -disassemble -triple mips64el - | FileCheck %s + +; Sign extend from 32 to 64 was creating nonsense opcodes + +; CHECK: sll ${{[0-9]+}}, ${{[0-9]+}}, 0 + +; ModuleID = '../sext.c' +;target datalayout = "e-p:64:64:64-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v64:64:64-n32" +;target triple = "mips64el-unknown-linux" + +define i64 @foo(i32 %ival) nounwind readnone { +entry: + %conv = sext i32 %ival to i64 + ret i64 %conv +} From mgottesman at apple.com Mon Aug 6 21:54:52 2012 From: mgottesman at apple.com (Michael Gottesman) Date: Tue, 07 Aug 2012 02:54:52 -0000 Subject: [llvm-commits] [LNT] r161386 - /lnt/trunk/lnt/server/ui/util.py Message-ID: <20120807025452.8418A2A6C073@llvm.org> Author: mgottesman Date: Mon Aug 6 21:54:52 2012 New Revision: 161386 URL: http://llvm.org/viewvc/llvm-project?rev=161386&view=rev Log: [LNT] Added code to lnt/server/ui/util.py so that one can get the color string from a cell without needing to render an actual html table cell. Also coloring NaNs was not being handled correctly since the code was checking for non floats only instead of non floats and NaNs. Modified: lnt/trunk/lnt/server/ui/util.py Modified: lnt/trunk/lnt/server/ui/util.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/util.py?rev=161386&r1=161385&r2=161386&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/util.py (original) +++ lnt/trunk/lnt/server/ui/util.py Mon Aug 6 21:54:52 2012 @@ -173,7 +173,10 @@ def getColor(self): v = self.value - if not isinstance(v, float): + + # NaN is the unique floating point number with the property + # that NaN != NaN. We use this to detect actual NaNs. + if not isinstance(v, float) or v != v: return self.kNANColor # Clamp value. @@ -199,15 +202,18 @@ return self.value return '%.*f%%' % (self.precision, self.value*100) + def getColorString(self): + r,g,b = [clamp(int(v*255), 0, 255) + for v in self.getColor()] + return "#%02x%02x%02x" % (r,g,b) + def render(self, style=None): if style is None: style_string = "" else: style_string = ' style="%s"' % (style,) - r,g,b = [clamp(int(v*255), 0, 255) - for v in self.getColor()] - res = '%s' % ( - style_string, r, g, b, self.getValue()) + res = '%s' % ( + style_string, self.getColorString(), self.getValue()) return res def sorted(l, *args, **kwargs): From mgottesman at apple.com Mon Aug 6 22:01:49 2012 From: mgottesman at apple.com (Michael Gottesman) Date: Tue, 07 Aug 2012 03:01:49 -0000 Subject: [llvm-commits] [LNT] r161387 - /lnt/trunk/lnt/server/ui/util.py Message-ID: <20120807030149.A1C6D2A6C073@llvm.org> Author: mgottesman Date: Mon Aug 6 22:01:49 2012 New Revision: 161387 URL: http://llvm.org/viewvc/llvm-project?rev=161387&view=rev Log: [LNT] Fixed comment. Modified: lnt/trunk/lnt/server/ui/util.py Modified: lnt/trunk/lnt/server/ui/util.py URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/util.py?rev=161387&r1=161386&r2=161387&view=diff ============================================================================== --- lnt/trunk/lnt/server/ui/util.py (original) +++ lnt/trunk/lnt/server/ui/util.py Mon Aug 6 22:01:49 2012 @@ -174,8 +174,9 @@ def getColor(self): v = self.value - # NaN is the unique floating point number with the property - # that NaN != NaN. We use this to detect actual NaNs. + # NaN is the unique floating point number x with the property + # that x != x. We use this to detect actual NaNs and handle + # them appropriately. if not isinstance(v, float) or v != v: return self.kNANColor From dblaikie at gmail.com Mon Aug 6 23:41:25 2012 From: dblaikie at gmail.com (David Blaikie) Date: Mon, 6 Aug 2012 21:41:25 -0700 Subject: [llvm-commits] [llvm] r161371 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp In-Reply-To: <20120807002635.8AE482A6C073@llvm.org> References: <20120807002635.8AE482A6C073@llvm.org> Message-ID: On Mon, Aug 6, 2012 at 5:26 PM, Bill Wendling wrote: > Author: void > Date: Mon Aug 6 19:26:35 2012 > New Revision: 161371 > > URL: http://llvm.org/viewvc/llvm-project?rev=161371&view=rev > Log: > Constify the Type parameter to some methods (which are const anyway). FWIW we /removed/ the const from llvm::Types after the great Type rewrite of 3.0 because Types can be nothing other than const (they have no non-const public members) so it's just redundant/verbose. (while I don't necessarily agree with this attitude, it was Chris's preference & I made the patches to make the conversion) http://llvm.org/viewvc/llvm-project?view=rev&revision=135375 > > Modified: > llvm/trunk/include/llvm/Target/TargetData.h > llvm/trunk/lib/Target/TargetData.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetData.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=161371&r1=161370&r2=161371&view=diff > ============================================================================== > --- llvm/trunk/include/llvm/Target/TargetData.h (original) > +++ llvm/trunk/include/llvm/Target/TargetData.h Mon Aug 6 19:26:35 2012 > @@ -100,9 +100,9 @@ > void setAlignment(AlignTypeEnum align_type, unsigned abi_align, > unsigned pref_align, uint32_t bit_width); > unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width, > - bool ABIAlign, Type *Ty) const; > + bool ABIAlign, const Type *Ty) const; > //! Internal helper method that returns requested alignment for type. > - unsigned getAlignment(Type *Ty, bool abi_or_pref) const; > + unsigned getAlignment(const Type *Ty, bool abi_or_pref) const; > > /// Valid alignment predicate. > /// > @@ -223,19 +223,19 @@ > > /// getTypeSizeInBits - Return the number of bits necessary to hold the > /// specified type. For example, returns 36 for i36 and 80 for x86_fp80. > - uint64_t getTypeSizeInBits(Type* Ty) const; > + uint64_t getTypeSizeInBits(const Type* Ty) const; > > /// getTypeStoreSize - Return the maximum number of bytes that may be > /// overwritten by storing the specified type. For example, returns 5 > /// for i36 and 10 for x86_fp80. > - uint64_t getTypeStoreSize(Type *Ty) const { > + uint64_t getTypeStoreSize(const Type *Ty) const { > return (getTypeSizeInBits(Ty)+7)/8; > } > > /// getTypeStoreSizeInBits - Return the maximum number of bits that may be > /// overwritten by storing the specified type; always a multiple of 8. For > /// example, returns 40 for i36 and 80 for x86_fp80. > - uint64_t getTypeStoreSizeInBits(Type *Ty) const { > + uint64_t getTypeStoreSizeInBits(const Type *Ty) const { > return 8*getTypeStoreSize(Ty); > } > > @@ -243,7 +243,7 @@ > /// of the specified type, including alignment padding. This is the amount > /// that alloca reserves for this type. For example, returns 12 or 16 for > /// x86_fp80, depending on alignment. > - uint64_t getTypeAllocSize(Type* Ty) const { > + uint64_t getTypeAllocSize(const Type* Ty) const { > // Round up to the next alignment boundary. > return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty)); > } > @@ -252,13 +252,13 @@ > /// objects of the specified type, including alignment padding; always a > /// multiple of 8. This is the amount that alloca reserves for this type. > /// For example, returns 96 or 128 for x86_fp80, depending on alignment. > - uint64_t getTypeAllocSizeInBits(Type* Ty) const { > + uint64_t getTypeAllocSizeInBits(const Type* Ty) const { > return 8*getTypeAllocSize(Ty); > } > > /// getABITypeAlignment - Return the minimum ABI-required alignment for the > /// specified type. > - unsigned getABITypeAlignment(Type *Ty) const; > + unsigned getABITypeAlignment(const Type *Ty) const; > > /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for > /// an integer type of the specified bitwidth. > @@ -267,17 +267,17 @@ > > /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment > /// for the specified type when it is part of a call frame. > - unsigned getCallFrameTypeAlignment(Type *Ty) const; > + unsigned getCallFrameTypeAlignment(const Type *Ty) const; > > > /// getPrefTypeAlignment - Return the preferred stack/global alignment for > /// the specified type. This is always at least as good as the ABI alignment. > - unsigned getPrefTypeAlignment(Type *Ty) const; > + unsigned getPrefTypeAlignment(const Type *Ty) const; > > /// getPreferredTypeAlignmentShift - Return the preferred alignment for the > /// specified type, returned as log2 of the value (a shift amount). > /// > - unsigned getPreferredTypeAlignmentShift(Type *Ty) const; > + unsigned getPreferredTypeAlignmentShift(const Type *Ty) const; > > /// getIntPtrType - Return an unsigned integer type that is the same size or > /// greater to the host pointer size. > @@ -292,7 +292,7 @@ > /// getStructLayout - Return a StructLayout object, indicating the alignment > /// of the struct, its size, and the offsets of its fields. Note that this > /// information is lazily cached. > - const StructLayout *getStructLayout(StructType *Ty) const; > + const StructLayout *getStructLayout(const StructType *Ty) const; > > /// getPreferredAlignment - Return the preferred alignment of the specified > /// global. This includes an explicitly requested alignment (if the global > @@ -355,7 +355,7 @@ > > private: > friend class TargetData; // Only TargetData can create this class > - StructLayout(StructType *ST, const TargetData &TD); > + StructLayout(const StructType *ST, const TargetData &TD); > }; > > } // End llvm namespace > > Modified: llvm/trunk/lib/Target/TargetData.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=161371&r1=161370&r2=161371&view=diff > ============================================================================== > --- llvm/trunk/lib/Target/TargetData.cpp (original) > +++ llvm/trunk/lib/Target/TargetData.cpp Mon Aug 6 19:26:35 2012 > @@ -41,7 +41,7 @@ > // Support for StructLayout > //===----------------------------------------------------------------------===// > > -StructLayout::StructLayout(StructType *ST, const TargetData &TD) { > +StructLayout::StructLayout(const StructType *ST, const TargetData &TD) { > assert(!ST->isOpaque() && "Cannot get layout of opaque structs"); > StructAlignment = 0; > StructSize = 0; > @@ -332,7 +332,7 @@ > /// preferred if ABIInfo = false) the target wants for the specified datatype. > unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType, > uint32_t BitWidth, bool ABIInfo, > - Type *Ty) const { > + const Type *Ty) const { > // Check to see if we have an exact match and remember the best match we see. > int BestMatchIdx = -1; > int LargestInt = -1; > @@ -386,7 +386,7 @@ > namespace { > > class StructLayoutMap { > - typedef DenseMap LayoutInfoTy; > + typedef DenseMap LayoutInfoTy; > LayoutInfoTy LayoutInfo; > > public: > @@ -400,7 +400,7 @@ > } > } > > - StructLayout *&operator[](StructType *STy) { > + StructLayout *&operator[](const StructType *STy) { > return LayoutInfo[STy]; > } > > @@ -414,7 +414,7 @@ > delete static_cast(LayoutMap); > } > > -const StructLayout *TargetData::getStructLayout(StructType *Ty) const { > +const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { > if (!LayoutMap) > LayoutMap = new StructLayoutMap(); > > @@ -462,14 +462,14 @@ > } > > > -uint64_t TargetData::getTypeSizeInBits(Type *Ty) const { > +uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { > assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); > switch (Ty->getTypeID()) { > case Type::LabelTyID: > case Type::PointerTyID: > return getPointerSizeInBits(); > case Type::ArrayTyID: { > - ArrayType *ATy = cast(Ty); > + const ArrayType *ATy = cast(Ty); > return getTypeAllocSizeInBits(ATy->getElementType())*ATy->getNumElements(); > } > case Type::StructTyID: > @@ -508,7 +508,7 @@ > Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref > == false) for the requested type \a Ty. > */ > -unsigned TargetData::getAlignment(Type *Ty, bool abi_or_pref) const { > +unsigned TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const { > int AlignType = -1; > > assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); > @@ -558,7 +558,7 @@ > abi_or_pref, Ty); > } > > -unsigned TargetData::getABITypeAlignment(Type *Ty) const { > +unsigned TargetData::getABITypeAlignment(const Type *Ty) const { > return getAlignment(Ty, true); > } > > @@ -569,7 +569,7 @@ > } > > > -unsigned TargetData::getCallFrameTypeAlignment(Type *Ty) const { > +unsigned TargetData::getCallFrameTypeAlignment(const Type *Ty) const { > for (unsigned i = 0, e = Alignments.size(); i != e; ++i) > if (Alignments[i].AlignType == STACK_ALIGN) > return Alignments[i].ABIAlign; > @@ -577,11 +577,11 @@ > return getABITypeAlignment(Ty); > } > > -unsigned TargetData::getPrefTypeAlignment(Type *Ty) const { > +unsigned TargetData::getPrefTypeAlignment(const Type *Ty) const { > return getAlignment(Ty, false); > } > > -unsigned TargetData::getPreferredTypeAlignmentShift(Type *Ty) const { > +unsigned TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const { > unsigned Align = getPrefTypeAlignment(Ty); > assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); > return Log2_32(Align); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Aug 7 00:49:42 2012 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 6 Aug 2012 22:49:42 -0700 Subject: [llvm-commits] [llvm] r161371 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp In-Reply-To: References: <20120807002635.8AE482A6C073@llvm.org> Message-ID: On Aug 6, 2012, at 9:41 PM, David Blaikie wrote: > On Mon, Aug 6, 2012 at 5:26 PM, Bill Wendling wrote: >> Author: void >> Date: Mon Aug 6 19:26:35 2012 >> New Revision: 161371 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=161371&view=rev >> Log: >> Constify the Type parameter to some methods (which are const anyway). > > FWIW we /removed/ the const from llvm::Types after the great Type > rewrite of 3.0 because Types can be nothing other than const (they > have no non-const public members) so it's just redundant/verbose. > > (while I don't necessarily agree with this attitude, it was Chris's > preference & I made the patches to make the conversion) > > http://llvm.org/viewvc/llvm-project?view=rev&revision=135375 > Yeah. I was thinking about that on the way home today. I'll revert this. -bw >> >> Modified: >> llvm/trunk/include/llvm/Target/TargetData.h >> llvm/trunk/lib/Target/TargetData.cpp >> >> Modified: llvm/trunk/include/llvm/Target/TargetData.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=161371&r1=161370&r2=161371&view=diff >> ============================================================================== >> --- llvm/trunk/include/llvm/Target/TargetData.h (original) >> +++ llvm/trunk/include/llvm/Target/TargetData.h Mon Aug 6 19:26:35 2012 >> @@ -100,9 +100,9 @@ >> void setAlignment(AlignTypeEnum align_type, unsigned abi_align, >> unsigned pref_align, uint32_t bit_width); >> unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width, >> - bool ABIAlign, Type *Ty) const; >> + bool ABIAlign, const Type *Ty) const; >> //! Internal helper method that returns requested alignment for type. >> - unsigned getAlignment(Type *Ty, bool abi_or_pref) const; >> + unsigned getAlignment(const Type *Ty, bool abi_or_pref) const; >> >> /// Valid alignment predicate. >> /// >> @@ -223,19 +223,19 @@ >> >> /// getTypeSizeInBits - Return the number of bits necessary to hold the >> /// specified type. For example, returns 36 for i36 and 80 for x86_fp80. >> - uint64_t getTypeSizeInBits(Type* Ty) const; >> + uint64_t getTypeSizeInBits(const Type* Ty) const; >> >> /// getTypeStoreSize - Return the maximum number of bytes that may be >> /// overwritten by storing the specified type. For example, returns 5 >> /// for i36 and 10 for x86_fp80. >> - uint64_t getTypeStoreSize(Type *Ty) const { >> + uint64_t getTypeStoreSize(const Type *Ty) const { >> return (getTypeSizeInBits(Ty)+7)/8; >> } >> >> /// getTypeStoreSizeInBits - Return the maximum number of bits that may be >> /// overwritten by storing the specified type; always a multiple of 8. For >> /// example, returns 40 for i36 and 80 for x86_fp80. >> - uint64_t getTypeStoreSizeInBits(Type *Ty) const { >> + uint64_t getTypeStoreSizeInBits(const Type *Ty) const { >> return 8*getTypeStoreSize(Ty); >> } >> >> @@ -243,7 +243,7 @@ >> /// of the specified type, including alignment padding. This is the amount >> /// that alloca reserves for this type. For example, returns 12 or 16 for >> /// x86_fp80, depending on alignment. >> - uint64_t getTypeAllocSize(Type* Ty) const { >> + uint64_t getTypeAllocSize(const Type* Ty) const { >> // Round up to the next alignment boundary. >> return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty)); >> } >> @@ -252,13 +252,13 @@ >> /// objects of the specified type, including alignment padding; always a >> /// multiple of 8. This is the amount that alloca reserves for this type. >> /// For example, returns 96 or 128 for x86_fp80, depending on alignment. >> - uint64_t getTypeAllocSizeInBits(Type* Ty) const { >> + uint64_t getTypeAllocSizeInBits(const Type* Ty) const { >> return 8*getTypeAllocSize(Ty); >> } >> >> /// getABITypeAlignment - Return the minimum ABI-required alignment for the >> /// specified type. >> - unsigned getABITypeAlignment(Type *Ty) const; >> + unsigned getABITypeAlignment(const Type *Ty) const; >> >> /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for >> /// an integer type of the specified bitwidth. >> @@ -267,17 +267,17 @@ >> >> /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment >> /// for the specified type when it is part of a call frame. >> - unsigned getCallFrameTypeAlignment(Type *Ty) const; >> + unsigned getCallFrameTypeAlignment(const Type *Ty) const; >> >> >> /// getPrefTypeAlignment - Return the preferred stack/global alignment for >> /// the specified type. This is always at least as good as the ABI alignment. >> - unsigned getPrefTypeAlignment(Type *Ty) const; >> + unsigned getPrefTypeAlignment(const Type *Ty) const; >> >> /// getPreferredTypeAlignmentShift - Return the preferred alignment for the >> /// specified type, returned as log2 of the value (a shift amount). >> /// >> - unsigned getPreferredTypeAlignmentShift(Type *Ty) const; >> + unsigned getPreferredTypeAlignmentShift(const Type *Ty) const; >> >> /// getIntPtrType - Return an unsigned integer type that is the same size or >> /// greater to the host pointer size. >> @@ -292,7 +292,7 @@ >> /// getStructLayout - Return a StructLayout object, indicating the alignment >> /// of the struct, its size, and the offsets of its fields. Note that this >> /// information is lazily cached. >> - const StructLayout *getStructLayout(StructType *Ty) const; >> + const StructLayout *getStructLayout(const StructType *Ty) const; >> >> /// getPreferredAlignment - Return the preferred alignment of the specified >> /// global. This includes an explicitly requested alignment (if the global >> @@ -355,7 +355,7 @@ >> >> private: >> friend class TargetData; // Only TargetData can create this class >> - StructLayout(StructType *ST, const TargetData &TD); >> + StructLayout(const StructType *ST, const TargetData &TD); >> }; >> >> } // End llvm namespace >> >> Modified: llvm/trunk/lib/Target/TargetData.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=161371&r1=161370&r2=161371&view=diff >> ============================================================================== >> --- llvm/trunk/lib/Target/TargetData.cpp (original) >> +++ llvm/trunk/lib/Target/TargetData.cpp Mon Aug 6 19:26:35 2012 >> @@ -41,7 +41,7 @@ >> // Support for StructLayout >> //===----------------------------------------------------------------------===// >> >> -StructLayout::StructLayout(StructType *ST, const TargetData &TD) { >> +StructLayout::StructLayout(const StructType *ST, const TargetData &TD) { >> assert(!ST->isOpaque() && "Cannot get layout of opaque structs"); >> StructAlignment = 0; >> StructSize = 0; >> @@ -332,7 +332,7 @@ >> /// preferred if ABIInfo = false) the target wants for the specified datatype. >> unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType, >> uint32_t BitWidth, bool ABIInfo, >> - Type *Ty) const { >> + const Type *Ty) const { >> // Check to see if we have an exact match and remember the best match we see. >> int BestMatchIdx = -1; >> int LargestInt = -1; >> @@ -386,7 +386,7 @@ >> namespace { >> >> class StructLayoutMap { >> - typedef DenseMap LayoutInfoTy; >> + typedef DenseMap LayoutInfoTy; >> LayoutInfoTy LayoutInfo; >> >> public: >> @@ -400,7 +400,7 @@ >> } >> } >> >> - StructLayout *&operator[](StructType *STy) { >> + StructLayout *&operator[](const StructType *STy) { >> return LayoutInfo[STy]; >> } >> >> @@ -414,7 +414,7 @@ >> delete static_cast(LayoutMap); >> } >> >> -const StructLayout *TargetData::getStructLayout(StructType *Ty) const { >> +const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { >> if (!LayoutMap) >> LayoutMap = new StructLayoutMap(); >> >> @@ -462,14 +462,14 @@ >> } >> >> >> -uint64_t TargetData::getTypeSizeInBits(Type *Ty) const { >> +uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { >> assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); >> switch (Ty->getTypeID()) { >> case Type::LabelTyID: >> case Type::PointerTyID: >> return getPointerSizeInBits(); >> case Type::ArrayTyID: { >> - ArrayType *ATy = cast(Ty); >> + const ArrayType *ATy = cast(Ty); >> return getTypeAllocSizeInBits(ATy->getElementType())*ATy->getNumElements(); >> } >> case Type::StructTyID: >> @@ -508,7 +508,7 @@ >> Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref >> == false) for the requested type \a Ty. >> */ >> -unsigned TargetData::getAlignment(Type *Ty, bool abi_or_pref) const { >> +unsigned TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const { >> int AlignType = -1; >> >> assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); >> @@ -558,7 +558,7 @@ >> abi_or_pref, Ty); >> } >> >> -unsigned TargetData::getABITypeAlignment(Type *Ty) const { >> +unsigned TargetData::getABITypeAlignment(const Type *Ty) const { >> return getAlignment(Ty, true); >> } >> >> @@ -569,7 +569,7 @@ >> } >> >> >> -unsigned TargetData::getCallFrameTypeAlignment(Type *Ty) const { >> +unsigned TargetData::getCallFrameTypeAlignment(const Type *Ty) const { >> for (unsigned i = 0, e = Alignments.size(); i != e; ++i) >> if (Alignments[i].AlignType == STACK_ALIGN) >> return Alignments[i].ABIAlign; >> @@ -577,11 +577,11 @@ >> return getABITypeAlignment(Ty); >> } >> >> -unsigned TargetData::getPrefTypeAlignment(Type *Ty) const { >> +unsigned TargetData::getPrefTypeAlignment(const Type *Ty) const { >> return getAlignment(Ty, false); >> } >> >> -unsigned TargetData::getPreferredTypeAlignmentShift(Type *Ty) const { >> +unsigned TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const { >> unsigned Align = getPrefTypeAlignment(Ty); >> assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); >> return Log2_32(Align); >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Aug 7 00:52:00 2012 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 07 Aug 2012 05:52:00 -0000 Subject: [llvm-commits] [llvm] r161394 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp Message-ID: <20120807055200.1D29F2A6C073@llvm.org> Author: void Date: Tue Aug 7 00:51:59 2012 New Revision: 161394 URL: http://llvm.org/viewvc/llvm-project?rev=161394&view=rev Log: Revert r161371. Removing the 'const' before Type is a "good thing". --- Reverse-merging r161371 into '.': U include/llvm/Target/TargetData.h U lib/Target/TargetData.cpp Modified: llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/Target/TargetData.cpp Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=161394&r1=161393&r2=161394&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Tue Aug 7 00:51:59 2012 @@ -100,9 +100,9 @@ void setAlignment(AlignTypeEnum align_type, unsigned abi_align, unsigned pref_align, uint32_t bit_width); unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width, - bool ABIAlign, const Type *Ty) const; + bool ABIAlign, Type *Ty) const; //! Internal helper method that returns requested alignment for type. - unsigned getAlignment(const Type *Ty, bool abi_or_pref) const; + unsigned getAlignment(Type *Ty, bool abi_or_pref) const; /// Valid alignment predicate. /// @@ -223,19 +223,19 @@ /// getTypeSizeInBits - Return the number of bits necessary to hold the /// specified type. For example, returns 36 for i36 and 80 for x86_fp80. - uint64_t getTypeSizeInBits(const Type* Ty) const; + uint64_t getTypeSizeInBits(Type* Ty) const; /// getTypeStoreSize - Return the maximum number of bytes that may be /// overwritten by storing the specified type. For example, returns 5 /// for i36 and 10 for x86_fp80. - uint64_t getTypeStoreSize(const Type *Ty) const { + uint64_t getTypeStoreSize(Type *Ty) const { return (getTypeSizeInBits(Ty)+7)/8; } /// getTypeStoreSizeInBits - Return the maximum number of bits that may be /// overwritten by storing the specified type; always a multiple of 8. For /// example, returns 40 for i36 and 80 for x86_fp80. - uint64_t getTypeStoreSizeInBits(const Type *Ty) const { + uint64_t getTypeStoreSizeInBits(Type *Ty) const { return 8*getTypeStoreSize(Ty); } @@ -243,7 +243,7 @@ /// of the specified type, including alignment padding. This is the amount /// that alloca reserves for this type. For example, returns 12 or 16 for /// x86_fp80, depending on alignment. - uint64_t getTypeAllocSize(const Type* Ty) const { + uint64_t getTypeAllocSize(Type* Ty) const { // Round up to the next alignment boundary. return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty)); } @@ -252,13 +252,13 @@ /// objects of the specified type, including alignment padding; always a /// multiple of 8. This is the amount that alloca reserves for this type. /// For example, returns 96 or 128 for x86_fp80, depending on alignment. - uint64_t getTypeAllocSizeInBits(const Type* Ty) const { + uint64_t getTypeAllocSizeInBits(Type* Ty) const { return 8*getTypeAllocSize(Ty); } /// getABITypeAlignment - Return the minimum ABI-required alignment for the /// specified type. - unsigned getABITypeAlignment(const Type *Ty) const; + unsigned getABITypeAlignment(Type *Ty) const; /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for /// an integer type of the specified bitwidth. @@ -267,17 +267,17 @@ /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment /// for the specified type when it is part of a call frame. - unsigned getCallFrameTypeAlignment(const Type *Ty) const; + unsigned getCallFrameTypeAlignment(Type *Ty) const; /// getPrefTypeAlignment - Return the preferred stack/global alignment for /// the specified type. This is always at least as good as the ABI alignment. - unsigned getPrefTypeAlignment(const Type *Ty) const; + unsigned getPrefTypeAlignment(Type *Ty) const; /// getPreferredTypeAlignmentShift - Return the preferred alignment for the /// specified type, returned as log2 of the value (a shift amount). /// - unsigned getPreferredTypeAlignmentShift(const Type *Ty) const; + unsigned getPreferredTypeAlignmentShift(Type *Ty) const; /// getIntPtrType - Return an unsigned integer type that is the same size or /// greater to the host pointer size. @@ -292,7 +292,7 @@ /// getStructLayout - Return a StructLayout object, indicating the alignment /// of the struct, its size, and the offsets of its fields. Note that this /// information is lazily cached. - const StructLayout *getStructLayout(const StructType *Ty) const; + const StructLayout *getStructLayout(StructType *Ty) const; /// getPreferredAlignment - Return the preferred alignment of the specified /// global. This includes an explicitly requested alignment (if the global @@ -355,7 +355,7 @@ private: friend class TargetData; // Only TargetData can create this class - StructLayout(const StructType *ST, const TargetData &TD); + StructLayout(StructType *ST, const TargetData &TD); }; } // End llvm namespace Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=161394&r1=161393&r2=161394&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Tue Aug 7 00:51:59 2012 @@ -41,7 +41,7 @@ // Support for StructLayout //===----------------------------------------------------------------------===// -StructLayout::StructLayout(const StructType *ST, const TargetData &TD) { +StructLayout::StructLayout(StructType *ST, const TargetData &TD) { assert(!ST->isOpaque() && "Cannot get layout of opaque structs"); StructAlignment = 0; StructSize = 0; @@ -332,7 +332,7 @@ /// preferred if ABIInfo = false) the target wants for the specified datatype. unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType, uint32_t BitWidth, bool ABIInfo, - const Type *Ty) const { + Type *Ty) const { // Check to see if we have an exact match and remember the best match we see. int BestMatchIdx = -1; int LargestInt = -1; @@ -386,7 +386,7 @@ namespace { class StructLayoutMap { - typedef DenseMap LayoutInfoTy; + typedef DenseMap LayoutInfoTy; LayoutInfoTy LayoutInfo; public: @@ -400,7 +400,7 @@ } } - StructLayout *&operator[](const StructType *STy) { + StructLayout *&operator[](StructType *STy) { return LayoutInfo[STy]; } @@ -414,7 +414,7 @@ delete static_cast(LayoutMap); } -const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { +const StructLayout *TargetData::getStructLayout(StructType *Ty) const { if (!LayoutMap) LayoutMap = new StructLayoutMap(); @@ -462,14 +462,14 @@ } -uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const { +uint64_t TargetData::getTypeSizeInBits(Type *Ty) const { assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); switch (Ty->getTypeID()) { case Type::LabelTyID: case Type::PointerTyID: return getPointerSizeInBits(); case Type::ArrayTyID: { - const ArrayType *ATy = cast(Ty); + ArrayType *ATy = cast(Ty); return getTypeAllocSizeInBits(ATy->getElementType())*ATy->getNumElements(); } case Type::StructTyID: @@ -508,7 +508,7 @@ Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref == false) for the requested type \a Ty. */ -unsigned TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const { +unsigned TargetData::getAlignment(Type *Ty, bool abi_or_pref) const { int AlignType = -1; assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); @@ -558,7 +558,7 @@ abi_or_pref, Ty); } -unsigned TargetData::getABITypeAlignment(const Type *Ty) const { +unsigned TargetData::getABITypeAlignment(Type *Ty) const { return getAlignment(Ty, true); } @@ -569,7 +569,7 @@ } -unsigned TargetData::getCallFrameTypeAlignment(const Type *Ty) const { +unsigned TargetData::getCallFrameTypeAlignment(Type *Ty) const { for (unsigned i = 0, e = Alignments.size(); i != e; ++i) if (Alignments[i].AlignType == STACK_ALIGN) return Alignments[i].ABIAlign; @@ -577,11 +577,11 @@ return getABITypeAlignment(Ty); } -unsigned TargetData::getPrefTypeAlignment(const Type *Ty) const { +unsigned TargetData::getPrefTypeAlignment(Type *Ty) const { return getAlignment(Ty, false); } -unsigned TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const { +unsigned TargetData::getPreferredTypeAlignmentShift(Type *Ty) const { unsigned Align = getPrefTypeAlignment(Ty); assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); return Log2_32(Align); From dgregor at apple.com Tue Aug 7 01:16:26 2012 From: dgregor at apple.com (Douglas Gregor) Date: Mon, 06 Aug 2012 23:16:26 -0700 Subject: [llvm-commits] Fix cmake for Hexagon cross compilers In-Reply-To: References: Message-ID: <1210CAEF-9314-4B85-8A44-7D224B0AD435@apple.com> On Aug 6, 2012, at 1:11 PM, Sebastian Pop wrote: > Ping^4. > > Hi, I'm waiting for a month now for an OK to commit. > It seems that really nobody except me cares for this change. > Does it really matter to somebody if I'm pushing this change out to svn? > > How should I proceed in timeout cases like this? Patch looks good, please go ahead and commit. If this happens again, please CC me. If I can't review the patch, I'll find someone who can. Sorry about that! - Doug > Thanks, > Sebastian > > > On Wed, Aug 1, 2012 at 10:43 AM, Sebastian Pop wrote: >> Ping^2. >> >> Looks like nobody finds anything to say about this patch: >> could then somebody ok the patch? >> >> Thanks, >> Sebastian >> >> On Wed, Jul 18, 2012 at 10:55 PM, Sebastian Pop wrote: >>> On Tue, Jul 3, 2012 at 11:51 PM, Sebastian Pop wrote: >>>> On Tue, Jul 3, 2012 at 10:42 PM, Sebastian Pop wrote: >>>>> Hi, >>>>> >>>>> here is a patch that allows us to use cmake to specify a cross >>>>> compiler for Hexagon. >>>>> >>>>> In particular, the patch adds a missing case for the target Hexagon in >>>>> cmake/config-ix.cmake, and it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE >>>>> variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them >>>>> available at configure time. Here is the command line that I have used to test >>>>> my patches: >>>>> >>>>> $ cmake -G Ninja -D BUILD_SHARED_LIBS:BOOL=ON -D >>>>> LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D >>>>> TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D >>>>> LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D >>>>> LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu -D >>>>> LLVM_ENABLE_PIC:BOOL=OFF .. >>>>> $ ninja check >>>>> >>>> >>>> With this cmake command, building clang fails for two programs >>>> c-arcmt-test and c-index-test like this: >>>> >>>> [102/649] Linking CXX executable bin/c-index-test >>>> FAILED: : && /usr/bin/c++ -fno-common -Woverloaded-virtual >>>> -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W >>>> -Wno-unused-parameter -Wwrite-strings -fno-rtti >>>> tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o >>>> -o bin/c-index-test -rdynamic lib/libLLVMMC.so lib/libLLVMObject.so >>>> lib/libLLVMSupport.so -ldl -lpthread -llibclang >>>> -Wl,-rpath,/home/spop/llvm/svn-git-llvm/ninja.build/lib: && : >>>> /usr/bin/ld: cannot find -llibclang >>>> >>>> We are trying to link against a static libclang even when we explicitly asked >>>> cmake -D BUILD_SHARED_LIBS:BOOL=ON >>>> >>>> The attached patch fixes the compilation of these two programs by generating >>>> the static libclang.a even when BUILD_SHARED_LIBS is ON. >>>> >>>> Ok to commit the attached patch, or is there a better way to fix the cmake >>>> compilations by avoiding the static link against libclang? >>> >>> Ping second patch. >>> >>> Thanks, >>> Sebastian >>> -- >>> Qualcomm Innovation Center, Inc is a member of Code Aurora Forum >> >> >> >> -- >> Qualcomm Innovation Center, Inc is a member of Code Aurora Forum > > > > -- > Qualcomm Innovation Center, Inc is a member of Code Aurora Forum > <0001-build-a-static-libclang.a-even-for-BUILD_SHARED_LIBS.patch>_______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From mren at apple.com Tue Aug 7 01:16:46 2012 From: mren at apple.com (Manman Ren) Date: Tue, 07 Aug 2012 06:16:46 -0000 Subject: [llvm-commits] [llvm] r161396 - in /llvm/trunk: lib/CodeGen/MachineCSE.cpp test/CodeGen/X86/block-placement.ll test/CodeGen/X86/machine-cse.ll Message-ID: <20120807061646.77DE82A6C073@llvm.org> Author: mren Date: Tue Aug 7 01:16:46 2012 New Revision: 161396 URL: http://llvm.org/viewvc/llvm-project?rev=161396&view=rev Log: MachineCSE: Update the heuristics for isProfitableToCSE. If the result of a common subexpression is used at all uses of the candidate expression, CSE should not increase the live range of the common subexpression. rdar://11393714 and rdar://11819721 Modified: llvm/trunk/lib/CodeGen/MachineCSE.cpp llvm/trunk/test/CodeGen/X86/block-placement.ll llvm/trunk/test/CodeGen/X86/machine-cse.ll Modified: llvm/trunk/lib/CodeGen/MachineCSE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCSE.cpp?rev=161396&r1=161395&r2=161396&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineCSE.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineCSE.cpp Tue Aug 7 01:16:46 2012 @@ -324,6 +324,29 @@ MachineInstr *CSMI, MachineInstr *MI) { // FIXME: Heuristics that works around the lack the live range splitting. + // If CSReg is used at all uses of Reg, CSE should not increase register + // pressure of CSReg. + bool MayIncreasePressure = true; + if (TargetRegisterInfo::isVirtualRegister(CSReg) && + TargetRegisterInfo::isVirtualRegister(Reg)) { + MayIncreasePressure = false; + SmallPtrSet CSUses; + for (MachineRegisterInfo::use_nodbg_iterator I =MRI->use_nodbg_begin(CSReg), + E = MRI->use_nodbg_end(); I != E; ++I) { + MachineInstr *Use = &*I; + CSUses.insert(Use); + } + for (MachineRegisterInfo::use_nodbg_iterator I = MRI->use_nodbg_begin(Reg), + E = MRI->use_nodbg_end(); I != E; ++I) { + MachineInstr *Use = &*I; + if (!CSUses.count(Use)) { + MayIncreasePressure = true; + break; + } + } + } + if (!MayIncreasePressure) return true; + // Heuristics #1: Don't CSE "cheap" computation if the def is not local or in // an immediate predecessor. We don't want to increase register pressure and // end up causing other computation to be spilled. Modified: llvm/trunk/test/CodeGen/X86/block-placement.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=161396&r1=161395&r2=161396&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/block-placement.ll (original) +++ llvm/trunk/test/CodeGen/X86/block-placement.ll Tue Aug 7 01:16:46 2012 @@ -634,7 +634,7 @@ ; ; CHECK: test_unnatural_cfg_backwards_inner_loop ; CHECK: %entry -; CHECK: %body +; CHECK: [[BODY:# BB#[0-9]+]]: ; CHECK: %loop2b ; CHECK: %loop1 ; CHECK: %loop2a Modified: llvm/trunk/test/CodeGen/X86/machine-cse.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/machine-cse.ll?rev=161396&r1=161395&r2=161396&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/machine-cse.ll (original) +++ llvm/trunk/test/CodeGen/X86/machine-cse.ll Tue Aug 7 01:16:46 2012 @@ -99,3 +99,38 @@ %retval.0 = phi i32 [ 1, %entry ], [ %., %if.end ] ret i32 %retval.0 } + +; rdar://11393714 +define i8* @bsd_memchr(i8* %s, i32 %a, i32 %c, i64 %n) nounwind ssp { +; CHECK: %entry +; CHECK: xorl +; CHECK: %preheader +; CHECK: %do.body +; CHECK-NOT: xorl +; CHECK: %do.cond +; CHECK-NOT: xorl +; CHECK: %return +entry: + %cmp = icmp eq i64 %n, 0 + br i1 %cmp, label %return, label %preheader + +preheader: + %conv2 = and i32 %c, 255 + br label %do.body + +do.body: + %n.addr.0 = phi i64 [ %dec, %do.cond ], [ %n, %preheader ] + %p.0 = phi i8* [ %incdec.ptr, %do.cond ], [ %s, %preheader ] + %cmp3 = icmp eq i32 %a, %conv2 + br i1 %cmp3, label %return, label %do.cond + +do.cond: + %incdec.ptr = getelementptr inbounds i8* %p.0, i64 1 + %dec = add i64 %n.addr.0, -1 + %cmp6 = icmp eq i64 %dec, 0 + br i1 %cmp6, label %return, label %do.body + +return: + %retval.0 = phi i8* [ null, %entry ], [ null, %do.cond ], [ %p.0, %do.body ] + ret i8* %retval.0 +} From samsonov at google.com Tue Aug 7 01:22:33 2012 From: samsonov at google.com (Alexey Samsonov) Date: Tue, 7 Aug 2012 10:22:33 +0400 Subject: [llvm-commits] PATCH: Inserting LLVM code inside compiler-rt libraries In-Reply-To: References: <88FFE83D-1AE0-4BBF-84A7-D944EE805298@apple.com> Message-ID: On Mon, Aug 6, 2012 at 10:35 PM, Anna Zaks wrote: > > On Aug 6, 2012, at 10:46 AM, Chandler Carruth wrote: > > On Mon, Aug 6, 2012 at 10:29 AM, Anna Zaks wrote: > >> >> On Aug 2, 2012, at 11:09 AM, Chandler Carruth wrote: >> >> On Thu, Aug 2, 2012 at 10:59 AM, Alexey Samsonov wrote: >> >>> Hi, llvm-commits >>> >>> Here: http://codereview.appspot.com/6458066/ is the short experimental >>> FYI-patch that allows LLVM sources to be "compiled into" static compiler-rt >>> libraries in CMake build system. >>> >> >> Any plans on updating the autoconf+make build system as well? >> > > I cannot even read the makefiles of compiler-rt. I don't want to touch > them, and have encouraged others not to touch them as a consequence. I > think you'll need to talk to ddunbar, last time I complained about the poor > readability and maintainability of that make system he told me he would > just implement whatever we needed.... > > >> >> (I'm not sure that is smart enough to capture all dependencies, though). >>> With something that simple we can: >>> 1) directly use LLVM code from compiler-rt libraries. >>> 2) workaround the unavailable compilation of llvm libraries for several >>> targets: each static compiler-rt lib will contain its own private copy of >>> LLVM libs, compiled for necessary target and with necessary compile flags. >>> >> >> I've not looked at the patch yet, but some initial points... I'm a bit >> sad to start *another* thread, much of this was discussed in my RFC thread >> from some time ago, but here is a re-cap: >> >> >>> And there are multiple drawbacks: >>> 1) License issues (LLVM code has binary redistribution clause, right? So >>> everything built with "clang -faddress-sanitizer" would attribute LLVM >>> license, gr-r-r). >>> >> >> We are looking into fixing this, I'm fairly confident that in one form or >> another, this will largely be a temporary issue. Let's not discuss that to >> death here. >> >> >>> 2) Static ASan runtime is now 10x larger (2,5M vs 250K), while most of >>> its functionality (various stuff from LLVMSupport) is not needed. >>> >> >> This is simply poor structuring of the library, or misbehavior by the >> linker. We should figure out what's causing it and fix this. >> >> >>> 3) Symbol name clashes - suppose one want to build something with ASan >>> and link against "normal" version of LLVMSupport. (can compiling the code >>> with -fvisibility=hidden, as we currently do, help with this?) >>> >> >> -fvisibility=hidden won't help at all. >> >> This is what my RFC was about, specifically solving this problem. Perhaps >> we should actually go that route? ;] It keeps coming up, and there is a >> fairly direct solution that is a "small matter of code" to achieve. >> >> Does this direction look promising to you? >>> >> >> Yes. >> >> >>> Maybe, we should turn to using DSO instead? >>> >> >> We could in theory, but I was under the distinct impression that DSO-s >> were a non-starter for several different reasons: >> >> 1) Introduces complex rpath requirements into binaries, making >> distribution even harder. >> 2) Introduces small performance overhead into the runtime library in all >> cases... Maybe we could live with this though. >> 3) Introduces dramatic performance overhead into TLS for the runtime >> library, a likely deal-breaker for tsan. >> >> >> Suppose only LLVMSupport is pulled out into a separate DSO. Would the >> overhead be the same as making all of compiler-rt a separate dynamic >> library? If we only use it to symbolicate the trace after an error is hit, >> the performance overhead could be much smaller. >> > > This might work for asan, but my impression is it would not work for tsan. > There, we need to filter errors based on the symbolized backtrace, so it > won't just be in the error-path. > > > I ment: you hit a "possible" error, symbolicate it, and filter out if it's > blacklisted. It should be possible (at least in theory) not to require > symbolication on every memory access and hopefully the number of times you > hit a possible error is much smaller. That said, I did not look at how this > is actually implemented in TSan. > Yes, TSan needs symbolication only when it finds the actual data race. Still, overhead introduced by it is significant, and AFAIR TSan which uses addr2line symbolicator runs slower than TSan w/o any symbolication on large binaries (alas, I can't provide more specific data). > Also, this is a short term solution rather than a long term solution. We > will want to share more code further down the road, so I would like to > continue to push for a better long-term solution. > > >> >> >> To elaborate on #1 a bit, I'm not very enthusiastic about a strategy that >> *precludes* a statically linked binary from using the full runtime library. >> It also will limit the reach of asan on platforms which don't have a good >> DSO story or where it would be infeasible to get the DSO in place.... We >> have very real world use cases that fall into this category. >> >> >> The drawbacks of the DSO approach seem fundamental to the technology >> used. The drawbacks to the static library seem like solvable technical >> challenges we need to write some code to deal with. >> >> >> There is an advantage to using a dynamic library for compiler-rt on >> Darwin. To ensure there is only one copy of asan_init (and the data >> structures used by it) around, we link the compiler-rt library only into >> the executable. The current solution does not allow instrumenting a dynamic >> library (without instrumenting an executable as well). This is a major >> limitation and complicating the distribution(#1) seems like a reasonable >> price to pay at least for ASan, where the performance overhead should not >> be substantial. >> > > Sorry, I should have been more clear. > > I very much like preserving the ability to do *both* DSO and static > library. It's precluding either strategy that seems bad to me because, as > you point out, they both have their time, place, and purpose. As it > happens, if we can solve the problem for a statically linked runtime > library, I believe building a single DSO for the entire runtime will be > straight forward. > > > > > -- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120807/3ee25517/attachment.html From chandlerc at google.com Tue Aug 7 01:31:23 2012 From: chandlerc at google.com (Chandler Carruth) Date: Mon, 6 Aug 2012 23:31:23 -0700 Subject: [llvm-commits] Fix cmake for Hexagon cross compilers In-Reply-To: <1210CAEF-9314-4B85-8A44-7D224B0AD435@apple.com> References: <1210CAEF-9314-4B85-8A44-7D224B0AD435@apple.com> Message-ID: On Mon, Aug 6, 2012 at 11:16 PM, Douglas Gregor wrote: > > On Aug 6, 2012, at 1:11 PM, Sebastian Pop wrote: > > > Ping^4. > > > > Hi, I'm waiting for a month now for an OK to commit. > > It seems that really nobody except me cares for this change. > > Does it really matter to somebody if I'm pushing this change out to svn? > > > > How should I proceed in timeout cases like this? > > Patch looks good, please go ahead and commit. If this happens again, > please CC me. If I can't review the patch, I'll find someone who can. Sorry > about that! It's also largely my fault. I've been neglecting CMake patches. =/ Sebastian pinged me on IRC and I still didn't get to it. FWIW, the first patch makes perfect sense. The second patch I'm not as clear on... I feel like either: 1) We shouldn't build (or test) c-index-test and friends if they necessitate a static library and that isn't supported in the CMake configuration, or 2) We should link c-index-test and friends dynamically when explicitly requested to do so. I think I prefer #2. What do you think? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120806/b04c551c/attachment.html From chandlerc at google.com Tue Aug 7 03:01:28 2012 From: chandlerc at google.com (Chandler Carruth) Date: Tue, 7 Aug 2012 01:01:28 -0700 Subject: [llvm-commits] PATCH: [ASan] Add support for running unit tests by lit (as a part of 'make check-asan' command) In-Reply-To: References: Message-ID: Detailed comments in the codereview app... Generally this seems a good initial step. We still need to do some cleanup of the unittests and think more about the structure of the output tests (as we discussed in IRC) On Mon, Aug 6, 2012 at 1:37 AM, Alexey Samsonov wrote: > (ping) > > On Wed, Aug 1, 2012 at 5:51 PM, Alexey Samsonov wrote: > >> Hi! >> >> This patch adds the basic support for running ASan unit tests (compiled >> in a very hacky way) by llvm-lit tool, as a part of "make check-asan" >> command from build tree. >> Even though all tests are linked into a single "AsanTest" binary, they >> are sharded by llvm-lit tool and 119 tests pass in 6.47 seconds on my >> workstation (in 12 threads). >> The patch also disables ASan output tests (that use clang compiler from >> build tree) for cross-compilation. >> >> Code review: http://codereview.appspot.com/6454079/ >> >> -- >> Alexey Samsonov, MSK >> > > > > -- > Alexey Samsonov, MSK > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120807/c6c03434/attachment.html From samsonov at google.com Tue Aug 7 03:59:15 2012 From: samsonov at google.com (Alexey Samsonov) Date: Tue, 07 Aug 2012 08:59:15 -0000 Subject: [llvm-commits] [compiler-rt] r161406 - in /compiler-rt/trunk/lib: asan/lit_tests/CMakeLists.txt asan/lit_tests/Unit/ asan/lit_tests/Unit/lit.cfg asan/lit_tests/Unit/lit.site.cfg.in asan/lit_tests/lit.site.cfg.in asan/tests/CMakeLists.txt lit.common.unit.cfg Message-ID: <20120807085915.BDF1F2A6C073@llvm.org> Author: samsonov Date: Tue Aug 7 03:59:15 2012 New Revision: 161406 URL: http://llvm.org/viewvc/llvm-project?rev=161406&view=rev Log: [ASan] Add support for running unit tests by lit (as a part of 'make check-asan' command) Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in compiler-rt/trunk/lib/lit.common.unit.cfg Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt (original) +++ compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Tue Aug 7 03:59:15 2012 @@ -1,15 +1,39 @@ +set(ASAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) +set(ASAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg ) +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg + ) + set(ASAN_TEST_DEPS - clang clang-headers FileCheck count not clang-rt.asan-x86_64 clang-rt.asan-i386 ) +if(LLVM_INCLUDE_TESTS) + list(APPEND ASAN_TEST_DEPS AsanUnitTests) +endif() -add_lit_testsuite(check-asan "Running the AddressSanitizer tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${ASAN_TEST_DEPS} - ) -set_target_properties(check-asan PROPERTIES FOLDER "ASan tests") +if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}") + # Run ASan output tests only if we're not cross-compiling, + # and can be sure that clang would produce working binaries. + list(APPEND ASAN_TEST_DEPS + clang clang-headers FileCheck count not + ) + add_lit_testsuite(check-asan "Running the AddressSanitizer tests" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${ASAN_TEST_DEPS} + ) + set_target_properties(check-asan PROPERTIES FOLDER "ASan tests") +elseif(LLVM_INCLUDE_TESTS) + # Otherwise run only ASan unit tests. + add_lit_testsuite(check-asan "Running the AddressSanitizer unit tests" + ${CMAKE_CURRENT_BINARY_DIR}/Unit + DEPENDS ${ASAN_TEST_DEPS} + ) + set_target_properties(check-asan PROPERTIES FOLDER "ASan unit tests") +endif() Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg?rev=161406&view=auto ============================================================================== --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg (added) +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg Tue Aug 7 03:59:15 2012 @@ -0,0 +1,27 @@ +# -*- Python -*- + +import os + +def get_required_attr(config, attr_name): + attr_value = getattr(config, attr_name, None) + if not attr_value: + lit.fatal("No attribute %r in test configuration! You may need to run " + "tests from your build directory or add this attribute " + "to lit.site.cfg " % attr_name) + return attr_value + +# Setup attributes common for all compiler-rt projects. +llvm_src_root = get_required_attr(config, 'llvm_src_root') +compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects", + "compiler-rt", "lib", + "lit.common.unit.cfg") +lit.load_config(config, compiler_rt_lit_unit_cfg) + +# Setup config name. +config.name = 'AddressSanitizer-Unit' + +# Setup test source and exec root. For unit tests, we define +# it as build directory with ASan unit tests. +asan_binary_dir = get_required_attr(config, "asan_binary_dir") +config.test_exec_root = os.path.join(asan_binary_dir, "tests") +config.test_source_root = config.test_exec_root Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in?rev=161406&view=auto ============================================================================== --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in (added) +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in Tue Aug 7 03:59:15 2012 @@ -0,0 +1,10 @@ +## Autogenerated by LLVM/Clang configuration. +# Do not edit! + +config.target_triple = "@TARGET_TRIPLE@" +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.build_type = "@CMAKE_BUILD_TYPE@" +config.asan_binary_dir = "@ASAN_BINARY_DIR@" + +# Let the main config do the real work. +lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/Unit/lit.cfg") Modified: compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in?rev=161406&r1=161405&r2=161406&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in (original) +++ compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in Tue Aug 7 03:59:15 2012 @@ -6,4 +6,4 @@ config.clang = "@LLVM_BINARY_DIR@/bin/clang" # Let the main config do the real work. -lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg") +lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/lit.cfg") Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original) +++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Tue Aug 7 03:59:15 2012 @@ -47,10 +47,10 @@ -DASAN_UAR=0 ) -add_custom_target(AsanTests) -set_target_properties(AsanTests PROPERTIES FOLDER "ASan tests") +add_custom_target(AsanUnitTests) +set_target_properties(AsanUnitTests PROPERTIES FOLDER "ASan unit tests") function(add_asan_test testname) - add_unittest(AsanTests ${testname} ${ARGN}) + add_unittest(AsanUnitTests ${testname} ${ARGN}) if(LLVM_BUILD_32_BITS) target_link_libraries(${testname} clang_rt.asan-i386) else() Added: compiler-rt/trunk/lib/lit.common.unit.cfg URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lit.common.unit.cfg?rev=161406&view=auto ============================================================================== --- compiler-rt/trunk/lib/lit.common.unit.cfg (added) +++ compiler-rt/trunk/lib/lit.common.unit.cfg Tue Aug 7 03:59:15 2012 @@ -0,0 +1,21 @@ +# -*- Python -*- + +# Configuration file for 'lit' test runner. +# This file contains common config setup rules for unit tests in various +# compiler-rt testsuites. + +import os + +# Setup test format +build_type = getattr(config, "build_type", "Debug") +config.test_format = lit.formats.GoogleTest(build_type, "Test") + +# Setup test suffixes. +config.suffixes = [] + +# Propagate the temp directory. Windows requires this because it uses \Windows\ +# if none of these are present. +if 'TMP' in os.environ: + config.environment['TMP'] = os.environ['TMP'] +if 'TEMP' in os.environ: + config.environment['TEMP'] = os.environ['TEMP'] From chandlerc at google.com Tue Aug 7 04:22:28 2012 From: chandlerc at google.com (Chandler Carruth) Date: Tue, 7 Aug 2012 02:22:28 -0700 Subject: [llvm-commits] [compiler-rt] r161406 - in /compiler-rt/trunk/lib: asan/lit_tests/CMakeLists.txt asan/lit_tests/Unit/ asan/lit_tests/Unit/lit.cfg asan/lit_tests/Unit/lit.site.cfg.in asan/lit_tests/lit.site.cfg.in asan/tests/CMakeLists.txt lit.comm Message-ID: On Tue, Aug 7, 2012 at 1:59 AM, Alexey Samsonov wrote: > Author: samsonov > Date: Tue Aug 7 03:59:15 2012 > New Revision: 161406 > > URL: http://llvm.org/viewvc/llvm-project?rev=161406&view=rev > Log: > [ASan] Add support for running unit tests by lit (as a part of 'make > check-asan' command) > > Added: > compiler-rt/trunk/lib/asan/lit_tests/Unit/ > compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg > compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in > compiler-rt/trunk/lib/lit.common.unit.cfg > Modified: > compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt > compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in > compiler-rt/trunk/lib/asan/tests/CMakeLists.txt > > Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff > > ============================================================================== > --- compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt (original) > +++ compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Tue Aug 7 > 03:59:15 2012 > @@ -1,15 +1,39 @@ > +set(ASAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) > +set(ASAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) > + > configure_lit_site_cfg( > ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg > ) > > +configure_lit_site_cfg( > + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in > + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg > + ) > + > set(ASAN_TEST_DEPS > - clang clang-headers FileCheck count not > clang-rt.asan-x86_64 clang-rt.asan-i386 > I don't think you even need the runtime libraries... AsanUnitTests should bring everything it needs? > ) > +if(LLVM_INCLUDE_TESTS) > + list(APPEND ASAN_TEST_DEPS AsanUnitTests) > +endif() > > -add_lit_testsuite(check-asan "Running the AddressSanitizer tests" > - ${CMAKE_CURRENT_BINARY_DIR} > - DEPENDS ${ASAN_TEST_DEPS} > - ) > -set_target_properties(check-asan PROPERTIES FOLDER "ASan tests") > +if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}") > + # Run ASan output tests only if we're not cross-compiling, > + # and can be sure that clang would produce working binaries. > + list(APPEND ASAN_TEST_DEPS > + clang clang-headers FileCheck count not > + ) > + add_lit_testsuite(check-asan "Running the AddressSanitizer tests" > + ${CMAKE_CURRENT_BINARY_DIR} > + DEPENDS ${ASAN_TEST_DEPS} > + ) > + set_target_properties(check-asan PROPERTIES FOLDER "ASan tests") > +elseif(LLVM_INCLUDE_TESTS) > + # Otherwise run only ASan unit tests. > + add_lit_testsuite(check-asan "Running the AddressSanitizer unit tests" > + ${CMAKE_CURRENT_BINARY_DIR}/Unit > + DEPENDS ${ASAN_TEST_DEPS} > + ) > + set_target_properties(check-asan PROPERTIES FOLDER "ASan unit tests") > +endif() > > Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg > URL: > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg?rev=161406&view=auto > > ============================================================================== > --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg (added) > +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg Tue Aug 7 03:59:15 > 2012 > @@ -0,0 +1,27 @@ > +# -*- Python -*- > + > +import os > + > +def get_required_attr(config, attr_name): > + attr_value = getattr(config, attr_name, None) > + if not attr_value: > + lit.fatal("No attribute %r in test configuration! You may need to run > " > + "tests from your build directory or add this attribute " > + "to lit.site.cfg " % attr_name) > + return attr_value > + > +# Setup attributes common for all compiler-rt projects. > +llvm_src_root = get_required_attr(config, 'llvm_src_root') > +compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects", > + "compiler-rt", "lib", > + "lit.common.unit.cfg") > +lit.load_config(config, compiler_rt_lit_unit_cfg) > + > +# Setup config name. > +config.name = 'AddressSanitizer-Unit' > + > +# Setup test source and exec root. For unit tests, we define > +# it as build directory with ASan unit tests. > +asan_binary_dir = get_required_attr(config, "asan_binary_dir") > +config.test_exec_root = os.path.join(asan_binary_dir, "tests") > +config.test_source_root = config.test_exec_root > > Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in > URL: > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in?rev=161406&view=auto > > ============================================================================== > --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in (added) > +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in Tue Aug 7 > 03:59:15 2012 > @@ -0,0 +1,10 @@ > +## Autogenerated by LLVM/Clang configuration. > +# Do not edit! > + > +config.target_triple = "@TARGET_TRIPLE@" > +config.llvm_src_root = "@LLVM_SOURCE_DIR@" > +config.build_type = "@CMAKE_BUILD_TYPE@" > +config.asan_binary_dir = "@ASAN_BINARY_DIR@" > + > +# Let the main config do the real work. > +lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/Unit/lit.cfg") > > Modified: compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in > URL: > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in?rev=161406&r1=161405&r2=161406&view=diff > > ============================================================================== > --- compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in (original) > +++ compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in Tue Aug 7 > 03:59:15 2012 > @@ -6,4 +6,4 @@ > config.clang = "@LLVM_BINARY_DIR@/bin/clang" > > # Let the main config do the real work. > -lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg") > +lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/lit.cfg") > > Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff > > ============================================================================== > --- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original) > +++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Tue Aug 7 03:59:15 > 2012 > @@ -47,10 +47,10 @@ > -DASAN_UAR=0 > ) > > -add_custom_target(AsanTests) > -set_target_properties(AsanTests PROPERTIES FOLDER "ASan tests") > +add_custom_target(AsanUnitTests) > +set_target_properties(AsanUnitTests PROPERTIES FOLDER "ASan unit tests") > function(add_asan_test testname) > - add_unittest(AsanTests ${testname} ${ARGN}) > + add_unittest(AsanUnitTests ${testname} ${ARGN}) > if(LLVM_BUILD_32_BITS) > target_link_libraries(${testname} clang_rt.asan-i386) > else() > > Added: compiler-rt/trunk/lib/lit.common.unit.cfg > URL: > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lit.common.unit.cfg?rev=161406&view=auto > > ============================================================================== > --- compiler-rt/trunk/lib/lit.common.unit.cfg (added) > +++ compiler-rt/trunk/lib/lit.common.unit.cfg Tue Aug 7 03:59:15 2012 > @@ -0,0 +1,21 @@ > +# -*- Python -*- > + > +# Configuration file for 'lit' test runner. > +# This file contains common config setup rules for unit tests in various > +# compiler-rt testsuites. > + > +import os > + > +# Setup test format > +build_type = getattr(config, "build_type", "Debug") > +config.test_format = lit.formats.GoogleTest(build_type, "Test") > + > +# Setup test suffixes. > +config.suffixes = [] > + > +# Propagate the temp directory. Windows requires this because it uses > \Windows\ > +# if none of these are present. > +if 'TMP' in os.environ: > + config.environment['TMP'] = os.environ['TMP'] > +if 'TEMP' in os.environ: > + config.environment['TEMP'] = os.environ['TEMP'] > > > _______________________________________________ > 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/20120807/7d477fd2/attachment-0001.html From samsonov at google.com Tue Aug 7 04:31:33 2012 From: samsonov at google.com (Alexey Samsonov) Date: Tue, 7 Aug 2012 13:31:33 +0400 Subject: [llvm-commits] [compiler-rt] r161406 - in /compiler-rt/trunk/lib: asan/lit_tests/CMakeLists.txt asan/lit_tests/Unit/ asan/lit_tests/Unit/lit.cfg asan/lit_tests/Unit/lit.site.cfg.in asan/lit_tests/lit.site.cfg.in asan/tests/CMakeLists.txt lit.comm In-Reply-To: References: Message-ID: On Tue, Aug 7, 2012 at 1:22 PM, Chandler Carruth wrote: > On Tue, Aug 7, 2012 at 1:59 AM, Alexey Samsonov > wrote: > >> Author: samsonov >> Date: Tue Aug 7 03:59:15 2012 >> New Revision: 161406 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=161406&view=rev >> Log: >> [ASan] Add support for running unit tests by lit (as a part of 'make >> check-asan' command) >> >> Added: >> compiler-rt/trunk/lib/asan/lit_tests/Unit/ >> compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg >> compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in >> compiler-rt/trunk/lib/lit.common.unit.cfg >> Modified: >> compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt >> compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in >> compiler-rt/trunk/lib/asan/tests/CMakeLists.txt >> >> Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt >> URL: >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff >> >> ============================================================================== >> --- compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt (original) >> +++ compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Tue Aug 7 >> 03:59:15 2012 >> @@ -1,15 +1,39 @@ >> +set(ASAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) >> +set(ASAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) >> + >> configure_lit_site_cfg( >> ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >> ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg >> ) >> >> +configure_lit_site_cfg( >> + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in >> + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg >> + ) >> + >> set(ASAN_TEST_DEPS >> - clang clang-headers FileCheck count not >> clang-rt.asan-x86_64 clang-rt.asan-i386 >> > > I don't think you even need the runtime libraries... AsanUnitTests should > bring everything it needs? > Only if LLVM_INCLUDE_TESTS is set. > > >> ) >> +if(LLVM_INCLUDE_TESTS) >> + list(APPEND ASAN_TEST_DEPS AsanUnitTests) >> +endif() >> >> -add_lit_testsuite(check-asan "Running the AddressSanitizer tests" >> - ${CMAKE_CURRENT_BINARY_DIR} >> - DEPENDS ${ASAN_TEST_DEPS} >> - ) >> -set_target_properties(check-asan PROPERTIES FOLDER "ASan tests") >> +if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}") >> + # Run ASan output tests only if we're not cross-compiling, >> + # and can be sure that clang would produce working binaries. >> + list(APPEND ASAN_TEST_DEPS >> + clang clang-headers FileCheck count not >> + ) >> + add_lit_testsuite(check-asan "Running the AddressSanitizer tests" >> + ${CMAKE_CURRENT_BINARY_DIR} >> + DEPENDS ${ASAN_TEST_DEPS} >> + ) >> + set_target_properties(check-asan PROPERTIES FOLDER "ASan tests") >> +elseif(LLVM_INCLUDE_TESTS) >> + # Otherwise run only ASan unit tests. >> + add_lit_testsuite(check-asan "Running the AddressSanitizer unit tests" >> + ${CMAKE_CURRENT_BINARY_DIR}/Unit >> + DEPENDS ${ASAN_TEST_DEPS} >> + ) >> + set_target_properties(check-asan PROPERTIES FOLDER "ASan unit tests") >> +endif() >> >> Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg >> URL: >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg?rev=161406&view=auto >> >> ============================================================================== >> --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg (added) >> +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg Tue Aug 7 03:59:15 >> 2012 >> @@ -0,0 +1,27 @@ >> +# -*- Python -*- >> + >> +import os >> + >> +def get_required_attr(config, attr_name): >> + attr_value = getattr(config, attr_name, None) >> + if not attr_value: >> + lit.fatal("No attribute %r in test configuration! You may need to >> run " >> + "tests from your build directory or add this attribute " >> + "to lit.site.cfg " % attr_name) >> + return attr_value >> + >> +# Setup attributes common for all compiler-rt projects. >> +llvm_src_root = get_required_attr(config, 'llvm_src_root') >> +compiler_rt_lit_unit_cfg = os.path.join(llvm_src_root, "projects", >> + "compiler-rt", "lib", >> + "lit.common.unit.cfg") >> +lit.load_config(config, compiler_rt_lit_unit_cfg) >> + >> +# Setup config name. >> +config.name = 'AddressSanitizer-Unit' >> + >> +# Setup test source and exec root. For unit tests, we define >> +# it as build directory with ASan unit tests. >> +asan_binary_dir = get_required_attr(config, "asan_binary_dir") >> +config.test_exec_root = os.path.join(asan_binary_dir, "tests") >> +config.test_source_root = config.test_exec_root >> >> Added: compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in >> URL: >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in?rev=161406&view=auto >> >> ============================================================================== >> --- compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in (added) >> +++ compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in Tue Aug 7 >> 03:59:15 2012 >> @@ -0,0 +1,10 @@ >> +## Autogenerated by LLVM/Clang configuration. >> +# Do not edit! >> + >> +config.target_triple = "@TARGET_TRIPLE@" >> +config.llvm_src_root = "@LLVM_SOURCE_DIR@" >> +config.build_type = "@CMAKE_BUILD_TYPE@" >> +config.asan_binary_dir = "@ASAN_BINARY_DIR@" >> + >> +# Let the main config do the real work. >> +lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/Unit/lit.cfg") >> >> Modified: compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in >> URL: >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in?rev=161406&r1=161405&r2=161406&view=diff >> >> ============================================================================== >> --- compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in (original) >> +++ compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in Tue Aug 7 >> 03:59:15 2012 >> @@ -6,4 +6,4 @@ >> config.clang = "@LLVM_BINARY_DIR@/bin/clang" >> >> # Let the main config do the real work. >> -lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg") >> +lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/lit.cfg") >> >> Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt >> URL: >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff >> >> ============================================================================== >> --- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original) >> +++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Tue Aug 7 03:59:15 >> 2012 >> @@ -47,10 +47,10 @@ >> -DASAN_UAR=0 >> ) >> >> -add_custom_target(AsanTests) >> -set_target_properties(AsanTests PROPERTIES FOLDER "ASan tests") >> +add_custom_target(AsanUnitTests) >> +set_target_properties(AsanUnitTests PROPERTIES FOLDER "ASan unit tests") >> function(add_asan_test testname) >> - add_unittest(AsanTests ${testname} ${ARGN}) >> + add_unittest(AsanUnitTests ${testname} ${ARGN}) >> if(LLVM_BUILD_32_BITS) >> target_link_libraries(${testname} clang_rt.asan-i386) >> else() >> >> Added: compiler-rt/trunk/lib/lit.common.unit.cfg >> URL: >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lit.common.unit.cfg?rev=161406&view=auto >> >> ============================================================================== >> --- compiler-rt/trunk/lib/lit.common.unit.cfg (added) >> +++ compiler-rt/trunk/lib/lit.common.unit.cfg Tue Aug 7 03:59:15 2012 >> @@ -0,0 +1,21 @@ >> +# -*- Python -*- >> + >> +# Configuration file for 'lit' test runner. >> +# This file contains common config setup rules for unit tests in various >> +# compiler-rt testsuites. >> + >> +import os >> + >> +# Setup test format >> +build_type = getattr(config, "build_type", "Debug") >> +config.test_format = lit.formats.GoogleTest(build_type, "Test") >> + >> +# Setup test suffixes. >> +config.suffixes = [] >> + >> +# Propagate the temp directory. Windows requires this because it uses >> \Windows\ >> +# if none of these are present. >> +if 'TMP' in os.environ: >> + config.environment['TMP'] = os.environ['TMP'] >> +if 'TEMP' in os.environ: >> + config.environment['TEMP'] = os.environ['TEMP'] >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > -- Alexey Samsonov, MSK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120807/ed6c49f4/attachment.html From chandlerc at google.com Tue Aug 7 04:42:18 2012 From: chandlerc at google.com (Chandler Carruth) Date: Tue, 7 Aug 2012 02:42:18 -0700 Subject: [llvm-commits] [compiler-rt] r161406 - in /compiler-rt/trunk/lib: asan/lit_tests/CMakeLists.txt asan/lit_tests/Unit/ asan/lit_tests/Unit/lit.cfg asan/lit_tests/Unit/lit.site.cfg.in asan/lit_tests/lit.site.cfg.in asan/tests/CMakeLists.txt lit.comm In-Reply-To: References: Message-ID: On Tue, Aug 7, 2012 at 2:31 AM, Alexey Samsonov wrote: > > > On Tue, Aug 7, 2012 at 1:22 PM, Chandler Carruth > wrote: > > On Tue, Aug 7, 2012 at 1:59 AM, Alexey Samsonov >> wrote: >> >>> Author: samsonov >>> Date: Tue Aug 7 03:59:15 2012 >>> New Revision: 161406 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=161406&view=rev >>> Log: >>> [ASan] Add support for running unit tests by lit (as a part of 'make >>> check-asan' command) >>> >>> Added: >>> compiler-rt/trunk/lib/asan/lit_tests/Unit/ >>> compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.cfg >>> compiler-rt/trunk/lib/asan/lit_tests/Unit/lit.site.cfg.in >>> compiler-rt/trunk/lib/lit.common.unit.cfg >>> Modified: >>> compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt >>> compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in >>> compiler-rt/trunk/lib/asan/tests/CMakeLists.txt >>> >>> Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt >>> URL: >>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt?rev=161406&r1=161405&r2=161406&view=diff >>> >>> ============================================================================== >>> --- compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt (original) >>> +++ compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Tue Aug 7 >>> 03:59:15 2012 >>> @@ -1,15 +1,39 @@ >>> +set(ASAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) >>> +set(ASAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) >>> + >>> configure_lit_site_cfg( >>> ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >>> ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg >>> ) >>> >>> +configure_lit_site_cfg( >>> + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in >>> + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg >>> + ) >>> + >>> set(ASAN_TEST_DEPS >>> - clang clang-headers FileCheck count not >>> clang-rt.asan-x86_64 clang-rt.asan-i386 >>> >> >> I don't think you even need the runtime libraries... AsanUnitTests should >> bring everything it needs? >> > > Only if LLVM_INCLUDE_TESTS is set. > Sorry, I was trying to suggest sinking the libraries down to where you add clang, clang-headers, etc... Not removing them completely. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120807/5b17cfd8/attachment.html From chandlerc at gmail.com Tue Aug 7 04:45:24 2012 From: chandlerc at gmail.com (Chandler Carruth) Date: Tue, 07 Aug 2012 09:45:24 -0000 Subject: [llvm-commits] [llvm] r161409 - in /llvm/trunk: lib/CodeGen/MachineBlockPlacement.cpp test/CodeGen/X86/2008-10-27-CoalescerBug.ll test/CodeGen/X86/block-placement.ll test/CodeGen/X86/loop-blocks.ll test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll Message-ID: <20120807094524.EA5DA2A6C073@llvm.org> Author: chandlerc Date: Tue Aug 7 04:45:24 2012 New Revision: 161409 URL: http://llvm.org/viewvc/llvm-project?rev=161409&view=rev Log: Add a much more conservative strategy for aligning branch targets. Previously, MBP essentially aligned every branch target it could. This bloats code quite a bit, especially non-looping code which has no real reason to prefer aligned branch targets so heavily. As Andy said in review, it's still a bit odd to do this without a real cost model, but this at least has much more plausible heuristics. Fixes PR13265. Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll llvm/trunk/test/CodeGen/X86/block-placement.ll llvm/trunk/test/CodeGen/X86/loop-blocks.ll llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=161409&r1=161408&r2=161409&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Tue Aug 7 04:45:24 2012 @@ -1011,29 +1011,63 @@ // Walk through the backedges of the function now that we have fully laid out // the basic blocks and align the destination of each backedge. We don't rely - // on the loop info here so that we can align backedges in unnatural CFGs and - // backedges that were introduced purely because of the loop rotations done - // during this layout pass. - // FIXME: This isn't quite right, we shouldn't align backedges that result - // from blocks being sunken below the exit block for the function. + // exclusively on the loop info here so that we can align backedges in + // unnatural CFGs and backedges that were introduced purely because of the + // loop rotations done during this layout pass. if (F.getFunction()->hasFnAttr(Attribute::OptimizeForSize)) return; unsigned Align = TLI->getPrefLoopAlignment(); if (!Align) return; // Don't care about loop alignment. + if (FunctionChain.begin() == FunctionChain.end()) + return; // Empty chain. - SmallPtrSet PreviousBlocks; - for (BlockChain::iterator BI = FunctionChain.begin(), + const BranchProbability ColdProb(1, 5); // 20% + BlockFrequency EntryFreq = MBFI->getBlockFreq(F.begin()); + BlockFrequency WeightedEntryFreq = EntryFreq * ColdProb; + for (BlockChain::iterator BI = llvm::next(FunctionChain.begin()), BE = FunctionChain.end(); BI != BE; ++BI) { - PreviousBlocks.insert(*BI); - // Set alignment on the destination of all the back edges in the new - // ordering. - for (MachineBasicBlock::succ_iterator SI = (*BI)->succ_begin(), - SE = (*BI)->succ_end(); - SI != SE; ++SI) - if (PreviousBlocks.count(*SI)) - (*SI)->setAlignment(Align); + // Don't align non-looping basic blocks. These are unlikely to execute + // enough times to matter in practice. Note that we'll still handle + // unnatural CFGs inside of a natural outer loop (the common case) and + // rotated loops. + MachineLoop *L = MLI->getLoopFor(*BI); + if (!L) + continue; + + // If the block is cold relative to the function entry don't waste space + // aligning it. + BlockFrequency Freq = MBFI->getBlockFreq(*BI); + if (Freq < WeightedEntryFreq) + continue; + + // If the block is cold relative to its loop header, don't align it + // regardless of what edges into the block exist. + MachineBasicBlock *LoopHeader = L->getHeader(); + BlockFrequency LoopHeaderFreq = MBFI->getBlockFreq(LoopHeader); + if (Freq < (LoopHeaderFreq * ColdProb)) + continue; + + // Check for the existence of a non-layout predecessor which would benefit + // from aligning this block. + MachineBasicBlock *LayoutPred = *llvm::prior(BI); + + // Force alignment if all the predecessors are jumps. We already checked + // that the block isn't cold above. + if (!LayoutPred->isSuccessor(*BI)) { + (*BI)->setAlignment(Align); + continue; + } + + // Align this block if the layout predecessor's edge into this block is + // cold relative to the block. When this is true, othe predecessors make up + // all of the hot entries into the block and thus alignment is likely to be + // important. + BranchProbability LayoutProb = MBPI->getEdgeProbability(LayoutPred, *BI); + BlockFrequency LayoutEdgeFreq = MBFI->getBlockFreq(LayoutPred) * LayoutProb; + if (LayoutEdgeFreq <= (Freq * ColdProb)) + (*BI)->setAlignment(Align); } } Modified: llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll?rev=161409&r1=161408&r2=161409&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-10-27-CoalescerBug.ll Tue Aug 7 04:45:24 2012 @@ -17,8 +17,7 @@ ; CHECK: %bb30.loopexit ; CHECK: divsd %xmm0 ; CHECK: movsd %xmm0, 16(%esp) -; CHECK: .align -; CHECK-NEXT: %bb3 +; CHECK: %bb3 bb3: ; preds = %bb30.loopexit, %bb25, %bb3 %2 = load i32* null, align 4 ; [#uses=1] %3 = mul i32 %2, 0 ; [#uses=1] Modified: llvm/trunk/test/CodeGen/X86/block-placement.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=161409&r1=161408&r2=161409&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/block-placement.ll (original) +++ llvm/trunk/test/CodeGen/X86/block-placement.ll Tue Aug 7 04:45:24 2012 @@ -7,10 +7,15 @@ ; that is not expected to run. ; CHECK: test_ifchains: ; CHECK: %entry +; CHECK-NOT: .align ; CHECK: %else1 +; CHECK-NOT: .align ; CHECK: %else2 +; CHECK-NOT: .align ; CHECK: %else3 +; CHECK-NOT: .align ; CHECK: %else4 +; CHECK-NOT: .align ; CHECK: %exit ; CHECK: %then1 ; CHECK: %then2 @@ -76,8 +81,11 @@ ; Check that we sink cold loop blocks after the hot loop body. ; CHECK: test_loop_cold_blocks: ; CHECK: %entry +; CHECK-NOT: .align ; CHECK: %unlikely1 +; CHECK-NOT: .align ; CHECK: %unlikely2 +; CHECK: .align ; CHECK: %body1 ; CHECK: %body2 ; CHECK: %body3 Modified: llvm/trunk/test/CodeGen/X86/loop-blocks.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/loop-blocks.ll?rev=161409&r1=161408&r2=161409&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/loop-blocks.ll (original) +++ llvm/trunk/test/CodeGen/X86/loop-blocks.ll Tue Aug 7 04:45:24 2012 @@ -41,7 +41,6 @@ ; CHECK-NEXT: align ; CHECK-NEXT: .LBB1_4: ; CHECK-NEXT: callq bar99 -; CHECK-NEXT: align ; CHECK-NEXT: .LBB1_1: ; CHECK-NEXT: callq body @@ -79,7 +78,6 @@ ; CHECK-NEXT: .LBB2_5: ; CHECK-NEXT: callq block_a_true_func ; CHECK-NEXT: callq block_a_merge_func -; CHECK-NEXT: align ; CHECK-NEXT: .LBB2_1: ; CHECK-NEXT: callq body ; @@ -139,13 +137,13 @@ ; CHECK-NEXT: align ; CHECK-NEXT: .LBB3_7: ; CHECK-NEXT: callq bar100 -; CHECK-NEXT: align ; CHECK-NEXT: .LBB3_1: ; CHECK-NEXT: callq loop_header ; CHECK: jl .LBB3_7 ; CHECK: jge .LBB3_3 ; CHECK-NEXT: callq bar101 ; CHECK-NEXT: jmp .LBB3_1 +; CHECK-NEXT: align ; CHECK-NEXT: .LBB3_3: ; CHECK: jge .LBB3_4 ; CHECK-NEXT: callq bar102 Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll?rev=161409&r1=161408&r2=161409&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll (original) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll Tue Aug 7 04:45:24 2012 @@ -99,7 +99,6 @@ ; CHECK: %for.body3.lr.ph.us.i.loopexit ; CHECK-NEXT: in Loop: Header ; CHECK-NEXT: incq -; CHECK-NEXT: .align ; CHECK-NEXT: %for.body3.us.i ; CHECK-NEXT: Inner Loop ; CHECK: testb From chandlerc at gmail.com Tue Aug 7 04:54:27 2012 From: chandlerc at gmail.com (Chandler Carruth) Date: Tue, 7 Aug 2012 02:54:27 -0700 Subject: [llvm-commits] PATCH: Change the strategy for aligning branch targets during MachineBlockPlacement In-Reply-To: <49BD35BD-3F1E-4F22-B5EA-B182DA2663B1@apple.com> References: <49BD35BD-3F1E-4F22-B5EA-B182DA2663B1@apple.com> Message-ID: FYI, I finally got back around to this and committed it in r161409. I implemented the heuristic you suggested of never aligning blocks once they are cold relative to the function entry, that makes perfect sense. I've kept the LoopInfo-based logic as I think it's a nice simple way to reason about what the right strategy is, and we already are using LoopInfo if we do block placement at all, so we might as well re-use that data.... Let me know if you have any other thoughts on this, I'm happy to keep tweaking or poking it until its right. Also let me know if you see and perf regressions that seem likely related. On Mon, Jul 23, 2012 at 8:34 PM, Andrew Trick wrote: > On Jul 16, 2012, at 6:24 AM, Chandler Carruth wrote: > > Attached is a patch that instead walks the blocks and considers various > aspects of the layout and the probabilities to decide whether aligning the > block is likely to be profitable. It uses completely arbitrary heuristics > which happen to produce results similar to the previous results, but with > specific fixes to obviously ridiculous alignment such as reported in the PR. > > It errs slightly in the direction of aligning fewer branch targets. To my > mind this is the correct slant because alignment introduces significant > code bloat and Agners tells me to be very judicious in aligning things as > it rarely makes a large difference. If anything, I'd like to make this > *more* conservative, but I'd rather take baby steps. > > Does this initial step look good? > > Thoughts about how far to go here? I have a follow-up patch that makes the > whole thing tunable with a commandline flag. I can apply that and run some > in depth benchmarks, but I suspect that the patch as-is already represents > a strict improvement over the status quo... > -Chandler > > > This looks like a good improvement. I'm not used to determining alignment > without knowing instruction sizes and the actual alignment cost... But your > approach makes sense. > > + // If the block is cold relative to its loop header, don't align it > + // regardless of what edges into the block exist. > > What if it's cold relative to its outer loop, or parent function? Cold > code can have nested loops. If you can get away with frequency relative to > function entry and layout predecessor, then you don't need LoopInfo here. > > -Andy > > _______________________________________________ > 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/20120807/7cc3bc83/attachment.html From chandlerc at gmail.com Tue Aug 7 05:59:59 2012 From: chandlerc at gmail.com (Chandler Carruth) Date: Tue, 07 Aug 2012 10:59:59 -0000 Subject: [llvm-commits] [llvm] r161410 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/Inline/inline_constprop.ll Message-ID: <20120807105959.4C0842A6C073@llvm.org> Author: chandlerc Date: Tue Aug 7 05:59:59 2012 New Revision: 161410 URL: http://llvm.org/viewvc/llvm-project?rev=161410&view=rev Log: Fix PR13412, a nasty miscompile due to the interleaved instsimplify+inline strategy. The crux of the problem is that instsimplify was reasonably relying on an invariant that is true within any single function, but is no longer true mid-inline the way we use it. This invariant is that an argument pointer != a local (alloca) pointer. The fix is really light weight though, and allows instsimplify to be resiliant to these situations: when checking the relation ships to function arguments, ensure that the argumets come from the same function. If they come from different functions, then none of these assumptions hold. All credit to Benjamin Kramer for coming up with this clever solution to the problem. Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp llvm/trunk/test/Transforms/Inline/inline_constprop.ll Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=161410&r1=161409&r2=161410&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original) +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Tue Aug 7 05:59:59 2012 @@ -1719,10 +1719,13 @@ return ConstantInt::get(ITy, false); // A local identified object (alloca or noalias call) can't equal any - // incoming argument, unless they're both null. - if (isa(LHSPtr) && isa(RHSPtr) && - Pred == CmpInst::ICMP_EQ) - return ConstantInt::get(ITy, false); + // incoming argument, unless they're both null or they belong to + // different functions. The latter happens during inlining. + if (Instruction *LHSInst = dyn_cast(LHSPtr)) + if (Argument *RHSArg = dyn_cast(RHSPtr)) + if (LHSInst->getParent()->getParent() == RHSArg->getParent() && + Pred == CmpInst::ICMP_EQ) + return ConstantInt::get(ITy, false); } // Assume that the constant null is on the right. @@ -1732,14 +1735,17 @@ else if (Pred == CmpInst::ICMP_NE) return ConstantInt::get(ITy, true); } - } else if (isa(LHSPtr)) { + } else if (Argument *LHSArg = dyn_cast(LHSPtr)) { RHSPtr = RHSPtr->stripInBoundsOffsets(); - // An alloca can't be equal to an argument. - if (isa(RHSPtr)) { - if (Pred == CmpInst::ICMP_EQ) - return ConstantInt::get(ITy, false); - else if (Pred == CmpInst::ICMP_NE) - return ConstantInt::get(ITy, true); + // An alloca can't be equal to an argument unless they come from separate + // functions via inlining. + if (AllocaInst *RHSInst = dyn_cast(RHSPtr)) { + if (LHSArg->getParent() == RHSInst->getParent()->getParent()) { + if (Pred == CmpInst::ICMP_EQ) + return ConstantInt::get(ITy, false); + else if (Pred == CmpInst::ICMP_NE) + return ConstantInt::get(ITy, true); + } } } Modified: llvm/trunk/test/Transforms/Inline/inline_constprop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/inline_constprop.ll?rev=161410&r1=161409&r2=161410&view=diff ============================================================================== --- llvm/trunk/test/Transforms/Inline/inline_constprop.ll (original) +++ llvm/trunk/test/Transforms/Inline/inline_constprop.ll Tue Aug 7 05:59:59 2012 @@ -110,3 +110,65 @@ bb.false: ret i32 %sub } + + +define i32 @PR13412.main() { +; This is a somewhat complicated three layer subprogram that was reported to +; compute the wrong value for a branch due to assuming that an argument +; mid-inline couldn't be equal to another pointer. +; +; After inlining, the branch should point directly to the exit block, not to +; the intermediate block. +; CHECK: @PR13412.main +; CHECK: br i1 true, label %[[TRUE_DEST:.*]], label %[[FALSE_DEST:.*]] +; CHECK: [[FALSE_DEST]]: +; CHECK-NEXT: call void @PR13412.fail() +; CHECK: [[TRUE_DEST]]: +; CHECK-NEXT: ret i32 0 + +entry: + %i1 = alloca i64 + store i64 0, i64* %i1 + %arraydecay = bitcast i64* %i1 to i32* + %call = call i1 @PR13412.first(i32* %arraydecay, i32* %arraydecay) + br i1 %call, label %cond.end, label %cond.false + +cond.false: + call void @PR13412.fail() + br label %cond.end + +cond.end: + ret i32 0 +} + +define internal i1 @PR13412.first(i32* %a, i32* %b) { +entry: + %call = call i32* @PR13412.second(i32* %a, i32* %b) + %cmp = icmp eq i32* %call, %b + ret i1 %cmp +} + +declare void @PR13412.fail() + +define internal i32* @PR13412.second(i32* %a, i32* %b) { +entry: + %sub.ptr.lhs.cast = ptrtoint i32* %b to i64 + %sub.ptr.rhs.cast = ptrtoint i32* %a to i64 + %sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast + %sub.ptr.div = ashr exact i64 %sub.ptr.sub, 2 + %cmp = icmp ugt i64 %sub.ptr.div, 1 + br i1 %cmp, label %if.then, label %if.end3 + +if.then: + %0 = load i32* %a + %1 = load i32* %b + %cmp1 = icmp eq i32 %0, %1 + br i1 %cmp1, label %return, label %if.end3 + +if.end3: + br label %return + +return: + %retval.0 = phi i32* [ %b, %if.end3 ], [ %a, %if.then ] + ret i32* %retval.0 +} From samsonov at google.com Tue Aug 7 06:00:19 2012 From: samsonov at google.com (Alexey Samsonov) Date: Tue, 07 Aug 2012 11:00:19 -0000 Subject: [llvm-commits] [compiler-rt] r161411 - in /compiler-rt/trunk/lib: asan/lit_tests/lit.site.cfg.in lit.common.cfg Message-ID: <20120807110019.9CEA22A6C073@llvm.org> Author: samsonov Date: Tue Aug 7 06:00:19 2012 New Revision: 161411 URL: http://llvm.org/viewvc/llvm-project?rev=161411&view=rev Log: [ASan] add llvm_tools_dir to lit.site.cfg for ASan and add it to PATH Modified: compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in compiler-rt/trunk/lib/lit.common.cfg Modified: compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in?rev=161411&r1=161410&r2=161411&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in (original) +++ compiler-rt/trunk/lib/asan/lit_tests/lit.site.cfg.in Tue Aug 7 06:00:19 2012 @@ -3,7 +3,16 @@ config.target_triple = "@TARGET_TRIPLE@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.clang = "@LLVM_BINARY_DIR@/bin/clang" +# LLVM tools dir can be passed in lit parameters, so try to +# apply substitution. +try: + config.llvm_tools_dir = config.llvm_tools_dir % lit.params +except KeyError,e: + key, = e.args + lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key)) + # Let the main config do the real work. lit.load_config(config, "@ASAN_SOURCE_DIR@/lit_tests/lit.cfg") Modified: compiler-rt/trunk/lib/lit.common.cfg URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lit.common.cfg?rev=161411&r1=161410&r2=161411&view=diff ============================================================================== --- compiler-rt/trunk/lib/lit.common.cfg (original) +++ compiler-rt/trunk/lib/lit.common.cfg Tue Aug 7 06:00:19 2012 @@ -35,6 +35,13 @@ if name in config.environment: del config.environment[name] +# Tweak PATH to include llvm tools dir. +llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) +if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)): + lit.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir) +path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) +config.environment['PATH'] = path + # Define %clang substitution to use in test RUN lines. config.substitutions.append( ("%clang ", (" " + config.clang + " ")) ) From samsonov at google.com Tue Aug 7 06:09:41 2012 From: samsonov at google.com (Alexey Samsonov) Date: Tue, 07 Aug 2012 11:09:41 -0000 Subject: [llvm-commits] [compiler-rt] r161412 - /compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Message-ID: <20120807110941.F1CFD2A6C073@llvm.org> Author: samsonov Date: Tue Aug 7 06:09:41 2012 New Revision: 161412 URL: http://llvm.org/viewvc/llvm-project?rev=161412&view=rev Log: [ASan] simplify cmake rules for adding lit testsuites Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Modified: compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt?rev=161412&r1=161411&r2=161412&view=diff ============================================================================== --- compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt (original) +++ compiler-rt/trunk/lib/asan/lit_tests/CMakeLists.txt Tue Aug 7 06:09:41 2012 @@ -11,19 +11,16 @@ ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg ) -set(ASAN_TEST_DEPS - clang-rt.asan-x86_64 clang-rt.asan-i386 - ) -if(LLVM_INCLUDE_TESTS) - list(APPEND ASAN_TEST_DEPS AsanUnitTests) -endif() - if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}") # Run ASan output tests only if we're not cross-compiling, # and can be sure that clang would produce working binaries. - list(APPEND ASAN_TEST_DEPS + set(ASAN_TEST_DEPS clang clang-headers FileCheck count not + clang-rt.asan-x86_64 clang-rt.asan-i386 ) + if(LLVM_INCLUDE_TESTS) + list(APPEND ASAN_TEST_DEPS AsanUnitTests) + endif() add_lit_testsuite(check-asan "Running the AddressSanitizer tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${ASAN_TEST_DEPS} @@ -33,7 +30,7 @@ # Otherwise run only ASan unit tests. add_lit_testsuite(check-asan "Running the AddressSanitizer unit tests" ${CMAKE_CURRENT_BINARY_DIR}/Unit - DEPENDS ${ASAN_TEST_DEPS} + DEPENDS AsanUnitTests ) set_target_properties(check-asan PROPERTIES FOLDER "ASan unit tests") endif() From benny.kra at googlemail.com Tue Aug 7 06:13:19 2012 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Tue, 07 Aug 2012 11:13:19 -0000 Subject: [llvm-commits] [llvm] r161413 - in /llvm/trunk: lib/Analysis/InlineCost.cpp test/Transforms/Inline/inline-byval-bonus.ll Message-ID: <20120807111319.7F79F2A6C073@llvm.org> Author: d0k Date: Tue Aug 7 06:13:19 2012 New Revision: 161413 URL: http://llvm.org/viewvc/llvm-project?rev=161413&view=rev Log: PR13095: Give an inline cost bonus to functions using byval arguments. We give a bonus for every argument because the argument setup is not needed anymore when the function is inlined. With this patch we interpret byval arguments as a compact representation of many arguments. The byval argument setup is implemented in the backend as an inline memcpy, so to model the cost as accurately as possible we take the number of pointer-sized elements in the byval argument and give a bonus of 2 instructions for every one of those. The bonus is capped at 8 elements, which is the number of stores at which the x86 backend switches from an expanded inline memcpy to a real memcpy. It would be better to use the real memcpy threshold from the backend, but it's not available via TargetData. This change brings the performance of c-ray in line with gcc 4.7. The included test case tries to reproduce the c-ray problem to catch regressions for this benchmark early, its performance is dominated by the inline decision of a specific call. This only has a small impact on most code, more on x86 and arm than on x86_64 due to the way the ABI works. When building LLVM for x86 it gives a small inline cost boost to virtually any function using StringRef or STL allocators, but only a 0.01% increase in overall binary size. The size of gcc compiled by clang actually shrunk by a couple bytes with this patch applied, but not significantly. Added: llvm/trunk/test/Transforms/Inline/inline-byval-bonus.ll Modified: llvm/trunk/lib/Analysis/InlineCost.cpp Modified: llvm/trunk/lib/Analysis/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=161413&r1=161412&r2=161413&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InlineCost.cpp (original) +++ llvm/trunk/lib/Analysis/InlineCost.cpp Tue Aug 7 06:13:19 2012 @@ -797,9 +797,33 @@ FiftyPercentVectorBonus = Threshold; TenPercentVectorBonus = Threshold / 2; - // Subtract off one instruction per call argument as those will be free after - // inlining. - Cost -= CS.arg_size() * InlineConstants::InstrCost; + // Give out bonuses per argument, as the instructions setting them up will + // be gone after inlining. + for (unsigned I = 0, E = CS.arg_size(); I != E; ++I) { + if (TD && CS.isByValArgument(I)) { + // We approximate the number of loads and stores needed by dividing the + // size of the byval type by the target's pointer size. + PointerType *PTy = cast(CS.getArgument(I)->getType()); + unsigned TypeSize = TD->getTypeSizeInBits(PTy->getElementType()); + unsigned PointerSize = TD->getPointerSizeInBits(); + // Ceiling division. + unsigned NumStores = (TypeSize + PointerSize - 1) / PointerSize; + + // If it generates more than 8 stores it is likely to be expanded as an + // inline memcpy so we take that as an upper bound. Otherwise we assume + // one load and one store per word copied. + // FIXME: The maxStoresPerMemcpy setting from the target should be used + // here instead of a magic number of 8, but it's not available via + // TargetData. + NumStores = std::min(NumStores, 8U); + + Cost -= 2 * NumStores * InlineConstants::InstrCost; + } else { + // For non-byval arguments subtract off one instruction per call + // argument. + Cost -= InlineConstants::InstrCost; + } + } // If there is only one call of the function, and it has internal linkage, // the cost of inlining it drops dramatically. Added: llvm/trunk/test/Transforms/Inline/inline-byval-bonus.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/inline-byval-bonus.ll?rev=161413&view=auto ============================================================================== --- llvm/trunk/test/Transforms/Inline/inline-byval-bonus.ll (added) +++ llvm/trunk/test/Transforms/Inline/inline-byval-bonus.ll Tue Aug 7 06:13:19 2012 @@ -0,0 +1,193 @@ +; RUN: opt -S -inline -inline-threshold=275 < %s | FileCheck %s +; PR13095 + +; The performance of the c-ray benchmark largely depends on the inlining of a +; specific call to @ray_sphere. This test case is designed to verify that it's +; inlined at -O3. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.8.0" + +%struct.sphere = type { %struct.vec3, double, %struct.material, %struct.sphere* } +%struct.vec3 = type { double, double, double } +%struct.material = type { %struct.vec3, double, double } +%struct.ray = type { %struct.vec3, %struct.vec3 } +%struct.spoint = type { %struct.vec3, %struct.vec3, %struct.vec3, double } + +define i32 @caller(%struct.sphere* %i) { + %shadow_ray = alloca %struct.ray, align 8 + call void @fix(%struct.ray* %shadow_ray) + + %call = call i32 @ray_sphere(%struct.sphere* %i, %struct.ray* byval align 8 %shadow_ray, %struct.spoint* null) + ret i32 %call + +; CHECK: @caller +; CHECK-NOT: call i32 @ray_sphere +; CHECK: ret i32 +} + +declare void @fix(%struct.ray*) + +define i32 @ray_sphere(%struct.sphere* nocapture %sph, %struct.ray* nocapture byval align 8 %ray, %struct.spoint* %sp) nounwind uwtable ssp { + %1 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 1, i32 0 + %2 = load double* %1, align 8 + %3 = fmul double %2, %2 + %4 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 1, i32 1 + %5 = load double* %4, align 8 + %6 = fmul double %5, %5 + %7 = fadd double %3, %6 + %8 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 1, i32 2 + %9 = load double* %8, align 8 + %10 = fmul double %9, %9 + %11 = fadd double %7, %10 + %12 = fmul double %2, 2.000000e+00 + %13 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 0, i32 0 + %14 = load double* %13, align 8 + %15 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 0, i32 0 + %16 = load double* %15, align 8 + %17 = fsub double %14, %16 + %18 = fmul double %12, %17 + %19 = fmul double %5, 2.000000e+00 + %20 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 0, i32 1 + %21 = load double* %20, align 8 + %22 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 0, i32 1 + %23 = load double* %22, align 8 + %24 = fsub double %21, %23 + %25 = fmul double %19, %24 + %26 = fadd double %18, %25 + %27 = fmul double %9, 2.000000e+00 + %28 = getelementptr inbounds %struct.ray* %ray, i64 0, i32 0, i32 2 + %29 = load double* %28, align 8 + %30 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 0, i32 2 + %31 = load double* %30, align 8 + %32 = fsub double %29, %31 + %33 = fmul double %27, %32 + %34 = fadd double %26, %33 + %35 = fmul double %16, %16 + %36 = fmul double %23, %23 + %37 = fadd double %35, %36 + %38 = fmul double %31, %31 + %39 = fadd double %37, %38 + %40 = fmul double %14, %14 + %41 = fadd double %40, %39 + %42 = fmul double %21, %21 + %43 = fadd double %42, %41 + %44 = fmul double %29, %29 + %45 = fadd double %44, %43 + %46 = fsub double -0.000000e+00, %16 + %47 = fmul double %14, %46 + %48 = fmul double %21, %23 + %49 = fsub double %47, %48 + %50 = fmul double %29, %31 + %51 = fsub double %49, %50 + %52 = fmul double %51, 2.000000e+00 + %53 = fadd double %52, %45 + %54 = getelementptr inbounds %struct.sphere* %sph, i64 0, i32 1 + %55 = load double* %54, align 8 + %56 = fmul double %55, %55 + %57 = fsub double %53, %56 + %58 = fmul double %34, %34 + %59 = fmul double %11, 4.000000e+00 + %60 = fmul double %59, %57 + %61 = fsub double %58, %60 + %62 = fcmp olt double %61, 0.000000e+00 + br i1 %62, label %130, label %63 + +;

"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5}, g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].d ata)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c) {a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return thi s.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.v alHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&& j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArr ay(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):thi s.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[] ,d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t] !=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){re turn a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toL owerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f=== "$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter. ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagNam e(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\ ]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){va r d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,t his)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNode s)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|me ta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a ))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&& this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W," "):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e) {var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0] &&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch (l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f, f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=fun ction(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement ("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.na me,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String ,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once mem ory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d .data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error :1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d. async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-Wit h"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3) ,a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this .prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFuncti on(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo( d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file Propchange: lnt/trunk/lnt/server/ui/static/jquery/1.7.2/jquery-1.7.2.min.js ------------------------------------------------------------------------------ svn:executable = * Added: lnt/trunk/lnt/server/ui/static/jquery/1.7.2/jquery-ui-1.8.22.custom.min.js URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/1.7.2/jquery-ui-1.8.22.custom.min.js?rev=161421&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/1.7.2/jquery-ui-1.8.22.custom.min.js (added) +++ lnt/trunk/lnt/server/ui/static/jquery/1.7.2/jquery-ui-1.8.22.custom.min.js Tue Aug 7 11:37:19 2012 @@ -0,0 +1,125 @@ +/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.core.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.22",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b= ="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0} ,disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr .createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp( b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.position.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.to p+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosi tion.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top", !0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})( jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.draggable.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;re turn this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getPa rentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){va r c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:functi on(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margi ns.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),1 0)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperP roportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position); var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containme nt){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.lefth[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.toph[3]?j-this.offset.click.toph[2]?k-this.offset.click.left=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f=k&&g<=l||h>=k&&h<=l||gl)&&(e>=i&&e<=j||f>=i&&f<=j||ej);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.eleme nt.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles=" n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection (),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.or iginalElement),this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f. outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proport ionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.max Width)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),ea.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else th is.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this .originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.22"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a( this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,st ep:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width: j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.o ffset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height :m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height) /(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.selectable.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("
")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),th is},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unsele cting",b,{unselecting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.righth||i.bottome&&i.rightf&&i.bottom *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");re turn this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.cu rrentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zI ndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pag eY=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),t his.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash( this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.position Abs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+jf&&b+ka[this.floating?"width":"height"]?l:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName); j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.c ustom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddi ngBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=nu ll,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentIte m;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=thi s.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop "),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0) +(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+t his.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.leftthis.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containm ent[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.topthis.containment[3]?h-this.offset.click.topthis.containment[2]?i-this.offset.click.left=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("o pacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return ;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers. find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find(" a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target },b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:func tion(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-a ll").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.acc ordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.22",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate ({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBoun ce":"swing",duration:a.down?1e3:200})}}})})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.autocomplete.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.s earching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("
    ").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.origi nalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)} ,_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length").data("item.autocomplete",c).append(a("
    ").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a .grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover ").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")}, _init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.dialog.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
    ")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui- icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.optio ns.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.mod al&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("
    ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(g);a.each(d,function(a,b){if(a==="click")return;a in f?e[a](b):e.attr(a,b)}),a.fn.button&&e .button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.r esizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend ({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is (":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.22",uuid:0,maxZ:0,getTitleId:function(a){va r b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe( ),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b").appendTo(this.element).addClass("ui-slider-range ui-widget-hea der"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)|| 0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0 ),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({he ight:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.22"})})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.tabs.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,pane l:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTempla te).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.dis abled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h ;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-s elected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).d equeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b); var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo( this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass( "ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.a jax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.22"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout (function(){var a=d.selected;c.select(++a'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker :{version:"1.8.22"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:functio n(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
    ')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(''+c+""),a[d?"before":"after"](b.append)),a.unbind( "focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dia logInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="inpu t"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d =="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;exten dRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length) {var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a)),this._attachHandlers(a);var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("widt h",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+(c?0:$(document).scrollLeft()),i=document.documentElement.clientHeight+(c?0:$(document).scrollTop());return b.lef t-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val( ):"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a) ,c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b ,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b +"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm- dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:functi on(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_attachHandlers:function(a){var b=this._get(a,"stepMonths"),c="#"+a.id;a.dpDiv.find("[data-handler]").map(function(){var a={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(c)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(c,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),a[this.get Attribute("data-handler")])})},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a, -1,o,n)?''+q+"":e?"":''+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+"":e?"":''+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline? "":'",x=d?'
    '+(c?w:"")+(this._isInRange(a,v)?'":"")+(c?"":w)+"
    ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='
    '+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
    '+"";var R=z?'":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?' class="ui-datepicker-week-end"':"")+">"+''+C[T]+""}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOf Month(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?'":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+""}n++,n>11&&(n=0,o++),Q+="
    '+this._get(a,"weekHeader")+"
    '+this._get(a,"calculateWeek")(Y)+""+(bb&&!G?"&# xa0;":bc?''+Y.getDate()+"":''+Y.getDate()+"")+"
    "+(j?""+(g[0]>0&&N==g[1]-1?'
    ':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='
    ',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i|| !j?" ":"")+m),l+="
    ",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDa yOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(n ew Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.22",window["DP_jQuery_"+dpuuid]=$})(jQuery);;/*! j Query UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.progressbar.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
    ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.ap ply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.22"})})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.core.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=(a.curCSS||a.css)(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.current Style,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightCol or","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144, 238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(thi s,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.22",save:function(a,b){for(var c=0;c").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,ri ght:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l( b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d ,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c :d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Ma th.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.fade.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.fold.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.highlight.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);;/*! jQuery UI - v1.8.22 - 2012-07-24 +* https://github.com/jquery/jquery-ui +* Includes: jquery.effects.pulsate.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);; \ No newline at end of file Propchange: lnt/trunk/lnt/server/ui/static/jquery/1.7.2/jquery-ui-1.8.22.custom.min.js ------------------------------------------------------------------------------ svn:executable = * From mgottesman at apple.com Tue Aug 7 11:37:29 2012 From: mgottesman at apple.com (Michael Gottesman) Date: Tue, 07 Aug 2012 16:37:29 -0000 Subject: [llvm-commits] [LNT] r161423 - in /lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults: ./ LICENCE README.mkdn jquery.formdefaults.js jquery.formdefaults.min.js Message-ID: <20120807163729.9ACA32A6C073@llvm.org> Author: mgottesman Date: Tue Aug 7 11:37:29 2012 New Revision: 161423 URL: http://llvm.org/viewvc/llvm-project?rev=161423&view=rev Log: [LNT] Added jquery plugin jquery.formdefaults in ui/static/jquery/jquery.formdefaults for use with the new compiler status overview page. *NOTE* code is MIT Licensed. Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/ lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/LICENCE (with props) lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/README.mkdn (with props) lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.js (with props) lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.min.js (with props) Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/LICENCE URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/LICENCE?rev=161423&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/LICENCE (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/LICENCE Tue Aug 7 11:37:29 2012 @@ -0,0 +1,19 @@ +The MIT License (MIT) + +Copyright (c) 2011 Rob Schmitt + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. \ No newline at end of file Propchange: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/LICENCE ------------------------------------------------------------------------------ svn:executable = * Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/README.mkdn URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/README.mkdn?rev=161423&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/README.mkdn (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/README.mkdn Tue Aug 7 11:37:29 2012 @@ -0,0 +1,22 @@ +# FormDefaults for jQuery + +This plugin allows you to provide default values for form fields, which are automatically hidden/shown as the user focuses into and out of the form field. The plugin will also bubble up the DOM tree and attach itself to the form to prevent the default values from being submitted. + +## Usage + +Usage is simple: + + $(".form-text").formDefaults(); + +This will attach the plugin to any form field with a class of 'form-text'. + +You can also provide some settings for the active and inactive text color (depending on whether the form fields is in focus or not): + + $(".form-text").formDefaults({ + activeColor: '#000', + inactiveColor: '#ccc' + }); + +## Copyright + +Copyright (c) 2011 Rob Schmitt. See LICENSE for details. \ No newline at end of file Propchange: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/README.mkdn ------------------------------------------------------------------------------ svn:executable = * Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.js URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.js?rev=161423&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.js (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.js Tue Aug 7 11:37:29 2012 @@ -0,0 +1,56 @@ +(function($) { + + $.fn.formDefaults = function(options) { + + var opts = $.extend({}, $.fn.formDefaults.defaults, options); + + return this.each(function() { + + var $this = $(this); + var $form = $this.parents("form"); + + $this + .data("defaultValue", this.value) + .addClass("form-default-value-processed"); + + if (opts.inactiveColor) { + $this.css("color", opts.inactiveColor); + } + + $this + .focus(function() { + if (this.value == $this.data("defaultValue")) { + this.value = ''; + this.style.color = opts.activeColor; + } + }) + .blur(function() { + if (this.value == '') { + this.style.color = opts.inactiveColor; + this.value = $this.data("defaultValue"); + } + }); + + if (!$form.data("defaultValueProcessed")) { + $form + .data("defaultValueProcessed", true) + .submit(function(e) { + $(this).find(".form-default-value-processed").each(function() { + var $el = $(this); + if ($el.data("defaultValue") == $el.val()) { + $el.val(''); + } + }); + }); + } + + }); + + }; + + $.fn.formDefaults.defaults = { + activeColor: '#000', // Color of text when form field is active + inactiveColor: '' // Color of text when form field is inactive (ignored when not specified) + }; + +}(jQuery)); Propchange: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.js ------------------------------------------------------------------------------ svn:executable = * Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.min.js URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.min.js?rev=161423&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.min.js (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.min.js Tue Aug 7 11:37:29 2012 @@ -0,0 +1,2 @@ +(function(b){b.fn.formDefaults=function(e){var c=b.extend({},b.fn.formDefaults.defaults,e);return this.each(function(){var a=b(this),d=a.parents("form");a.data("defaultValue",this.value).addClass("form-default-value-processed");c.inactiveColor&&a.css("color",c.inactiveColor);a.focus(function(){this.value==a.data("defaultValue")&&(this.value="",this.style.color=c.activeColor)}).blur(function(){""==this.value&&(this.style.color=c.inactiveColor,this.value=a.data("defaultValue"))});d.data("defaultValueProcessed")|| +d.data("defaultValueProcessed",!0).submit(function(){b(this).find(".form-default-value-processed").each(function(){var a=b(this);a.data("defaultValue")==a.val()&&a.val("")})})})};b.fn.formDefaults.defaults={activeColor:"#000",inactiveColor:""}})(jQuery); Propchange: lnt/trunk/lnt/server/ui/static/jquery/jquery.formdefaults/jquery.formdefaults.min.js ------------------------------------------------------------------------------ svn:executable = * From mgottesman at apple.com Tue Aug 7 11:37:24 2012 From: mgottesman at apple.com (Michael Gottesman) Date: Tue, 07 Aug 2012 16:37:24 -0000 Subject: [llvm-commits] [LNT] r161422 - in /lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu: ./ LICENSE README.md jquery.contextMenu.js jquery.contextMenu.min.js Message-ID: <20120807163724.CAB703524042@llvm.org> Author: mgottesman Date: Tue Aug 7 11:37:24 2012 New Revision: 161422 URL: http://llvm.org/viewvc/llvm-project?rev=161422&view=rev Log: [LNT] Added jquery plugin jquery.contextmenu for new compiler status overview page that I am going to commit. *NOTE* Code is MIT Licensed. Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/ lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/LICENSE (with props) lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/README.md (with props) lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/jquery.contextMenu.js (with props) lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/jquery.contextMenu.min.js (with props) Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/LICENSE URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/LICENSE?rev=161422&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/LICENSE (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/LICENSE Tue Aug 7 11:37:24 2012 @@ -0,0 +1,5 @@ + +This file was not included with the downloaded distribution. It is +just a placeholder. The readme file for this jquery plugin, README.md, +states that the library is licensed under the MIT License and provides +a link to http://opensource.org/licenses/mit-license. Propchange: lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/LICENSE ------------------------------------------------------------------------------ svn:executable = * Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/README.md URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/README.md?rev=161422&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/README.md (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/README.md Tue Aug 7 11:37:24 2012 @@ -0,0 +1,264 @@ +# jQuery contextMenu plugin & polyfill # + +$.contextMenu is a management facility for - you guessed it - context menus. It was designed for an application where there are hundreds of elements that may show a context menu - so intialization speed and memory usage are kept fairly small. It also allows to register context menus without providing actual markup, as $.contextMenu generates DOMElements as needed. + +[features](http://medialize.github.com/jQuery-contextMenu/index.html) - +[demo](http://medialize.github.com/jQuery-contextMenu/demo.html) - +[documentation](http://medialize.github.com/jQuery-contextMenu/docs.html) + + +## Dependencies ## + +* jQuery 1.7 (using new .on().off() event API) +* jQuery UI position (optional but recommended) + +## Usage ## + +register contextMenu from javascript: + +```javascript +$.contextMenu({ + // define which elements trigger this menu + selector: ".with-cool-menu", + // define the elements of the menu + items: { + foo: {name: "Foo", callback: function(key, opt){ alert("Foo!"); }}, + bar: {name: "Bar", callback: function(key, opt){ alert("Bar!") }} + } + // there's more, have a look at the demos and docs... +}); +``` + +have a look at the [demos](http://medialize.github.com/jQuery-contextMenu/demo.html). + + +## HTML5 Compatibility ## + +Firefox 8 implemented contextmenu using the <menuitem> tags for menu-structure. The specs however state that <command> tags should be used for this purpose. $.contextMenu accepts both. + +Firefox 8 does not yet fully implement the contextmenu specification ([Ticket #617528](https://bugzilla.mozilla.org/show_bug.cgi?id=617528)). The elements +[a](http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-a-element-to-define-a-command), +[button](http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-button-element-to-define-a-command), +[input](http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-input-element-to-define-a-command) and +[option](http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-option-element-to-define-a-command) +usable as commands are being ignored altogether. It also doesn't (optically) distinguish between checkbox/radio and regular commands ([Bug #705292](https://bugzilla.mozilla.org/show_bug.cgi?id=705292)). + +* [contextmenu specs](http://www.w3.org/TR/html5/interactive-elements.html#context-menus) +* [command specs](http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html) +* [Browser support according to caniuse.com](http://caniuse.com/#search=context%20menu) + +Note: While the specs note <option>s to be renderd as regular commands, $.contextMenu will render an actual <select>. import contextMenu from HTML5 <menu>: + +```javascript +$.contextMenu("html5"); +``` + +## Interaction Principles ## + +You're (obviously) able to use the context menu with your mouse. Once it is opened, you can also use the keyboard to (fully) navigate it. + +* ??? (up) previous item in list, will skip disabled elements and wrap around +* ??? (down) next item in, will skip disabled elements and wrap around +* ??? (right) dive into sub-menu +* ??? (left) rise from sub-menu +* ??? (return) invoke command +* ??? (tab) next item or input element, will skip disabled elements and wrap around +* ??? ??? (shift tab) previous item or input element, will skip disabled elements and wrap around +* ??? (escape) close menu +* ??? (space) captured and ignore to avoid page scrolling (for consistency with native menus) +* ??? (page up) captured and ignore to avoid page scrolling (for consistency with native menus) +* ??? (page down) captured and ignore to avoid page scrolling (for consistency with native menus) +* ??? (home) first item in list, will skip disabled elements +* ??? (end) last item in, will skip disabled elements + +Besides the obvious, browser also react to alphanumeric key strokes. Hitting r in a context menu will make Firefox (8) reload the page immediately. Chrome selects the option to see infos on the page, Safari selects the option to print the document. Awesome, right? Until trying the same on Windows I did not realize that the browsers were using the access-key for this. I would've preferred typing the first character of something, say "s" for "save" and then iterate through all the commands beginning with s. But that's me - what do I know about UX? Anyways, $.contextMenu now also supports accesskey handling. + + +## Minify ## + +use [Google Closure Compiler](http://closure-compiler.appspot.com/home): + +``` +// ==ClosureCompiler== +// @compilation_level SIMPLE_OPTIMIZATIONS +// @output_file_name contextMenu.js +// @code_url http://medialize.github.com/jQuery-contextMenu/jquery-1.7.1.min.js +// @code_url http://medialize.github.com/jQuery-contextMenu/jquery.ui.position.js +// @code_url http://medialize.github.com/jQuery-contextMenu/jquery.contextMenu.js +// ==/ClosureCompiler== +``` + + +## Authors ## + +* [Rodney Rehm](https://github.com/rodneyrehm) +* [Christiaan Baartse](https://github.com/christiaan) (single callback per menu) +* [Addy Osmani](https://github.com/addyosmani) (compatibility with native context menu in Firefox 8) + + +## License ## + +$.contextMenu is published under the [MIT license](http://www.opensource.org/licenses/mit-license) and [GPL v3](http://opensource.org/licenses/GPL-3.0). + + +## Changelog ## + +### 1.5.22 ### + +* Fixing issue with animation and remove on hide (Issue #64) + +### 1.5.21 ### + +* Fixing backdrop would not remove on destroy (Issue #63) + +### 1.5.20 ### + +* Fixing backdrop would not position properly in IE6 (Issue #59) +* Fixing nested input elements not accessible in Chrome / Safari (Issue #58) + +### 1.5.19 ### + +* fixing sub-menu positioning when `$.ui.position` is not available (Issue #56) + +### 1.5.18 ### + +* fixing html5 `` import (Issue #53) + +### 1.5.17 ### + +* fixing `options` to default to `options.trigger = "right"` +* fixing variable name typo (Within Issue #51) +* fixing menu not closing while opening other menu (Within Issue #51) +* adding workaround for `contextmenu`-bug in Firefox 12 (Within Issue #51) + +### 1.5.16 ### + +* added vendor-prefixed user-select to CSS +* fixed issue with z-indexing when `` is used as a trigger (Issue #49) + +### 1.5.15 ### + +* allowing to directly open another element's menu while a menu is shown (Issue #48) +* fixing autohide option that would not properly hide the menu + +### 1.5.14 ### + +* options.build() would break default options (Issue #47) +* $.contextMenu('destroy') would not remove backdrop + +### 1.5.13 ### + +* exposing $trigger to dynamically built custom menu-item types (Issue #42) +* fixing repositioning of open menu (formerly accidental re-open) +* adding asynchronous example +* dropping ignoreRightClick in favor of proper event-type detection + +### 1.5.12 ### + +* prevent invoking callback of first item of a sub-menu when clicking on the sub-menu-item (Issue #41) + +### 1.5.11 ### + +* providing `opt.$trigger` to show event (Issue #39) + +### 1.5.10 ### + +* ignoreRightClick would not prevent right click when menu is already open (Issue #38) + +### 1.5.9 ### + +* If build() did not return any items, an empty menu was shown (Issue #33) + +### 1.5.8 ### + +* Capturing Page Up and Page Down keys to ignore like space (Issue #30) +* Added Home / End keys to jump to first / last command of menu (Issue #29) +* Bug hitting enter in an <input> would yield an error (Issue #28) + +### 1.5.7 ### + +* Non-ASCII character in jquery.contextMenu.js caused compatibility issues in Rails (Issue #27) + +### 1.5.6 ### + +* Bug contextmenu event was not passed to build() callback (Issue #24) +* Bug sub-menu markers would not display properly in Safari and Chrome (Issue #25) + +### 1.5.5 ### + +* Bug Internet Explorer would not close menu when giving input elements focus (Issue #23) + +### 1.5.4 ### + +* Bug not set z-index of sub-menus might not overlap the main menu correctly (Issue #22) + +### 1.5.3 ### + +* Bug `console.log is undefined` + +### 1.5.2 ### + +* Bug sub-menus would not properly update their disabled states (Issue #16) [again???] +* Bug sub-menus would not properly adjust width accoring to min-width and max-width (Issue #18) + +### 1.5.1 ### + +* Bug sub-menus would not properly update their disabled states (Issue #16) + +### 1.5 ### + +* Added [dynamic menu creation](http://medialize.github.com/jQuery-contextMenu/demo/dynamic-create.html) (Issue #15) + +### 1.4.4 ### + +* Bug positioning <menu> when trigger element is `position:fixed` (Issue #14) + +### 1.4.3 ### + +* Bug key handler would caputure all key strokes while menu was visible (essentially disabling F5 and co.) + +### 1.4.2 ### + +* Bug opt.$trigger was not available to disabled callbacks +* jQuery bumped to 1.7.1 + +### 1.4.1 ### + +* Bug where <menu> imports would not pass action (click event) properly + +### 1.4 ### + +* Upgraded to jQuery 1.7 (changed dependecy!) +* Added internal events `contextmenu:focus`, `contextmenu:blur` and `contextmenu:hide` +* Added custom <command> types +* Bug where `className` wasn't properly set on <menu> + +### 1.3 ### + +* Added support for accesskeys +* Bug where two sub-menus could be open simultaneously + +### 1.2.2 ### + +* Bug in HTML5 import + +### 1.2.1 ### + +* Bug in HTML5 detection + +### 1.2 ### + +* Added compatibility to <menuitem> for Firefox 8 +* Upgraded to jQuery 1.6.2 + +### 1.1 ### + +* Bug #1 TypeError on HTML5 action passthru +* Bug #2 disbaled callback not invoked properly +* Feature #3 auto-hide option for hover trigger +* Feature #4 option to use a single callback for all commands, rather than registering the same function for each item +* Option to ignore right-click (original "contextmenu" event trigger) for non-right-click triggers + +### 1.0 ### + +* Initial $.contextMenu handler \ No newline at end of file Propchange: lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/README.md ------------------------------------------------------------------------------ svn:executable = * Added: lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/jquery.contextMenu.js URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/jquery.contextMenu.js?rev=161422&view=auto ============================================================================== --- lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/jquery.contextMenu.js (added) +++ lnt/trunk/lnt/server/ui/static/jquery/jquery.contextmenu/jquery.contextMenu.js Tue Aug 7 11:37:24 2012 @@ -0,0 +1,1590 @@ +/*! + * jQuery contextMenu - Plugin for simple contextMenu handling + * + * Version: 1.5.22 + * + * Authors: Rodney Rehm, Addy Osmani (patches for FF) + * Web: http://medialize.github.com/jQuery-contextMenu/ + * + * Licensed under + * MIT License http://www.opensource.org/licenses/mit-license + * GPL v3 http://opensource.org/licenses/GPL-3.0 + * + */ + +// ==ClosureCompiler== +// @compilation_level SIMPLE_OPTIMIZATIONS +// @output_file_name jquery.contextMenu.min.js +// ==/ClosureCompiler== + +(function($, undefined){ + + // TODO: - + // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio + // create structure if $.support[htmlCommand || htmlMenuitem] and !opt.disableNative + +// determine html5 compatibility +$.support.htmlMenuitem = ('HTMLMenuItemElement' in window); +$.support.htmlCommand = ('HTMLCommandElement' in window); +$.support.eventSelectstart = ("onselectstart" in document.documentElement); +/* // should the need arise, test for css user-select +$.support.cssUserSelect = (function(){ + var t = false, + e = document.createElement('div'); + + $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) { + var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect', + prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select'; + + e.style.cssText = prop + ': text;'; + if (e.style[propCC] == 'text') { + t = true; + return false; + } + + return true; + }); + + return t; +})(); +*/ + +var // currently active contextMenu trigger + $currentTrigger = null, + // is contextMenu initialized with at least one menu? + initialized = false, + // window handle + $win = $(window), + // number of registered menus + counter = 0, + // mapping selector to namespace + namespaces = {}, + // mapping namespace to options + menus = {}, + // custom command type handlers + types = {}, + // default values + defaults = { + // selector of contextMenu trigger + selector: null, + // where to append the menu to + appendTo: null, + // method to trigger context menu ["right", "left", "hover"] + trigger: "right", + // hide menu when mouse leaves trigger / menu elements + autoHide: false, + // ms to wait before showing a hover-triggered context menu + delay: 200, + // determine position to show menu at + determinePosition: function($menu) { + // position to the lower middle of the trigger element + if ($.ui && $.ui.position) { + // .position() is provided as a jQuery UI utility + // (...and it won't work on hidden elements) + $menu.css('display', 'block').position({ + my: "center top", + at: "center bottom", + of: this, + offset: "0 5", + collision: "fit" + }).css('display', 'none'); + } else { + // determine contextMenu position + var offset = this.offset(); + offset.top += this.outerHeight(); + offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2; + $menu.css(offset); + } + }, + // position menu + position: function(opt, x, y) { + var $this = this, + offset; + // determine contextMenu position + if (!x && !y) { + opt.determinePosition.call(this, opt.$menu); + return; + } else if (x === "maintain" && y === "maintain") { + // x and y must not be changed (after re-show on command click) + offset = opt.$menu.position(); + } else { + // x and y are given (by mouse event) + var triggerIsFixed = opt.$trigger.parents().andSelf() + .filter(function() { + return $(this).css('position') == "fixed"; + }).length; + + if (triggerIsFixed) { + y -= $win.scrollTop(); + x -= $win.scrollLeft(); + } + offset = {top: y, left: x}; + } + + // correct offset if viewport demands it + var bottom = $win.scrollTop() + $win.height(), + right = $win.scrollLeft() + $win.width(), + height = opt.$menu.height(), + width = opt.$menu.width(); + + if (offset.top + height > bottom) { + offset.top -= height; + } + + if (offset.left + width > right) { + offset.left -= width; + } + + opt.$menu.css(offset); + }, + // position the sub-menu + positionSubmenu: function($menu) { + if ($.ui && $.ui.position) { + // .position() is provided as a jQuery UI utility + // (...and it won't work on hidden elements) + $menu.css('display', 'block').position({ + my: "left top", + at: "right top", + of: this, + collision: "fit" + }).css('display', ''); + } else { + // determine contextMenu position + var offset = { + top: 0, + left: this.outerWidth() + }; + $menu.css(offset); + } + }, + // offset to add to zIndex + zIndex: 1, + // show hide animation settings + animation: { + duration: 50, + show: 'slideDown', + hide: 'slideUp' + }, + // events + events: { + show: $.noop, + hide: $.noop + }, + // default callback + callback: null, + // list of contextMenu items + items: {} + }, + // mouse position for hover activation + hoveract = { + timer: null, + pageX: null, + pageY: null + }, + // determine zIndex + zindex = function($t) { + var zin = 0, + $tt = $t; + + while (true) { + zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0); + $tt = $tt.parent(); + if (!$tt || !$tt.length || "html body".indexOf($tt.prop('nodeName').toLowerCase()) > -1 ) { + break; + } + } + + return zin; + }, + // event handlers + handle = { + // abort anything + abortevent: function(e){ + e.preventDefault(); + e.stopImmediatePropagation(); + }, + + // contextmenu show dispatcher + contextmenu: function(e) { + var $this = $(this); + + // disable actual context-menu + e.preventDefault(); + e.stopImmediatePropagation(); + + // abort native-triggered events unless we're triggering on right click + if (e.data.trigger != 'right' && e.originalEvent) { + return; + } + + if (!$this.hasClass('context-menu-disabled')) { + // theoretically need to fire a show event at + // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus + // var evt = jQuery.Event("show", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this }); + // e.data.$menu.trigger(evt); + + $currentTrigger = $this; + if (e.data.build) { + var built = e.data.build($currentTrigger, e); + // abort if build() returned false + if (built === false) { + return; + } + + // dynamically build menu on invocation + e.data = $.extend(true, {}, defaults, e.data, built || {}); + + // abort if there are no items to display + if (!e.data.items || $.isEmptyObject(e.data.items)) { + // Note: jQuery captures and ignores errors from event handlers + if (window.console) { + (console.error || console.log)("No items specified to show in contextMenu"); + } + + throw new Error('No Items sepcified'); + } + + // backreference for custom command type creation + e.data.$trigger = $currentTrigger; + + op.create(e.data); + } + // show menu + op.show.call($this, e.data, e.pageX, e.pageY); + } + }, + // contextMenu left-click trigger + click: function(e) { + e.preventDefault(); + e.stopImmediatePropagation(); + $(this).trigger(jQuery.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY })); + }, + // contextMenu right-click trigger + mousedown: function(e) { + // register mouse down + var $this = $(this); + + // hide any previous menus + if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) { + $currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide'); + } + + // activate on right click + if (e.button == 2) { + $currentTrigger = $this.data('contextMenuActive', true); + } + }, + // contextMenu right-click trigger + mouseup: function(e) { + // show menu + var $this = $(this); + if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) { + e.preventDefault(); + e.stopImmediatePropagation(); + $currentTrigger = $this; + $this.trigger(jQuery.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY })); + } + + $this.removeData('contextMenuActive'); + }, + // contextMenu hover trigger + mouseenter: function(e) { + var $this = $(this), + $related = $(e.relatedTarget), + $document = $(document); + + // abort if we're coming from a menu + if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) { + return; + } + + // abort if a menu is shown + if ($currentTrigger && $currentTrigger.length) { + return; + } + + hoveract.pageX = e.pageX; + hoveract.pageY = e.pageY; + hoveract.data = e.data; + $document.on('mousemove.contextMenuShow', handle.mousemove); + hoveract.timer = setTimeout(function() { + hoveract.timer = null; + $document.off('mousemove.contextMenuShow'); + $currentTrigger = $this; + $this.trigger(jQuery.Event("contextmenu", { data: hoveract.data, pageX: hoveract.pageX, pageY: hoveract.pageY })); + }, e.data.delay ); + }, + // contextMenu hover trigger + mousemove: function(e) { + hoveract.pageX = e.pageX; + hoveract.pageY = e.pageY; + }, + // contextMenu hover trigger + mouseleave: function(e) { + // abort if we're leaving for a menu + var $related = $(e.relatedTarget); + if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) { + return; + } + + try { + clearTimeout(hoveract.timer); + } catch(e) {} + + hoveract.timer = null; + }, + + // click on layer to hide contextMenu + layerClick: function(e) { + var $this = $(this), + root = $this.data('contextMenuRoot'), + mouseup = false, + button = e.button, + x = e.pageX, + y = e.pageY, + target, + offset, + selectors; + + e.preventDefault(); + e.stopImmediatePropagation(); + + // This hack looks about as ugly as it is + // Firefox 12 (at least) fires the contextmenu event directly "after" mousedown + // for some reason `root.$layer.hide(); document.elementFromPoint()` causes this + // contextmenu event to be triggered on the uncovered element instead of on the + // layer (where every other sane browser, including Firefox nightly at the time) + // triggers the event. This workaround might be obsolete by September 2012. + $this.on('mouseup', function() { + mouseup = true; + }); + setTimeout(function() { + var $window, hideshow; + + // test if we need to reposition the menu + if ((root.trigger == 'left' && button == 0) || (root.trigger == 'right' && button == 2)) { + if (document.elementFromPoint) { + root.$layer.hide(); + target = document.elementFromPoint(x, y); + root.$layer.show(); + + selectors = []; + for (var s in namespaces) { + selectors.push(s); + } + + target = $(target).closest(selectors.join(', ')); + + if (target.length) { + if (target.is(root.$trigger[0])) { + root.position.call(root.$trigger, root, x, y); + return; + } + } + } else { + offset = root.$trigger.offset(); + $window = $(window); + // while this looks kinda awful, it's the best way to avoid + // unnecessarily calculating any positions + offset.top += $window.scrollTop(); + if (offset.top <= e.pageY) { + offset.left += $window.scrollLeft(); + if (offset.left <= e.pageX) { + offset.bottom = offset.top + root.$trigger.outerHeight(); + if (offset.bottom >= e.pageY) { + offset.right = offset.left + root.$trigger.outerWidth(); + if (offset.right >= e.pageX) { + // reposition + root.position.call(root.$trigger, root, x, y); + return; + } + } + } + } + } + } + + hideshow = function(e) { + if (e) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + + root.$menu.trigger('contextmenu:hide'); + if (target && target.length) { + setTimeout(function() { + target.contextMenu({x: x, y: y}); + }, 50); + } + }; + + if (mouseup) { + // mouseup has already happened + hideshow(); + } else { + // remove only after mouseup has completed + $this.on('mouseup', hideshow); + } + }, 50); + }, + // key handled :hover + keyStop: function(e, opt) { + if (!opt.isInput) { + e.preventDefault(); + } + + e.stopPropagation(); + }, + key: function(e) { + var opt = $currentTrigger.data('contextMenu') || {}, + $children = opt.$menu.children(), + $round; + + switch (e.keyCode) { + case 9: + case 38: // up + handle.keyStop(e, opt); + // if keyCode is [38 (up)] or [9 (tab) with shift] + if (opt.isInput) { + if (e.keyCode == 9 && e.shiftKey) { + e.preventDefault(); + opt.$selected && opt.$selected.find('input, textarea, select').blur(); + opt.$menu.trigger('prevcommand'); + return; + } else if (e.keyCode == 38 && opt.$selected.find('input, textarea, select').prop('type') == 'checkbox') { + // checkboxes don't capture this key + e.preventDefault(); + return; + } + } else if (e.keyCode != 9 || e.shiftKey) { + opt.$menu.trigger('prevcommand'); + return; + } + + case 9: // tab + case 40: // down + handle.keyStop(e, opt); + if (opt.isInput) { + if (e.keyCode == 9) { + e.preventDefault(); + opt.$selected && opt.$selected.find('input, textarea, select').blur(); + opt.$menu.trigger('nextcommand'); + return; + } else if (e.keyCode == 40 && opt.$selected.find('input, textarea, select').prop('type') == 'checkbox') { + // checkboxes don't capture this key + e.preventDefault(); + return; + } + } else { + opt.$menu.trigger('nextcommand'); + return; + } + break; + + case 37: // left + handle.keyStop(e, opt); + if (opt.isInput || !opt.$selected || !opt.$selected.length) { + break; + } + + if (!opt.$selected.parent().hasClass('context-menu-root')) { + var $parent = opt.$selected.parent().parent(); + opt.$selected.trigger('contextmenu:blur'); + opt.$selected = $parent; + return; + } + break; + + case 39: // right + handle.keyStop(e, opt); + if (opt.isInput || !opt.$selected || !opt.$selected.length) { + break; + } + + var itemdata = opt.$selected.data('contextMenu') || {}; + if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) { + opt.$selected = null; + itemdata.$selected = null; + itemdata.$menu.trigger('nextcommand'); + return; + } + break; + + case 35: // end + case 36: // home + if (opt.$selected && opt.$selected.find('input, textarea, select').length) { + return; + } else { + (opt.$selected && opt.$selected.parent() || opt.$menu) + .children(':not(.disabled, .not-selectable)')[e.keyCode == 36 ? 'first' : 'last']() + .trigger('contextmenu:focus'); + e.preventDefault(); + return; + } + break; + + case 13: // enter + handle.keyStop(e, opt); + if (opt.isInput) { + if (opt.$selected && !opt.$selected.is('textarea, select')) { + e.preventDefault(); + return; + } + break; + } + opt.$selected && opt.$selected.trigger('mouseup'); + return; + + case 32: // space + case 33: // page up + case 34: // page down + // prevent browser from scrolling down while menu is visible + handle.keyStop(e, opt); + return; + + case 27: // esc + handle.keyStop(e, opt); + opt.$menu.trigger('contextmenu:hide'); + return; + + default: // 0-9, a-z + var k = (String.fromCharCode(e.keyCode)).toUpperCase(); + if (opt.accesskeys[k]) { + // according to the specs accesskeys must be invoked immediately + opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu + ? 'contextmenu:focus' + : 'mouseup' + ); + return; + } + break; + } + // pass event to selected item, + // stop propagation to avoid endless recursion + e.stopPropagation(); + opt.$selected && opt.$selected.trigger(e); + }, + + // select previous possible command in menu + prevItem: function(e) { + e.stopPropagation(); + var opt = $(this).data('contextMenu') || {}; + + // obtain currently selected menu + if (opt.$selected) { + var $s = opt.$selected; + opt = opt.$selected.parent().data('contextMenu') || {}; + opt.$selected = $s; + } + + var $children = opt.$menu.children(), + $prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(), + $round = $prev; + + // skip disabled + while ($prev.hasClass('disabled') || $prev.hasClass('not-selectable')) { + if ($prev.prev().length) { + $prev = $prev.prev(); + } else { + $prev = $children.last(); + } + if ($prev.is($round)) { + // break endless loop + return; + } + } + + // leave current + if (opt.$selected) { + handle.itemMouseleave.call(opt.$selected.get(0), e); + } + + // activate next + handle.itemMouseenter.call($prev.get(0), e); + + // focus input + var $input = $prev.find('input, textarea, select'); + if ($input.length) { + $input.focus(); + } + }, + // select next possible command in menu + nextItem: function(e) { + e.stopPropagation(); + var opt = $(this).data('contextMenu') || {}; + + // obtain currently selected menu + if (opt.$selected) { + var $s = opt.$selected; + opt = opt.$selected.parent().data('contextMenu') || {}; + opt.$selected = $s; + } + + var $children = opt.$menu.children(), + $next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(), + $round = $next; + + // skip disabled + while ($next.hasClass('disabled') || $next.hasClass('not-selectable')) { + if ($next.next().length) { + $next = $next.next(); + } else { + $next = $children.first(); + } + if ($next.is($round)) { + // break endless loop + return; + } + } + + // leave current + if (opt.$selected) { + handle.itemMouseleave.call(opt.$selected.get(0), e); + } + + // activate next + handle.itemMouseenter.call($next.get(0), e); + + // focus input + var $input = $next.find('input, textarea, select'); + if ($input.length) { + $input.focus(); + } + }, + + // flag that we're inside an input so the key handler can act accordingly + focusInput: function(e) { + var $this = $(this).closest('.context-menu-item'), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + root.$selected = opt.$selected = $this; + root.isInput = opt.isInput = true; + }, + // flag that we're inside an input so the key handler can act accordingly + blurInput: function(e) { + var $this = $(this).closest('.context-menu-item'), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + root.isInput = opt.isInput = false; + }, + + // :hover on menu + menuMouseenter: function(e) { + var root = $(this).data().contextMenuRoot; + root.hovering = true; + }, + // :hover on menu + menuMouseleave: function(e) { + var root = $(this).data().contextMenuRoot; + if (root.$layer && root.$layer.is(e.relatedTarget)) { + root.hovering = false; + } + }, + + // :hover done manually so key handling is possible + itemMouseenter: function(e) { + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + root.hovering = true; + + // abort if we're re-entering + if (e && root.$layer && root.$layer.is(e.relatedTarget)) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + + // make sure only one item is selected + (opt.$menu ? opt : root).$menu + .children('.hover').trigger('contextmenu:blur'); + + if ($this.hasClass('disabled') || $this.hasClass('not-selectable')) { + opt.$selected = null; + return; + } + + $this.trigger('contextmenu:focus'); + }, + // :hover done manually so key handling is possible + itemMouseleave: function(e) { + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) { + root.$selected && root.$selected.trigger('contextmenu:blur'); + e.preventDefault(); + e.stopImmediatePropagation(); + root.$selected = opt.$selected = opt.$node; + return; + } + + $this.trigger('contextmenu:blur'); + }, + // contextMenu item click + itemClick: function(e) { + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot, + key = data.contextMenuKey, + callback; + + // abort if the key is unknown or disabled or is a menu + if (!opt.items[key] || $this.hasClass('disabled') || $this.hasClass('context-menu-submenu')) { + return; + } + + e.preventDefault(); + e.stopImmediatePropagation(); + + if ($.isFunction(root.callbacks[key])) { + // item-specific callback + callback = root.callbacks[key]; + } else if ($.isFunction(root.callback)) { + // default callback + callback = root.callback; + } else { + // no callback, no action + return; + } + + // hide menu if callback doesn't stop that + if (callback.call(root.$trigger, key, root) !== false) { + root.$menu.trigger('contextmenu:hide'); + } else if (root.$menu.parent().length) { + op.update.call(root.$trigger, root); + } + }, + // ignore click events on input elements + inputClick: function(e) { + e.stopImmediatePropagation(); + }, + + // hide + hideMenu: function(e, data) { + var root = $(this).data('contextMenuRoot'); + op.hide.call(root.$trigger, root, data && data.force); + }, + // focus + focusItem: function(e) { + e.stopPropagation(); + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + $this.addClass('hover') + .siblings('.hover').trigger('contextmenu:blur'); + + // remember selected + opt.$selected = root.$selected = $this; + + // position sub-menu - do after show so dumb $.ui.position can keep up + if (opt.$node) { + root.positionSubmenu.call(opt.$node, opt.$menu); + } + }, + // blur + blurItem: function(e) { + e.stopPropagation(); + var $this = $(this), + data = $this.data(), + opt = data.contextMenu, + root = data.contextMenuRoot; + + $this.removeClass('hover'); + opt.$selected = null; + } + }, + // operations + op = { + show: function(opt, x, y) { + var $this = $(this), + offset, + css = {}; + + // hide any open menus + $('#context-menu-layer').trigger('mousedown'); + + // backreference for callbacks + opt.$trigger = $this; + + // show event + if (opt.events.show.call($this, opt) === false) { + $currentTrigger = null; + return; + } + + // create or update context menu + op.update.call($this, opt); + + // position menu + opt.position.call($this, opt, x, y); + + // make sure we're in front + if (opt.zIndex) { + css.zIndex = zindex($this) + opt.zIndex; + } + + // add layer + op.layer.call(opt.$menu, opt, css.zIndex); + + // adjust sub-menu zIndexes + opt.$menu.find('ul').css('zIndex', css.zIndex + 1); + + // position and show context menu + opt.$menu.css( css )[opt.animation.show](opt.animation.duration); + // make options available + $this.data('contextMenu', opt); + // register key handler + $(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key); + // register autoHide handler + if (opt.autoHide) { + // trigger element coordinates + var pos = $this.position(); + pos.right = pos.left + $this.outerWidth(); + pos.bottom = pos.top + this.outerHeight(); + // mouse position handler + $(document).on('mousemove.contextMenuAutoHide', function(e) { + if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) { + // if mouse in menu... + opt.$menu.trigger('contextmenu:hide'); + } + }); + } + }, + hide: function(opt, force) { + var $this = $(this); + if (!opt) { + opt = $this.data('contextMenu') || {}; + } + + // hide event + if (!force && opt.events && opt.events.hide.call($this, opt) === false) { + return; + } + + if (opt.$layer) { + // keep layer for a bit so the contextmenu event can be aborted properly by opera + setTimeout((function($layer){ return function(){ + $layer.remove(); + }; + })(opt.$layer), 10); + + try { + delete opt.$layer; + } catch(e) { + opt.$layer = null; + } + } + + // remove handle + $currentTrigger = null; + // remove selected + opt.$menu.find('.hover').trigger('contextmenu:blur'); + opt.$selected = null; + // unregister key and mouse handlers + //$(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705 + $(document).off('.contextMenuAutoHide').off('keydown.contextMenu'); + // hide menu + opt.$menu && opt.$menu[opt.animation.hide](opt.animation.duration, function (){ + // tear down dynamically built menu after animation is completed. + if (opt.build) { + opt.$menu.remove(); + $.each(opt, function(key, value) { + switch (key) { + case 'ns': + case 'selector': + case 'build': + case 'trigger': + return true; + + default: + opt[key] = undefined; + try { + delete opt[key]; + } catch (e) {} + return true; + } + }); + } + }); + }, + create: function(opt, root) { + if (root === undefined) { + root = opt; + } + // create contextMenu + opt.$menu = $('
      ').data({ + 'contextMenu': opt, + 'contextMenuRoot': root + }); + + $.each(['callbacks', 'commands', 'inputs'], function(i,k){ + opt[k] = {}; + if (!root[k]) { + root[k] = {}; + } + }); + + root.accesskeys || (root.accesskeys = {}); + + // create contextMenu items + $.each(opt.items, function(key, item){ + var $t = $('
    • '), + $label = null, + $input = null; + + item.$node = $t.data({ + 'contextMenu': opt, + 'contextMenuRoot': root, + 'contextMenuKey': key + }); + + // register accesskey + // NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that + if (item.accesskey) { + var aks = splitAccesskey(item.accesskey); + for (var i=0, ak; ak = aks[i]; i++) { + if (!root.accesskeys[ak]) { + root.accesskeys[ak] = item; + item._name = item.name.replace(new RegExp('(' + ak + ')', 'i'), '$1'); + break; + } + } + } + + if (typeof item == "string") { + $t.addClass('context-menu-separator not-selectable'); + } else if (item.type && types[item.type]) { + // run custom type handler + types[item.type].call($t, item, opt, root); + // register commands + $.each([opt, root], function(i,k){ + k.commands[key] = item; + if ($.isFunction(item.callback)) { + k.callbacks[key] = item.callback; + } + }); + } else { + // add label for input + if (item.type == 'html') { + $t.addClass('context-menu-html not-selectable'); + } else if (item.type) { + $label = $('').appendTo($t); + $('').html(item._name || item.name).appendTo($label); + $t.addClass('context-menu-input'); + opt.hasTypes = true; + $.each([opt, root], function(i,k){ + k.commands[key] = item; + k.inputs[key] = item; + }); + } else if (item.items) { + item.type = 'sub'; + } + + switch (item.type) { + case 'text': + $input = $('') + .val(item.value || "").appendTo($label); + break; + + case 'textarea': + $input = $('') + .val(item.value || "").appendTo($label); + + if (item.height) { + $input.height(item.height); + } + break; + + case 'checkbox': + $input = $('') + .val(item.value || "").prop("checked", !!item.selected).prependTo($label); + break; + + case 'radio': + $input = $('') + .val(item.value || "").prop("checked", !!item.selected).prependTo($label); + break; + + case 'select': + $input = $(' + if (item.type && item.type != 'sub' && item.type != 'html') { + $input + .on('focus', handle.focusInput) + .on('blur', handle.blurInput); + + if (item.events) { + $input.on(item.events); + } + } + + // add icons + if (item.icon) { + $t.addClass("icon icon-" + item.icon); + } + } + + // cache contained elements + item.$input = $input; + item.$label = $label; + + // attach item to menu + $t.appendTo(opt.$menu); + + // Disable text selection + if (!opt.hasTypes && $.support.eventSelectstart) { + // browsers support user-select: none, + // IE has a special event for text-selection + // browsers supporting neither will not be preventing text-selection + $t.on('selectstart.disableTextSelect', handle.abortevent); + } + }); + // attach contextMenu to (to bypass any possible overflow:hidden issues on parents of the trigger element) + if (!opt.$node) { + opt.$menu.css('display', 'none').addClass('context-menu-root'); + } + opt.$menu.appendTo(opt.appendTo || document.body); + }, + update: function(opt, root) { + var $this = this; + if (root === undefined) { + root = opt; + // determine widths of submenus, as CSS won't grow them automatically + // position:absolute > position:absolute; min-width:100; max-width:200; results in width: 100; + // kinda sucks hard... + opt.$menu.find('ul').andSelf().css({position: 'static', display: 'block'}).each(function(){ + var $this = $(this); + $this.width($this.css('position', 'absolute').width()) + .css('position', 'static'); + }).css({position: '', display: ''}); + } + // re-check disabled for each item + opt.$menu.children().each(function(){ + var $item = $(this), + key = $item.data('contextMenuKey'), + item = opt.items[key], + disabled = ($.isFunction(item.disabled) && item.disabled.call($this, key, root)) || item.disabled === true; + + // dis- / enable item + $item[disabled ? 'addClass' : 'removeClass']('disabled'); + + if (item.type) { + // dis- / enable input elements + $item.find('input, select, textarea').prop('disabled', disabled); + + // update input states + switch (item.type) { + case 'text': + case 'textarea': + item.$input.val(item.value || ""); + break; + + case 'checkbox': + case 'radio': + item.$input.val(item.value || "").prop('checked', !!item.selected); + break; + + case 'select': + item.$input.val(item.selected || ""); + break; + } + } + + if (item.$menu) { + // update sub-menu + op.update.call($this, item, root); + } + }); + }, + layer: function(opt, zIndex) { + // add transparent layer for click area + // filter and background for Internet Explorer, Issue #23 + var $layer = opt.$layer = $('
      ') + .css({height: $win.height(), width: $win.width(), display: 'block'}) + .data('contextMenuRoot', opt) + .insertBefore(this) + .on('contextmenu', handle.abortevent) + .on('mousedown', handle.layerClick); + + // IE6 doesn't know position:fixed; + if (!$.support.fixedPosition) { + $layer.css({ + 'position' : 'absolute', + 'height' : $(document).height() + }); + } + + return $layer; + } + }; + +// split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key +function splitAccesskey(val) { + var t = val.split(/\s+/), + keys = []; + + for (var i=0, k; k = t[i]; i++) { + k = k[0].toUpperCase(); // first character only + // theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it. + // a map to look up already used access keys would be nice + keys.push(k); + } + + return keys; +} + +// handle contextMenu triggers +$.fn.contextMenu = function(operation) { + if (operation === undefined) { + this.first().trigger('contextmenu'); + } else if (operation.x && operation.y) { + this.first().trigger(jQuery.Event("contextmenu", {pageX: operation.x, pageY: operation.y})); + } else if (operation === "hide") { + var $menu = this.data('contextMenu').$menu; + $menu && $menu.trigger('contextmenu:hide'); + } else if (operation) { + this.removeClass('context-menu-disabled'); + } else if (!operation) { + this.addClass('context-menu-disabled'); + } + + return this; +}; + +// manage contextMenu instances +$.contextMenu = function(operation, options) { + if (typeof operation != 'string') { + options = operation; + operation = 'create'; + } + + if (typeof options == 'string') { + options = {selector: options}; + } else if (options === undefined) { + options = {}; + } + + // merge with default options + var o = $.extend(true, {}, defaults, options || {}), + $document = $(document); + + switch (operation) { + case 'create': + // no selector no joy + if (!o.selector) { + throw new Error('No selector specified'); + } + // make sure internal classes are not bound to + if (o.selector.match(/.context-menu-(list|item|input)($|\s)/)) { + throw new Error('Cannot bind to selector "' + o.selector + '" as it contains a reserved className'); + } + if (!o.build && (!o.items || $.isEmptyObject(o.items))) { + throw new Error('No Items sepcified'); + } + counter ++; + o.ns = '.contextMenu' + counter; + namespaces[o.selector] = o.ns; + menus[o.ns] = o; + + // default to right click + if (!o.trigger) { + o.trigger = 'right'; + } + + if (!initialized) { + // make sure item click is registered first + $document + .on({ + 'contextmenu:hide.contextMenu': handle.hideMenu, + 'prevcommand.contextMenu': handle.prevItem, + 'nextcommand.contextMenu': handle.nextItem, + 'contextmenu.contextMenu': handle.abortevent, + 'mouseenter.contextMenu': handle.menuMouseenter, + 'mouseleave.contextMenu': handle.menuMouseleave + }, '.context-menu-list') + .on('mouseup.contextMenu', '.context-menu-input', handle.inputClick) + .on({ + 'mouseup.contextMenu': handle.itemClick, + 'contextmenu:focus.contextMenu': handle.focusItem, + 'contextmenu:blur.contextMenu': handle.blurItem, + 'contextmenu.contextMenu': handle.abortevent, + 'mouseenter.contextMenu': handle.itemMouseenter, + 'mouseleave.contextMenu': handle.itemMouseleave + }, '.context-menu-item'); + + initialized = true; + } + + // engage native contextmenu event + $document + .on('contextmenu' + o.ns, o.selector, o, handle.contextmenu); + + switch (o.trigger) { + case 'hover': + $document + .on('mouseenter' + o.ns, o.selector, o, handle.mouseenter) + .on('mouseleave' + o.ns, o.selector, o, handle.mouseleave); + break; + + case 'left': + $document.on('click' + o.ns, o.selector, o, handle.click); + break; + /* + default: + // http://www.quirksmode.org/dom/events/contextmenu.html + $document + .on('mousedown' + o.ns, o.selector, o, handle.mousedown) + .on('mouseup' + o.ns, o.selector, o, handle.mouseup); + break; + */ + } + + // create menu + if (!o.build) { + op.create(o); + } + break; + + case 'destroy': + if (!o.selector) { + $document.off('.contextMenu .contextMenuAutoHide'); + $.each(namespaces, function(key, value) { + $document.off(value); + }); + + namespaces = {}; + menus = {}; + counter = 0; + initialized = false; + + $('#context-menu-layer, .context-menu-list').remove(); + } else if (namespaces[o.selector]) { + var $visibleMenu = $('.context-menu-list').filter(':visible'); + if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) { + $visibleMenu.trigger('contextmenu:hide', {force: true}); + } + + try { + if (menus[namespaces[o.selector]].$menu) { + menus[namespaces[o.selector]].$menu.remove(); + } + + delete menus[namespaces[o.selector]]; + } catch(e) { + menus[namespaces[o.selector]] = null; + } + + $document.off(namespaces[o.selector]); + } + break; + + case 'html5': + // if or are not handled by the browser, + // or options was a bool true, + // initialize $.contextMenu for them + if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options == "boolean" && options)) { + $('menu[type="context"]').each(function() { + if (this.id) { + $.contextMenu({ + selector: '[contextmenu=' + this.id +']', + items: $.contextMenu.fromMenu(this) + }); + } + }).css('display', 'none'); + } + break; + + default: + throw new Error('Unknown operation "' + operation + '"'); + } + + return this; +}; + +// import values into commands +$.contextMenu.setInputValues = function(opt, data) { + if (data === undefined) { + data = {}; + } + + $.each(opt.inputs, function(key, item) { + switch (item.type) { + case 'text': + case 'textarea': + item.value = data[key] || ""; + break; + + case 'checkbox': + item.selected = data[key] ? true : false; + break; + + case 'radio': + item.selected = (data[item.radio] || "") == item.value ? true : false; + break; + + case 'select': + item.selected = data[key] || ""; + break; + } + }); +}; + +// export values from commands +$.contextMenu.getInputValues = function(opt, data) { + if (data === undefined) { + data = {}; + } + + $.each(opt.inputs, function(key, item) { + switch (item.type) { + case 'text': + case 'textarea': + case 'select': + data[key] = item.$input.val(); + break; + + case 'checkbox': + data[key] = item.$input.prop('checked'); + break; + + case 'radio': + if (item.$input.prop('checked')) { + data[item.radio] = item.value; + } + break; + } + }); + + return data; +}; + +// find